terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CredentialRetrievalError on ECS after a few successful calls

sfc-gh-afedorov opened this issue · comments

  • Async AWS SDK for Python version: 9.3.1
  • Python version: 3.7.11
  • Operating System: ECS with Docker Container built on python:3.7-slim-stretch

Description

Trying to run aws_collect.py from the SnowAlert project

Everything works fine running on macOS with py3.9 but in ECS with credentials passed as environment variables, out of four times that I tried it in ECS Tasks, 0, 1, 8, and 12 calls are made before a novel exception is raised in connectors/utils.py:92

async with aioboto3.Session().client('sts') as sts:

botocore.exceptions.CredentialRetrievalError: Error when retrieving credentials from container-role: Error retrieving metadata: Received error when attempting to retrieve ECS metadata:

What I Did

Ran the connector on one of our internal accounts that works fine with 8.3.0 but raises an exception after 12 calls in v9

This would probably be an issue with aiobotocore, as aioboto3 uses its credential handling.