EC2Client
Auto-generated documentation for EC2 type annotations stubs module mypy-boto3-ec2.
EC2Client
Type annotations and code completion for boto3.client("ec2")
.
boto3 documentation
from boto3.session import Session
from mypy_boto3_ec2.client import EC2Client
def get_ec2_client() -> EC2Client:
return Session().client("ec2")
Exceptions
boto3
client exceptions are generated in runtime.
This class provides code completion for boto3.client("ec2").exceptions
structure.
client = boto3.client("ec2")
try:
do_something(client)
except (
client.ClientError,
) as e:
print(e)
from mypy_boto3_ec2.client import Exceptions
def handle_error(exc: Exceptions.ClientError) -> None:
...
Methods
accept_address_transfer
Accepts an Elastic IP address transfer.
Type annotations and code completion for boto3.client("ec2").accept_address_transfer
method.
boto3 documentation
def accept_address_transfer(
self,
*,
Address: str,
TagSpecifications: Sequence[TagSpecificationTypeDef] = ..., # (1)
DryRun: bool = ...,
) -> AcceptAddressTransferResultTypeDef: # (2)
...
kwargs: AcceptAddressTransferRequestRequestTypeDef = { # (1)
"Address": ...,
}
parent.accept_address_transfer(**kwargs)
accept_reserved_instances_exchange_quote
Accepts the Convertible Reserved Instance exchange quote described in the GetReservedInstancesExchangeQuote call.
Type annotations and code completion for boto3.client("ec2").accept_reserved_instances_exchange_quote
method.
boto3 documentation
def accept_reserved_instances_exchange_quote(
self,
*,
ReservedInstanceIds: Sequence[str],
DryRun: bool = ...,
TargetConfigurations: Sequence[TargetConfigurationRequestTypeDef] = ..., # (1)
) -> AcceptReservedInstancesExchangeQuoteResultTypeDef: # (2)
...
kwargs: AcceptReservedInstancesExchangeQuoteRequestRequestTypeDef = { # (1)
"ReservedInstanceIds": ...,
}
parent.accept_reserved_instances_exchange_quote(**kwargs)
accept_transit_gateway_multicast_domain_associations
Accepts a request to associate subnets with a transit gateway multicast domain.
Type annotations and code completion for boto3.client("ec2").accept_transit_gateway_multicast_domain_associations
method.
boto3 documentation
def accept_transit_gateway_multicast_domain_associations(
self,
*,
TransitGatewayMulticastDomainId: str = ...,
TransitGatewayAttachmentId: str = ...,
SubnetIds: Sequence[str] = ...,
DryRun: bool = ...,
) -> AcceptTransitGatewayMulticastDomainAssociationsResultTypeDef: # (1)
...
kwargs: AcceptTransitGatewayMulticastDomainAssociationsRequestRequestTypeDef = { # (1)
"TransitGatewayMulticastDomainId": ...,
}
parent.accept_transit_gateway_multicast_domain_associations(**kwargs)
accept_transit_gateway_peering_attachment
Accepts a transit gateway peering attachment request.
Type annotations and code completion for boto3.client("ec2").accept_transit_gateway_peering_attachment
method.
boto3 documentation
def accept_transit_gateway_peering_attachment(
self,
*,
TransitGatewayAttachmentId: str,
DryRun: bool = ...,
) -> AcceptTransitGatewayPeeringAttachmentResultTypeDef: # (1)
...
kwargs: AcceptTransitGatewayPeeringAttachmentRequestRequestTypeDef = { # (1)
"TransitGatewayAttachmentId": ...,
}
parent.accept_transit_gateway_peering_attachment(**kwargs)
accept_transit_gateway_vpc_attachment
Accepts a request to attach a VPC to a transit gateway.
Type annotations and code completion for boto3.client("ec2").accept_transit_gateway_vpc_attachment
method.
boto3 documentation
def accept_transit_gateway_vpc_attachment(
self,
*,
TransitGatewayAttachmentId: str,
DryRun: bool = ...,
) -> AcceptTransitGatewayVpcAttachmentResultTypeDef: # (1)
...
kwargs: AcceptTransitGatewayVpcAttachmentRequestRequestTypeDef = { # (1)
"TransitGatewayAttachmentId": ...,
}
parent.accept_transit_gateway_vpc_attachment(**kwargs)
accept_vpc_endpoint_connections
Accepts connection requests to your VPC endpoint service.
Type annotations and code completion for boto3.client("ec2").accept_vpc_endpoint_connections
method.
boto3 documentation
def accept_vpc_endpoint_connections(
self,
*,
ServiceId: str,
VpcEndpointIds: Sequence[str],
DryRun: bool = ...,
) -> AcceptVpcEndpointConnectionsResultTypeDef: # (1)
...
kwargs: AcceptVpcEndpointConnectionsRequestRequestTypeDef = { # (1)
"ServiceId": ...,
"VpcEndpointIds": ...,
}
parent.accept_vpc_endpoint_connections(**kwargs)
accept_vpc_peering_connection
Accept a VPC peering connection request.
Type annotations and code completion for boto3.client("ec2").accept_vpc_peering_connection
method.
boto3 documentation
def accept_vpc_peering_connection(
self,
*,
VpcPeeringConnectionId: str,
DryRun: bool = ...,
) -> AcceptVpcPeeringConnectionResultTypeDef: # (1)
...
kwargs: AcceptVpcPeeringConnectionRequestRequestTypeDef = { # (1)
"VpcPeeringConnectionId": ...,
}
parent.accept_vpc_peering_connection(**kwargs)
advertise_byoip_cidr
Advertises an IPv4 or IPv6 address range that is provisioned for use with your Amazon Web Services resources through bring your own IP addresses (BYOIP).
Type annotations and code completion for boto3.client("ec2").advertise_byoip_cidr
method.
boto3 documentation
def advertise_byoip_cidr(
self,
*,
Cidr: str,
DryRun: bool = ...,
) -> AdvertiseByoipCidrResultTypeDef: # (1)
...
kwargs: AdvertiseByoipCidrRequestRequestTypeDef = { # (1)
"Cidr": ...,
}
parent.advertise_byoip_cidr(**kwargs)
allocate_address
Allocates an Elastic IP address to your Amazon Web Services account.
Type annotations and code completion for boto3.client("ec2").allocate_address
method.
boto3 documentation
def allocate_address(
self,
*,
Domain: DomainTypeType = ..., # (1)
Address: str = ...,
PublicIpv4Pool: str = ...,
NetworkBorderGroup: str = ...,
CustomerOwnedIpv4Pool: str = ...,
DryRun: bool = ...,
TagSpecifications: Sequence[TagSpecificationTypeDef] = ..., # (2)
) -> AllocateAddressResultTypeDef: # (3)
...
kwargs: AllocateAddressRequestRequestTypeDef = { # (1)
"Domain": ...,
}
parent.allocate_address(**kwargs)
allocate_hosts
Allocates a Dedicated Host to your account.
Type annotations and code completion for boto3.client("ec2").allocate_hosts
method.
boto3 documentation
def allocate_hosts(
self,
*,
AvailabilityZone: str,
Quantity: int,
AutoPlacement: AutoPlacementType = ..., # (1)
ClientToken: str = ...,
InstanceType: str = ...,
InstanceFamily: str = ...,
TagSpecifications: Sequence[TagSpecificationTypeDef] = ..., # (2)
HostRecovery: HostRecoveryType = ..., # (3)
OutpostArn: str = ...,
) -> AllocateHostsResultTypeDef: # (4)
...
- See AutoPlacementType
- See TagSpecificationTypeDef
- See HostRecoveryType
- See AllocateHostsResultTypeDef
kwargs: AllocateHostsRequestRequestTypeDef = { # (1)
"AvailabilityZone": ...,
"Quantity": ...,
}
parent.allocate_hosts(**kwargs)
allocate_ipam_pool_cidr
Allocate a CIDR from an IPAM pool.
Type annotations and code completion for boto3.client("ec2").allocate_ipam_pool_cidr
method.
boto3 documentation
def allocate_ipam_pool_cidr(
self,
*,
IpamPoolId: str,
DryRun: bool = ...,
Cidr: str = ...,
NetmaskLength: int = ...,
ClientToken: str = ...,
Description: str = ...,
PreviewNextCidr: bool = ...,
DisallowedCidrs: Sequence[str] = ...,
) -> AllocateIpamPoolCidrResultTypeDef: # (1)
...
kwargs: AllocateIpamPoolCidrRequestRequestTypeDef = { # (1)
"IpamPoolId": ...,
}
parent.allocate_ipam_pool_cidr(**kwargs)
apply_security_groups_to_client_vpn_target_network
Applies a security group to the association between the target network and the Client VPN endpoint.
Type annotations and code completion for boto3.client("ec2").apply_security_groups_to_client_vpn_target_network
method.
boto3 documentation
def apply_security_groups_to_client_vpn_target_network(
self,
*,
ClientVpnEndpointId: str,
VpcId: str,
SecurityGroupIds: Sequence[str],
DryRun: bool = ...,
) -> ApplySecurityGroupsToClientVpnTargetNetworkResultTypeDef: # (1)
...
kwargs: ApplySecurityGroupsToClientVpnTargetNetworkRequestRequestTypeDef = { # (1)
"ClientVpnEndpointId": ...,
"VpcId": ...,
"SecurityGroupIds": ...,
}
parent.apply_security_groups_to_client_vpn_target_network(**kwargs)
assign_ipv6_addresses
Assigns one or more IPv6 addresses to the specified network interface.
Type annotations and code completion for boto3.client("ec2").assign_ipv6_addresses
method.
boto3 documentation
def assign_ipv6_addresses(
self,
*,
NetworkInterfaceId: str,
Ipv6AddressCount: int = ...,
Ipv6Addresses: Sequence[str] = ...,
Ipv6PrefixCount: int = ...,
Ipv6Prefixes: Sequence[str] = ...,
) -> AssignIpv6AddressesResultTypeDef: # (1)
...
kwargs: AssignIpv6AddressesRequestRequestTypeDef = { # (1)
"NetworkInterfaceId": ...,
}
parent.assign_ipv6_addresses(**kwargs)
assign_private_ip_addresses
Assigns one or more secondary private IP addresses to the specified network interface.
Type annotations and code completion for boto3.client("ec2").assign_private_ip_addresses
method.
boto3 documentation
def assign_private_ip_addresses(
self,
*,
NetworkInterfaceId: str,
AllowReassignment: bool = ...,
PrivateIpAddresses: Sequence[str] = ...,
SecondaryPrivateIpAddressCount: int = ...,
Ipv4Prefixes: Sequence[str] = ...,
Ipv4PrefixCount: int = ...,
) -> AssignPrivateIpAddressesResultTypeDef: # (1)
...
kwargs: AssignPrivateIpAddressesRequestRequestTypeDef = { # (1)
"NetworkInterfaceId": ...,
}
parent.assign_private_ip_addresses(**kwargs)
assign_private_nat_gateway_address
Assigns one or more private IPv4 addresses to a private NAT gateway.
Type annotations and code completion for boto3.client("ec2").assign_private_nat_gateway_address
method.
boto3 documentation
def assign_private_nat_gateway_address(
self,
*,
NatGatewayId: str,
PrivateIpAddresses: Sequence[str] = ...,
PrivateIpAddressCount: int = ...,
DryRun: bool = ...,
) -> AssignPrivateNatGatewayAddressResultTypeDef: # (1)
...
kwargs: AssignPrivateNatGatewayAddressRequestRequestTypeDef = { # (1)
"NatGatewayId": ...,
}
parent.assign_private_nat_gateway_address(**kwargs)
associate_address
Associates an Elastic IP address, or carrier IP address (for instances that are in subnets in Wavelength Zones) with an instance or a network interface.
Type annotations and code completion for boto3.client("ec2").associate_address
method.
boto3 documentation
def associate_address(
self,
*,
AllocationId: str = ...,
InstanceId: str = ...,
PublicIp: str = ...,
AllowReassociation: bool = ...,
DryRun: bool = ...,
NetworkInterfaceId: str = ...,
PrivateIpAddress: str = ...,
) -> AssociateAddressResultTypeDef: # (1)
...
kwargs: AssociateAddressRequestRequestTypeDef = { # (1)
"AllocationId": ...,
}
parent.associate_address(**kwargs)
associate_client_vpn_target_network
Associates a target network with a Client VPN endpoint.
Type annotations and code completion for boto3.client("ec2").associate_client_vpn_target_network
method.
boto3 documentation
def associate_client_vpn_target_network(
self,
*,
ClientVpnEndpointId: str,
SubnetId: str,
ClientToken: str = ...,
DryRun: bool = ...,
) -> AssociateClientVpnTargetNetworkResultTypeDef: # (1)
...
kwargs: AssociateClientVpnTargetNetworkRequestRequestTypeDef = { # (1)
"ClientVpnEndpointId": ...,
"SubnetId": ...,
}
parent.associate_client_vpn_target_network(**kwargs)
associate_dhcp_options
Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.
Type annotations and code completion for boto3.client("ec2").associate_dhcp_options
method.
boto3 documentation
def associate_dhcp_options(
self,
*,
DhcpOptionsId: str,
VpcId: str,
DryRun: bool = ...,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: AssociateDhcpOptionsRequestRequestTypeDef = { # (1)
"DhcpOptionsId": ...,
"VpcId": ...,
}
parent.associate_dhcp_options(**kwargs)
associate_enclave_certificate_iam_role
Associates an Identity and Access Management (IAM) role with an Certificate Manager (ACM) certificate.
Type annotations and code completion for boto3.client("ec2").associate_enclave_certificate_iam_role
method.
boto3 documentation
def associate_enclave_certificate_iam_role(
self,
*,
CertificateArn: str,
RoleArn: str,
DryRun: bool = ...,
) -> AssociateEnclaveCertificateIamRoleResultTypeDef: # (1)
...
kwargs: AssociateEnclaveCertificateIamRoleRequestRequestTypeDef = { # (1)
"CertificateArn": ...,
"RoleArn": ...,
}
parent.associate_enclave_certificate_iam_role(**kwargs)
associate_iam_instance_profile
Associates an IAM instance profile with a running or stopped instance.
Type annotations and code completion for boto3.client("ec2").associate_iam_instance_profile
method.
boto3 documentation