Monday, December 24, 2018

HowTo - Get InstanceID of AWS EC2 for coding usage

HowTo - Get InstanceID of AWS EC2 for coding usage







Hello Folks, today let us see how we can fetch the instance id or any other info in shell script and use them in the code

There will be need to fetch the metadata of the instance we are connected with and this can be done using the URL given by AWS

http://169.254.169.254/latest/meta-data/instance-id

Now with this url, we can fetch InstanceId of the EC2 and various other
meta data like hostname, AMI-id etc

Let us see how we achieve this in program with a simple example



No comments:

Post a Comment