aio-libs / aiobotocore

asyncio support for botocore library using aiohttp

Home Page:https://aiobotocore.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aiobotocore does not work with only IMDSv1

Strunevskiy opened this issue · comments

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

  • I have reproduced in environment where pip check passes without errors
  • I have provided pip freeze results
  • I have provided sample code or detailed way to reproduce
  • [YES] I have tried the same code in botocore to ensure this is an aiobotocore specific issue
  • [YES] I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
  • [YES] I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection

pip freeze results

Environment:

  • Python Version: [e.g. 3.6]
  • OS name and version: [e.g. darwin stretch]

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

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!

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.