Search code examples
amazon-web-servicesamazon-ec2ip-address

Is 169.254.169.254 only used by AWS EC2?


I'm planning to make a script for package installation, mainly targeted for EC2 Instances.

What I'm planning to do is amazon-linux-extras, and curl 169.254.169.254/latest/meta-data/public-ipv4 and curl 169.254.169.254/latest/meta-data/local-ipv4 if ec2, else yum add-repo.

However, what I'm concerned is this script being run by non-ec2 instances as I'm planning to share this script with the public, and the main concern is some machines that aren't EC2 instances having access to 169.254.169.254.

I googled that IP address but couldn't find another use case other than AWS. Is it okay to assume curl 169.254.169.254 returning something means they're EC2 instance?


Solution

  • A little late to answer this question but just in case anyone else comes across this question as well; not only AWS uses 169.254.169.254. Other cloud services that also use 169.254.169.254 for accessing their instance metadata includes Digital Ocean, Azure, OpenStack/RackSpace, HP Helion. This is as far as I know of as of today.