Confirm by changing [ ] to [x] below:
Issue is about usage on:
Platform/OS/Hardware/Device
What are you running the cli on?
Docker(base image nvidia/cuda:10.2-cudnn7-runtime-ubuntu18.04) / Azure AKS NV6 instance
Kubernetes version: 1.15.10
aws-cli/2.0.16 Python/3.7.3 Linux/4.9.184-linuxkit botocore/2.0.0dev20
Describe the question
At the startup of my container, I want to fetch some static data by copying bucket's contents into a local directory.
It seems from debug output that aws-cli detects that it is running in EKS and goes to fetch a metadata from IMDS (there is an http server on 169.254.169.254:80
, see https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service). However, api is different and the request ends up with 400 bad request. I guess it actually is some kind of collision.
So, is there a way to go over this without some hacks like adding NET_ADMIN
capability to the container and messing with ip routing?
Logs/output
Get full traceback and error logs by adding --debug
to the command.
cli is installed in Dockerfile via:
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -f awscliv2.zip && \
aws --version
Command itself
```
Having experienced the same bug as well.
@we-taper As a temporary solution, the following command can be executed on the host prior to using aws-cli:
# ip route add blackhole 169.254.169.254
And after you are done don't forget to put everyting back in place by:
# ip route del blackhole 169.254.169.254
Alternatively, you can manually set AWS_REGION
environment variable to your preferred region like this:
export AWS_REGION="eu-west-1"
Or via cli option:
aws --region eu-west-1 whatever
Still an issue since cli does not provide problem description and requires manual tuning.
Hi @tna0y.
sorry for the late response, it sounds like this was an issue regarding IMDS v2 incompatibility with CLI's region discovery.
This has been patched very recently (like this week), would you mind updating to the latest CLI version and retrying?
I found that it didn't work for my build :P
Thanks for that find, @tna0y. I had the same issue come up, as you can see here, only identified after I added --debug
and was able to search for botocore.utils.BadIMDSRequestError
and find this issue. Running 2.0.24 in the amazon/aws-cli
docker image.
I have the same issue on an Azure VM.
aws --version
aws-cli/2.0.40 Python/3.7.3 Linux/5.3.0-1035-azure exe/x86_64.ubuntu.18
uname -a
Linux lin00004V 5.3.0-1035-azure #36-Ubuntu SMP Thu Aug 6 09:21:33 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Performing either of the workarounds above (set AWS_REGION or ip route) works.
Works fine under git-bash on Win10 with no requirement to implement either of these work arounds.
aws-cli/2.0.43 Python/3.7.7 Windows/10 exe/AMD64
Thanks for your input, all!
As noted above, this is due to a change in behavior between the V1 and V2 clients. As of AWS CLI v2 2.0.15, if a region is not specified, the IMDS service is used to try and determine it. Setting a region prevents this request from happening.
https://github.com/aws/aws-cli/pull/5207
I think that @tna0y is correct in that it's using Azure's metadata service, which is not desirable!
There is also an undocumented environment variable that can be set to disable this:
AWS_EC2_METADATA_DISABLED=true
I will open a separate documentation issue to make sure this is added to the list of AWS CLI environment variables.
Opened the following documentation issue: https://github.com/aws/aws-cli/issues/5623
Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Most helpful comment
@we-taper As a temporary solution, the following command can be executed on the host prior to using aws-cli:
And after you are done don't forget to put everyting back in place by:
Alternatively, you can manually set
AWS_REGION
environment variable to your preferred region like this:Or via cli option:
Still an issue since cli does not provide problem description and requires manual tuning.