Zenika-Training / strigo-init-script-libs

Script snippets for Strigo init scripts
3 stars 1 forks source link

Better way to get IPs #22

Closed zigarn closed 3 years ago

awattez commented 3 years ago

I'm not sure if ec2metadata is deprecated. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html

zigarn commented 3 years ago

@awattez so you think it's more reliable to curl the 169.254.169.254? (Anyway it will be more reliable than using remote ifconfig.co service)

awattez commented 3 years ago

I'm not sure if ec2metadata is deprecated. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html

My bad, it appears to be the ec2metadata python script from cloud-utils 📦. it calls the correct url in the python script.

awattez commented 3 years ago

Everything is here : https://github.com/canonical/cloud-utils/blob/main/bin/ec2metadata

The 169.254.169.254 is called in python script :)

But in the Strigo script we have to be sure that we have installed cloud-utils package.

zigarn commented 3 years ago

So may be better to do direct call instead of depending on a tool that may not be installed in custom AMIs.

zigarn commented 3 years ago

cloud-utils is easier to use, just added the install (instead of curl) to be sure to have it.