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

# EC2ServiceResource usage example

from types_aiobotocore_ec2.service_resource import EC2ServiceResource

def get_ec2_resource() -> EC2ServiceResource:
    return session.resource("ec2")

Attributes#

Collections#

ServiceResourceClassicAddressesCollection#

Provides access to ClassicAddress resource.

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

# ServiceResourceClassicAddressesCollection 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

# ServiceResourceDhcpOptionsSetsCollection 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

# ServiceResourceImagesCollection 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

# ServiceResourceInstancesCollection 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

# ServiceResourceInternetGatewaysCollection 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

# ServiceResourceKeyPairsCollection 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

# ServiceResourceNetworkAclsCollection 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

# ServiceResourceNetworkInterfacesCollection 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

# ServiceResourcePlacementGroupsCollection 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

# ServiceResourceRouteTablesCollection 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

# ServiceResourceSecurityGroupsCollection 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

# ServiceResourceSnapshotsCollection 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

# ServiceResourceSubnetsCollection 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

# ServiceResourceVolumesCollection 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

# ServiceResourceVpcAddressesCollection 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

# ServiceResourceVpcPeeringConnectionsCollection 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

# ServiceResourceVpcsCollection 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

# ClassicAddress method definition

await def ClassicAddress(
    self,
    public_ip: str,
) -> ClassicAddress:
    ...

EC2ServiceResource.DhcpOptions method#

Creates a DhcpOptions resource.

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

# DhcpOptions method definition

await def DhcpOptions(
    self,
    id: str,
) -> DhcpOptions:
    ...

EC2ServiceResource.Image method#

Creates a Image resource.

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

# Image method definition

await def Image(
    self,
    id: str,
) -> Image:
    ...

EC2ServiceResource.Instance method#

Creates a Instance resource.

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

# Instance method definition

await def Instance(
    self,
    id: str,
) -> Instance:
    ...

EC2ServiceResource.InternetGateway method#

Creates a InternetGateway resource.

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

# InternetGateway method definition

await def InternetGateway(
    self,
    id: str,
) -> InternetGateway:
    ...

EC2ServiceResource.KeyPair method#

Creates a KeyPairInfo resource.

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

# KeyPair method definition

await def KeyPair(
    self,
    name: str,
) -> KeyPair:
    ...

EC2ServiceResource.NetworkAcl method#

Creates a NetworkAcl resource.

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

# NetworkAcl method definition

await def NetworkAcl(
    self,
    id: str,
) -> NetworkAcl:
    ...

EC2ServiceResource.NetworkInterface method#

Creates a NetworkInterface resource.

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

# NetworkInterface method definition

await def NetworkInterface(
    self,
    id: str,
) -> NetworkInterface:
    ...

EC2ServiceResource.NetworkInterfaceAssociation method#

Creates a NetworkInterfaceAssociation resource.

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

# NetworkInterfaceAssociation method definition

await def NetworkInterfaceAssociation(
    self,
    id: str,
) -> NetworkInterfaceAssociation:
    ...

EC2ServiceResource.PlacementGroup method#

Creates a PlacementGroup resource.

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

# PlacementGroup method definition

await def PlacementGroup(
    self,
    name: str,
) -> PlacementGroup:
    ...

EC2ServiceResource.Route method#

Creates a Route resource.

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

# Route method definition

await def Route(
    self,
    route_table_id: str,
    destination_cidr_block: str,
) -> Route:
    ...

EC2ServiceResource.RouteTable method#

Creates a RouteTable resource.

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

# RouteTable method definition

await def RouteTable(
    self,
    id: str,
) -> RouteTable:
    ...

EC2ServiceResource.RouteTableAssociation method#

Creates a RouteTableAssociation resource.

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

# RouteTableAssociation method definition

await def RouteTableAssociation(
    self,
    id: str,
) -> RouteTableAssociation:
    ...

EC2ServiceResource.SecurityGroup method#

Creates a SecurityGroup resource.

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

# SecurityGroup method definition

await def SecurityGroup(
    self,
    id: str,
) -> SecurityGroup:
    ...

EC2ServiceResource.Snapshot method#

Creates a Snapshot resource.

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

# Snapshot method definition

await def Snapshot(
    self,
    id: str,
) -> Snapshot:
    ...

EC2ServiceResource.Subnet method#

Creates a Subnet resource.

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

# Subnet method definition

await def Subnet(
    self,
    id: str,
) -> Subnet:
    ...

EC2ServiceResource.Tag method#

Creates a Tag resource.

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

# Tag method definition

await def Tag(
    self,
    resource_id: str,
    key: str,
    value: str,
) -> Tag:
    ...

EC2ServiceResource.Volume method#

Creates a Volume resource.

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

# Volume method definition

await def Volume(
    self,
    id: str,
) -> Volume:
    ...

EC2ServiceResource.Vpc method#

Creates a Vpc resource.

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

# Vpc method definition

await def Vpc(
    self,
    id: str,
) -> Vpc:
    ...

EC2ServiceResource.VpcAddress method#

Creates a VpcAddress resource.

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

# VpcAddress method definition

await def VpcAddress(
    self,
    allocation_id: str,
) -> VpcAddress:
    ...

EC2ServiceResource.VpcPeeringConnection method#

Creates a VpcPeeringConnection resource.

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

# VpcPeeringConnection method definition

await def VpcPeeringConnection(
    self,
    id: str,
) -> VpcPeeringConnection:
    ...

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

# create_dhcp_options 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
# create_dhcp_options method usage example with argument unpacking

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

# create_instances 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[InstanceNetworkInterfaceSpecificationServiceResourceTypeDef] = ...,  # (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 = ...,
    EnablePrimaryIpv6: 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 InstanceNetworkInterfaceSpecificationServiceResourceTypeDef
  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
# create_instances method usage example with argument unpacking

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

# create_internet_gateway method definition

await def create_internet_gateway(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> InternetGateway:
    ...
  1. See TagSpecificationTypeDef
# create_internet_gateway method usage example with argument unpacking

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

# create_key_pair 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
# create_key_pair method usage example with argument unpacking

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

# create_network_acl method definition

await def create_network_acl(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> NetworkAcl:
    ...
  1. See TagSpecificationTypeDef
# create_network_acl method usage example with argument unpacking

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

# create_network_interface 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 = ...,
    EnablePrimaryIpv6: bool = ...,
) -> NetworkInterface:
    ...
  1. See InstanceIpv6AddressTypeDef
  2. See PrivateIpAddressSpecificationTypeDef
  3. See Ipv4PrefixSpecificationRequestTypeDef
  4. See Ipv6PrefixSpecificationRequestTypeDef
  5. See NetworkInterfaceCreationTypeType
  6. See TagSpecificationTypeDef
# create_network_interface method usage example with argument unpacking

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

# create_placement_group 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
# create_placement_group method usage example with argument unpacking

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

# create_route_table method definition

await def create_route_table(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> RouteTable:
    ...
  1. See TagSpecificationTypeDef
# create_route_table method usage example with argument unpacking

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

# create_security_group method definition

await def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    VpcId: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> SecurityGroup:
    ...
  1. See TagSpecificationTypeDef
# create_security_group method usage example with argument unpacking

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

# create_snapshot method definition

await def create_snapshot(
    self,
    *,
    VolumeId: str,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> Snapshot:
    ...
  1. See TagSpecificationTypeDef
# create_snapshot method usage example with argument unpacking

kwargs: CreateSnapshotRequestServiceResourceCreateSnapshotTypeDef = {  # (1)
    "VolumeId": ...,
}

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

EC2ServiceResource.create_subnet method#

Creates a subnet in the specified VPC.

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

# create_subnet 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
# create_subnet method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Resources: Sequence[str],
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

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

# create_volume 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
# create_volume method usage example with argument unpacking

kwargs: CreateVolumeRequestServiceResourceCreateVolumeTypeDef = {  # (1)
    "AvailabilityZone": ...,
}

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

EC2ServiceResource.create_vpc method#

Creates a VPC with the specified CIDR blocks.

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

# create_vpc 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
# create_vpc method usage example with argument unpacking

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

# create_vpc_peering_connection method definition

await def create_vpc_peering_connection(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
    PeerOwnerId: str = ...,
    PeerVpcId: str = ...,
    PeerRegion: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> VpcPeeringConnection:
    ...
  1. See TagSpecificationTypeDef
# create_vpc_peering_connection method usage example with argument unpacking

kwargs: CreateVpcPeeringConnectionRequestServiceResourceCreateVpcPeeringConnectionTypeDef = {  # (1)
    "VpcId": ...,
}

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

# disassociate_route_table method definition

await def disassociate_route_table(
    self,
    *,
    AssociationId: str,
    DryRun: bool = ...,
) -> None:
    ...
# disassociate_route_table method usage example with argument unpacking

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

# get_available_subresources 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

# import_key_pair 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
# import_key_pair method usage example with argument unpacking

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

# register_image 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 = ...,
    ImdsSupport: ImdsSupportValuesType = ...,  # (5)
) -> Image:
    ...
  1. See ArchitectureValuesType
  2. See BlockDeviceMappingTypeDef
  3. See BootModeValuesType
  4. See TpmSupportValuesType
  5. See ImdsSupportValuesType
# register_image method usage example with argument unpacking

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

# ClassicAddress usage example

from types_aiobotocore_ec2.service_resource import ClassicAddress

def get_resource() -> ClassicAddress:
    return session.resource("ec2").ClassicAddress(...)

ClassicAddress attributes#

  • instance_id: Awaitable[str]
  • allocation_id: Awaitable[str]
  • association_id: Awaitable[str]
  • domain: Awaitable[DomainTypeType]
  • network_interface_id: Awaitable[str]
  • network_interface_owner_id: Awaitable[str]
  • private_ip_address: Awaitable[str]
  • tags: Awaitable[List[TagTypeDef]]
  • public_ipv4_pool: Awaitable[str]
  • network_border_group: Awaitable[str]
  • customer_owned_ip: Awaitable[str]
  • customer_owned_ipv4_pool: Awaitable[str]
  • carrier_ip: Awaitable[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 aiobotocore.resource("ec2").associate method. boto3 documentation

# associate method definition

await def associate(
    self,
    *,
    AllocationId: str = ...,
    InstanceId: str = ...,
    AllowReassociation: bool = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...
  1. See AssociateAddressResultTypeDef
# associate method usage example with argument unpacking

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

# disassociate method definition

await def disassociate(
    self,
    *,
    AssociationId: str = ...,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# disassociate method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load method definition

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

ClassicAddress.release method#

Releases the specified Elastic IP address.

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

# release method definition

await def release(
    self,
    *,
    AllocationId: str = ...,
    PublicIp: str = ...,
    NetworkBorderGroup: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# release method usage example with argument unpacking

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

# reload method definition

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

DhcpOptions#

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

# DhcpOptions usage example

from types_aiobotocore_ec2.service_resource import DhcpOptions

def get_resource() -> DhcpOptions:
    return session.resource("ec2").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 aiobotocore.resource("ec2").associate_with_vpc method. boto3 documentation

# associate_with_vpc method definition

await def associate_with_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
# associate_with_vpc method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

DhcpOptions.delete method#

Deletes the specified set of DHCP options.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

Image#

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

# Image usage example

from types_aiobotocore_ec2.service_resource import Image

def get_resource() -> Image:
    return session.resource("ec2").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 aiobotocore.resource("ec2").create_tags method. boto3 documentation

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Image.deregister method#

Deregisters the specified AMI.

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

# deregister method definition

await def deregister(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# deregister method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: ImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> ImageAttributeTypeDef:  # (2)
    ...
  1. See ImageAttributeNameType
  2. See ImageAttributeTypeDef
# describe_attribute method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").modify_attribute method. boto3 documentation

# modify_attribute 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] = ...,
    ImdsSupport: AttributeValueTypeDef = ...,  # (1)
) -> None:
    ...
  1. See AttributeValueTypeDef
  2. See LaunchPermissionModificationsTypeDef
  3. See OperationTypeType
  4. See AttributeValueTypeDef
# modify_attribute method usage example with argument unpacking

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

# reload 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 aiobotocore.resource("ec2").reset_attribute method. boto3 documentation

# reset_attribute method definition

await def reset_attribute(
    self,
    *,
    Attribute: ResetImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See ResetImageAttributeNameType
# reset_attribute method usage example with argument unpacking

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

# wait_until_exists method definition

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

Instance#

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

# Instance usage example

from types_aiobotocore_ec2.service_resource import Instance

def get_resource() -> Instance:
    return session.resource("ec2").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

# InstanceVolumesCollection 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

# InstanceVpcAddressesCollection 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 aiobotocore.resource("ec2").attach_classic_link_vpc method. boto3 documentation

# attach_classic_link_vpc method definition

await def attach_classic_link_vpc(
    self,
    *,
    Groups: Sequence[str],
    VpcId: str,
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See AttachClassicLinkVpcResultTypeDef
# attach_classic_link_vpc method usage example with argument unpacking

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

# attach_volume method definition

await def attach_volume(
    self,
    *,
    Device: str,
    VolumeId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentTypeDef:  # (1)
    ...
  1. See VolumeAttachmentTypeDef
# attach_volume method usage example with argument unpacking

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

# console_output method definition

await def console_output(
    self,
    *,
    DryRun: bool = ...,
    Latest: bool = ...,
) -> GetConsoleOutputResultTypeDef:  # (1)
    ...
  1. See GetConsoleOutputResultTypeDef
# console_output method usage example with argument unpacking

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

# create_image 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
# create_image method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: InstanceCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Instance.delete_tags method#

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

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

# delete_tags method definition

await def delete_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# delete_tags method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> InstanceAttributeTypeDef:  # (2)
    ...
  1. See InstanceAttributeNameType
  2. See InstanceAttributeTypeDef
# describe_attribute method usage example with argument unpacking

kwargs: DescribeInstanceAttributeRequestInstanceDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

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

.

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

# detach_classic_link_vpc method definition

await def detach_classic_link_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See DetachClassicLinkVpcResultTypeDef
# detach_classic_link_vpc method usage example with argument unpacking

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

# detach_volume method definition

await def detach_volume(
    self,
    *,
    VolumeId: str,
    Device: str = ...,
    Force: bool = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentTypeDef:  # (1)
    ...
  1. See VolumeAttachmentTypeDef
# detach_volume method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").modify_attribute method. boto3 documentation

# modify_attribute 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
# modify_attribute method usage example with argument unpacking

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

# monitor method definition

await def monitor(
    self,
    *,
    DryRun: bool = ...,
) -> MonitorInstancesResultTypeDef:  # (1)
    ...
  1. See MonitorInstancesResultTypeDef
# monitor method usage example with argument unpacking

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

# password_data method definition

await def password_data(
    self,
    *,
    DryRun: bool = ...,
) -> GetPasswordDataResultTypeDef:  # (1)
    ...
  1. See GetPasswordDataResultTypeDef
# password_data method usage example with argument unpacking

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

# reboot method definition

await def reboot(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# reboot method usage example with argument unpacking

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

# reload 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 aiobotocore.resource("ec2").report_status method. boto3 documentation

# report_status 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
# report_status method usage example with argument unpacking

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

# reset_attribute method definition

await def reset_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
# reset_attribute method usage example with argument unpacking

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

# reset_kernel method definition

await def reset_kernel(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'kernel',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
# reset_kernel method usage example with argument unpacking

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

# reset_ramdisk method definition

await def reset_ramdisk(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'ramdisk',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
# reset_ramdisk method usage example with argument unpacking

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

# reset_source_dest_check method definition

await def reset_source_dest_check(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'sourceDestCheck',  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See InstanceAttributeNameType
# reset_source_dest_check method usage example with argument unpacking

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

# start method definition

await def start(
    self,
    *,
    AdditionalInfo: str = ...,
    DryRun: bool = ...,
) -> StartInstancesResultTypeDef:  # (1)
    ...
  1. See StartInstancesResultTypeDef
# start method usage example with argument unpacking

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

# stop method definition

await def stop(
    self,
    *,
    Hibernate: bool = ...,
    DryRun: bool = ...,
    Force: bool = ...,
) -> StopInstancesResultTypeDef:  # (1)
    ...
  1. See StopInstancesResultTypeDef
# stop method usage example with argument unpacking

kwargs: StopInstancesRequestInstanceStopTypeDef = {  # (1)
    "Hibernate": ...,
}

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

Instance.terminate method#

Shuts down the specified instances.

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

# terminate method definition

await def terminate(
    self,
    *,
    DryRun: bool = ...,
) -> TerminateInstancesResultTypeDef:  # (1)
    ...
  1. See TerminateInstancesResultTypeDef
# terminate method usage example with argument unpacking

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

# unmonitor method definition

await def unmonitor(
    self,
    *,
    DryRun: bool = ...,
) -> UnmonitorInstancesResultTypeDef:  # (1)
    ...
  1. See UnmonitorInstancesResultTypeDef
# unmonitor method usage example with argument unpacking

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

# wait_until_exists 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 aiobotocore.resource("ec2").wait_until_running method. boto3 documentation

# wait_until_running 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 aiobotocore.resource("ec2").wait_until_stopped method. boto3 documentation

# wait_until_stopped 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 aiobotocore.resource("ec2").wait_until_terminated method. boto3 documentation

# wait_until_terminated method definition

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

InternetGateway#

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

# InternetGateway usage example

from types_aiobotocore_ec2.service_resource import InternetGateway

def get_resource() -> InternetGateway:
    return session.resource("ec2").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 aiobotocore.resource("ec2").attach_to_vpc method. boto3 documentation

# attach_to_vpc method definition

await def attach_to_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
# attach_to_vpc method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

InternetGateway.delete method#

Deletes the specified internet gateway.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# detach_from_vpc method definition

await def detach_from_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> None:
    ...
# detach_from_vpc method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

KeyPair#

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

# KeyPair usage example

from types_aiobotocore_ec2.service_resource import KeyPair

def get_resource() -> KeyPair:
    return session.resource("ec2").KeyPair(...)

KeyPair attributes#

  • key_fingerprint: Awaitable[str]
  • key_material: Awaitable[str]
  • key_name: Awaitable[str]
  • key_pair_id: Awaitable[str]
  • tags: Awaitable[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 aiobotocore.resource("ec2").delete method. boto3 documentation

# delete method definition

await def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources method definition

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

KeyPairInfo#

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

# KeyPairInfo usage example

from types_aiobotocore_ec2.service_resource import KeyPairInfo

def get_resource() -> KeyPairInfo:
    return session.resource("ec2").KeyPairInfo(...)

KeyPairInfo attributes#

  • key_pair_id: Awaitable[str]
  • key_fingerprint: Awaitable[str]
  • key_name: Awaitable[str]
  • key_type: Awaitable[KeyTypeType]
  • tags: Awaitable[List[TagTypeDef]]
  • public_key: Awaitable[str]
  • create_time: Awaitable[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 aiobotocore.resource("ec2").delete method. boto3 documentation

# delete method definition

await def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

NetworkAcl#

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

# NetworkAcl usage example

from types_aiobotocore_ec2.service_resource import NetworkAcl

def get_resource() -> NetworkAcl:
    return session.resource("ec2").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 aiobotocore.resource("ec2").create_entry method. boto3 documentation

# create_entry 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
# create_entry method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

NetworkAcl.delete method#

Deletes the specified network ACL.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# delete_entry method definition

await def delete_entry(
    self,
    *,
    Egress: bool,
    RuleNumber: int,
    DryRun: bool = ...,
) -> None:
    ...
# delete_entry method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload 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 aiobotocore.resource("ec2").replace_association method. boto3 documentation

# replace_association method definition

await def replace_association(
    self,
    *,
    AssociationId: str,
    DryRun: bool = ...,
) -> ReplaceNetworkAclAssociationResultTypeDef:  # (1)
    ...
  1. See ReplaceNetworkAclAssociationResultTypeDef
# replace_association method usage example with argument unpacking

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

# replace_entry 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
# replace_entry method usage example with argument unpacking

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

# NetworkInterface usage example

from types_aiobotocore_ec2.service_resource import NetworkInterface

def get_resource() -> NetworkInterface:
    return session.resource("ec2").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 aiobotocore.resource("ec2").assign_private_ip_addresses method. boto3 documentation

# assign_private_ip_addresses 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
# assign_private_ip_addresses method usage example with argument unpacking

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

# attach method definition

await def attach(
    self,
    *,
    DeviceIndex: int,
    InstanceId: str,
    DryRun: bool = ...,
    NetworkCardIndex: int = ...,
    EnaSrdSpecification: EnaSrdSpecificationTypeDef = ...,  # (1)
) -> AttachNetworkInterfaceResultTypeDef:  # (2)
    ...
  1. See EnaSrdSpecificationTypeDef
  2. See AttachNetworkInterfaceResultTypeDef
# attach method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

NetworkInterface.delete method#

Deletes the specified network interface.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: NetworkInterfaceAttributeType = ...,  # (1)
    DryRun: bool = ...,
) -> DescribeNetworkInterfaceAttributeResultTypeDef:  # (2)
    ...
  1. See NetworkInterfaceAttributeType
  2. See DescribeNetworkInterfaceAttributeResultTypeDef
# describe_attribute method usage example with argument unpacking

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

# detach method definition

await def detach(
    self,
    *,
    AttachmentId: str,
    DryRun: bool = ...,
    Force: bool = ...,
) -> None:
    ...
# detach method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load method definition

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

NetworkInterface.modify_attribute method#

Modifies the specified network interface attribute.

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

# modify_attribute method definition

await def modify_attribute(
    self,
    *,
    Attachment: NetworkInterfaceAttachmentChangesTypeDef = ...,  # (1)
    Description: AttributeValueTypeDef = ...,  # (2)
    DryRun: bool = ...,
    Groups: Sequence[str] = ...,
    SourceDestCheck: AttributeBooleanValueTypeDef = ...,  # (3)
    EnaSrdSpecification: EnaSrdSpecificationTypeDef = ...,  # (4)
    EnablePrimaryIpv6: bool = ...,
) -> None:
    ...
  1. See NetworkInterfaceAttachmentChangesTypeDef
  2. See AttributeValueTypeDef
  3. See AttributeBooleanValueTypeDef
  4. See EnaSrdSpecificationTypeDef
# modify_attribute method usage example with argument unpacking

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

# reload method definition

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

NetworkInterface.reset_attribute method#

Resets a network interface attribute.

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

# reset_attribute method definition

await def reset_attribute(
    self,
    *,
    DryRun: bool = ...,
    SourceDestCheck: str = ...,
) -> None:
    ...
# reset_attribute method usage example with argument unpacking

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

# unassign_private_ip_addresses method definition

await def unassign_private_ip_addresses(
    self,
    *,
    PrivateIpAddresses: Sequence[str] = ...,
    Ipv4Prefixes: Sequence[str] = ...,
) -> None:
    ...
# unassign_private_ip_addresses method usage example with argument unpacking

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

# NetworkInterfaceAssociation usage example

from types_aiobotocore_ec2.service_resource import NetworkInterfaceAssociation

def get_resource() -> NetworkInterfaceAssociation:
    return session.resource("ec2").NetworkInterfaceAssociation(...)

NetworkInterfaceAssociation attributes#

  • carrier_ip: Awaitable[str]
  • customer_owned_ip: Awaitable[str]
  • ip_owner_id: Awaitable[str]
  • public_dns_name: Awaitable[str]
  • public_ip: Awaitable[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 aiobotocore.resource("ec2").delete method. boto3 documentation

# delete method definition

await def delete(
    self,
    *,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

PlacementGroup#

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

# PlacementGroup usage example

from types_aiobotocore_ec2.service_resource import PlacementGroup

def get_resource() -> PlacementGroup:
    return session.resource("ec2").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

# PlacementGroupInstancesCollection 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 aiobotocore.resource("ec2").delete method. boto3 documentation

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

Route#

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

# Route usage example

from types_aiobotocore_ec2.service_resource import Route

def get_resource() -> Route:
    return session.resource("ec2").Route(...)

Route attributes#

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

Route methods#

Route.RouteTable method#

Creates a RouteTable resource.

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

# RouteTable 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 aiobotocore.resource("ec2").delete method. boto3 documentation

# delete method definition

await def delete(
    self,
    *,
    DestinationIpv6CidrBlock: str = ...,
    DestinationPrefixListId: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").replace method. boto3 documentation

# replace 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:
    ...
# replace method usage example with argument unpacking

kwargs: ReplaceRouteRequestRouteReplaceTypeDef = {  # (1)
    "DestinationIpv6CidrBlock": ...,
}

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

RouteTable#

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

# RouteTable usage example

from types_aiobotocore_ec2.service_resource import RouteTable

def get_resource() -> RouteTable:
    return session.resource("ec2").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 aiobotocore.resource("ec2").associate_with_subnet method. boto3 documentation

# associate_with_subnet method definition

await def associate_with_subnet(
    self,
    *,
    DryRun: bool = ...,
    SubnetId: str = ...,
    GatewayId: str = ...,
) -> RouteTableAssociation:
    ...
# associate_with_subnet method usage example with argument unpacking

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

# create_route 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:
    ...
# create_route method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

RouteTable.delete method#

Deletes the specified route table.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

RouteTableAssociation#

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

# RouteTableAssociation usage example

from types_aiobotocore_ec2.service_resource import RouteTableAssociation

def get_resource() -> RouteTableAssociation:
    return session.resource("ec2").RouteTableAssociation(...)

RouteTableAssociation attributes#

RouteTableAssociation methods#

RouteTableAssociation.delete method#

Disassociates a subnet or gateway from a route table.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").replace_subnet method. boto3 documentation

# replace_subnet method definition

await def replace_subnet(
    self,
    *,
    RouteTableId: str,
    DryRun: bool = ...,
) -> RouteTableAssociation:
    ...
# replace_subnet method usage example with argument unpacking

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

# SecurityGroup usage example

from types_aiobotocore_ec2.service_resource import SecurityGroup

def get_resource() -> SecurityGroup:
    return session.resource("ec2").SecurityGroup(...)

SecurityGroup attributes#

  • description: Awaitable[str]
  • group_name: Awaitable[str]
  • ip_permissions: Awaitable[List[IpPermissionTypeDef]]
  • owner_id: Awaitable[str]
  • group_id: Awaitable[str]
  • ip_permissions_egress: Awaitable[List[IpPermissionTypeDef]]
  • tags: Awaitable[List[TagTypeDef]]
  • vpc_id: Awaitable[str]
  • id: str

SecurityGroup methods#

SecurityGroup.authorize_egress method#

Adds the specified outbound (egress) rules to a security group for use with a VPC.

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

# authorize_egress 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
# authorize_egress method usage example with argument unpacking

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

# authorize_ingress 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
# authorize_ingress method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

SecurityGroup.delete method#

Deletes a security group.

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

# delete method definition

await def delete(
    self,
    *,
    GroupName: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

SecurityGroup.revoke_egress method#

Removes the specified outbound (egress) rules from the specified security group.

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

# revoke_egress 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
# revoke_egress method usage example with argument unpacking

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

# revoke_ingress 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
# revoke_ingress method usage example with argument unpacking

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

# Snapshot usage example

from types_aiobotocore_ec2.service_resource import Snapshot

def get_resource() -> Snapshot:
    return session.resource("ec2").Snapshot(...)

Snapshot attributes#

  • data_encryption_key_id: Awaitable[str]
  • description: Awaitable[str]
  • encrypted: Awaitable[bool]
  • kms_key_id: Awaitable[str]
  • owner_id: Awaitable[str]
  • progress: Awaitable[str]
  • snapshot_id: Awaitable[str]
  • start_time: Awaitable[datetime]
  • state: Awaitable[SnapshotStateType]
  • state_message: Awaitable[str]
  • volume_id: Awaitable[str]
  • volume_size: Awaitable[int]
  • owner_alias: Awaitable[str]
  • outpost_arn: Awaitable[str]
  • tags: Awaitable[List[TagTypeDef]]
  • storage_tier: Awaitable[StorageTierType]
  • restore_expiry_time: Awaitable[datetime]
  • sse_type: Awaitable[SSETypeType]
  • 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 aiobotocore.resource("ec2").copy method. boto3 documentation

# copy 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
# copy method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Snapshot.delete method#

Deletes the specified snapshot.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeSnapshotAttributeResultTypeDef:  # (2)
    ...
  1. See SnapshotAttributeNameType
  2. See DescribeSnapshotAttributeResultTypeDef
# describe_attribute method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").modify_attribute method. boto3 documentation

# modify_attribute 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
# modify_attribute method usage example with argument unpacking

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

# reload method definition

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

Snapshot.reset_attribute method#

Resets permission settings for the specified snapshot.

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

# reset_attribute method definition

await def reset_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See SnapshotAttributeNameType
# reset_attribute method usage example with argument unpacking

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

# wait_until_completed method definition

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

Subnet#

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

# Subnet usage example

from types_aiobotocore_ec2.service_resource import Subnet

def get_resource() -> Subnet:
    return session.resource("ec2").Subnet(...)

Subnet attributes#

  • availability_zone: Awaitable[str]
  • availability_zone_id: Awaitable[str]
  • available_ip_address_count: Awaitable[int]
  • cidr_block: Awaitable[str]
  • default_for_az: Awaitable[bool]
  • enable_lni_at_device_index: Awaitable[int]
  • map_public_ip_on_launch: Awaitable[bool]
  • map_customer_owned_ip_on_launch: Awaitable[bool]
  • customer_owned_ipv4_pool: Awaitable[str]
  • state: Awaitable[SubnetStateType]
  • subnet_id: Awaitable[str]
  • vpc_id: Awaitable[str]
  • owner_id: Awaitable[str]
  • assign_ipv6_address_on_creation: Awaitable[bool]
  • ipv6_cidr_block_association_set: Awaitable[List[SubnetIpv6CidrBlockAssociationTypeDef]]
  • tags: Awaitable[List[TagTypeDef]]
  • subnet_arn: Awaitable[str]
  • outpost_arn: Awaitable[str]
  • enable_dns64: Awaitable[bool]
  • ipv6_native: Awaitable[bool]
  • private_dns_name_options_on_launch: Awaitable[PrivateDnsNameOptionsOnLaunchResponseTypeDef]
  • id: str
  • vpc: Vpc
  • instances: SubnetInstancesCollection
  • network_interfaces: SubnetNetworkInterfacesCollection

Subnet collections#

Subnet.instances#

Provides access to Instance resource.

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

# SubnetInstancesCollection 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

# SubnetNetworkInterfacesCollection 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 aiobotocore.resource("ec2").create_instances method. boto3 documentation

# create_instances 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[InstanceNetworkInterfaceSpecificationSubnetTypeDef] = ...,  # (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 = ...,
    EnablePrimaryIpv6: 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 InstanceNetworkInterfaceSpecificationSubnetTypeDef
  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
# create_instances method usage example with argument unpacking

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

# create_network_interface 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 = ...,
    EnablePrimaryIpv6: bool = ...,
) -> NetworkInterface:
    ...
  1. See InstanceIpv6AddressTypeDef
  2. See PrivateIpAddressSpecificationTypeDef
  3. See Ipv4PrefixSpecificationRequestTypeDef
  4. See Ipv6PrefixSpecificationRequestTypeDef
  5. See NetworkInterfaceCreationTypeType
  6. See TagSpecificationTypeDef
# create_network_interface method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Subnet.delete method#

Deletes the specified subnet.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

Tag#

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

# Tag usage example

from types_aiobotocore_ec2.service_resource import Tag

def get_resource() -> Tag:
    return session.resource("ec2").Tag(...)

Tag attributes#

  • resource_type: Awaitable[ResourceTypeType]
  • resource_id: str
  • key: str
  • value: str

Tag methods#

Tag.delete method#

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

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").reload method. boto3 documentation

# reload method definition

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

Volume#

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

# Volume usage example

from types_aiobotocore_ec2.service_resource import Volume

def get_resource() -> Volume:
    return session.resource("ec2").Volume(...)

Volume attributes#

  • attachments: Awaitable[List[VolumeAttachmentTypeDef]]
  • availability_zone: Awaitable[str]
  • create_time: Awaitable[datetime]
  • encrypted: Awaitable[bool]
  • kms_key_id: Awaitable[str]
  • outpost_arn: Awaitable[str]
  • size: Awaitable[int]
  • snapshot_id: Awaitable[str]
  • state: Awaitable[VolumeStateType]
  • volume_id: Awaitable[str]
  • iops: Awaitable[int]
  • tags: Awaitable[List[TagTypeDef]]
  • volume_type: Awaitable[VolumeTypeType]
  • fast_restored: Awaitable[bool]
  • multi_attach_enabled: Awaitable[bool]
  • throughput: Awaitable[int]
  • sse_type: Awaitable[SSETypeType]
  • id: str
  • snapshots: VolumeSnapshotsCollection

Volume collections#

Volume.snapshots#

Provides access to Snapshot resource.

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

# VolumeSnapshotsCollection 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 aiobotocore.resource("ec2").attach_to_instance method. boto3 documentation

# attach_to_instance method definition

await def attach_to_instance(
    self,
    *,
    Device: str,
    InstanceId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseTypeDef
# attach_to_instance method usage example with argument unpacking

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

# create_snapshot method definition

await def create_snapshot(
    self,
    *,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> Snapshot:
    ...
  1. See TagSpecificationTypeDef
# create_snapshot method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Volume.delete method#

Deletes the specified EBS volume.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: VolumeAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVolumeAttributeResultTypeDef:  # (2)
    ...
  1. See VolumeAttributeNameType
  2. See DescribeVolumeAttributeResultTypeDef
# describe_attribute method usage example with argument unpacking

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

# describe_status 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
# describe_status method usage example with argument unpacking

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

# detach_from_instance method definition

await def detach_from_instance(
    self,
    *,
    Device: str = ...,
    Force: bool = ...,
    InstanceId: str = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...
  1. See VolumeAttachmentResponseTypeDef
# detach_from_instance method usage example with argument unpacking

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

# enable_io method definition

await def enable_io(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# enable_io method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load method definition

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

Volume.modify_attribute method#

Modifies a volume attribute.

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

# modify_attribute method definition

await def modify_attribute(
    self,
    *,
    AutoEnableIO: AttributeBooleanValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See AttributeBooleanValueTypeDef
# modify_attribute method usage example with argument unpacking

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

# reload method definition

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

Vpc#

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

# Vpc usage example

from types_aiobotocore_ec2.service_resource import Vpc

def get_resource() -> Vpc:
    return session.resource("ec2").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

# VpcAcceptedVpcPeeringConnectionsCollection 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

# VpcInstancesCollection 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

# VpcInternetGatewaysCollection 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

# VpcNetworkAclsCollection 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

# VpcNetworkInterfacesCollection 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

# VpcRequestedVpcPeeringConnectionsCollection 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

# VpcRouteTablesCollection 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

# VpcSecurityGroupsCollection 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

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

# associate_dhcp_options method definition

await def associate_dhcp_options(
    self,
    *,
    DhcpOptionsId: str,
    DryRun: bool = ...,
) -> None:
    ...
# associate_dhcp_options method usage example with argument unpacking

kwargs: AssociateDhcpOptionsRequestVpcAssociateDhcpOptionsTypeDef = {  # (1)
    "DhcpOptionsId": ...,
}

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

.

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

# attach_classic_link_instance method definition

await def attach_classic_link_instance(
    self,
    *,
    Groups: Sequence[str],
    InstanceId: str,
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See AttachClassicLinkVpcResultTypeDef
# attach_classic_link_instance method usage example with argument unpacking

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

# attach_internet_gateway method definition

await def attach_internet_gateway(
    self,
    *,
    InternetGatewayId: str,
    DryRun: bool = ...,
) -> None:
    ...
# attach_internet_gateway method usage example with argument unpacking

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

# create_network_acl method definition

await def create_network_acl(
    self,
    *,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> NetworkAcl:
    ...
  1. See TagSpecificationTypeDef
# create_network_acl method usage example with argument unpacking

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

# create_route_table method definition

await def create_route_table(
    self,
    *,
    DryRun: bool = ...,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
) -> RouteTable:
    ...
  1. See TagSpecificationTypeDef
# create_route_table method usage example with argument unpacking

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

# create_security_group method definition

await def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    TagSpecifications: Sequence[TagSpecificationTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> SecurityGroup:
    ...
  1. See TagSpecificationTypeDef
# create_security_group method usage example with argument unpacking

kwargs: CreateSecurityGroupRequestVpcCreateSecurityGroupTypeDef = {  # (1)
    "Description": ...,
    "GroupName": ...,
}

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

Vpc.create_subnet method#

Creates a subnet in the specified VPC.

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

# create_subnet 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
# create_subnet method usage example with argument unpacking

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

# create_tags method definition

await def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...
  1. See TagTypeDef
# create_tags method usage example with argument unpacking

kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}

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

Vpc.delete method#

Deletes the specified VPC.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

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

# describe_attribute method definition

await def describe_attribute(
    self,
    *,
    Attribute: VpcAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVpcAttributeResultTypeDef:  # (2)
    ...
  1. See VpcAttributeNameType
  2. See DescribeVpcAttributeResultTypeDef
# describe_attribute method usage example with argument unpacking

kwargs: DescribeVpcAttributeRequestVpcDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}

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

.

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

# detach_classic_link_instance method definition

await def detach_classic_link_instance(
    self,
    *,
    InstanceId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...
  1. See DetachClassicLinkVpcResultTypeDef
# detach_classic_link_instance method usage example with argument unpacking

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

# detach_internet_gateway method definition

await def detach_internet_gateway(
    self,
    *,
    InternetGatewayId: str,
    DryRun: bool = ...,
) -> None:
    ...
# detach_internet_gateway method usage example with argument unpacking

kwargs: DetachInternetGatewayRequestVpcDetachInternetGatewayTypeDef = {  # (1)
    "InternetGatewayId": ...,
}

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

.

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

# disable_classic_link method definition

await def disable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> DisableVpcClassicLinkResultTypeDef:  # (1)
    ...
  1. See DisableVpcClassicLinkResultTypeDef
# disable_classic_link method usage example with argument unpacking

kwargs: DisableVpcClassicLinkRequestVpcDisableClassicLinkTypeDef = {  # (1)
    "DryRun": ...,
}

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

.

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

# enable_classic_link method definition

await def enable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> EnableVpcClassicLinkResultTypeDef:  # (1)
    ...
  1. See EnableVpcClassicLinkResultTypeDef
# enable_classic_link method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load 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 aiobotocore.resource("ec2").modify_attribute method. boto3 documentation

# modify_attribute method definition

await def modify_attribute(
    self,
    *,
    EnableDnsHostnames: AttributeBooleanValueTypeDef = ...,  # (1)
    EnableDnsSupport: AttributeBooleanValueTypeDef = ...,  # (1)
    EnableNetworkAddressUsageMetrics: AttributeBooleanValueTypeDef = ...,  # (1)
) -> None:
    ...
  1. See AttributeBooleanValueTypeDef
  2. See AttributeBooleanValueTypeDef
  3. See AttributeBooleanValueTypeDef
# modify_attribute method usage example with argument unpacking

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

# reload 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 aiobotocore.resource("ec2").request_vpc_peering_connection method. boto3 documentation

# request_vpc_peering_connection 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
# request_vpc_peering_connection method usage example with argument unpacking

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

# wait_until_available 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 aiobotocore.resource("ec2").wait_until_exists method. boto3 documentation

# wait_until_exists method definition

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

VpcPeeringConnection#

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

# VpcPeeringConnection usage example

from types_aiobotocore_ec2.service_resource import VpcPeeringConnection

def get_resource() -> VpcPeeringConnection:
    return session.resource("ec2").VpcPeeringConnection(...)

VpcPeeringConnection attributes#

VpcPeeringConnection methods#

VpcPeeringConnection.accept method#

Accept a VPC peering connection request.

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

# accept method definition

await def accept(
    self,
    *,
    DryRun: bool = ...,
) -> AcceptVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See AcceptVpcPeeringConnectionResultTypeDef
# accept method usage example with argument unpacking

kwargs: AcceptVpcPeeringConnectionRequestVpcPeeringConnectionAcceptTypeDef = {  # (1)
    "DryRun": ...,
}

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

VpcPeeringConnection.delete method#

Deletes a VPC peering connection.

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

# delete method definition

await def delete(
    self,
    *,
    DryRun: bool = ...,
) -> DeleteVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See DeleteVpcPeeringConnectionResultTypeDef
# delete method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load method definition

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

VpcPeeringConnection.reject method#

Rejects a VPC peering connection request.

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

# reject method definition

await def reject(
    self,
    *,
    DryRun: bool = ...,
) -> RejectVpcPeeringConnectionResultTypeDef:  # (1)
    ...
  1. See RejectVpcPeeringConnectionResultTypeDef
# reject method usage example with argument unpacking

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

# reload method definition

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

VpcPeeringConnection.wait_until_exists method#

Waits until this VpcPeeringConnection is exists.

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

# wait_until_exists method definition

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

VpcAddress#

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

# VpcAddress usage example

from types_aiobotocore_ec2.service_resource import VpcAddress

def get_resource() -> VpcAddress:
    return session.resource("ec2").VpcAddress(...)

VpcAddress attributes#

  • instance_id: Awaitable[str]
  • public_ip: Awaitable[str]
  • association_id: Awaitable[str]
  • domain: Awaitable[DomainTypeType]
  • network_interface_id: Awaitable[str]
  • network_interface_owner_id: Awaitable[str]
  • private_ip_address: Awaitable[str]
  • tags: Awaitable[List[TagTypeDef]]
  • public_ipv4_pool: Awaitable[str]
  • network_border_group: Awaitable[str]
  • customer_owned_ip: Awaitable[str]
  • customer_owned_ipv4_pool: Awaitable[str]
  • carrier_ip: Awaitable[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 aiobotocore.resource("ec2").associate method. boto3 documentation

# associate method definition

await def associate(
    self,
    *,
    InstanceId: str = ...,
    PublicIp: str = ...,
    AllowReassociation: bool = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...
  1. See AssociateAddressResultTypeDef
# associate method usage example with argument unpacking

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

# get_available_subresources 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 aiobotocore.resource("ec2").load method. boto3 documentation

# load method definition

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

VpcAddress.release method#

Releases the specified Elastic IP address.

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

# release method definition

await def release(
    self,
    *,
    AllocationId: str = ...,
    PublicIp: str = ...,
    NetworkBorderGroup: str = ...,
    DryRun: bool = ...,
) -> None:
    ...
# release method usage example with argument unpacking

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

# reload method definition

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