Type annotations for aiobotocore SSM

3.4.0 · active · verified Thu Apr 16

types-aiobotocore-ssm provides comprehensive type annotations for the `aiobotocore` SSM (Systems Manager) service, enhancing static type checking with tools like MyPy. It is generated by `mypy-boto3-builder` (version 8.12.0 for the current 3.4.0 release of the stubs) and receives frequent updates, typically in sync with `aiobotocore` releases and `mypy-boto3-builder` enhancements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `types-aiobotocore-ssm` with `aiobotocore` to create a typed SSM client, call an asynchronous operation, and retrieve a typed waiter. Explicit type annotations (e.g., `# type: SSMClient`) are optional but can improve clarity and provide better IDE support. Remember to install `aiobotocore` as a runtime dependency.

import asyncio
from aiobotocore.session import get_session
from types_aiobotocore_ssm.client import SSMClient
from types_aiobotocore_ssm.waiter import CommandExecutedWaiter

async def describe_instance_information():
    session = get_session()
    async with session.create_client("ssm") as client: # type: SSMClient
        # Use explicit type annotation for client for clarity, though often inferred
        print("Describing instance information...")
        response = await client.describe_instance_information(
            MaxResults=5
        )
        print(f"Instances: {[instance['InstanceId'] for instance in response.get('InstanceInformationList', [])]}")

        # Example of using a waiter
        print("Getting CommandExecuted waiter...")
        waiter: CommandExecutedWaiter = client.get_waiter("command_executed")
        # await waiter.wait(CommandId="your-command-id", InstanceId="your-instance-id")
        print("Waiter retrieved. Actual wait requires command/instance IDs.")

if __name__ == "__main__":
    asyncio.run(describe_instance_information())

view raw JSON →