aio-libs / aiobotocore

asyncio support for botocore library using aiohttp
https://aiobotocore.aio-libs.org
Apache License 2.0
1.16k stars 182 forks source link

aiobotocore does not work with only IMDSv1 #1055

Closed Strunevskiy closed 2 weeks ago

Strunevskiy commented 10 months ago

Describe the bug When I try to get any access to AWS service on EC2 with only IMDSv1, aiobotocore fails to get credentials. botocore usually fails back to IMDSv1 when IMDSv2 is not available, but aiobotocore throws the error.

Checklist

pip freeze results

Environment:

Additional context I believe it happens because botocore and aiobotocore use different underlying HTTP clients which behave differently when getting 405

It looks like it is failing here instead of returning None. https://github.com/aio-libs/aiobotocore/blob/master/aiobotocore/utils.py#L118

As a result, it is failing here https://github.com/aio-libs/aiobotocore/blob/master/aiobotocore/utils.py#L210

thehesiod commented 10 months ago

i think there's a way to force an authentication mechanism, is there any way to make a testcase? Ideally either via moto or a cloudformation script to bring up an env to test with. THanks!

Strunevskiy commented 10 months ago

i think there's a way to force an authentication mechanism, is there any way to make a testcase? Ideally either via moto or a cloudformation script to bring up an env to test with. THanks!

Where do you have this mechanism to force an authentication? My credentials sits in IMDSv1 when I try to access S3 a request fails.

I will try to create cloudformation for this test case.