aiobotocore

raw JSON →
3.3.0 verified Tue May 12 auth: no python install: verified quickstart: verified

aiobotocore is an asyncio-native, mostly feature-complete async wrapper around botocore, enabling non-blocking AWS service calls via aiohttp (with experimental httpx support). Current version is 3.3.0. Releases track botocore closely — minor/patch releases drop frequently (often weekly) to relax or bump the botocore dependency range, with occasional minor releases adding features like socket_factory support in AioConfig.

pip install aiobotocore
error ModuleNotFoundError: No module named 'aiobotocore'
cause The 'aiobotocore' library is not installed in the Python environment.
fix
Install 'aiobotocore' using pip: 'pip install aiobotocore'.
error AttributeError: module 'aiobotocore' has no attribute 'AioSession'
cause The 'AioSession' attribute does not exist in the 'aiobotocore' module.
fix
Use 'aiobotocore.session.get_session()' to create a session instead.
error AttributeError: 'ClientCreatorContext' object has no attribute 'send_message'
cause The 'create_client' method returns a coroutine that needs to be awaited.
fix
Await the 'create_client' coroutine: 'client = await session.create_client('sqs')'.
error aiobotocore==X.Y.Z requires botocore<A.B.C,>=D.E.F but botocore G.H.I was resolved
cause There is a version incompatibility between 'aiobotocore' and 'botocore' (or 'boto3'), often due to other installed packages requiring different 'botocore' versions.
fix
Use a virtual environment to isolate dependencies and explicitly pin compatible versions of 'aiobotocore', 'botocore', and 'boto3' in your project's dependencies.
error botocore.exceptions.NoCredentialsError: Unable to locate credentials
cause The aiobotocore client, inheriting from botocore, cannot find valid AWS credentials in the standard locations (environment variables, shared credentials file, IAM role).
fix
Ensure AWS credentials are configured properly, typically via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN), a shared credentials file (~/.aws/credentials), or an IAM role attached to the execution environment.
breaking create_client() MUST be used as an async context manager (async with). Calling it without a context manager and manually closing is unreliable, and since v3.0.0 creating a new ClientSession after the client exits its context is explicitly forbidden and raises an error.
fix Always use: async with session.create_client('s3', ...) as client: ...
breaking The aiobotocore[boto3] and aiobotocore[awscli] packaging extras were removed in v3.0.0. Installing them will raise a pip error about unknown extras.
fix Install separately: pip install aiobotocore boto3 or pip install aiobotocore awscli
breaking Credential properties (credentials.access_key, credentials.secret_key, credentials.token) raise NotImplementedError because they do not trigger an async refresh cycle.
fix Use the async method: frozen = await credentials.get_frozen_credentials()
gotcha aiobotocore pins botocore to a narrow version range that changes with every release. Installing aiobotocore alongside boto3, awscli, s3fs, or moto frequently causes pip dependency conflicts because those packages independently pin botocore.
fix Pin all AWS-related packages together (aiobotocore, boto3, botocore) to a mutually compatible set. Check the aiobotocore release notes for the supported botocore range. Use a lockfile (pip-tools, poetry, uv) to resolve conflicts upfront.
gotcha get_object() response Body must be consumed inside an async context manager. Reading Body outside of 'async with response["Body"] as stream:' can leave the underlying TCP connection dangling and cause connection pool exhaustion.
fix async with response['Body'] as stream: data = await stream.read()
gotcha Paginators are async iterators in aiobotocore. You must use 'async for result in paginator.paginate(...):', NOT a regular 'for' loop. A regular for loop will not await pages and silently yields nothing or raises TypeError.
fix paginator = client.get_paginator('list_objects_v2') async for page in paginator.paginate(Bucket='my-bucket'): for obj in page.get('Contents', []): print(obj['Key'])
deprecated Passing the 'loop' parameter to get_session() is a legacy pattern from pre-asyncio.run() era and is no longer supported. Python's asyncio manages the event loop implicitly.
fix Use get_session() with no arguments, and run coroutines with asyncio.run(main()).
breaking AWS error: AuthorizationHeaderMalformed. This usually means that AWS credentials (Access Key ID and Secret Access Key) are not configured correctly or are missing in the environment where the code is running. Common causes include missing environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) or an improperly configured AWS credentials file (~/.aws/credentials).
fix Ensure AWS credentials are properly configured in the execution environment. This can be done via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) or by configuring an AWS credentials file. Verify that the credentials have the necessary permissions for the AWS service being accessed.
pip install aiobotocore boto3
pip install 'types-aiobotocore[essential]'
python os / libc variant status wheel install import disk
3.10 alpine (musl) essential - - - -
3.10 alpine (musl) aiobotocore - - 0.89s 59.0M
3.10 alpine (musl) aiobotocore - - 0.86s 61.1M
3.10 slim (glibc) essential - - - -
3.10 slim (glibc) aiobotocore - - 0.64s 61M
3.10 slim (glibc) aiobotocore - - 0.65s 64M
3.11 alpine (musl) essential - - - -
3.11 alpine (musl) aiobotocore - - 1.17s 62.8M
3.11 alpine (musl) aiobotocore - - 1.17s 65.2M
3.11 slim (glibc) essential - - - -
3.11 slim (glibc) aiobotocore - - 0.97s 65M
3.11 slim (glibc) aiobotocore - - 0.95s 68M
3.12 alpine (musl) essential - - - -
3.12 alpine (musl) aiobotocore - - 1.23s 54.4M
3.12 alpine (musl) aiobotocore - - 1.23s 56.8M
3.12 slim (glibc) essential - - - -
3.12 slim (glibc) aiobotocore - - 1.21s 57M
3.12 slim (glibc) aiobotocore - - 1.19s 59M
3.13 alpine (musl) essential - - - -
3.13 alpine (musl) aiobotocore - - 1.19s 53.7M
3.13 alpine (musl) aiobotocore - - 1.17s 56.0M
3.13 slim (glibc) essential - - - -
3.13 slim (glibc) aiobotocore - - 1.16s 56M
3.13 slim (glibc) aiobotocore - - 1.16s 58M
3.9 alpine (musl) essential - - - -
3.9 alpine (musl) aiobotocore - - 0.74s 58.9M
3.9 alpine (musl) aiobotocore - - 0.77s 61.1M
3.9 slim (glibc) essential - - - -
3.9 slim (glibc) aiobotocore - - 0.69s 62M
3.9 slim (glibc) aiobotocore - - 0.66s 64M

List S3 buckets using an async context-managed client with credentials from environment variables.

import asyncio
import os
from aiobotocore.session import get_session
import botocore.exceptions

async def main():
    session = get_session()
    async with session.create_client(
        's3',
        region_name='us-east-1',
        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),
    ) as client:
        try:
            response = await client.list_buckets()
            for bucket in response.get('Buckets', []):
                print(bucket['Name'])
        except botocore.exceptions.ClientError as e:
            print(f"AWS error: {e.response['Error']['Code']} - {e.response['Error']['Message']}")
        except botocore.exceptions.NoCredentialsError:
            print('No credentials found')

asyncio.run(main())