Registry /
type-stubs / types-aiobotocore-cloudwatch
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.95 runs
installs and imports cleanly · install 0.0s · import 1.170s · 60.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 6.3s · import 1.032s · 63MB
61MB installed
● package 61MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CloudWatchClient
✓ from types_aiobotocore_cloudwatch.client import CloudWatchClient
Import the typed client from the stub package for explicit type hinting.
PutMetricDataInputRequestTypeDef
✓ from types_aiobotocore_cloudwatch.type_defs import PutMetricDataInputRequestTypeDef
Import specific TypeDefs for precise type annotations of input/output dictionaries.
This quickstart demonstrates how to use `types-aiobotocore-cloudwatch` for type hinting an `aiobotocore` CloudWatch client. It creates a client, prepares metric data using a `TypeDef`, and calls `put_metric_data` with full type safety.
import asyncio
import os
from aiobotocore.session import get_session
from types_aiobotocore_cloudwatch.client import CloudWatchClient
from types_aiobotocore_cloudwatch.type_defs import PutMetricDataInputRequestTypeDef
async def put_cloudwatch_metric():
session = get_session()
# Ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION are set as environment variables
async with session.create_client(
"cloudwatch",
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID", ""),
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", ""),
region_name=os.environ.get("AWS_REGION", "us-east-1")
) as client:
# client is automatically type-hinted as CloudWatchClient by static analysis
# For explicit hinting:
cloudwatch_client: CloudWatchClient = client
metric_data: PutMetricDataInputRequestTypeDef = {
"Namespace": "MyApplication",
"MetricData": [
{
"MetricName": "RequestCount",
"Dimensions": [
{"Name": "Environment", "Value": "Production"},
],
"Value": 1.0,
"Unit": "Count",
},
],
}
response = await cloudwatch_client.put_metric_data(
Namespace=metric_data["Namespace"],
MetricData=metric_data["MetricData"]
)
print(f"PutMetricData response: {response}")
if __name__ == "__main__":
# Example usage: set dummy env vars if not truly interacting with AWS
os.environ.setdefault("AWS_ACCESS_KEY_ID", "DUMMY_KEY")
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "DUMMY_SECRET")
os.environ.setdefault("AWS_REGION", "us-east-1")
asyncio.run(put_cloudwatch_metric())
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0 (which generated `types-aiobotocore-cloudwatch` 3.4.0), Python 3.8 is no longer supported for these type stubs. The package requires Python >= 3.9.fixEnsure your project uses Python 3.9 or newer. Check your `pyproject.toml` or `requirements.txt` for `python_requires`.
affects: types-aiobotocore-cloudwatch >= 3.4.0
gotchaAs of `mypy-boto3-builder` version 8.12.0, all `types-aiobotocore` packages officially migrated to PEP 561 native namespace packages. While type checkers generally find stubs, for explicit and robust type hinting, it is recommended to directly import types (like `CloudWatchClient` or `TypeDefs`) from the `types_aiobotocore_cloudwatch` package rather than relying on inferred types from `aiobotocore`'s runtime imports.fixUpdate your import statements to explicitly import type symbols from `types_aiobotocore_cloudwatch` (e.g., `from types_aiobotocore_cloudwatch.client import CloudWatchClient`).
affects: types-aiobotocore-cloudwatch >= 3.4.0
breaking`mypy-boto3-builder` version 8.9.0 introduced changes to `TypeDef` naming conventions. Some argument TypeDefs might have shorter names (e.g., `RequestRequestTypeDef` became `RequestTypeDef`), and `Extra` postfixes might have moved. While not every service is affected in the same way, verify your custom `TypeDef` usage if you encounter type-checking errors related to dictionary shapes.fixConsult the `types-aiobotocore-cloudwatch` documentation or source for the correct `TypeDef` names and adjust your code accordingly.
affects: types-aiobotocore-cloudwatch >= 3.1.0 (generated by builder 8.9.0)
Upgrade
Version history
3.9.0latest on PyPI · released Aug 2, 2026
Audit
Dependencies
aiobotocorerequiredRuntime dependency for which these are type stubs. Required for actual execution.