3

I would like to know if its possible to get the current AWS EC2 Instance ID using AWS SDK PHP.

I know it can be achieved using

@file_get_contents("http://169.254.169.254/latest/meta-data/instance-id");

But I dont want to use file_get_contents as it will fail locally(unnecessary http call even when I know it is goint to fail) or if I am using it on a non AWS server.

Rayiez
  • 1,420
  • 19
  • 20

0 Answers0