Skip to content

EC2

Installation

To install the EC2 client:

python -m pip install aws-sdk-ec2

Client

AsyncEC2Client

Bases: AsyncClient[AsyncEC2Config]

This is the Amazon EC2 API Reference. It provides descriptions, API request parameters, and the XML response for each of the Amazon EC2 Query API actions. Note that the Amazon EC2 API includes actions for Amazon EC2 plus additional services, such as Amazon EBS and Amazon VPC.

Learn more

Alternatively, use one of the following methods to access the Amazon EC2 API, instead of using the Query API directly:

Operations

Configuration

AsyncEC2Config dataclass

AsyncEC2Config()

Bases: AsyncAwsConfig

EC2 configuration (async-resolved).

Attributes

auth_scheme_resolver class-attribute instance-attribute
auth_scheme_resolver: AuthSchemeResolver | None = None

An auth scheme resolver that determines the auth scheme for each operation.

auth_schemes class-attribute instance-attribute
auth_schemes: dict[ShapeID, AsyncAuthScheme[Any, Any, Any, Any]] | None = None

A map of auth scheme ids to auth schemes.

aws_access_key_id class-attribute instance-attribute
aws_access_key_id: str | None = None

The identifier for a secret access key.

aws_credentials_identity_resolver class-attribute instance-attribute
aws_credentials_identity_resolver: AsyncIdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None = None

Resolves AWS Credentials. Required for operations that use Sigv4 Auth.

aws_secret_access_key class-attribute instance-attribute
aws_secret_access_key: str | None = None

A secret access key that can be used to sign requests.

aws_session_token class-attribute instance-attribute
aws_session_token: str | None = None

The session token used with temporary AWS credentials.

endpoint_resolver class-attribute instance-attribute
endpoint_resolver: EndpointResolver | AsyncEndpointResolver | None = None

The endpoint resolver used to resolve the final endpoint per-operation based on the configuration.

interceptors class-attribute instance-attribute
interceptors: list[_ServiceInterceptor] = field(default_factory=lambda: [])

The list of interceptors, which are hooks that are called during the execution of a request.

protocol class-attribute instance-attribute
protocol: ClientProtocol[Any, Any] | None = None

Pass a protocol class reference from smithy_aws_core.aio.protocols to select the protocol, e.g. protocol=AsyncAwsJson10ClientProtocol. For custom protocols a protocol instance may also be passed.

region class-attribute instance-attribute
region: str | None = None

The AWS region to connect to. The configured region is used to determine the service endpoint.

sdk_ua_app_id class-attribute instance-attribute
sdk_ua_app_id: str | None = None

A unique and opaque application ID that is appended to the User-Agent header.

use_dualstack_endpoint class-attribute instance-attribute
use_dualstack_endpoint: bool | None = None

When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.

use_fips_endpoint class-attribute instance-attribute
use_fips_endpoint: bool | None = None

When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.

user_agent_extra class-attribute instance-attribute
user_agent_extra: str | None = None

Additional suffix to be added to the User-Agent header.

Methods:

resolve async classmethod
resolve(*, profile: str | None = None, fs: AsyncFileSystem | None = None, config_file_path: str | None = None, credentials_file_path: str | None = None, **overrides: Unpack[_AsyncEC2ConfigOverrides]) -> Self

Resolve config from environment, config files, defaults, and explicit overrides.

set_auth_scheme
set_auth_scheme(scheme: AsyncAuthScheme[Any, Any, Any, Any]) -> None

Set an auth scheme implementation using its scheme ID. :param scheme: The auth scheme to add or replace.

Plugin module-attribute

Plugin: TypeAlias = Callable[[AsyncEC2Config], None]

A callable that customizes a client configuration. Service-level plugins are applied once to the base configuration inherited by every operation. Operation-level plugins apply only to a single operation invocation.

Structures

Errors

Enums