Wednesday, April 22, 2015

What is instance metadata and user data in AWS? (40 of 285 technotesfor 2015)

Instance Meta Data:

  • data about your instance that you can use to configure or manage the running instance. 
  • Instance metadata is divided into categories. 


User Data:

  • user data that you supplied when launching your instance.
  •  you can specify parameters for configuring your instance, or attach a simple script. 
  • You can also use this data to build more generic AMIs that can be modified by configuration files supplied at launch time. 
  • For example, if you run web servers for various small businesses, they can all use the same AMI and retrieve their content from the Amazon S3 bucket you specify in the user data at launch. To add a new customer at any time, simply create a bucket for the customer, add their content, and launch your AMI. If you launch more than one instance at the same time, the user data is available to all instances in that reservation.


Security:

  • the data is not protected by cryptographic methods. Anyone who can access the instance can view its metadata. 
  • you should take suitable precautions to protect sensitive data (such as long-lived encryption keys). 
  • You should not store sensitive data, such as passwords, as user data.


In AWS use the blow url to call the rest service to get the instance details
http://169.254.169.254/latest/meta-data/
Or
you can use Windows Power Shell
invoke-restmethod -uri http://169.254.169.254/latest/meta-data
or you can download Instance MetaData Query Tool from
http://aws.amazon.com/code/1825
or Linux  / Unix
curl http://169.254.169.254/latest/meta-data/ 
User Data - 
Use the below url to retrieve User Meta Data
http://169.254.169.254/latest/user-data
Dynamic Data - 
Use the below url to retrieve Dynamic Data
http://169.254.169.254/latest/dynamic

Resources:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html 

1 comment:

likitha said...

Good explanation,thanks for writing,it is useful for so many developers
AWS Online Training