{"id":602,"library":"aioboto3","title":"aioboto3","description":"aioboto3 is an asynchronous wrapper for boto3, the Amazon Web Services (AWS) SDK for Python. It allows developers to interact with AWS services using Python's `async/await` syntax, leveraging the `aiobotocore` library for its asynchronous backend. This enables non-blocking I/O operations with AWS, ideal for modern async applications. The current version is 15.5.0, with frequent releases often aligned with updates to its underlying dependencies.","status":"active","version":"15.5.0","language":"python","source_language":"en","source_url":"https://github.com/terrycain/aioboto3","tags":["aws","async","boto3","aiobotocore","cloud","asynchronous"],"install":[{"cmd":"pip install aioboto3","lang":"bash","label":"Standard Installation"},{"cmd":"pip install aioboto3[s3cse]","lang":"bash","label":"With S3 Client-Side Encryption"}],"dependencies":[{"reason":"The core AWS SDK that aioboto3 wraps.","package":"boto3"},{"reason":"The asynchronous backend for AWS interactions.","package":"aiobotocore"},{"reason":"Required for S3 client-side encryption functionality.","package":"cryptography","optional":true}],"imports":[{"note":"Top-level `aioboto3.client` and `aioboto3.resource` were removed in v9. You must create a Session first, then use `session.client()` or `session.resource()`.","wrong":"import aioboto3; client = aioboto3.client('s3')","symbol":"Session","correct":"from aioboto3 import Session"}],"quickstart":{"code":"import asyncio\nimport os\nfrom aioboto3 import Session\nfrom boto3.dynamodb.conditions import Key\n\nasync def main():\n    aws_region = os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')\n    session = Session()\n    async with session.resource('dynamodb', region_name=aws_region) as dynamodb_resource:\n        table_name = 'my_async_table'\n        # Check if table exists, create if not (simplified for quickstart)\n        try:\n            await dynamodb_resource.Table(table_name).wait_until_exists()\n            print(f\"Table '{table_name}' already exists.\")\n        except Exception:\n            print(f\"Creating table '{table_name}'...\")\n            table = await dynamodb_resource.create_table(\n                TableName=table_name,\n                KeySchema=[\n                    {'AttributeName': 'pk', 'KeyType': 'HASH'}\n                ],\n                AttributeDefinitions=[\n                    {'AttributeName': 'pk', 'AttributeType': 'S'}\n                ],\n                BillingMode='PAY_PER_REQUEST'\n            )\n            await table.wait_until_exists()\n            print(f\"Table '{table_name}' created successfully.\")\n            table = await dynamodb_resource.Table(table_name)\n\n        table = await dynamodb_resource.Table(table_name)\n        \n        print(\"Putting item...\")\n        await table.put_item(\n            Item={'pk': 'test1', 'data': 'async_data_value'}\n        )\n        print(\"Item put.\")\n\n        print(\"Querying item...\")\n        result = await table.query(\n            KeyConditionExpression=Key('pk').eq('test1')\n        )\n        print(\"Query result:\", result['Items'])\n\n        # Clean up (optional, for demonstration)\n        print(f\"Deleting table '{table_name}'...\")\n        await table.delete()\n        await table.wait_until_not_exists()\n        print(f\"Table '{table_name}' deleted.\")\n\nif __name__ == '__main__':\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates creating an asynchronous DynamoDB resource, creating a table (if it doesn't exist), inserting an item, querying it, and finally deleting the table. Ensure your AWS credentials and default region are configured in your environment (e.g., via `~/.aws/credentials` or environment variables like `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`)."},"warnings":[{"fix":"Replace `aioboto3.client('service')` with `session = aioboto3.Session(); async with session.client('service') as client:`","message":"Breaking Change in v9: Direct calls to `aioboto3.resource()` and `aioboto3.client()` are no longer available. You must first create a `Session` object and then use `session.client()` or `session.resource()`.","severity":"breaking","affected_versions":">= 9.0.0"},{"fix":"Ensure all `session.client()` and `session.resource()` calls are wrapped in an `async with` statement, e.g., `async with session.client('s3') as s3_client:`.","message":"Breaking Change in v9/v8.0.0+: `client` and `resource` methods (obtained from a session) must now be used as asynchronous context managers (`async with`). This change aligns with `aiobotocore` 1.0.1+ behavior.","severity":"breaking","affected_versions":">= 8.0.0"},{"fix":"Review S3 `upload_file` and `download_file` calls for custom `S3Transfer` configurations and adapt them to the `boto3`-aligned structure.","message":"Breaking Change in v11: The `S3Transfer` configuration passed into S3 `upload_file` and `download_file` methods has been updated to match `boto3`'s behavior, which might require adjustments if you were passing custom transfer configurations.","severity":"breaking","affected_versions":">= 11.0.0"},{"fix":"Always use `await` when getting a specific resource object, e.g., `bucket = await s3_resource.Bucket('mybucket')` or `table = await dynamodb_resource.Table('my_table')`.","message":"Service-specific resource objects (e.g., `s3.Bucket`, `dynamo_resource.Table`) must be `await`ed when instantiated, as their creation is an asynchronous operation.","severity":"gotcha","affected_versions":"All versions where `resource` is an async context manager"},{"fix":"For persistent clients in web servers, manage client/resource lifecycle using `AsyncExitStack` (e.g., in FastAPI's startup/shutdown events) to ensure clients are opened once and properly closed.","message":"For long-running processes like web servers, directly using `async with session.client(...)` per request can introduce overhead. For persistent clients, an `AsyncExitStack` or similar pattern is recommended to manage the context manager lifecycle.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure AWS credentials are correctly configured in your environment. This can be done via environment variables (e.g., `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`), shared credential files (`~/.aws/credentials`), or IAM roles (for EC2 instances or ECS tasks).","message":"aioboto3 could not find AWS credentials. This often manifests as `botocore.exceptions.NoCredentialsError: Unable to locate credentials` when attempting to interact with AWS services.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Configure AWS credentials in your environment. Refer to the AWS documentation on configuring the AWS CLI and SDKs for detailed instructions.","message":"Unable to locate AWS credentials. Ensure your AWS credentials are configured via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), shared credentials file (~/.aws/credentials), or IAM roles/profiles.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'15.5.0':56 'aioboto3':1,2 'aiobotocor':32,71 'align':61 'allow':18 'amazon':10 'applic':51 'async':50,69 'async/await':28 'asynchron':5,36,73 'aw':13,23,46,68 'backend':37 'block':42 'boto3':8,70 'cloud':72 'current':53 'depend':67 'develop':19 'enabl':39 'frequent':58 'i/o':43 'ideal':47 'interact':21 'leverag':30 'librari':33 'modern':49 'non':41 'non-block':40 'often':60 'oper':44 'python':16,26 'releas':59 'sdk':14 'servic':12,24 'syntax':29 'under':66 'updat':63 'use':25 'version':54 'web':11 'wrapper':6","created_at":"2026-03-28T17:06:46.221706+00:00","updated_at":"2026-04-17T15:11:04.977480+00:00","problems":[{"fix":"pip install aioboto3","cause":"The 'aioboto3' library is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'aioboto3'"},{"fix":"dynamodb = await aioboto3.Session().resource('dynamodb')","cause":"The 'resource' method in 'aioboto3' is asynchronous and needs to be awaited.","error":"AttributeError: 'ResourceCreatorContext' object has no attribute 'Table'"},{"fix":"Ensure compatible versions of 'aioboto3' and 'aiobotocore' are installed, or downgrade 'aioboto3' to a version where 'AioSession' is available.","cause":"The 'AioSession' attribute is not present in the 'aiobotocore' module, possibly due to version incompatibility.","error":"AttributeError: module 'aiobotocore' has no attribute 'AioSession'"},{"fix":"sagemaker_client = await aioboto3.Session().client('sagemaker-runtime')","cause":"The 'client' method in 'aioboto3' is asynchronous and needs to be awaited.","error":"AttributeError: 'ClientCreatorContext' object has no attribute 'invoke_endpoint'"},{"fix":"Ensure all calls to `async` functions within an `async` context are prefixed with `await`. If calling from synchronous code, wrap the coroutine call with `asyncio.run()`.","cause":"An asynchronous function (coroutine) was called, but its execution was not properly initiated using the `await` keyword or by `asyncio.run()`, meaning the coroutine object was created but never executed.","error":"RuntimeWarning: coroutine '...' was never awaited"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"15.5.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/terricain/aioboto3","docs":"https://readthedocs.org/projects/aioboto3/","changelog":null,"pypi":"https://pypi.org/project/aioboto3/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["aws","type-stubs","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}