2

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?

4

1 Answer 1

3

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.