Find the instance id of an AWS EC2 instance within that EC2 machine
Briefly

In Linux (Ubuntu ) terminal you can use ec2metadata which gives the metadata of the instance, to get only the instance id you can use ec2metadata - instance-id
You can get more metadata and user data using the CLI or HTTP call, and you are not billed for HTTP requests used to retrieve instance metadata and user data.
Read at Medium
[
add
]
[
|
|
]