Skip to content

EC2ServiceResource

Index > EC2 > EC2ServiceResource

Auto-generated documentation for EC2 type annotations stubs module types-aiobotocore-ec2.

EC2ServiceResource

Type annotations and code completion for session.resource("ec2"), included resources and collections. boto3 documentation

Usage example
from aioboto3.session import Session
from types_aiobotocore_ec2.service_resource import EC2ServiceResource

session = Session()
async with session.resource("ec2") as resource:
    resource: EC2ServiceResource

Attributes

Collections

ServiceResourceClassicAddressesCollection

Provides access to ClassicAddress resource.

Type annotations and code completion for session.resource("ec2").classic_addresses collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceClassicAddressesCollection,

def get_collection() -> ServiceResourceClassicAddressesCollection:
    return session.resource("ec2").classic_addresses

ServiceResourceDhcpOptionsSetsCollection

Provides access to DhcpOptions resource.

Type annotations and code completion for session.resource("ec2").dhcp_options_sets collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceDhcpOptionsSetsCollection,

def get_collection() -> ServiceResourceDhcpOptionsSetsCollection:
    return session.resource("ec2").dhcp_options_sets

ServiceResourceImagesCollection

Provides access to Image resource.

Type annotations and code completion for session.resource("ec2").images collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceImagesCollection,

def get_collection() -> ServiceResourceImagesCollection:
    return session.resource("ec2").images

ServiceResourceInstancesCollection

Provides access to Instance resource.

Type annotations and code completion for session.resource("ec2").instances collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceInstancesCollection,

def get_collection() -> ServiceResourceInstancesCollection:
    return session.resource("ec2").instances

ServiceResourceInternetGatewaysCollection

Provides access to InternetGateway resource.

Type annotations and code completion for session.resource("ec2").internet_gateways collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceInternetGatewaysCollection,

def get_collection() -> ServiceResourceInternetGatewaysCollection:
    return session.resource("ec2").internet_gateways

ServiceResourceKeyPairsCollection

Provides access to KeyPairInfo resource.

Type annotations and code completion for session.resource("ec2").key_pairs collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceKeyPairsCollection,

def get_collection() -> ServiceResourceKeyPairsCollection:
    return session.resource("ec2").key_pairs

ServiceResourceNetworkAclsCollection

Provides access to NetworkAcl resource.

Type annotations and code completion for session.resource("ec2").network_acls collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceNetworkAclsCollection,

def get_collection() -> ServiceResourceNetworkAclsCollection:
    return session.resource("ec2").network_acls

ServiceResourceNetworkInterfacesCollection

Provides access to NetworkInterface resource.

Type annotations and code completion for session.resource("ec2").network_interfaces collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceNetworkInterfacesCollection,

def get_collection() -> ServiceResourceNetworkInterfacesCollection:
    return session.resource("ec2").network_interfaces

ServiceResourcePlacementGroupsCollection

Provides access to PlacementGroup resource.

Type annotations and code completion for session.resource("ec2").placement_groups collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourcePlacementGroupsCollection,

def get_collection() -> ServiceResourcePlacementGroupsCollection:
    return session.resource("ec2").placement_groups

ServiceResourceRouteTablesCollection

Provides access to RouteTable resource.

Type annotations and code completion for session.resource("ec2").route_tables collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceRouteTablesCollection,

def get_collection() -> ServiceResourceRouteTablesCollection:
    return session.resource("ec2").route_tables

ServiceResourceSecurityGroupsCollection

Provides access to SecurityGroup resource.

Type annotations and code completion for session.resource("ec2").security_groups collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceSecurityGroupsCollection,

def get_collection() -> ServiceResourceSecurityGroupsCollection:
    return session.resource("ec2").security_groups

ServiceResourceSnapshotsCollection

Provides access to Snapshot resource.

Type annotations and code completion for session.resource("ec2").snapshots collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceSnapshotsCollection,

def get_collection() -> ServiceResourceSnapshotsCollection:
    return session.resource("ec2").snapshots

ServiceResourceSubnetsCollection

Provides access to Subnet resource.

Type annotations and code completion for session.resource("ec2").subnets collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceSubnetsCollection,

def get_collection() -> ServiceResourceSubnetsCollection:
    return session.resource("ec2").subnets

ServiceResourceVolumesCollection

Provides access to Volume resource.

Type annotations and code completion for session.resource("ec2").volumes collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceVolumesCollection,

def get_collection() -> ServiceResourceVolumesCollection:
    return session.resource("ec2").volumes

ServiceResourceVpcAddressesCollection

Provides access to VpcAddress resource.

Type annotations and code completion for session.resource("ec2").vpc_addresses collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceVpcAddressesCollection,

def get_collection() -> ServiceResourceVpcAddressesCollection:
    return session.resource("ec2").vpc_addresses

ServiceResourceVpcPeeringConnectionsCollection

Provides access to VpcPeeringConnection resource.

Type annotations and code completion for session.resource("ec2").vpc_peering_connections collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceVpcPeeringConnectionsCollection,

def get_collection() -> ServiceResourceVpcPeeringConnectionsCollection:
    return session.resource("ec2").vpc_peering_connections

ServiceResourceVpcsCollection

Provides access to Vpc resource.

Type annotations and code completion for session.resource("ec2").vpcs collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ServiceResourceVpcsCollection,

def get_collection() -> ServiceResourceVpcsCollection:
    return session.resource("ec2").vpcs

Methods

EC2ServiceResource.ClassicAddress method

Creates a ClassicAddress resource.

Type annotations and code completion for session.resource("ec2").ClassicAddress method. boto3 documentation

Method definition
await def ClassicAddress(
    self,
    public_ip: str,
) -> ClassicAddress:
    ...
Usage example with kwargs
kwargs: ServiceResourceClassicAddressRequestTypeDef = {  # (1)
    "public_ip": ...,
}

parent.ClassicAddress(**kwargs)
  1. See ServiceResourceClassicAddressRequestTypeDef

EC2ServiceResource.DhcpOptions method

Creates a DhcpOptions resource.

Type annotations and code completion for session.resource("ec2").DhcpOptions method. boto3 documentation

Method definition
await def DhcpOptions(
    self,
    id: str,
) -> DhcpOptions:
    ...
Usage example with kwargs
kwargs: ServiceResourceDhcpOptionsRequestTypeDef = {  # (1)
    "id": ...,
}

parent.DhcpOptions(**kwargs)
  1. See ServiceResourceDhcpOptionsRequestTypeDef

EC2ServiceResource.Image method

Creates a Image resource.

Type annotations and code completion for session.resource("ec2").Image method. boto3 documentation

Method definition
await def Image(
    self,
    id: str,
) -> Image:
    ...
Usage example with kwargs
kwargs: ServiceResourceImageRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Image(**kwargs)
  1. See ServiceResourceImageRequestTypeDef

EC2ServiceResource.Instance method

Creates a Instance resource.

Type annotations and code completion for session.resource("ec2").Instance method. boto3 documentation

Method definition
await def Instance(
    self,
    id: str,
) -> Instance:
    ...
Usage example with kwargs
kwargs: ServiceResourceInstanceRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Instance(**kwargs)
  1. See ServiceResourceInstanceRequestTypeDef

EC2ServiceResource.InternetGateway method

Creates a InternetGateway resource.

Type annotations and code completion for session.resource("ec2").InternetGateway method. boto3 documentation

Method definition
await def InternetGateway(
    self,
    id: str,
) -> InternetGateway:
    ...
Usage example with kwargs
kwargs: ServiceResourceInternetGatewayRequestTypeDef = {  # (1)
    "id": ...,
}

parent.InternetGateway(**kwargs)
  1. See ServiceResourceInternetGatewayRequestTypeDef

EC2ServiceResource.KeyPair method

Creates a KeyPairInfo resource.

Type annotations and code completion for session.resource("ec2").KeyPair method. boto3 documentation

Method definition
await def KeyPair(
    self,
    name: str,
) -> KeyPairInfo:
    ...
Usage example with kwargs
kwargs: ServiceResourceKeyPairRequestTypeDef = {  # (1)
    "name": ...,
}

parent.KeyPair(**kwargs)
  1. See ServiceResourceKeyPairRequestTypeDef

EC2ServiceResource.NetworkAcl method

Creates a NetworkAcl resource.

Type annotations and code completion for session.resource("ec2").NetworkAcl method. boto3 documentation

Method definition
await def NetworkAcl(
    self,
    id: str,
) -> NetworkAcl:
    ...
Usage example with kwargs
kwargs: ServiceResourceNetworkAclRequestTypeDef = {  # (1)
    "id": ...,
}

parent.NetworkAcl(**kwargs)
  1. See ServiceResourceNetworkAclRequestTypeDef

EC2ServiceResource.NetworkInterface method

Creates a NetworkInterface resource.

Type annotations and code completion for session.resource("ec2").NetworkInterface method. boto3 documentation

Method definition
await def NetworkInterface(
    self,
    id: str,
) -> NetworkInterface:
    ...
Usage example with kwargs
kwargs: ServiceResourceNetworkInterfaceRequestTypeDef = {  # (1)
    "id": ...,
}

parent.NetworkInterface(**kwargs)
  1. See ServiceResourceNetworkInterfaceRequestTypeDef

EC2ServiceResource.NetworkInterfaceAssociation method

Creates a NetworkInterfaceAssociation resource.

Type annotations and code completion for session.resource("ec2").NetworkInterfaceAssociation method. boto3 documentation

Method definition
await def NetworkInterfaceAssociation(
    self,
    id: str,
) -> NetworkInterfaceAssociation:
    ...
Usage example with kwargs
kwargs: ServiceResourceNetworkInterfaceAssociationRequestTypeDef = {  # (1)
    "id": ...,
}

parent.NetworkInterfaceAssociation(**kwargs)
  1. See ServiceResourceNetworkInterfaceAssociationRequestTypeDef

EC2ServiceResource.PlacementGroup method

Creates a PlacementGroup resource.

Type annotations and code completion for session.resource("ec2").PlacementGroup method. boto3 documentation

Method definition
await def PlacementGroup(
    self,
    name: str,
) -> PlacementGroup:
    ...
Usage example with kwargs
kwargs: ServiceResourcePlacementGroupRequestTypeDef = {  # (1)
    "name": ...,
}

parent.PlacementGroup(**kwargs)
  1. See ServiceResourcePlacementGroupRequestTypeDef

EC2ServiceResource.Route method

Creates a Route resource.

Type annotations and code completion for session.resource("ec2").Route method. boto3 documentation

Method definition
await def Route(
    self,
    route_table_id: str,
    destination_cidr_block: str,
) -> Route:
    ...
Usage example with kwargs
kwargs: ServiceResourceRouteRequestTypeDef = {  # (1)
    "route_table_id": ...,
    "destination_cidr_block": ...,
}

parent.Route(**kwargs)
  1. See ServiceResourceRouteRequestTypeDef

EC2ServiceResource.RouteTable method

Creates a RouteTable resource.

Type annotations and code completion for session.resource("ec2").RouteTable method. boto3 documentation

Method definition
await def RouteTable(
    self,
    id: str,
) -> RouteTable:
    ...
Usage example with kwargs
kwargs: ServiceResourceRouteTableRequestTypeDef = {  # (1)
    "id": ...,
}

parent.RouteTable(**kwargs)
  1. See ServiceResourceRouteTableRequestTypeDef

EC2ServiceResource.RouteTableAssociation method

Creates a RouteTableAssociation resource.

Type annotations and code completion for session.resource("ec2").RouteTableAssociation method. boto3 documentation

Method definition
await def RouteTableAssociation(
    self,
    id: str,
) -> RouteTableAssociation:
    ...
Usage example with kwargs
kwargs: ServiceResourceRouteTableAssociationRequestTypeDef = {  # (1)
    "id": ...,
}

parent.RouteTableAssociation(**kwargs)
  1. See ServiceResourceRouteTableAssociationRequestTypeDef

EC2ServiceResource.SecurityGroup method

Creates a SecurityGroup resource.

Type annotations and code completion for session.resource("ec2").SecurityGroup method. boto3 documentation

Method definition
await def SecurityGroup(
    self,
    id: str,
) -> SecurityGroup:
    ...
Usage example with kwargs
kwargs: ServiceResourceSecurityGroupRequestTypeDef = {  # (1)
    "id": ...,
}

parent.SecurityGroup(**kwargs)
  1. See ServiceResourceSecurityGroupRequestTypeDef

EC2ServiceResource.Snapshot method

Creates a Snapshot resource.

Type annotations and code completion for session.resource("ec2").Snapshot method. boto3 documentation

Method definition
await def Snapshot(
    self,
    id: str,
) -> Snapshot:
    ...
Usage example with kwargs
kwargs: ServiceResourceSnapshotRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Snapshot(**kwargs)
  1. See ServiceResourceSnapshotRequestTypeDef

EC2ServiceResource.Subnet method

Creates a Subnet resource.

Type annotations and code completion for session.resource("ec2").Subnet method. boto3 documentation

Method definition
await def Subnet(
    self,
    id: str,
) -> Subnet:
    ...
Usage example with kwargs
kwargs: ServiceResourceSubnetRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Subnet(**kwargs)
  1. See ServiceResourceSubnetRequestTypeDef

EC2ServiceResource.Tag method

Creates a Tag resource.

Type annotations and code completion for session.resource("ec2").Tag method. boto3 documentation

Method definition
await def Tag(
    self,
    resource_id: str,
    key: str,
    value: str,
) -> Tag:
    ...
Usage example with kwargs
kwargs: ServiceResourceTagRequestTypeDef = {  # (1)
    "resource_id": ...,
    "key": ...,
    "value": ...,
}

parent.Tag(**kwargs)
  1. See ServiceResourceTagRequestTypeDef

EC2ServiceResource.Volume method

Creates a Volume resource.

Type annotations and code completion for session.resource("ec2").Volume method. boto3 documentation

Method definition
await def Volume(
    self,
    id: str,
) -> Volume:
    ...
Usage example with kwargs
kwargs: ServiceResourceVolumeRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Volume(**kwargs)
  1. See ServiceResourceVolumeRequestTypeDef

EC2ServiceResource.Vpc method

Creates a Vpc resource.

Type annotations and code completion for session.resource("ec2").Vpc method. boto3 documentation

Method definition
await def Vpc(
    self,
    id: str,
) -> Vpc:
    ...
Usage example with kwargs
kwargs: ServiceResourceVpcRequestTypeDef = {  # (1)
    "id": ...,
}

parent.Vpc(**kwargs)
  1. See ServiceResourceVpcRequestTypeDef

EC2ServiceResource.VpcAddress method

Creates a VpcAddress resource.

Type annotations and code completion for session.resource("ec2").VpcAddress method. boto3 documentation

Method definition
await def VpcAddress(
    self,
    allocation_id: str,
) -> VpcAddress:
    ...
Usage example with kwargs
kwargs: ServiceResourceVpcAddressRequestTypeDef = {  # (1)
    "allocation_id": ...,
}

parent.VpcAddress(**kwargs)
  1. See ServiceResourceVpcAddressRequestTypeDef

EC2ServiceResource.VpcPeeringConnection method

Creates a VpcPeeringConnection resource.

Type annotations and code completion for session.resource("ec2").VpcPeeringConnection method. boto3 documentation

Method definition
await def VpcPeeringConnection(
    self,
    id: str,
) -> VpcPeeringConnection:
    ...
Usage example with kwargs
kwargs: ServiceResourceVpcPeeringConnectionRequestTypeDef = {  # (1)
    "id": ...,
}

parent.VpcPeeringConnection(**kwargs)
  1. See ServiceResourceVpcPeeringConnectionRequestTypeDef

EC2ServiceResource.create_dhcp_options method

Creates a set of DHCP options for your VPC.

Type annotations and code completion for session.resource("ec2").create_dhcp_options method. boto3 documentation

Method definition
await def create_dhcp_options(
    self,
    *,
    DhcpConfigurations: Sequence[NewDhcpConfigurationTypeDef],  # (1)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
    DryRun: bool = ...,
) -> DhcpOptions:
    ...
  1. See NewDhcpConfigurationTypeDef
  2. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateDhcpOptionsRequestServiceResourceCreateDhcpOptionsTypeDef = {  # (1)
    "DhcpConfigurations": ...,
}

parent.create_dhcp_options(**kwargs)
  1. See CreateDhcpOptionsRequestServiceResourceCreateDhcpOptionsTypeDef

EC2ServiceResource.create_instances method

Launches the specified number of instances using an AMI for which you have permissions.

Type annotations and code completion for session.resource("ec2").create_instances method. boto3 documentation

Method definition
await def create_instances(
    self,
    *,
    MaxCount: int,
    MinCount: int,
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (1)
    ImageId: str = ...,
    InstanceType: InstanceTypeType = ...,  # (2)
    Ipv6AddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (3)
    KernelId: str = ...,
    KeyName: str = ...,
    Monitoring: RunInstancesMonitoringEnabledTypeDef = ...,  # (4)
    Placement: PlacementTypeDef = ...,  # (5)
    RamdiskId: str = ...,
    SecurityGroupIds: Sequence[str] = ...,
    SecurityGroups: Sequence[str] = ...,
    SubnetId: str = ...,
    UserData: str = ...,
    AdditionalInfo: str = ...,
    ClientToken: str = ...,
    DisableApiTermination: bool = ...,
    DryRun: bool = ...,
    EbsOptimized: bool = ...,
    IamInstanceProfile: IamInstanceProfileSpecificationTypeDef = ...,  # (6)
    InstanceInitiatedShutdownBehavior: ShutdownBehaviorType = ...,  # (7)
    NetworkInterfaces: Sequence[InstanceNetworkInterfaceSpecificationTypeDef] = ...,  # (8)
    PrivateIpAddress: str = ...,
    ElasticGpuSpecification: Sequence[ElasticGpuSpecificationTypeDef] = ...,  # (9)
    ElasticInferenceAccelerators: Sequence[ElasticInferenceAcceleratorTypeDef] = ...,  # (10)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (11)
    LaunchTemplate: LaunchTemplateSpecificationTypeDef = ...,  # (12)
    InstanceMarketOptions: InstanceMarketOptionsRequestTypeDef = ...,  # (13)
    CreditSpecification: CreditSpecificationRequestTypeDef = ...,  # (14)
    CpuOptions: CpuOptionsRequestTypeDef = ...,  # (15)
    CapacityReservationSpecification: CapacityReservationSpecificationTypeDef = ...,  # (16)
    HibernationOptions: HibernationOptionsRequestTypeDef = ...,  # (17)
    LicenseSpecifications: Sequence[LicenseConfigurationRequestTypeDef] = ...,  # (18)
    MetadataOptions: InstanceMetadataOptionsRequestTypeDef = ...,  # (19)
    EnclaveOptions: EnclaveOptionsRequestTypeDef = ...,  # (20)
    PrivateDnsNameOptions: PrivateDnsNameOptionsRequestTypeDef = ...,  # (21)
    MaintenanceOptions: InstanceMaintenanceOptionsRequestTypeDef = ...,  # (22)
    DisableApiStop: bool = ...,
) -> List[Instance]:
    ...
  1. See BlockDeviceMappingTypeDef
  2. See InstanceTypeType
  3. See InstanceIpv6AddressTypeDef
  4. See RunInstancesMonitoringEnabledTypeDef
  5. See PlacementTypeDef
  6. See IamInstanceProfileSpecificationTypeDef
  7. See ShutdownBehaviorType
  8. See InstanceNetworkInterfaceSpecificationTypeDef
  9. See ElasticGpuSpecificationTypeDef
  10. See ElasticInferenceAcceleratorTypeDef
  11. See TagSpecificationTypeDef
  12. See LaunchTemplateSpecificationTypeDef
  13. See InstanceMarketOptionsRequestTypeDef
  14. See CreditSpecificationRequestTypeDef
  15. See CpuOptionsRequestTypeDef
  16. See CapacityReservationSpecificationTypeDef
  17. See HibernationOptionsRequestTypeDef
  18. See LicenseConfigurationRequestTypeDef
  19. See InstanceMetadataOptionsRequestTypeDef
  20. See EnclaveOptionsRequestTypeDef
  21. See PrivateDnsNameOptionsRequestTypeDef
  22. See InstanceMaintenanceOptionsRequestTypeDef
Usage example with kwargs
kwargs: RunInstancesRequestServiceResourceCreateInstancesTypeDef = {  # (1)
    "MaxCount": ...,
    "MinCount": ...,
}

parent.create_instances(**kwargs)
  1. See RunInstancesRequestServiceResourceCreateInstancesTypeDef

EC2ServiceResource.create_internet_gateway method

Creates an internet gateway for use with a VPC.

Type annotations and code completion for session.resource("ec2").create_internet_gateway method. boto3 documentation

Method definition
await def create_internet_gateway(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> InternetGateway:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateInternetGatewayRequestServiceResourceCreateInternetGatewayTypeDef = {  # (1)
    "TagSpecifications": ...,
}

parent.create_internet_gateway(**kwargs)
  1. See CreateInternetGatewayRequestServiceResourceCreateInternetGatewayTypeDef

EC2ServiceResource.create_key_pair method

Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified PEM or PPK format.

Type annotations and code completion for session.resource("ec2").create_key_pair method. boto3 documentation

Method definition
await def create_key_pair(
    self,
    *,
    KeyName: str,
    DryRun: bool = ...,
    KeyType: KeyTypeType = ...,  # (1)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
    KeyFormat: KeyFormatType = ...,  # (3)
) -> KeyPair:
    ...
  1. See KeyTypeType
  2. See TagSpecificationTypeDef
  3. See KeyFormatType
Usage example with kwargs
kwargs: CreateKeyPairRequestServiceResourceCreateKeyPairTypeDef = {  # (1)
    "KeyName": ...,
}

parent.create_key_pair(**kwargs)
  1. See CreateKeyPairRequestServiceResourceCreateKeyPairTypeDef

EC2ServiceResource.create_network_acl method

Creates a network ACL in a VPC.

Type annotations and code completion for session.resource("ec2").create_network_acl method. boto3 documentation

Method definition
await def create_network_acl(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> NetworkAcl:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateNetworkAclRequestServiceResourceCreateNetworkAclTypeDef = {  # (1)
    "VpcId": ...,
}

parent.create_network_acl(**kwargs)
  1. See CreateNetworkAclRequestServiceResourceCreateNetworkAclTypeDef

EC2ServiceResource.create_network_interface method

Creates a network interface in the specified subnet.

Type annotations and code completion for session.resource("ec2").create_network_interface method. boto3 documentation

Method definition
await def create_network_interface(
    self,
    *,
    SubnetId: str,
    Description: str = ...,
    DryRun: bool = ...,
    Groups: Sequence[str] = ...,
    Ipv6AddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (1)
    PrivateIpAddress: str = ...,
    PrivateIpAddresses: Sequence[PrivateIpAddressSpecificationTypeDef] = ...,  # (2)
    SecondaryPrivateIpAddressCount: int = ...,
    Ipv4Prefixes: Sequence[Ipv4PrefixSpecificationRequestTypeDef] = ...,  # (3)
    Ipv4PrefixCount: int = ...,
    Ipv6Prefixes: Sequence[Ipv6PrefixSpecificationRequestTypeDef] = ...,  # (4)
    Ipv6PrefixCount: int = ...,
    InterfaceType: NetworkInterfaceCreationTypeType = ...,  # (5)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (6)
    ClientToken: str = ...,
) -> NetworkInterface:
    ...
  1. See InstanceIpv6AddressTypeDef
  2. See PrivateIpAddressSpecificationTypeDef
  3. See Ipv4PrefixSpecificationRequestTypeDef
  4. See Ipv6PrefixSpecificationRequestTypeDef
  5. See NetworkInterfaceCreationTypeType
  6. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateNetworkInterfaceRequestServiceResourceCreateNetworkInterfaceTypeDef = {  # (1)
    "SubnetId": ...,
}

parent.create_network_interface(**kwargs)
  1. See CreateNetworkInterfaceRequestServiceResourceCreateNetworkInterfaceTypeDef

EC2ServiceResource.create_placement_group method

Creates a placement group in which to launch instances.

Type annotations and code completion for session.resource("ec2").create_placement_group method. boto3 documentation

Method definition
await def create_placement_group(
    self,
    *,
    DryRun: bool = ...,
    GroupName: str = ...,
    Strategy: PlacementStrategyType = ...,  # (1)
    PartitionCount: int = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
    SpreadLevel: SpreadLevelType = ...,  # (3)
) -> PlacementGroup:
    ...
  1. See PlacementStrategyType
  2. See TagSpecificationTypeDef
  3. See SpreadLevelType
Usage example with kwargs
kwargs: CreatePlacementGroupRequestServiceResourceCreatePlacementGroupTypeDef = {  # (1)
    "DryRun": ...,
}

parent.create_placement_group(**kwargs)
  1. See CreatePlacementGroupRequestServiceResourceCreatePlacementGroupTypeDef

EC2ServiceResource.create_route_table method

Creates a route table for the specified VPC.

Type annotations and code completion for session.resource("ec2").create_route_table method. boto3 documentation

Method definition
await def create_route_table(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> RouteTable:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateRouteTableRequestServiceResourceCreateRouteTableTypeDef = {  # (1)
    "VpcId": ...,
}

parent.create_route_table(**kwargs)
  1. See CreateRouteTableRequestServiceResourceCreateRouteTableTypeDef

EC2ServiceResource.create_security_group method

Creates a security group.

Type annotations and code completion for session.resource("ec2").create_security_group method. boto3 documentation

Method definition
await def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    VpcId: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> SecurityGroup:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSecurityGroupRequestServiceResourceCreateSecurityGroupTypeDef = {  # (1)
    "Description": ...,
    "GroupName": ...,
}

parent.create_security_group(**kwargs)
  1. See CreateSecurityGroupRequestServiceResourceCreateSecurityGroupTypeDef

EC2ServiceResource.create_snapshot method

Creates a snapshot of an EBS volume and stores it in Amazon S3.

Type annotations and code completion for session.resource("ec2").create_snapshot method. boto3 documentation

Method definition
await def create_snapshot(
    self,
    *,
    VolumeId: str,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> Snapshot:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSnapshotRequestServiceResourceCreateSnapshotTypeDef = {  # (1)
    "VolumeId": ...,
}

parent.create_snapshot(**kwargs)
  1. See CreateSnapshotRequestServiceResourceCreateSnapshotTypeDef

EC2ServiceResource.create_subnet method

Creates a subnet in a specified VPC.

Type annotations and code completion for session.resource("ec2").create_subnet method. boto3 documentation

Method definition
await def create_subnet(
    self,
    *,
    VpcId: str,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    AvailabilityZone: str = ...,
    AvailabilityZoneId: str = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    OutpostArn: str = ...,
    DryRun: bool = ...,
    Ipv6Native: bool = ...,
) -> Subnet:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSubnetRequestServiceResourceCreateSubnetTypeDef = {  # (1)
    "VpcId": ...,
}

parent.create_subnet(**kwargs)
  1. See CreateSubnetRequestServiceResourceCreateSubnetTypeDef

EC2ServiceResource.create_tags method

Type annotations and code completion for session.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Resources: Sequence[str],
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestServiceResourceCreateTagsTypeDef = {  # (1)
    "Resources": ...,
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestServiceResourceCreateTagsTypeDef

EC2ServiceResource.create_volume method

Creates an EBS volume that can be attached to an instance in the same Availability Zone.

Type annotations and code completion for session.resource("ec2").create_volume method. boto3 documentation

Method definition
await def create_volume(
    self,
    *,
    AvailabilityZone: str,
    Encrypted: bool = ...,
    Iops: int = ...,
    KmsKeyId: str = ...,
    OutpostArn: str = ...,
    Size: int = ...,
    SnapshotId: str = ...,
    VolumeType: VolumeTypeType = ...,  # (1)
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
    MultiAttachEnabled: bool = ...,
    Throughput: int = ...,
    ClientToken: str = ...,
) -> Volume:
    ...
  1. See VolumeTypeType
  2. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateVolumeRequestServiceResourceCreateVolumeTypeDef = {  # (1)
    "AvailabilityZone": ...,
}

parent.create_volume(**kwargs)
  1. See CreateVolumeRequestServiceResourceCreateVolumeTypeDef

EC2ServiceResource.create_vpc method

Creates a VPC with the specified IPv4 CIDR block.

Type annotations and code completion for session.resource("ec2").create_vpc method. boto3 documentation

Method definition
await def create_vpc(
    self,
    *,
    CidrBlock: str = ...,
    AmazonProvidedIpv6CidrBlock: bool = ...,
    Ipv6Pool: str = ...,
    Ipv6CidrBlock: str = ...,
    Ipv4IpamPoolId: str = ...,
    Ipv4NetmaskLength: int = ...,
    Ipv6IpamPoolId: str = ...,
    Ipv6NetmaskLength: int = ...,
    DryRun: bool = ...,
    InstanceTenancy: TenancyType = ...,  # (1)
    Ipv6CidrBlockNetworkBorderGroup: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
) -> Vpc:
    ...
  1. See TenancyType
  2. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateVpcRequestServiceResourceCreateVpcTypeDef = {  # (1)
    "CidrBlock": ...,
}

parent.create_vpc(**kwargs)
  1. See CreateVpcRequestServiceResourceCreateVpcTypeDef

EC2ServiceResource.create_vpc_peering_connection method

Requests a VPC peering connection between two VPCs: a requester VPC that you own and an accepter VPC with which to create the connection.

Type annotations and code completion for session.resource("ec2").create_vpc_peering_connection method. boto3 documentation

Method definition
await def create_vpc_peering_connection(
    self,
    *,
    DryRun: bool = ...,
    PeerOwnerId: str = ...,
    PeerVpcId: str = ...,
    VpcId: str = ...,
    PeerRegion: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> VpcPeeringConnection:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateVpcPeeringConnectionRequestServiceResourceCreateVpcPeeringConnectionTypeDef = {  # (1)
    "DryRun": ...,
}

parent.create_vpc_peering_connection(**kwargs)
  1. See CreateVpcPeeringConnectionRequestServiceResourceCreateVpcPeeringConnectionTypeDef

EC2ServiceResource.disassociate_route_table method

Disassociates a subnet or gateway from a route table.

Type annotations and code completion for session.resource("ec2").disassociate_route_table method. boto3 documentation

Method definition
await def disassociate_route_table(
    self,
    *,
    AssociationId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DisassociateRouteTableRequestServiceResourceDisassociateRouteTableTypeDef = {  # (1)
    "AssociationId": ...,
}

parent.disassociate_route_table(**kwargs)
  1. See DisassociateRouteTableRequestServiceResourceDisassociateRouteTableTypeDef

EC2ServiceResource.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for session.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

EC2ServiceResource.import_key_pair method

Imports the public key from an RSA or ED25519 key pair that you created with a third-party tool.

Type annotations and code completion for session.resource("ec2").import_key_pair method. boto3 documentation

Method definition
await def import_key_pair(
    self,
    *,
    KeyName: str,
    PublicKeyMaterial: Union[str, bytes, IO[Any], StreamingBody],
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> KeyPairInfo:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: ImportKeyPairRequestServiceResourceImportKeyPairTypeDef = {  # (1)
    "KeyName": ...,
    "PublicKeyMaterial": ...,
}

parent.import_key_pair(**kwargs)
  1. See ImportKeyPairRequestServiceResourceImportKeyPairTypeDef

EC2ServiceResource.register_image method

Registers an AMI.

Type annotations and code completion for session.resource("ec2").register_image method. boto3 documentation

Method definition
await def register_image(
    self,
    *,
    Name: str,
    ImageLocation: str = ...,
    Architecture: ArchitectureValuesType = ...,  # (1)
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (2)
    Description: str = ...,
    DryRun: bool = ...,
    EnaSupport: bool = ...,
    KernelId: str = ...,
    BillingProducts: Sequence[str] = ...,
    RamdiskId: str = ...,
    RootDeviceName: str = ...,
    SriovNetSupport: str = ...,
    VirtualizationType: str = ...,
    BootMode: BootModeValuesType = ...,  # (3)
    TpmSupport: TpmSupportValuesType = ...,  # (4)
    UefiData: str = ...,
) -> Image:
    ...
  1. See ArchitectureValuesType
  2. See BlockDeviceMappingTypeDef
  3. See BootModeValuesType
  4. See TpmSupportValuesType
Usage example with kwargs
kwargs: RegisterImageRequestServiceResourceRegisterImageTypeDef = {  # (1)
    "Name": ...,
}

parent.register_image(**kwargs)
  1. See RegisterImageRequestServiceResourceRegisterImageTypeDef

ClassicAddress

Type annotations and code completion for session.resource("ec2").ClassicAddress class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import ClassicAddress


async def get_resource() -> ClassicAddress:
    async with session.resource("ec2") as resource:
        return await resource.ClassicAddress(...)

ClassicAddress attributes

  • instance_id: str
  • allocation_id: str
  • association_id: str
  • domain: DomainTypeType
  • network_interface_id: str
  • network_interface_owner_id: str
  • private_ip_address: str
  • tags: List[TagTypeDef]
  • public_ipv4_pool: str
  • network_border_group: str
  • customer_owned_ip: str
  • customer_owned_ipv4_pool: str
  • carrier_ip: str
  • public_ip: str

ClassicAddress methods

ClassicAddress.associate method

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 aioboto3.resource("ec2").associate method. boto3 documentation

Method definition
await def associate(
    self,
    *,
    AllocationId: str = ...,
    InstanceId: str = ...,
    AllowReassociation: bool = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...
  1. See AssociateAddressResultTypeDef
Usage example with kwargs
kwargs: AssociateAddressRequestClassicAddressAssociateTypeDef = {  # (1)
    "AllocationId": ...,
}

parent.associate(**kwargs)
  1. See AssociateAddressRequestClassicAddressAssociateTypeDef

ClassicAddress.disassociate method

Disassociates an Elastic IP address from the instance or network interface it's associated with.

Type annotations and code completion for aioboto3.resource("ec2").disassociate method. boto3 documentation

Method definition
await def disassociate(
    self,
    *,
    AssociationId: str = ...,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DisassociateAddressRequestClassicAddressDisassociateTypeDef = {  # (1)
    "AssociationId": ...,
}

parent.disassociate(**kwargs)
  1. See DisassociateAddressRequestClassicAddressDisassociateTypeDef

ClassicAddress.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

ClassicAddress.load method

Calls 🇵🇾meth:EC2.Client.describe_addresses to update the attributes of the ClassicAddress resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

ClassicAddress.release method

Releases the specified Elastic IP address.

Type annotations and code completion for aioboto3.resource("ec2").release method. boto3 documentation

Method definition
await def release(
    self,
    *,
    AllocationId: str = ...,
    PublicIp: str = ...,
    NetworkBorderGroup: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: ReleaseAddressRequestClassicAddressReleaseTypeDef = {  # (1)
    "AllocationId": ...,
}

parent.release(**kwargs)
  1. See ReleaseAddressRequestClassicAddressReleaseTypeDef

ClassicAddress.reload method

Calls 🇵🇾meth:EC2.Client.describe_addresses to update the attributes of the ClassicAddress resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

DhcpOptions

Type annotations and code completion for session.resource("ec2").DhcpOptions class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import DhcpOptions


async def get_resource() -> DhcpOptions:
    async with session.resource("ec2") as resource:
        return await resource.DhcpOptions(...)

DhcpOptions attributes

DhcpOptions methods

DhcpOptions.associate_with_vpc method

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 aioboto3.resource("ec2").associate_with_vpc method. boto3 documentation

Method definition
await def associate_with_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: AssociateDhcpOptionsRequestDhcpOptionsAssociateWithVpcTypeDef = {  # (1)
    "VpcId": ...,
}

parent.associate_with_vpc(**kwargs)
  1. See AssociateDhcpOptionsRequestDhcpOptionsAssociateWithVpcTypeDef

DhcpOptions.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestDhcpOptionsCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestDhcpOptionsCreateTagsTypeDef

DhcpOptions.delete method

Deletes the specified set of DHCP options.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteDhcpOptionsRequestDhcpOptionsDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteDhcpOptionsRequestDhcpOptionsDeleteTypeDef

DhcpOptions.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

DhcpOptions.load method

Calls 🇵🇾meth:EC2.Client.describe_dhcp_options to update the attributes of the DhcpOptions resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

DhcpOptions.reload method

Calls 🇵🇾meth:EC2.Client.describe_dhcp_options to update the attributes of the DhcpOptions resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Image

Type annotations and code completion for session.resource("ec2").Image class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Image


async def get_resource() -> Image:
    async with session.resource("ec2") as resource:
        return await resource.Image(...)

Image attributes

Image methods

Image.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestImageCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestImageCreateTagsTypeDef

Image.deregister method

Deregisters the specified AMI.

Type annotations and code completion for aioboto3.resource("ec2").deregister method. boto3 documentation

Method definition
await def deregister(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeregisterImageRequestImageDeregisterTypeDef = {  # (1)
    "DryRun": ...,
}

parent.deregister(**kwargs)
  1. See DeregisterImageRequestImageDeregisterTypeDef

Image.describe_attribute method

Describes the specified attribute of the specified AMI.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: ImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> ImageAttributeTypeDef:  # (2)
    ...
  1. See ImageAttributeNameType
  2. See ImageAttributeTypeDef
Usage example with kwargs
kwargs: DescribeImageAttributeRequestImageDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeImageAttributeRequestImageDescribeAttributeTypeDef

Image.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Image.load method

Calls 🇵🇾meth:EC2.Client.describe_images to update the attributes of the Image resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Image.modify_attribute method

Modifies the specified attribute of the specified AMI.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    Attribute: str = ...,
    Description: AttributeValueTypeDef = ...,  # (1)
    LaunchPermission: LaunchPermissionModificationsTypeDef = ...,  # (2)
    OperationType: OperationTypeType = ...,  # (3)
    ProductCodes: Sequence[str] = ...,
    UserGroups: Sequence[str] = ...,
    UserIds: Sequence[str] = ...,
    Value: str = ...,
    DryRun: bool = ...,
    OrganizationArns: Sequence[str] = ...,
    OrganizationalUnitArns: Sequence[str] = ...,
) -> None:
    ...
  1. See AttributeValueTypeDef
  2. See LaunchPermissionModificationsTypeDef
  3. See OperationTypeType
Usage example with kwargs
kwargs: ModifyImageAttributeRequestImageModifyAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifyImageAttributeRequestImageModifyAttributeTypeDef

Image.reload method

Calls 🇵🇾meth:EC2.Client.describe_images to update the attributes of the Image resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Image.reset_attribute method

Resets an attribute of an AMI to its default value.

Type annotations and code completion for aioboto3.resource("ec2").reset_attribute method. boto3 documentation

Method definition
await def reset_attribute(
    self,
    *,
    Attribute: ResetImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See ResetImageAttributeNameType
Usage example with kwargs
kwargs: ResetImageAttributeRequestImageResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_attribute(**kwargs)
  1. See ResetImageAttributeRequestImageResetAttributeTypeDef

Image.wait_until_exists method

Waits until this Image is exists.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_exists method. boto3 documentation

Method definition
await def wait_until_exists(
    self,
) -> None:
    ...

Instance

Type annotations and code completion for session.resource("ec2").Instance class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Instance


async def get_resource() -> Instance:
    async with session.resource("ec2") as resource:
        return await resource.Instance(...)

Instance attributes

Instance collections

Instance.volumes

Provides access to Volume resource.

Type annotations and code completion for session.resource("ec2").Instance(...).volumes collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import InstanceVolumesCollection,

def get_collection() -> InstanceVolumesCollection:
    resource = session.resource("ec2").Instance(...)
    return resource.volumes

Instance.vpc_addresses

Provides access to VpcAddress resource.

Type annotations and code completion for session.resource("ec2").Instance(...).vpc_addresses collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import InstanceVpcAddressesCollection,

def get_collection() -> InstanceVpcAddressesCollection:
    resource = session.resource("ec2").Instance(...)
    return resource.vpc_addresses

Instance methods

.

Type annotations and code completion for aioboto3.resource("ec2").attach_classic_link_vpc method. boto3 documentation

Method definition
await def attach_classic_link_vpc(
    self,
    *,
    Groups: Sequence[str],
    VpcId: str,
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See AttachClassicLinkVpcResultTypeDef
Usage example with kwargs
kwargs: AttachClassicLinkVpcRequestInstanceAttachClassicLinkVpcTypeDef = {  # (1)
    "Groups": ...,
    "VpcId": ...,
}

parent.attach_classic_link_vpc(**kwargs)
  1. See AttachClassicLinkVpcRequestInstanceAttachClassicLinkVpcTypeDef

Instance.attach_volume method

Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.

Type annotations and code completion for aioboto3.resource("ec2").attach_volume method. boto3 documentation

Method definition
await def attach_volume(
    self,
    *,
    Device: str,
    VolumeId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseMetadataTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseMetadataTypeDef
Usage example with kwargs
kwargs: AttachVolumeRequestInstanceAttachVolumeTypeDef = {  # (1)
    "Device": ...,
    "VolumeId": ...,
}

parent.attach_volume(**kwargs)
  1. See AttachVolumeRequestInstanceAttachVolumeTypeDef

Instance.console_output method

Gets the console output for the specified instance.

Type annotations and code completion for aioboto3.resource("ec2").console_output method. boto3 documentation

Method definition
await def console_output(
    self,
    *,
    DryRun: bool = ...,
    Latest: bool = ...,
) -> GetConsoleOutputResultTypeDef:  # (1)
    ...
  1. See GetConsoleOutputResultTypeDef
Usage example with kwargs
kwargs: GetConsoleOutputRequestInstanceConsoleOutputTypeDef = {  # (1)
    "DryRun": ...,
}

parent.console_output(**kwargs)
  1. See GetConsoleOutputRequestInstanceConsoleOutputTypeDef

Instance.create_image method

Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped.

Type annotations and code completion for aioboto3.resource("ec2").create_image method. boto3 documentation

Method definition
await def create_image(
    self,
    *,
    Name: str,
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (1)
    Description: str = ...,
    DryRun: bool = ...,
    NoReboot: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
) -> Image:
    ...
  1. See BlockDeviceMappingTypeDef
  2. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateImageRequestInstanceCreateImageTypeDef = {  # (1)
    "Name": ...,
}

parent.create_image(**kwargs)
  1. See CreateImageRequestInstanceCreateImageTypeDef

Instance.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestInstanceCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestInstanceCreateTagsTypeDef

Instance.delete_tags method

Deletes the specified set of tags from the specified set of resources.

Type annotations and code completion for aioboto3.resource("ec2").delete_tags method. boto3 documentation

Method definition
await def delete_tags(
    self,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: InstanceDeleteTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

parent.delete_tags(**kwargs)
  1. See InstanceDeleteTagsRequestTypeDef

Instance.describe_attribute method

Describes the specified attribute of the specified instance.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> InstanceAttributeTypeDef:  # (2)
    ...
  1. See InstanceAttributeNameType
  2. See InstanceAttributeTypeDef
Usage example with kwargs
kwargs: DescribeInstanceAttributeRequestInstanceDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeInstanceAttributeRequestInstanceDescribeAttributeTypeDef

.

Type annotations and code completion for aioboto3.resource("ec2").detach_classic_link_vpc method. boto3 documentation

Method definition
await def detach_classic_link_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See DetachClassicLinkVpcResultTypeDef
Usage example with kwargs
kwargs: DetachClassicLinkVpcRequestInstanceDetachClassicLinkVpcTypeDef = {  # (1)
    "VpcId": ...,
}

parent.detach_classic_link_vpc(**kwargs)
  1. See DetachClassicLinkVpcRequestInstanceDetachClassicLinkVpcTypeDef

Instance.detach_volume method

Detaches an EBS volume from an instance.

Type annotations and code completion for aioboto3.resource("ec2").detach_volume method. boto3 documentation

Method definition
await def detach_volume(
    self,
    *,
    VolumeId: str,
    Device: str = ...,
    Force: bool = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseMetadataTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseMetadataTypeDef
Usage example with kwargs
kwargs: DetachVolumeRequestInstanceDetachVolumeTypeDef = {  # (1)
    "VolumeId": ...,
}

parent.detach_volume(**kwargs)
  1. See DetachVolumeRequestInstanceDetachVolumeTypeDef

Instance.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Instance.load method

Calls 🇵🇾meth:EC2.Client.describe_instances to update the attributes of the Instance resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Instance.modify_attribute method

Modifies the specified attribute of the specified instance.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    SourceDestCheck: AttributeBooleanValueTypeDef = ...,  # (1)
    Attribute: InstanceAttributeNameType = ...,  # (2)
    BlockDeviceMappings: Sequence[InstanceBlockDeviceMappingSpecificationTypeDef] = ...,  # (3)
    DisableApiTermination: AttributeBooleanValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
    EbsOptimized: AttributeBooleanValueTypeDef = ...,  # (1)
    EnaSupport: AttributeBooleanValueTypeDef = ...,  # (1)
    Groups: Sequence[str] = ...,
    InstanceInitiatedShutdownBehavior: AttributeValueTypeDef = ...,  # (7)
    InstanceType: AttributeValueTypeDef = ...,  # (7)
    Kernel: AttributeValueTypeDef = ...,  # (7)
    Ramdisk: AttributeValueTypeDef = ...,  # (7)
    SriovNetSupport: AttributeValueTypeDef = ...,  # (7)
    UserData: BlobAttributeValueTypeDef = ...,  # (12)
    Value: str = ...,
    DisableApiStop: AttributeBooleanValueTypeDef = ...,  # (1)
) -> None:
    ...
  1. See AttributeBooleanValueTypeDef
  2. See InstanceAttributeNameType
  3. See InstanceBlockDeviceMappingSpecificationTypeDef
  4. See AttributeBooleanValueTypeDef
  5. See AttributeBooleanValueTypeDef
  6. See AttributeBooleanValueTypeDef
  7. See AttributeValueTypeDef
  8. See AttributeValueTypeDef
  9. See AttributeValueTypeDef
  10. See AttributeValueTypeDef
  11. See AttributeValueTypeDef
  12. See BlobAttributeValueTypeDef
  13. See AttributeBooleanValueTypeDef
Usage example with kwargs
kwargs: ModifyInstanceAttributeRequestInstanceModifyAttributeTypeDef = {  # (1)
    "SourceDestCheck": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifyInstanceAttributeRequestInstanceModifyAttributeTypeDef

Instance.monitor method

Enables detailed monitoring for a running instance.

Type annotations and code completion for aioboto3.resource("ec2").monitor method. boto3 documentation

Method definition
await def monitor(
    self,
    *,
    DryRun: bool = ...,
) -> MonitorInstancesResultTypeDef:  # (1)
    ...
  1. See MonitorInstancesResultTypeDef
Usage example with kwargs
kwargs: MonitorInstancesRequestInstanceMonitorTypeDef = {  # (1)
    "DryRun": ...,
}

parent.monitor(**kwargs)
  1. See MonitorInstancesRequestInstanceMonitorTypeDef

Instance.password_data method

Retrieves the encrypted administrator password for a running Windows instance.

Type annotations and code completion for aioboto3.resource("ec2").password_data method. boto3 documentation

Method definition
await def password_data(
    self,
    *,
    DryRun: bool = ...,
) -> GetPasswordDataResultTypeDef:  # (1)
    ...
  1. See GetPasswordDataResultTypeDef
Usage example with kwargs
kwargs: GetPasswordDataRequestInstancePasswordDataTypeDef = {  # (1)
    "DryRun": ...,
}

parent.password_data(**kwargs)
  1. See GetPasswordDataRequestInstancePasswordDataTypeDef

Instance.reboot method

Requests a reboot of the specified instances.

Type annotations and code completion for aioboto3.resource("ec2").reboot method. boto3 documentation

Method definition
await def reboot(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: RebootInstancesRequestInstanceRebootTypeDef = {  # (1)
    "DryRun": ...,
}

parent.reboot(**kwargs)
  1. See RebootInstancesRequestInstanceRebootTypeDef

Instance.reload method

Calls 🇵🇾meth:EC2.Client.describe_instances to update the attributes of the Instance resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Instance.report_status method

Submits feedback about the status of an instance.

Type annotations and code completion for aioboto3.resource("ec2").report_status method. boto3 documentation

Method definition
await def report_status(
    self,
    *,
    ReasonCodes: Sequence[ReportInstanceReasonCodesType],  # (1)
    Status: ReportStatusTypeType,  # (2)
    Description: str = ...,
    DryRun: bool = ...,
    EndTime: Union[datetime, str] = ...,
    StartTime: Union[datetime, str] = ...,
) -> None:
    ...
  1. See ReportInstanceReasonCodesType
  2. See ReportStatusTypeType
Usage example with kwargs
kwargs: ReportInstanceStatusRequestInstanceReportStatusTypeDef = {  # (1)
    "ReasonCodes": ...,
    "Status": ...,
}

parent.report_status(**kwargs)
  1. See ReportInstanceStatusRequestInstanceReportStatusTypeDef

Instance.reset_attribute method

Resets an attribute of an instance to its default value.

Type annotations and code completion for aioboto3.resource("ec2").reset_attribute method. boto3 documentation

Method definition
await def reset_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
Usage example with kwargs
kwargs: ResetInstanceAttributeRequestInstanceResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_attribute(**kwargs)
  1. See ResetInstanceAttributeRequestInstanceResetAttributeTypeDef

Instance.reset_kernel method

Resets an attribute of an instance to its default value.

Type annotations and code completion for aioboto3.resource("ec2").reset_kernel method. boto3 documentation

Method definition
await def reset_kernel(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'kernel',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
Usage example with kwargs
kwargs: ResetInstanceAttributeRequestInstanceResetKernelTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_kernel(**kwargs)
  1. See ResetInstanceAttributeRequestInstanceResetKernelTypeDef

Instance.reset_ramdisk method

Resets an attribute of an instance to its default value.

Type annotations and code completion for aioboto3.resource("ec2").reset_ramdisk method. boto3 documentation

Method definition
await def reset_ramdisk(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'ramdisk',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
Usage example with kwargs
kwargs: ResetInstanceAttributeRequestInstanceResetRamdiskTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_ramdisk(**kwargs)
  1. See ResetInstanceAttributeRequestInstanceResetRamdiskTypeDef

Instance.reset_source_dest_check method

Resets an attribute of an instance to its default value.

Type annotations and code completion for aioboto3.resource("ec2").reset_source_dest_check method. boto3 documentation

Method definition
await def reset_source_dest_check(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'sourceDestCheck',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
Usage example with kwargs
kwargs: ResetInstanceAttributeRequestInstanceResetSourceDestCheckTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_source_dest_check(**kwargs)
  1. See ResetInstanceAttributeRequestInstanceResetSourceDestCheckTypeDef

Instance.start method

Starts an Amazon EBS-backed instance that you've previously stopped.

Type annotations and code completion for aioboto3.resource("ec2").start method. boto3 documentation

Method definition
await def start(
    self,
    *,
    AdditionalInfo: str = ...,
    DryRun: bool = ...,
) -> StartInstancesResultTypeDef:  # (1)
    ...
  1. See StartInstancesResultTypeDef
Usage example with kwargs
kwargs: StartInstancesRequestInstanceStartTypeDef = {  # (1)
    "AdditionalInfo": ...,
}

parent.start(**kwargs)
  1. See StartInstancesRequestInstanceStartTypeDef

Instance.stop method

Stops an Amazon EBS-backed instance.

Type annotations and code completion for aioboto3.resource("ec2").stop method. boto3 documentation

Method definition
await def stop(
    self,
    *,
    Hibernate: bool = ...,
    DryRun: bool = ...,
    Force: bool = ...,
) -> StopInstancesResultTypeDef:  # (1)
    ...
  1. See StopInstancesResultTypeDef
Usage example with kwargs
kwargs: StopInstancesRequestInstanceStopTypeDef = {  # (1)
    "Hibernate": ...,
}

parent.stop(**kwargs)
  1. See StopInstancesRequestInstanceStopTypeDef

Instance.terminate method

Shuts down the specified instances.

Type annotations and code completion for aioboto3.resource("ec2").terminate method. boto3 documentation

Method definition
await def terminate(
    self,
    *,
    DryRun: bool = ...,
) -> TerminateInstancesResultTypeDef:  # (1)
    ...
  1. See TerminateInstancesResultTypeDef
Usage example with kwargs
kwargs: TerminateInstancesRequestInstanceTerminateTypeDef = {  # (1)
    "DryRun": ...,
}

parent.terminate(**kwargs)
  1. See TerminateInstancesRequestInstanceTerminateTypeDef

Instance.unmonitor method

Disables detailed monitoring for a running instance.

Type annotations and code completion for aioboto3.resource("ec2").unmonitor method. boto3 documentation

Method definition
await def unmonitor(
    self,
    *,
    DryRun: bool = ...,
) -> UnmonitorInstancesResultTypeDef:  # (1)
    ...
  1. See UnmonitorInstancesResultTypeDef
Usage example with kwargs
kwargs: UnmonitorInstancesRequestInstanceUnmonitorTypeDef = {  # (1)
    "DryRun": ...,
}

parent.unmonitor(**kwargs)
  1. See UnmonitorInstancesRequestInstanceUnmonitorTypeDef

Instance.wait_until_exists method

Waits until this Instance is exists.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_exists method. boto3 documentation

Method definition
await def wait_until_exists(
    self,
) -> None:
    ...

Instance.wait_until_running method

Waits until this Instance is running.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_running method. boto3 documentation

Method definition
await def wait_until_running(
    self,
) -> None:
    ...

Instance.wait_until_stopped method

Waits until this Instance is stopped.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_stopped method. boto3 documentation

Method definition
await def wait_until_stopped(
    self,
) -> None:
    ...

Instance.wait_until_terminated method

Waits until this Instance is terminated.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_terminated method. boto3 documentation

Method definition
await def wait_until_terminated(
    self,
) -> None:
    ...

InternetGateway

Type annotations and code completion for session.resource("ec2").InternetGateway class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import InternetGateway


async def get_resource() -> InternetGateway:
    async with session.resource("ec2") as resource:
        return await resource.InternetGateway(...)

InternetGateway attributes

InternetGateway methods

InternetGateway.attach_to_vpc method

Attaches an internet gateway or a virtual private gateway to a VPC, enabling connectivity between the internet and the VPC.

Type annotations and code completion for aioboto3.resource("ec2").attach_to_vpc method. boto3 documentation

Method definition
await def attach_to_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: AttachInternetGatewayRequestInternetGatewayAttachToVpcTypeDef = {  # (1)
    "VpcId": ...,
}

parent.attach_to_vpc(**kwargs)
  1. See AttachInternetGatewayRequestInternetGatewayAttachToVpcTypeDef

InternetGateway.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestInternetGatewayCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestInternetGatewayCreateTagsTypeDef

InternetGateway.delete method

Deletes the specified internet gateway.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteInternetGatewayRequestInternetGatewayDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteInternetGatewayRequestInternetGatewayDeleteTypeDef

InternetGateway.detach_from_vpc method

Detaches an internet gateway from a VPC, disabling connectivity between the internet and the VPC.

Type annotations and code completion for aioboto3.resource("ec2").detach_from_vpc method. boto3 documentation

Method definition
await def detach_from_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DetachInternetGatewayRequestInternetGatewayDetachFromVpcTypeDef = {  # (1)
    "VpcId": ...,
}

parent.detach_from_vpc(**kwargs)
  1. See DetachInternetGatewayRequestInternetGatewayDetachFromVpcTypeDef

InternetGateway.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

InternetGateway.load method

Calls 🇵🇾meth:EC2.Client.describe_internet_gateways to update the attributes of the InternetGateway resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

InternetGateway.reload method

Calls 🇵🇾meth:EC2.Client.describe_internet_gateways to update the attributes of the InternetGateway resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

KeyPair

Type annotations and code completion for session.resource("ec2").KeyPair class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import KeyPair


async def get_resource() -> KeyPair:
    async with session.resource("ec2") as resource:
        return await resource.KeyPair(...)

KeyPair attributes

  • key_fingerprint: str
  • key_material: str
  • key_name: str
  • key_pair_id: str
  • tags: List[TagTypeDef]
  • name: str

KeyPair methods

KeyPair.delete method

Deletes the specified key pair, by removing the public key from Amazon EC2.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteKeyPairRequestKeyPairDeleteTypeDef = {  # (1)
    "KeyPairId": ...,
}

parent.delete(**kwargs)
  1. See DeleteKeyPairRequestKeyPairDeleteTypeDef

KeyPair.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

KeyPairInfo

Type annotations and code completion for session.resource("ec2").KeyPairInfo class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import KeyPairInfo


async def get_resource() -> KeyPairInfo:
    async with session.resource("ec2") as resource:
        return await resource.KeyPairInfo(...)

KeyPairInfo attributes

  • key_pair_id: str
  • key_fingerprint: str
  • key_name: str
  • key_type: KeyTypeType
  • tags: List[TagTypeDef]
  • public_key: str
  • create_time: datetime
  • name: str

KeyPairInfo methods

KeyPairInfo.delete method

Deletes the specified key pair, by removing the public key from Amazon EC2.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteKeyPairRequestKeyPairInfoDeleteTypeDef = {  # (1)
    "KeyPairId": ...,
}

parent.delete(**kwargs)
  1. See DeleteKeyPairRequestKeyPairInfoDeleteTypeDef

KeyPairInfo.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

KeyPairInfo.load method

Calls 🇵🇾meth:EC2.Client.describe_key_pairs to update the attributes of the KeyPairInfo resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

KeyPairInfo.reload method

Calls 🇵🇾meth:EC2.Client.describe_key_pairs to update the attributes of the KeyPairInfo resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

NetworkAcl

Type annotations and code completion for session.resource("ec2").NetworkAcl class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import NetworkAcl


async def get_resource() -> NetworkAcl:
    async with session.resource("ec2") as resource:
        return await resource.NetworkAcl(...)

NetworkAcl attributes

NetworkAcl methods

NetworkAcl.create_entry method

Creates an entry (a rule) in a network ACL with the specified rule number.

Type annotations and code completion for aioboto3.resource("ec2").create_entry method. boto3 documentation

Method definition
await def create_entry(
    self,
    *,
    Egress: bool,
    Protocol: str,
    RuleAction: RuleActionType,  # (1)
    RuleNumber: int,
    CidrBlock: str = ...,
    DryRun: bool = ...,
    IcmpTypeCode: IcmpTypeCodeTypeDef = ...,  # (2)
    Ipv6CidrBlock: str = ...,
    PortRange: PortRangeTypeDef = ...,  # (3)
) -> None:
    ...
  1. See RuleActionType
  2. See IcmpTypeCodeTypeDef
  3. See PortRangeTypeDef
Usage example with kwargs
kwargs: CreateNetworkAclEntryRequestNetworkAclCreateEntryTypeDef = {  # (1)
    "Egress": ...,
    "Protocol": ...,
    "RuleAction": ...,
    "RuleNumber": ...,
}

parent.create_entry(**kwargs)
  1. See CreateNetworkAclEntryRequestNetworkAclCreateEntryTypeDef

NetworkAcl.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestNetworkAclCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestNetworkAclCreateTagsTypeDef

NetworkAcl.delete method

Deletes the specified network ACL.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteNetworkAclRequestNetworkAclDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteNetworkAclRequestNetworkAclDeleteTypeDef

NetworkAcl.delete_entry method

Deletes the specified ingress or egress entry (rule) from the specified network ACL.

Type annotations and code completion for aioboto3.resource("ec2").delete_entry method. boto3 documentation

Method definition
await def delete_entry(
    self,
    *,
    Egress: bool,
    RuleNumber: int,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteNetworkAclEntryRequestNetworkAclDeleteEntryTypeDef = {  # (1)
    "Egress": ...,
    "RuleNumber": ...,
}

parent.delete_entry(**kwargs)
  1. See DeleteNetworkAclEntryRequestNetworkAclDeleteEntryTypeDef

NetworkAcl.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

NetworkAcl.load method

Calls 🇵🇾meth:EC2.Client.describe_network_acls to update the attributes of the NetworkAcl resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

NetworkAcl.reload method

Calls 🇵🇾meth:EC2.Client.describe_network_acls to update the attributes of the NetworkAcl resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

NetworkAcl.replace_association method

Changes which network ACL a subnet is associated with.

Type annotations and code completion for aioboto3.resource("ec2").replace_association method. boto3 documentation

Method definition
await def replace_association(
    self,
    *,
    AssociationId: str,
    DryRun: bool = ...,
) -> ReplaceNetworkAclAssociationResultTypeDef:  # (1)
    ...
  1. See ReplaceNetworkAclAssociationResultTypeDef
Usage example with kwargs
kwargs: ReplaceNetworkAclAssociationRequestNetworkAclReplaceAssociationTypeDef = {  # (1)
    "AssociationId": ...,
}

parent.replace_association(**kwargs)
  1. See ReplaceNetworkAclAssociationRequestNetworkAclReplaceAssociationTypeDef

NetworkAcl.replace_entry method

Replaces an entry (rule) in a network ACL.

Type annotations and code completion for aioboto3.resource("ec2").replace_entry method. boto3 documentation

Method definition
await def replace_entry(
    self,
    *,
    Egress: bool,
    Protocol: str,
    RuleAction: RuleActionType,  # (1)
    RuleNumber: int,
    CidrBlock: str = ...,
    DryRun: bool = ...,
    IcmpTypeCode: IcmpTypeCodeTypeDef = ...,  # (2)
    Ipv6CidrBlock: str = ...,
    PortRange: PortRangeTypeDef = ...,  # (3)
) -> None:
    ...
  1. See RuleActionType
  2. See IcmpTypeCodeTypeDef
  3. See PortRangeTypeDef
Usage example with kwargs
kwargs: ReplaceNetworkAclEntryRequestNetworkAclReplaceEntryTypeDef = {  # (1)
    "Egress": ...,
    "Protocol": ...,
    "RuleAction": ...,
    "RuleNumber": ...,
}

parent.replace_entry(**kwargs)
  1. See ReplaceNetworkAclEntryRequestNetworkAclReplaceEntryTypeDef

NetworkInterface

Type annotations and code completion for session.resource("ec2").NetworkInterface class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import NetworkInterface


async def get_resource() -> NetworkInterface:
    async with session.resource("ec2") as resource:
        return await resource.NetworkInterface(...)

NetworkInterface attributes

NetworkInterface methods

NetworkInterface.assign_private_ip_addresses method

Assigns one or more secondary private IP addresses to the specified network interface.

Type annotations and code completion for aioboto3.resource("ec2").assign_private_ip_addresses method. boto3 documentation

Method definition
await def assign_private_ip_addresses(
    self,
    *,
    AllowReassignment: bool = ...,
    PrivateIpAddresses: Sequence[str] = ...,
    SecondaryPrivateIpAddressCount: int = ...,
    Ipv4Prefixes: Sequence[str] = ...,
    Ipv4PrefixCount: int = ...,
) -> AssignPrivateIpAddressesResultTypeDef:  # (1)
    ...
  1. See AssignPrivateIpAddressesResultTypeDef
Usage example with kwargs
kwargs: AssignPrivateIpAddressesRequestNetworkInterfaceAssignPrivateIpAddressesTypeDef = {  # (1)
    "AllowReassignment": ...,
}

parent.assign_private_ip_addresses(**kwargs)
  1. See AssignPrivateIpAddressesRequestNetworkInterfaceAssignPrivateIpAddressesTypeDef

NetworkInterface.attach method

Attaches a network interface to an instance.

Type annotations and code completion for aioboto3.resource("ec2").attach method. boto3 documentation

Method definition
await def attach(
    self,
    *,
    DeviceIndex: int,
    InstanceId: str,
    DryRun: bool = ...,
    NetworkCardIndex: int = ...,
) -> AttachNetworkInterfaceResultTypeDef:  # (1)
    ...
  1. See AttachNetworkInterfaceResultTypeDef
Usage example with kwargs
kwargs: AttachNetworkInterfaceRequestNetworkInterfaceAttachTypeDef = {  # (1)
    "DeviceIndex": ...,
    "InstanceId": ...,
}

parent.attach(**kwargs)
  1. See AttachNetworkInterfaceRequestNetworkInterfaceAttachTypeDef

NetworkInterface.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestNetworkInterfaceCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestNetworkInterfaceCreateTagsTypeDef

NetworkInterface.delete method

Deletes the specified network interface.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteNetworkInterfaceRequestNetworkInterfaceDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteNetworkInterfaceRequestNetworkInterfaceDeleteTypeDef

NetworkInterface.describe_attribute method

Describes a network interface attribute.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: NetworkInterfaceAttributeType = ...,  # (1)
    DryRun: bool = ...,
) -> DescribeNetworkInterfaceAttributeResultTypeDef:  # (2)
    ...
  1. See NetworkInterfaceAttributeType
  2. See DescribeNetworkInterfaceAttributeResultTypeDef
Usage example with kwargs
kwargs: DescribeNetworkInterfaceAttributeRequestNetworkInterfaceDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeNetworkInterfaceAttributeRequestNetworkInterfaceDescribeAttributeTypeDef

NetworkInterface.detach method

Detaches a network interface from an instance.

Type annotations and code completion for aioboto3.resource("ec2").detach method. boto3 documentation

Method definition
await def detach(
    self,
    *,
    AttachmentId: str,
    DryRun: bool = ...,
    Force: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DetachNetworkInterfaceRequestNetworkInterfaceDetachTypeDef = {  # (1)
    "AttachmentId": ...,
}

parent.detach(**kwargs)
  1. See DetachNetworkInterfaceRequestNetworkInterfaceDetachTypeDef

NetworkInterface.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

NetworkInterface.load method

Calls 🇵🇾meth:EC2.Client.describe_network_interfaces to update the attributes of the NetworkInterface resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

NetworkInterface.modify_attribute method

Modifies the specified network interface attribute.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    Attachment: NetworkInterfaceAttachmentChangesTypeDef = ...,  # (1)
    Description: AttributeValueTypeDef = ...,  # (2)
    DryRun: bool = ...,
    Groups: Sequence[str] = ...,
    SourceDestCheck: AttributeBooleanValueTypeDef = ...,  # (3)
) -> None:
    ...
  1. See NetworkInterfaceAttachmentChangesTypeDef
  2. See AttributeValueTypeDef
  3. See AttributeBooleanValueTypeDef
Usage example with kwargs
kwargs: ModifyNetworkInterfaceAttributeRequestNetworkInterfaceModifyAttributeTypeDef = {  # (1)
    "Attachment": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifyNetworkInterfaceAttributeRequestNetworkInterfaceModifyAttributeTypeDef

NetworkInterface.reload method

Calls 🇵🇾meth:EC2.Client.describe_network_interfaces to update the attributes of the NetworkInterface resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

NetworkInterface.reset_attribute method

Resets a network interface attribute.

Type annotations and code completion for aioboto3.resource("ec2").reset_attribute method. boto3 documentation

Method definition
await def reset_attribute(
    self,
    *,
    DryRun: bool = ...,
    SourceDestCheck: str = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: ResetNetworkInterfaceAttributeRequestNetworkInterfaceResetAttributeTypeDef = {  # (1)
    "DryRun": ...,
}

parent.reset_attribute(**kwargs)
  1. See ResetNetworkInterfaceAttributeRequestNetworkInterfaceResetAttributeTypeDef

NetworkInterface.unassign_private_ip_addresses method

Unassigns one or more secondary private IP addresses, or IPv4 Prefix Delegation prefixes from a network interface.

Type annotations and code completion for aioboto3.resource("ec2").unassign_private_ip_addresses method. boto3 documentation

Method definition
await def unassign_private_ip_addresses(
    self,
    *,
    PrivateIpAddresses: Sequence[str] = ...,
    Ipv4Prefixes: Sequence[str] = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: UnassignPrivateIpAddressesRequestNetworkInterfaceUnassignPrivateIpAddressesTypeDef = {  # (1)
    "PrivateIpAddresses": ...,
}

parent.unassign_private_ip_addresses(**kwargs)
  1. See UnassignPrivateIpAddressesRequestNetworkInterfaceUnassignPrivateIpAddressesTypeDef

NetworkInterfaceAssociation

Type annotations and code completion for session.resource("ec2").NetworkInterfaceAssociation class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import NetworkInterfaceAssociation


async def get_resource() -> NetworkInterfaceAssociation:
    async with session.resource("ec2") as resource:
        return await resource.NetworkInterfaceAssociation(...)

NetworkInterfaceAssociation attributes

  • carrier_ip: str
  • customer_owned_ip: str
  • ip_owner_id: str
  • public_dns_name: str
  • public_ip: str
  • id: str
  • address: VpcAddress

NetworkInterfaceAssociation methods

NetworkInterfaceAssociation.delete method

Disassociates an Elastic IP address from the instance or network interface it's associated with.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DisassociateAddressRequestNetworkInterfaceAssociationDeleteTypeDef = {  # (1)
    "PublicIp": ...,
}

parent.delete(**kwargs)
  1. See DisassociateAddressRequestNetworkInterfaceAssociationDeleteTypeDef

NetworkInterfaceAssociation.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

NetworkInterfaceAssociation.load method

Calls 🇵🇾meth:EC2.Client.describe_network_interfaces to update the attributes of the NetworkInterfaceAssociation resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

NetworkInterfaceAssociation.reload method

Calls 🇵🇾meth:EC2.Client.describe_network_interfaces to update the attributes of the NetworkInterfaceAssociation resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

PlacementGroup

Type annotations and code completion for session.resource("ec2").PlacementGroup class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import PlacementGroup


async def get_resource() -> PlacementGroup:
    async with session.resource("ec2") as resource:
        return await resource.PlacementGroup(...)

PlacementGroup attributes

PlacementGroup collections

PlacementGroup.instances

Provides access to Instance resource.

Type annotations and code completion for session.resource("ec2").PlacementGroup(...).instances collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import PlacementGroupInstancesCollection,

def get_collection() -> PlacementGroupInstancesCollection:
    resource = session.resource("ec2").PlacementGroup(...)
    return resource.instances

PlacementGroup methods

PlacementGroup.delete method

Deletes the specified placement group.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeletePlacementGroupRequestPlacementGroupDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeletePlacementGroupRequestPlacementGroupDeleteTypeDef

PlacementGroup.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

PlacementGroup.load method

Calls 🇵🇾meth:EC2.Client.describe_placement_groups to update the attributes of the PlacementGroup resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

PlacementGroup.reload method

Calls 🇵🇾meth:EC2.Client.describe_placement_groups to update the attributes of the PlacementGroup resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Route

Type annotations and code completion for session.resource("ec2").Route class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Route


async def get_resource() -> Route:
    async with session.resource("ec2") as resource:
        return await resource.Route(...)

Route attributes

  • destination_ipv6_cidr_block: str
  • destination_prefix_list_id: str
  • egress_only_internet_gateway_id: str
  • gateway_id: str
  • instance_id: str
  • instance_owner_id: str
  • nat_gateway_id: str
  • transit_gateway_id: str
  • local_gateway_id: str
  • carrier_gateway_id: str
  • network_interface_id: str
  • origin: RouteOriginType
  • state: RouteStateType
  • vpc_peering_connection_id: str
  • core_network_arn: str
  • route_table_id: str
  • destination_cidr_block: str

Route methods

Route.RouteTable method

Creates a RouteTable resource.

Type annotations and code completion for aioboto3.resource("ec2").RouteTable method. boto3 documentation

Method definition
await def RouteTable(
    self,
) -> RouteTable:
    ...

Route.delete method

Deletes the specified route from the specified route table.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DestinationIpv6CidrBlock: str = ...,
    DestinationPrefixListId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteRouteRequestRouteDeleteTypeDef = {  # (1)
    "DestinationIpv6CidrBlock": ...,
}

parent.delete(**kwargs)
  1. See DeleteRouteRequestRouteDeleteTypeDef

Route.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Route.replace method

Replaces an existing route within a route table in a VPC.

Type annotations and code completion for aioboto3.resource("ec2").replace method. boto3 documentation

Method definition
await def replace(
    self,
    *,
    DestinationIpv6CidrBlock: str = ...,
    DestinationPrefixListId: str = ...,
    DryRun: bool = ...,
    VpcEndpointId: str = ...,
    EgressOnlyInternetGatewayId: str = ...,
    GatewayId: str = ...,
    InstanceId: str = ...,
    LocalTarget: bool = ...,
    NatGatewayId: str = ...,
    TransitGatewayId: str = ...,
    LocalGatewayId: str = ...,
    CarrierGatewayId: str = ...,
    NetworkInterfaceId: str = ...,
    VpcPeeringConnectionId: str = ...,
    CoreNetworkArn: str = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: ReplaceRouteRequestRouteReplaceTypeDef = {  # (1)
    "DestinationIpv6CidrBlock": ...,
}

parent.replace(**kwargs)
  1. See ReplaceRouteRequestRouteReplaceTypeDef

RouteTable

Type annotations and code completion for session.resource("ec2").RouteTable class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import RouteTable


async def get_resource() -> RouteTable:
    async with session.resource("ec2") as resource:
        return await resource.RouteTable(...)

RouteTable attributes

RouteTable methods

RouteTable.associate_with_subnet method

Associates a subnet in your VPC or an internet gateway or virtual private gateway attached to your VPC with a route table in your VPC.

Type annotations and code completion for aioboto3.resource("ec2").associate_with_subnet method. boto3 documentation

Method definition
await def associate_with_subnet(
    self,
    *,
    DryRun: bool = ...,
    SubnetId: str = ...,
    GatewayId: str = ...,
) -> RouteTableAssociation:
    ...
Usage example with kwargs
kwargs: AssociateRouteTableRequestRouteTableAssociateWithSubnetTypeDef = {  # (1)
    "DryRun": ...,
}

parent.associate_with_subnet(**kwargs)
  1. See AssociateRouteTableRequestRouteTableAssociateWithSubnetTypeDef

RouteTable.create_route method

Creates a route in a route table within a VPC.

Type annotations and code completion for aioboto3.resource("ec2").create_route method. boto3 documentation

Method definition
await def create_route(
    self,
    *,
    DestinationCidrBlock: str = ...,
    DestinationIpv6CidrBlock: str = ...,
    DestinationPrefixListId: str = ...,
    DryRun: bool = ...,
    VpcEndpointId: str = ...,
    EgressOnlyInternetGatewayId: str = ...,
    GatewayId: str = ...,
    InstanceId: str = ...,
    NatGatewayId: str = ...,
    TransitGatewayId: str = ...,
    LocalGatewayId: str = ...,
    CarrierGatewayId: str = ...,
    NetworkInterfaceId: str = ...,
    VpcPeeringConnectionId: str = ...,
    CoreNetworkArn: str = ...,
) -> Route:
    ...
Usage example with kwargs
kwargs: CreateRouteRequestRouteTableCreateRouteTypeDef = {  # (1)
    "DestinationCidrBlock": ...,
}

parent.create_route(**kwargs)
  1. See CreateRouteRequestRouteTableCreateRouteTypeDef

RouteTable.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestRouteTableCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestRouteTableCreateTagsTypeDef

RouteTable.delete method

Deletes the specified route table.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteRouteTableRequestRouteTableDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteRouteTableRequestRouteTableDeleteTypeDef

RouteTable.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

RouteTable.load method

Calls 🇵🇾meth:EC2.Client.describe_route_tables to update the attributes of the RouteTable resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

RouteTable.reload method

Calls 🇵🇾meth:EC2.Client.describe_route_tables to update the attributes of the RouteTable resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

RouteTableAssociation

Type annotations and code completion for session.resource("ec2").RouteTableAssociation class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import RouteTableAssociation


async def get_resource() -> RouteTableAssociation:
    async with session.resource("ec2") as resource:
        return await resource.RouteTableAssociation(...)

RouteTableAssociation attributes

RouteTableAssociation methods

RouteTableAssociation.delete method

Disassociates a subnet or gateway from a route table.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DisassociateRouteTableRequestRouteTableAssociationDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DisassociateRouteTableRequestRouteTableAssociationDeleteTypeDef

RouteTableAssociation.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

RouteTableAssociation.replace_subnet method

Changes the route table associated with a given subnet, internet gateway, or virtual private gateway in a VPC.

Type annotations and code completion for aioboto3.resource("ec2").replace_subnet method. boto3 documentation

Method definition
await def replace_subnet(
    self,
    *,
    RouteTableId: str,
    DryRun: bool = ...,
) -> RouteTableAssociation:
    ...
Usage example with kwargs
kwargs: ReplaceRouteTableAssociationRequestRouteTableAssociationReplaceSubnetTypeDef = {  # (1)
    "RouteTableId": ...,
}

parent.replace_subnet(**kwargs)
  1. See ReplaceRouteTableAssociationRequestRouteTableAssociationReplaceSubnetTypeDef

SecurityGroup

Type annotations and code completion for session.resource("ec2").SecurityGroup class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import SecurityGroup


async def get_resource() -> SecurityGroup:
    async with session.resource("ec2") as resource:
        return await resource.SecurityGroup(...)

SecurityGroup attributes

SecurityGroup methods

SecurityGroup.authorize_egress method

Type annotations and code completion for aioboto3.resource("ec2").authorize_egress method. boto3 documentation

Method definition
await def authorize_egress(
    self,
    *,
    DryRun: bool = ...,
    IpPermissions: Sequence[IpPermissionTypeDef] = ...,  # (1)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
    CidrIp: str = ...,
    FromPort: int = ...,
    IpProtocol: str = ...,
    ToPort: int = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
) -> AuthorizeSecurityGroupEgressResultTypeDef:  # (3)
    ...
  1. See IpPermissionTypeDef
  2. See TagSpecificationTypeDef
  3. See AuthorizeSecurityGroupEgressResultTypeDef
Usage example with kwargs
kwargs: AuthorizeSecurityGroupEgressRequestSecurityGroupAuthorizeEgressTypeDef = {  # (1)
    "DryRun": ...,
}

parent.authorize_egress(**kwargs)
  1. See AuthorizeSecurityGroupEgressRequestSecurityGroupAuthorizeEgressTypeDef

SecurityGroup.authorize_ingress method

Adds the specified inbound (ingress) rules to a security group.

Type annotations and code completion for aioboto3.resource("ec2").authorize_ingress method. boto3 documentation

Method definition
await def authorize_ingress(
    self,
    *,
    CidrIp: str = ...,
    FromPort: int = ...,
    GroupName: str = ...,
    IpPermissions: Sequence[IpPermissionTypeDef] = ...,  # (1)
    IpProtocol: str = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    ToPort: int = ...,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (2)
) -> AuthorizeSecurityGroupIngressResultTypeDef:  # (3)
    ...
  1. See IpPermissionTypeDef
  2. See TagSpecificationTypeDef
  3. See AuthorizeSecurityGroupIngressResultTypeDef
Usage example with kwargs
kwargs: AuthorizeSecurityGroupIngressRequestSecurityGroupAuthorizeIngressTypeDef = {  # (1)
    "CidrIp": ...,
}

parent.authorize_ingress(**kwargs)
  1. See AuthorizeSecurityGroupIngressRequestSecurityGroupAuthorizeIngressTypeDef

SecurityGroup.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestSecurityGroupCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestSecurityGroupCreateTagsTypeDef

SecurityGroup.delete method

Deletes a security group.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    GroupName: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteSecurityGroupRequestSecurityGroupDeleteTypeDef = {  # (1)
    "GroupName": ...,
}

parent.delete(**kwargs)
  1. See DeleteSecurityGroupRequestSecurityGroupDeleteTypeDef

SecurityGroup.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

SecurityGroup.load method

Calls 🇵🇾meth:EC2.Client.describe_security_groups to update the attributes of the SecurityGroup resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

SecurityGroup.reload method

Calls 🇵🇾meth:EC2.Client.describe_security_groups to update the attributes of the SecurityGroup resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

SecurityGroup.revoke_egress method

Type annotations and code completion for aioboto3.resource("ec2").revoke_egress method. boto3 documentation

Method definition
await def revoke_egress(
    self,
    *,
    DryRun: bool = ...,
    IpPermissions: Sequence[IpPermissionTypeDef] = ...,  # (1)
    SecurityGroupRuleIds: Sequence[str] = ...,
    CidrIp: str = ...,
    FromPort: int = ...,
    IpProtocol: str = ...,
    ToPort: int = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
) -> RevokeSecurityGroupEgressResultTypeDef:  # (2)
    ...
  1. See IpPermissionTypeDef
  2. See RevokeSecurityGroupEgressResultTypeDef
Usage example with kwargs
kwargs: RevokeSecurityGroupEgressRequestSecurityGroupRevokeEgressTypeDef = {  # (1)
    "DryRun": ...,
}

parent.revoke_egress(**kwargs)
  1. See RevokeSecurityGroupEgressRequestSecurityGroupRevokeEgressTypeDef

SecurityGroup.revoke_ingress method

Removes the specified inbound (ingress) rules from a security group.

Type annotations and code completion for aioboto3.resource("ec2").revoke_ingress method. boto3 documentation

Method definition
await def revoke_ingress(
    self,
    *,
    CidrIp: str = ...,
    FromPort: int = ...,
    GroupName: str = ...,
    IpPermissions: Sequence[IpPermissionTypeDef] = ...,  # (1)
    IpProtocol: str = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    ToPort: int = ...,
    DryRun: bool = ...,
    SecurityGroupRuleIds: Sequence[str] = ...,
) -> RevokeSecurityGroupIngressResultTypeDef:  # (2)
    ...
  1. See IpPermissionTypeDef
  2. See RevokeSecurityGroupIngressResultTypeDef
Usage example with kwargs
kwargs: RevokeSecurityGroupIngressRequestSecurityGroupRevokeIngressTypeDef = {  # (1)
    "CidrIp": ...,
}

parent.revoke_ingress(**kwargs)
  1. See RevokeSecurityGroupIngressRequestSecurityGroupRevokeIngressTypeDef

Snapshot

Type annotations and code completion for session.resource("ec2").Snapshot class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Snapshot


async def get_resource() -> Snapshot:
    async with session.resource("ec2") as resource:
        return await resource.Snapshot(...)

Snapshot attributes

  • data_encryption_key_id: str
  • description: str
  • encrypted: bool
  • kms_key_id: str
  • owner_id: str
  • progress: str
  • snapshot_id: str
  • start_time: datetime
  • state: SnapshotStateType
  • state_message: str
  • volume_id: str
  • volume_size: int
  • owner_alias: str
  • outpost_arn: str
  • tags: List[TagTypeDef]
  • storage_tier: StorageTierType
  • restore_expiry_time: datetime
  • id: str
  • volume: Volume

Snapshot methods

Snapshot.copy method

Copies a point-in-time snapshot of an EBS volume and stores it in Amazon S3.

Type annotations and code completion for aioboto3.resource("ec2").copy method. boto3 documentation

Method definition
await def copy(
    self,
    *,
    SourceRegion: str,
    Description: str = ...,
    DestinationOutpostArn: str = ...,
    DestinationRegion: str = ...,
    Encrypted: bool = ...,
    KmsKeyId: str = ...,
    PresignedUrl: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> CopySnapshotResultTypeDef:  # (2)
    ...
  1. See TagSpecificationTypeDef
  2. See CopySnapshotResultTypeDef
Usage example with kwargs
kwargs: CopySnapshotRequestSnapshotCopyTypeDef = {  # (1)
    "SourceRegion": ...,
}

parent.copy(**kwargs)
  1. See CopySnapshotRequestSnapshotCopyTypeDef

Snapshot.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestSnapshotCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestSnapshotCreateTagsTypeDef

Snapshot.delete method

Deletes the specified snapshot.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteSnapshotRequestSnapshotDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteSnapshotRequestSnapshotDeleteTypeDef

Snapshot.describe_attribute method

Describes the specified attribute of the specified snapshot.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeSnapshotAttributeResultTypeDef:  # (2)
    ...
  1. See SnapshotAttributeNameType
  2. See DescribeSnapshotAttributeResultTypeDef
Usage example with kwargs
kwargs: DescribeSnapshotAttributeRequestSnapshotDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeSnapshotAttributeRequestSnapshotDescribeAttributeTypeDef

Snapshot.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Snapshot.load method

Calls 🇵🇾meth:EC2.Client.describe_snapshots to update the attributes of the Snapshot resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Snapshot.modify_attribute method

Adds or removes permission settings for the specified snapshot.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType = ...,  # (1)
    CreateVolumePermission: CreateVolumePermissionModificationsTypeDef = ...,  # (2)
    GroupNames: Sequence[str] = ...,
    OperationType: OperationTypeType = ...,  # (3)
    UserIds: Sequence[str] = ...,
    DryRun: bool = ...,
) -> None:
    ...
  1. See SnapshotAttributeNameType
  2. See CreateVolumePermissionModificationsTypeDef
  3. See OperationTypeType
Usage example with kwargs
kwargs: ModifySnapshotAttributeRequestSnapshotModifyAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifySnapshotAttributeRequestSnapshotModifyAttributeTypeDef

Snapshot.reload method

Calls 🇵🇾meth:EC2.Client.describe_snapshots to update the attributes of the Snapshot resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Snapshot.reset_attribute method

Resets permission settings for the specified snapshot.

Type annotations and code completion for aioboto3.resource("ec2").reset_attribute method. boto3 documentation

Method definition
await def reset_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See SnapshotAttributeNameType
Usage example with kwargs
kwargs: ResetSnapshotAttributeRequestSnapshotResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.reset_attribute(**kwargs)
  1. See ResetSnapshotAttributeRequestSnapshotResetAttributeTypeDef

Snapshot.wait_until_completed method

Waits until this Snapshot is completed.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_completed method. boto3 documentation

Method definition
await def wait_until_completed(
    self,
) -> None:
    ...

Subnet

Type annotations and code completion for session.resource("ec2").Subnet class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Subnet


async def get_resource() -> Subnet:
    async with session.resource("ec2") as resource:
        return await resource.Subnet(...)

Subnet attributes

Subnet collections

Subnet.instances

Provides access to Instance resource.

Type annotations and code completion for session.resource("ec2").Subnet(...).instances collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import SubnetInstancesCollection,

def get_collection() -> SubnetInstancesCollection:
    resource = session.resource("ec2").Subnet(...)
    return resource.instances

Subnet.network_interfaces

Provides access to NetworkInterface resource.

Type annotations and code completion for session.resource("ec2").Subnet(...).network_interfaces collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import SubnetNetworkInterfacesCollection,

def get_collection() -> SubnetNetworkInterfacesCollection:
    resource = session.resource("ec2").Subnet(...)
    return resource.network_interfaces

Subnet methods

Subnet.create_instances method

Launches the specified number of instances using an AMI for which you have permissions.

Type annotations and code completion for aioboto3.resource("ec2").create_instances method. boto3 documentation

Method definition
await def create_instances(
    self,
    *,
    MaxCount: int,
    MinCount: int,
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (1)
    ImageId: str = ...,
    InstanceType: InstanceTypeType = ...,  # (2)
    Ipv6AddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (3)
    KernelId: str = ...,
    KeyName: str = ...,
    Monitoring: RunInstancesMonitoringEnabledTypeDef = ...,  # (4)
    Placement: PlacementTypeDef = ...,  # (5)
    RamdiskId: str = ...,
    SecurityGroupIds: Sequence[str] = ...,
    SecurityGroups: Sequence[str] = ...,
    UserData: str = ...,
    AdditionalInfo: str = ...,
    ClientToken: str = ...,
    DisableApiTermination: bool = ...,
    DryRun: bool = ...,
    EbsOptimized: bool = ...,
    IamInstanceProfile: IamInstanceProfileSpecificationTypeDef = ...,  # (6)
    InstanceInitiatedShutdownBehavior: ShutdownBehaviorType = ...,  # (7)
    NetworkInterfaces: Sequence[InstanceNetworkInterfaceSpecificationTypeDef] = ...,  # (8)
    PrivateIpAddress: str = ...,
    ElasticGpuSpecification: Sequence[ElasticGpuSpecificationTypeDef] = ...,  # (9)
    ElasticInferenceAccelerators: Sequence[ElasticInferenceAcceleratorTypeDef] = ...,  # (10)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (11)
    LaunchTemplate: LaunchTemplateSpecificationTypeDef = ...,  # (12)
    InstanceMarketOptions: InstanceMarketOptionsRequestTypeDef = ...,  # (13)
    CreditSpecification: CreditSpecificationRequestTypeDef = ...,  # (14)
    CpuOptions: CpuOptionsRequestTypeDef = ...,  # (15)
    CapacityReservationSpecification: CapacityReservationSpecificationTypeDef = ...,  # (16)
    HibernationOptions: HibernationOptionsRequestTypeDef = ...,  # (17)
    LicenseSpecifications: Sequence[LicenseConfigurationRequestTypeDef] = ...,  # (18)
    MetadataOptions: InstanceMetadataOptionsRequestTypeDef = ...,  # (19)
    EnclaveOptions: EnclaveOptionsRequestTypeDef = ...,  # (20)
    PrivateDnsNameOptions: PrivateDnsNameOptionsRequestTypeDef = ...,  # (21)
    MaintenanceOptions: InstanceMaintenanceOptionsRequestTypeDef = ...,  # (22)
    DisableApiStop: bool = ...,
) -> List[Instance]:
    ...
  1. See BlockDeviceMappingTypeDef
  2. See InstanceTypeType
  3. See InstanceIpv6AddressTypeDef
  4. See RunInstancesMonitoringEnabledTypeDef
  5. See PlacementTypeDef
  6. See IamInstanceProfileSpecificationTypeDef
  7. See ShutdownBehaviorType
  8. See InstanceNetworkInterfaceSpecificationTypeDef
  9. See ElasticGpuSpecificationTypeDef
  10. See ElasticInferenceAcceleratorTypeDef
  11. See TagSpecificationTypeDef
  12. See LaunchTemplateSpecificationTypeDef
  13. See InstanceMarketOptionsRequestTypeDef
  14. See CreditSpecificationRequestTypeDef
  15. See CpuOptionsRequestTypeDef
  16. See CapacityReservationSpecificationTypeDef
  17. See HibernationOptionsRequestTypeDef
  18. See LicenseConfigurationRequestTypeDef
  19. See InstanceMetadataOptionsRequestTypeDef
  20. See EnclaveOptionsRequestTypeDef
  21. See PrivateDnsNameOptionsRequestTypeDef
  22. See InstanceMaintenanceOptionsRequestTypeDef
Usage example with kwargs
kwargs: RunInstancesRequestSubnetCreateInstancesTypeDef = {  # (1)
    "MaxCount": ...,
    "MinCount": ...,
}

parent.create_instances(**kwargs)
  1. See RunInstancesRequestSubnetCreateInstancesTypeDef

Subnet.create_network_interface method

Creates a network interface in the specified subnet.

Type annotations and code completion for aioboto3.resource("ec2").create_network_interface method. boto3 documentation

Method definition
await def create_network_interface(
    self,
    *,
    Description: str = ...,
    DryRun: bool = ...,
    Groups: Sequence[str] = ...,
    Ipv6AddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (1)
    PrivateIpAddress: str = ...,
    PrivateIpAddresses: Sequence[PrivateIpAddressSpecificationTypeDef] = ...,  # (2)
    SecondaryPrivateIpAddressCount: int = ...,
    Ipv4Prefixes: Sequence[Ipv4PrefixSpecificationRequestTypeDef] = ...,  # (3)
    Ipv4PrefixCount: int = ...,
    Ipv6Prefixes: Sequence[Ipv6PrefixSpecificationRequestTypeDef] = ...,  # (4)
    Ipv6PrefixCount: int = ...,
    InterfaceType: NetworkInterfaceCreationTypeType = ...,  # (5)
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (6)
    ClientToken: str = ...,
) -> NetworkInterface:
    ...
  1. See InstanceIpv6AddressTypeDef
  2. See PrivateIpAddressSpecificationTypeDef
  3. See Ipv4PrefixSpecificationRequestTypeDef
  4. See Ipv6PrefixSpecificationRequestTypeDef
  5. See NetworkInterfaceCreationTypeType
  6. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateNetworkInterfaceRequestSubnetCreateNetworkInterfaceTypeDef = {  # (1)
    "Description": ...,
}

parent.create_network_interface(**kwargs)
  1. See CreateNetworkInterfaceRequestSubnetCreateNetworkInterfaceTypeDef

Subnet.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestSubnetCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestSubnetCreateTagsTypeDef

Subnet.delete method

Deletes the specified subnet.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteSubnetRequestSubnetDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteSubnetRequestSubnetDeleteTypeDef

Subnet.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Subnet.load method

Calls 🇵🇾meth:EC2.Client.describe_subnets to update the attributes of the Subnet resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Subnet.reload method

Calls 🇵🇾meth:EC2.Client.describe_subnets to update the attributes of the Subnet resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Tag

Type annotations and code completion for session.resource("ec2").Tag class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Tag


async def get_resource() -> Tag:
    async with session.resource("ec2") as resource:
        return await resource.Tag(...)

Tag attributes

Tag methods

Tag.delete method

Deletes the specified set of tags from the specified set of resources.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteTagsRequestTagDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteTagsRequestTagDeleteTypeDef

Tag.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Tag.load method

Calls 🇵🇾meth:EC2.Client.describe_tags to update the attributes of the Tag resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Tag.reload method

Calls 🇵🇾meth:EC2.Client.describe_tags to update the attributes of the Tag resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Volume

Type annotations and code completion for session.resource("ec2").Volume class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Volume


async def get_resource() -> Volume:
    async with session.resource("ec2") as resource:
        return await resource.Volume(...)

Volume attributes

Volume collections

Volume.snapshots

Provides access to Snapshot resource.

Type annotations and code completion for session.resource("ec2").Volume(...).snapshots collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VolumeSnapshotsCollection,

def get_collection() -> VolumeSnapshotsCollection:
    resource = session.resource("ec2").Volume(...)
    return resource.snapshots

Volume methods

Volume.attach_to_instance method

Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.

Type annotations and code completion for aioboto3.resource("ec2").attach_to_instance method. boto3 documentation

Method definition
await def attach_to_instance(
    self,
    *,
    Device: str,
    InstanceId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseMetadataTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseMetadataTypeDef
Usage example with kwargs
kwargs: AttachVolumeRequestVolumeAttachToInstanceTypeDef = {  # (1)
    "Device": ...,
    "InstanceId": ...,
}

parent.attach_to_instance(**kwargs)
  1. See AttachVolumeRequestVolumeAttachToInstanceTypeDef

Volume.create_snapshot method

Creates a snapshot of an EBS volume and stores it in Amazon S3.

Type annotations and code completion for aioboto3.resource("ec2").create_snapshot method. boto3 documentation

Method definition
await def create_snapshot(
    self,
    *,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> Snapshot:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSnapshotRequestVolumeCreateSnapshotTypeDef = {  # (1)
    "Description": ...,
}

parent.create_snapshot(**kwargs)
  1. See CreateSnapshotRequestVolumeCreateSnapshotTypeDef

Volume.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestVolumeCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestVolumeCreateTagsTypeDef

Volume.delete method

Deletes the specified EBS volume.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteVolumeRequestVolumeDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteVolumeRequestVolumeDeleteTypeDef

Volume.describe_attribute method

Describes the specified attribute of the specified volume.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: VolumeAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVolumeAttributeResultTypeDef:  # (2)
    ...
  1. See VolumeAttributeNameType
  2. See DescribeVolumeAttributeResultTypeDef
Usage example with kwargs
kwargs: DescribeVolumeAttributeRequestVolumeDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeVolumeAttributeRequestVolumeDescribeAttributeTypeDef

Volume.describe_status method

Describes the status of the specified volumes.

Type annotations and code completion for aioboto3.resource("ec2").describe_status method. boto3 documentation

Method definition
await def describe_status(
    self,
    *,
    Filters: Sequence[FilterTypeDef] = ...,  # (1)
    MaxResults: int = ...,
    NextToken: str = ...,
    DryRun: bool = ...,
) -> DescribeVolumeStatusResultTypeDef:  # (2)
    ...
  1. See FilterTypeDef
  2. See DescribeVolumeStatusResultTypeDef
Usage example with kwargs
kwargs: DescribeVolumeStatusRequestVolumeDescribeStatusTypeDef = {  # (1)
    "Filters": ...,
}

parent.describe_status(**kwargs)
  1. See DescribeVolumeStatusRequestVolumeDescribeStatusTypeDef

Volume.detach_from_instance method

Detaches an EBS volume from an instance.

Type annotations and code completion for aioboto3.resource("ec2").detach_from_instance method. boto3 documentation

Method definition
await def detach_from_instance(
    self,
    *,
    Device: str = ...,
    Force: bool = ...,
    InstanceId: str = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseMetadataTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseMetadataTypeDef
Usage example with kwargs
kwargs: DetachVolumeRequestVolumeDetachFromInstanceTypeDef = {  # (1)
    "Device": ...,
}

parent.detach_from_instance(**kwargs)
  1. See DetachVolumeRequestVolumeDetachFromInstanceTypeDef

Volume.enable_io method

Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially inconsistent.

Type annotations and code completion for aioboto3.resource("ec2").enable_io method. boto3 documentation

Method definition
await def enable_io(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: EnableVolumeIORequestVolumeEnableIoTypeDef = {  # (1)
    "DryRun": ...,
}

parent.enable_io(**kwargs)
  1. See EnableVolumeIORequestVolumeEnableIoTypeDef

Volume.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Volume.load method

Calls 🇵🇾meth:EC2.Client.describe_volumes to update the attributes of the Volume resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Volume.modify_attribute method

Modifies a volume attribute.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    AutoEnableIO: AttributeBooleanValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See AttributeBooleanValueTypeDef
Usage example with kwargs
kwargs: ModifyVolumeAttributeRequestVolumeModifyAttributeTypeDef = {  # (1)
    "AutoEnableIO": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifyVolumeAttributeRequestVolumeModifyAttributeTypeDef

Volume.reload method

Calls 🇵🇾meth:EC2.Client.describe_volumes to update the attributes of the Volume resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Vpc

Type annotations and code completion for session.resource("ec2").Vpc class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import Vpc


async def get_resource() -> Vpc:
    async with session.resource("ec2") as resource:
        return await resource.Vpc(...)

Vpc attributes

Vpc collections

Vpc.accepted_vpc_peering_connections

Provides access to VpcPeeringConnection resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).accepted_vpc_peering_connections collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcAcceptedVpcPeeringConnectionsCollection,

def get_collection() -> VpcAcceptedVpcPeeringConnectionsCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.accepted_vpc_peering_connections

Vpc.instances

Provides access to Instance resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).instances collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcInstancesCollection,

def get_collection() -> VpcInstancesCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.instances

Vpc.internet_gateways

Provides access to InternetGateway resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).internet_gateways collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcInternetGatewaysCollection,

def get_collection() -> VpcInternetGatewaysCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.internet_gateways

Vpc.network_acls

Provides access to NetworkAcl resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).network_acls collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcNetworkAclsCollection,

def get_collection() -> VpcNetworkAclsCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.network_acls

Vpc.network_interfaces

Provides access to NetworkInterface resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).network_interfaces collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcNetworkInterfacesCollection,

def get_collection() -> VpcNetworkInterfacesCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.network_interfaces

Vpc.requested_vpc_peering_connections

Provides access to VpcPeeringConnection resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).requested_vpc_peering_connections collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcRequestedVpcPeeringConnectionsCollection,

def get_collection() -> VpcRequestedVpcPeeringConnectionsCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.requested_vpc_peering_connections

Vpc.route_tables

Provides access to RouteTable resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).route_tables collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcRouteTablesCollection,

def get_collection() -> VpcRouteTablesCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.route_tables

Vpc.security_groups

Provides access to SecurityGroup resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).security_groups collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcSecurityGroupsCollection,

def get_collection() -> VpcSecurityGroupsCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.security_groups

Vpc.subnets

Provides access to Subnet resource.

Type annotations and code completion for session.resource("ec2").Vpc(...).subnets collection. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcSubnetsCollection,

def get_collection() -> VpcSubnetsCollection:
    resource = session.resource("ec2").Vpc(...)
    return resource.subnets

Vpc methods

Vpc.associate_dhcp_options method

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 aioboto3.resource("ec2").associate_dhcp_options method. boto3 documentation

Method definition
await def associate_dhcp_options(
    self,
    *,
    DhcpOptionsId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: AssociateDhcpOptionsRequestVpcAssociateDhcpOptionsTypeDef = {  # (1)
    "DhcpOptionsId": ...,
}

parent.associate_dhcp_options(**kwargs)
  1. See AssociateDhcpOptionsRequestVpcAssociateDhcpOptionsTypeDef

.

Type annotations and code completion for aioboto3.resource("ec2").attach_classic_link_instance method. boto3 documentation

Method definition
await def attach_classic_link_instance(
    self,
    *,
    Groups: Sequence[str],
    InstanceId: str,
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See AttachClassicLinkVpcResultTypeDef
Usage example with kwargs
kwargs: AttachClassicLinkVpcRequestVpcAttachClassicLinkInstanceTypeDef = {  # (1)
    "Groups": ...,
    "InstanceId": ...,
}

parent.attach_classic_link_instance(**kwargs)
  1. See AttachClassicLinkVpcRequestVpcAttachClassicLinkInstanceTypeDef

Vpc.attach_internet_gateway method

Attaches an internet gateway or a virtual private gateway to a VPC, enabling connectivity between the internet and the VPC.

Type annotations and code completion for aioboto3.resource("ec2").attach_internet_gateway method. boto3 documentation

Method definition
await def attach_internet_gateway(
    self,
    *,
    InternetGatewayId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: AttachInternetGatewayRequestVpcAttachInternetGatewayTypeDef = {  # (1)
    "InternetGatewayId": ...,
}

parent.attach_internet_gateway(**kwargs)
  1. See AttachInternetGatewayRequestVpcAttachInternetGatewayTypeDef

Vpc.create_network_acl method

Creates a network ACL in a VPC.

Type annotations and code completion for aioboto3.resource("ec2").create_network_acl method. boto3 documentation

Method definition
await def create_network_acl(
    self,
    *,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> NetworkAcl:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateNetworkAclRequestVpcCreateNetworkAclTypeDef = {  # (1)
    "DryRun": ...,
}

parent.create_network_acl(**kwargs)
  1. See CreateNetworkAclRequestVpcCreateNetworkAclTypeDef

Vpc.create_route_table method

Creates a route table for the specified VPC.

Type annotations and code completion for aioboto3.resource("ec2").create_route_table method. boto3 documentation

Method definition
await def create_route_table(
    self,
    *,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> RouteTable:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateRouteTableRequestVpcCreateRouteTableTypeDef = {  # (1)
    "DryRun": ...,
}

parent.create_route_table(**kwargs)
  1. See CreateRouteTableRequestVpcCreateRouteTableTypeDef

Vpc.create_security_group method

Creates a security group.

Type annotations and code completion for aioboto3.resource("ec2").create_security_group method. boto3 documentation

Method definition
await def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> SecurityGroup:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSecurityGroupRequestVpcCreateSecurityGroupTypeDef = {  # (1)
    "Description": ...,
    "GroupName": ...,
}

parent.create_security_group(**kwargs)
  1. See CreateSecurityGroupRequestVpcCreateSecurityGroupTypeDef

Vpc.create_subnet method

Creates a subnet in a specified VPC.

Type annotations and code completion for aioboto3.resource("ec2").create_subnet method. boto3 documentation

Method definition
await def create_subnet(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    AvailabilityZone: str = ...,
    AvailabilityZoneId: str = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    OutpostArn: str = ...,
    DryRun: bool = ...,
    Ipv6Native: bool = ...,
) -> Subnet:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateSubnetRequestVpcCreateSubnetTypeDef = {  # (1)
    "TagSpecifications": ...,
}

parent.create_subnet(**kwargs)
  1. See CreateSubnetRequestVpcCreateSubnetTypeDef

Vpc.create_tags method

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.

Type annotations and code completion for aioboto3.resource("ec2").create_tags method. boto3 documentation

Method definition
await def create_tags(
    self,
    *,
    Tags: Optional[Sequence[TagTypeDef]],  # (1)
    DryRun: bool = ...,
) -> Tag:
    ...
  1. See TagTypeDef
Usage example with kwargs
kwargs: CreateTagsRequestVpcCreateTagsTypeDef = {  # (1)
    "Tags": ...,
}

parent.create_tags(**kwargs)
  1. See CreateTagsRequestVpcCreateTagsTypeDef

Vpc.delete method

Deletes the specified VPC.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DeleteVpcRequestVpcDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteVpcRequestVpcDeleteTypeDef

Vpc.describe_attribute method

Describes the specified attribute of the specified VPC.

Type annotations and code completion for aioboto3.resource("ec2").describe_attribute method. boto3 documentation

Method definition
await def describe_attribute(
    self,
    *,
    Attribute: VpcAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVpcAttributeResultTypeDef:  # (2)
    ...
  1. See VpcAttributeNameType
  2. See DescribeVpcAttributeResultTypeDef
Usage example with kwargs
kwargs: DescribeVpcAttributeRequestVpcDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

parent.describe_attribute(**kwargs)
  1. See DescribeVpcAttributeRequestVpcDescribeAttributeTypeDef

.

Type annotations and code completion for aioboto3.resource("ec2").detach_classic_link_instance method. boto3 documentation

Method definition
await def detach_classic_link_instance(
    self,
    *,
    InstanceId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See DetachClassicLinkVpcResultTypeDef
Usage example with kwargs
kwargs: DetachClassicLinkVpcRequestVpcDetachClassicLinkInstanceTypeDef = {  # (1)
    "InstanceId": ...,
}

parent.detach_classic_link_instance(**kwargs)
  1. See DetachClassicLinkVpcRequestVpcDetachClassicLinkInstanceTypeDef

Vpc.detach_internet_gateway method

Detaches an internet gateway from a VPC, disabling connectivity between the internet and the VPC.

Type annotations and code completion for aioboto3.resource("ec2").detach_internet_gateway method. boto3 documentation

Method definition
await def detach_internet_gateway(
    self,
    *,
    InternetGatewayId: str,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: DetachInternetGatewayRequestVpcDetachInternetGatewayTypeDef = {  # (1)
    "InternetGatewayId": ...,
}

parent.detach_internet_gateway(**kwargs)
  1. See DetachInternetGatewayRequestVpcDetachInternetGatewayTypeDef

Disables ClassicLink for a VPC.

Type annotations and code completion for aioboto3.resource("ec2").disable_classic_link method. boto3 documentation

Method definition
await def disable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> DisableVpcClassicLinkResultTypeDef:  # (1)
    ...
  1. See DisableVpcClassicLinkResultTypeDef
Usage example with kwargs
kwargs: DisableVpcClassicLinkRequestVpcDisableClassicLinkTypeDef = {  # (1)
    "DryRun": ...,
}

parent.disable_classic_link(**kwargs)
  1. See DisableVpcClassicLinkRequestVpcDisableClassicLinkTypeDef

.

Type annotations and code completion for aioboto3.resource("ec2").enable_classic_link method. boto3 documentation

Method definition
await def enable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> EnableVpcClassicLinkResultTypeDef:  # (1)
    ...
  1. See EnableVpcClassicLinkResultTypeDef
Usage example with kwargs
kwargs: EnableVpcClassicLinkRequestVpcEnableClassicLinkTypeDef = {  # (1)
    "DryRun": ...,
}

parent.enable_classic_link(**kwargs)
  1. See EnableVpcClassicLinkRequestVpcEnableClassicLinkTypeDef

Vpc.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Vpc.load method

Calls 🇵🇾meth:EC2.Client.describe_vpcs to update the attributes of the Vpc resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

Vpc.modify_attribute method

Modifies the specified attribute of the specified VPC.

Type annotations and code completion for aioboto3.resource("ec2").modify_attribute method. boto3 documentation

Method definition
await def modify_attribute(
    self,
    *,
    EnableDnsHostnames: AttributeBooleanValueTypeDef = ...,  # (1)
    EnableDnsSupport: AttributeBooleanValueTypeDef = ...,  # (1)
) -> None:
    ...
  1. See AttributeBooleanValueTypeDef
  2. See AttributeBooleanValueTypeDef
Usage example with kwargs
kwargs: ModifyVpcAttributeRequestVpcModifyAttributeTypeDef = {  # (1)
    "EnableDnsHostnames": ...,
}

parent.modify_attribute(**kwargs)
  1. See ModifyVpcAttributeRequestVpcModifyAttributeTypeDef

Vpc.reload method

Calls 🇵🇾meth:EC2.Client.describe_vpcs to update the attributes of the Vpc resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

Vpc.request_vpc_peering_connection method

Requests a VPC peering connection between two VPCs: a requester VPC that you own and an accepter VPC with which to create the connection.

Type annotations and code completion for aioboto3.resource("ec2").request_vpc_peering_connection method. boto3 documentation

Method definition
await def request_vpc_peering_connection(
    self,
    *,
    DryRun: bool = ...,
    PeerOwnerId: str = ...,
    PeerVpcId: str = ...,
    PeerRegion: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> VpcPeeringConnection:
    ...
  1. See TagSpecificationTypeDef
Usage example with kwargs
kwargs: CreateVpcPeeringConnectionRequestVpcRequestVpcPeeringConnectionTypeDef = {  # (1)
    "DryRun": ...,
}

parent.request_vpc_peering_connection(**kwargs)
  1. See CreateVpcPeeringConnectionRequestVpcRequestVpcPeeringConnectionTypeDef

Vpc.wait_until_available method

Waits until this Vpc is available.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_available method. boto3 documentation

Method definition
await def wait_until_available(
    self,
) -> None:
    ...

Vpc.wait_until_exists method

Waits until this Vpc is exists.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_exists method. boto3 documentation

Method definition
await def wait_until_exists(
    self,
) -> None:
    ...

VpcPeeringConnection

Type annotations and code completion for session.resource("ec2").VpcPeeringConnection class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcPeeringConnection


async def get_resource() -> VpcPeeringConnection:
    async with session.resource("ec2") as resource:
        return await resource.VpcPeeringConnection(...)

VpcPeeringConnection attributes

VpcPeeringConnection methods

VpcPeeringConnection.accept method

Accept a VPC peering connection request.

Type annotations and code completion for aioboto3.resource("ec2").accept method. boto3 documentation

Method definition
await def accept(
    self,
    *,
    DryRun: bool = ...,
) -> AcceptVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See AcceptVpcPeeringConnectionResultTypeDef
Usage example with kwargs
kwargs: AcceptVpcPeeringConnectionRequestVpcPeeringConnectionAcceptTypeDef = {  # (1)
    "DryRun": ...,
}

parent.accept(**kwargs)
  1. See AcceptVpcPeeringConnectionRequestVpcPeeringConnectionAcceptTypeDef

VpcPeeringConnection.delete method

Deletes a VPC peering connection.

Type annotations and code completion for aioboto3.resource("ec2").delete method. boto3 documentation

Method definition
await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> DeleteVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See DeleteVpcPeeringConnectionResultTypeDef
Usage example with kwargs
kwargs: DeleteVpcPeeringConnectionRequestVpcPeeringConnectionDeleteTypeDef = {  # (1)
    "DryRun": ...,
}

parent.delete(**kwargs)
  1. See DeleteVpcPeeringConnectionRequestVpcPeeringConnectionDeleteTypeDef

VpcPeeringConnection.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

VpcPeeringConnection.load method

Calls 🇵🇾meth:EC2.Client.describe_vpc_peering_connections to update the attributes of the VpcPeeringConnection resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

VpcPeeringConnection.reject method

Rejects a VPC peering connection request.

Type annotations and code completion for aioboto3.resource("ec2").reject method. boto3 documentation

Method definition
await def reject(
    self,
    *,
    DryRun: bool = ...,
) -> RejectVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See RejectVpcPeeringConnectionResultTypeDef
Usage example with kwargs
kwargs: RejectVpcPeeringConnectionRequestVpcPeeringConnectionRejectTypeDef = {  # (1)
    "DryRun": ...,
}

parent.reject(**kwargs)
  1. See RejectVpcPeeringConnectionRequestVpcPeeringConnectionRejectTypeDef

VpcPeeringConnection.reload method

Calls 🇵🇾meth:EC2.Client.describe_vpc_peering_connections to update the attributes of the VpcPeeringConnection resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...

VpcPeeringConnection.wait_until_exists method

Waits until this VpcPeeringConnection is exists.

Type annotations and code completion for aioboto3.resource("ec2").wait_until_exists method. boto3 documentation

Method definition
await def wait_until_exists(
    self,
) -> None:
    ...

VpcAddress

Type annotations and code completion for session.resource("ec2").VpcAddress class. boto3 documentation

Usage example
from types_aiobotocore_ec2.service_resource import VpcAddress


async def get_resource() -> VpcAddress:
    async with session.resource("ec2") as resource:
        return await resource.VpcAddress(...)

VpcAddress attributes

  • instance_id: str
  • public_ip: str
  • association_id: str
  • domain: DomainTypeType
  • network_interface_id: str
  • network_interface_owner_id: str
  • private_ip_address: str
  • tags: List[TagTypeDef]
  • public_ipv4_pool: str
  • network_border_group: str
  • customer_owned_ip: str
  • customer_owned_ipv4_pool: str
  • carrier_ip: str
  • allocation_id: str
  • association: NetworkInterfaceAssociation

VpcAddress methods

VpcAddress.associate method

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 aioboto3.resource("ec2").associate method. boto3 documentation

Method definition
await def associate(
    self,
    *,
    InstanceId: str = ...,
    PublicIp: str = ...,
    AllowReassociation: bool = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...
  1. See AssociateAddressResultTypeDef
Usage example with kwargs
kwargs: AssociateAddressRequestVpcAddressAssociateTypeDef = {  # (1)
    "InstanceId": ...,
}

parent.associate(**kwargs)
  1. See AssociateAddressRequestVpcAddressAssociateTypeDef

VpcAddress.get_available_subresources method

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for aioboto3.resource("ec2").get_available_subresources method. boto3 documentation

Method definition
await def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

VpcAddress.load method

Calls 🇵🇾meth:EC2.Client.describe_addresses to update the attributes of the VpcAddress resource.

Type annotations and code completion for aioboto3.resource("ec2").load method. boto3 documentation

Method definition
await def load(
    self,
) -> None:
    ...

VpcAddress.release method

Releases the specified Elastic IP address.

Type annotations and code completion for aioboto3.resource("ec2").release method. boto3 documentation

Method definition
await def release(
    self,
    *,
    AllocationId: str = ...,
    PublicIp: str = ...,
    NetworkBorderGroup: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
Usage example with kwargs
kwargs: ReleaseAddressRequestVpcAddressReleaseTypeDef = {  # (1)
    "AllocationId": ...,
}

parent.release(**kwargs)
  1. See ReleaseAddressRequestVpcAddressReleaseTypeDef

VpcAddress.reload method

Calls 🇵🇾meth:EC2.Client.describe_addresses to update the attributes of the VpcAddress resource.

Type annotations and code completion for aioboto3.resource("ec2").reload method. boto3 documentation

Method definition
await def reload(
    self,
) -> None:
    ...