Install & Compatibility
Where this runs
tested against v3.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 25.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.3s · import 0.000s · 26MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
EC2Client
✓ from types_aiobotocore_ec2 import EC2Client
✗ from types_aiobotocore_ec2 import EC2Client
This example demonstrates how to set up an `aiobotocore` client for EC2 and apply type annotations using `types-aiobotocore-ec2`. It explicitly types the client and shows how to leverage TypeDefs for response objects, enabling better static analysis and IDE autocompletion for asynchronous AWS calls.
import asyncio
from aiobotocore.session import get_session
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from types_aiobotocore_ec2.client import EC2Client
from types_aiobotocore_ec2.type_defs import DescribeInstancesResultTypeDef
async def describe_ec2_instances():
session = get_session()
async with session.create_client("ec2") as client:
# Explicit type annotation for the client
client: "EC2Client" = client
response = await client.describe_instances()
print(f"Found {len(response['Reservations'])} reservations.")
for reservation in response['Reservations']:
for instance in reservation['Instances']:
print(f" Instance ID: {instance['InstanceId']}, State: {instance['State']['Name']}")
# Example of using a TypeDef for a dictionary structure
example_type_def: "DescribeInstancesResultTypeDef" = response
print(f"Example TypeDef Reservations key: {example_type_def['Reservations'][0]['ReservationId']}")
if __name__ == "__main__":
asyncio.run(describe_ec2_instances())
Debug
Known issues
breakingSupport for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and subsequent generated packages. Users on Python 3.8 must either upgrade Python or use an older version of `types-aiobotocore-ec2`.fixUpgrade your Python environment to 3.9 or newer.
affects: >=3.4.0 (for types-aiobotocore-ec2), >=8.12.0 (for mypy-boto3-builder)
breakingGenerated TypeDef naming conventions may have changed in `mypy-boto3-builder` version 8.9.0. For instance, `CreateDistributionRequestRequestTypeDef` might become `CreateDistributionRequestTypeDef`. Code relying on specific TypeDef names may break.fixReview your type hints and update TypeDef names according to the latest generated types if you experience `NameError` or type resolution issues.
affects: >=3.x.x (for types-aiobotocore-ec2), >=8.9.0 (for mypy-boto3-builder)
gotchaInstalling `types-aiobotocore-ec2` only provides type annotations. For actual runtime execution, you must also install the `aiobotocore` library itself (`pip install aiobotocore`).fixEnsure both `aiobotocore` and `types-aiobotocore-ec2` are installed in your environment.
affects: all
gotchaWhen using standalone service packages like `types-aiobotocore-ec2` or `types-aiobotocore-lite`, explicit type annotations (e.g., `client: EC2Client`) are often required for full type checking and IDE support. The main `types-aiobotocore` package with overloads can sometimes infer types implicitly.fixAdd explicit type annotations for clients, resources, paginators, and waiters imported from `types_aiobotocore_ec2`.
affects: all
gotchaPyCharm users might experience slow performance or high CPU usage due to the large number of `Literal` overloads in these stub packages (related to PyCharm issue PY-40997).fixConsider using the `-lite` version of the stubs (`types-aiobotocore-lite-ec2` if available) or disable PyCharm's internal type checker and rely on external tools like MyPy or Pyright instead.
affects: all
Upgrade
Version history
3.9.0latest on PyPI · released Aug 2, 2026
Audit
Dependencies
aiobotocorerequiredThis package provides type stubs for aiobotocore. The runtime library is required for execution.
typing-extensionsrequiredWhile Python 3.9+ is required, aiobotocore itself lists typing-extensions as a dependency, and the builder ensures its version compatibility.