Friday, October 15, 2021

AWS - HowTo get instance id from within EC2 console

 




In this blog post, let us see how we get AWS EC2 instance id from within the EC2 itself

Pre-requisite:
  • An active AWS account
  • Permissions to launch and use AWS EC2 instance

Steps:
  • Create a simple free tier linux based EC2 instance from the AWS EC2 console
  • Take SSH or connect to the newly created EC2 instance
  • Then run the command "cat /var/lib/cloud-data/instance-id and get the id displayed/returned 


Note:

  • We can get the instance id from the EC2 console as well but this is another simple way of getting the value

No comments:

Post a Comment