AWS CloudFormation where will UserData be stored?

Question:

if I have a AWS CloudFormation template using UserData block containing script block to be executed, for example:

After the instance is created,

  1. I assume that this script block will be saved somewhere to be execute?
  2. If so, where can I find this script on the EC2 instance?
  3. Will AWS remove this temporary script after stack is created successfully?

I could not find they mention in the doc.

Thanks

Answer:

The user-data for an instance is available for any process on the instance to retrieve at this location:

The DNS name “instance-data” resolves to that IP address, so if you trust DNS to be up, you can also use the easier to remember:

Here are the Amazon docs:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html

Leave a Reply