Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wget can't access aws metadata #15

Open
Trandel opened this issue Nov 28, 2018 · 1 comment
Open

wget can't access aws metadata #15

Trandel opened this issue Nov 28, 2018 · 1 comment

Comments

@Trandel
Copy link

Trandel commented Nov 28, 2018

Hi,

I'm using your image for some automation and it worked great for a year or more but the new version of the image stopped working.

I was using the latest tag:
mesosphere/aws-cli latest f699e09bef16 10 months ago 97.8MB

and running this command inside:

aws ec2 associate-address --instance-id `wget -qO- http://169.254.169.254/latest/meta-data/instance-id` --allocation-id #ID# --allow-reassociation

Everything was fine but now with the new version I'm getting:
wget: error getting response

The same is for 1.11.188.

The problem seems to be this part: wget -qO- http://169.254.169.254/latest/meta-data/instance-id.

To replicate it you need to run it on AWS ec2 so it will have access to AWS meta-data url.

I've copied your working version to my docker hub account just to have a working image:
https://hub.docker.com/r/trandel/aws-cli/

I hope you will have some time to look at it.

Regards

@Trandel
Copy link
Author

Trandel commented Nov 28, 2018

Hi again,
It looks like I jumped to conclusions too fast. It's not the image version. I couldn't get it to work with the old one as well.

I'm using this image for EC2 instance: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI_launch_latest.html
amzn-ami-2018.03.i-amazon-ecs-optimized

Docker version: 18.06.1-ce

It looks like the issue is with alpine:3.6 which your image is based on.
I tried:

docker run --rm alpine:3.6 wget -qO- http://169.254.169.254/latest/meta-data/instance-id
and got wget: error getting response

docker run --rm alpine:3.7 wget -qO- http://169.254.169.254/latest/meta-data/instance-id
works as expected

docker run --rm alpine:3.8 wget -qO- http://169.254.169.254/latest/meta-data/instance-id
works as expected

I created a new image based on 3.8 trandel/aws-cli:alpine3.8 it fixed the issue for me.

You might want to update yours as well if you want it to work with newest EC2 images for ECS.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant