title: How do I make cloud-init startup scripts run every time my EC2 instance boots?
body: <p>I have an EC2 instance running an AMI based on the Amazon Linux AMI. Like all such AMIs, it supports the <a href="https://help.ubuntu.com/community/CloudInit" rel="noreferrer">cloud-init</a> system for running startup scripts based on the User Data passed into every instance. In this particular case, my User Data input happens to be an Include file that sources several other startup scripts:</p>
  
  <pre><code>#include
  http://s3.amazonaws.com/path/to/script/1
  http://s3.amazonaws.com/path/to/script/2
  </code></pre>
  
  <p>The first time I boot my instance, the cloud-init startup script runs correctly. However, if I do a soft reboot of the instance (by running <code>sudo shutdown -r now</code>, for instance), the instance comes back up <em>without</em> running the startup script the second time around. If I go into the system logs, I can see:</p>
  
  <pre><code>Running cloud-init user-scripts
  user-scripts already ran once-per-instance
  [  OK  ]
  </code></pre>
  
  <p>This is not what I want -- I can see the utility of having startup scripts that only run once per instance lifetime, but in my case these should run every time the instance starts up, like normal startup scripts.</p>
  
  <p>I realize that one possible solution is to manually have my scripts insert themselves into <code>rc.local</code> after running the first time. This seems burdensome, however, since the cloud-init and rc.d environments are subtly different and I would now have to debug scripts on first launch and all subsequent launches separately.</p>
  
  <p>Does anyone know how I can tell cloud-init to always run my scripts? This certainly sounds like something the designers of cloud-init would have considered.</p>