aws-cli
aws-cli copied to clipboard
wget can't access aws metadata
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
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