I have an autoscaling group launching different EC2 instances, each running the same wordpress application. Somewhere on the wordpress page (let’s call it home.html), I want to show the EC2 instance id. I can grab the instance id using this curl command: curl http://169.254.169.254/latest/meta-data/instance-id
.
Is there a way I can show the instance id using this curl command, or any way I can set an html variable dynamically to display this metadata on the page?
2
Answers
You can just make a HTTP request to GET any Metadata by passing the your metadata parameters.
or
You can find more meta-data here.
You could put something like this in your PHP template where you want to display the instance ID:
This will display the current instance id whenever the page is loaded