EC2ServiceResource#
Auto-generated documentation for EC2 type annotations stubs module types-boto3-ec2.
EC2ServiceResource#
Type annotations and code completion for boto3.resource("ec2"), included resources and collections.
 boto3 documentation
# EC2ServiceResource usage example
from types_boto3_ec2.service_resource import EC2ServiceResource
def get_ec2_resource() -> EC2ServiceResource:
    return boto3.resource("ec2")Attributes#
- meta:- EC2ResourceMeta
- classic_addresses:- ServiceResourceClassicAddressesCollection
- dhcp_options_sets:- ServiceResourceDhcpOptionsSetsCollection
- images:- ServiceResourceImagesCollection
- instances:- ServiceResourceInstancesCollection
- internet_gateways:- ServiceResourceInternetGatewaysCollection
- key_pairs:- ServiceResourceKeyPairsCollection
- network_acls:- ServiceResourceNetworkAclsCollection
- network_interfaces:- ServiceResourceNetworkInterfacesCollection
- placement_groups:- ServiceResourcePlacementGroupsCollection
- route_tables:- ServiceResourceRouteTablesCollection
- security_groups:- ServiceResourceSecurityGroupsCollection
- snapshots:- ServiceResourceSnapshotsCollection
- subnets:- ServiceResourceSubnetsCollection
- volumes:- ServiceResourceVolumesCollection
- vpc_addresses:- ServiceResourceVpcAddressesCollection
- vpc_peering_connections:- ServiceResourceVpcPeeringConnectionsCollection
- vpcs:- ServiceResourceVpcsCollection
Collections#
ServiceResourceClassicAddressesCollection#
Provides access to ClassicAddress resource.
Type annotations and code completion for boto3.resource("ec2").classic_addresses collection.
 boto3 documentation
# ServiceResourceClassicAddressesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceClassicAddressesCollection
def get_collection() -> ServiceResourceClassicAddressesCollection:
    return boto3.resource("ec2").classic_addressesServiceResourceDhcpOptionsSetsCollection#
Provides access to DhcpOptions resource.
Type annotations and code completion for boto3.resource("ec2").dhcp_options_sets collection.
 boto3 documentation
# ServiceResourceDhcpOptionsSetsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceDhcpOptionsSetsCollection
def get_collection() -> ServiceResourceDhcpOptionsSetsCollection:
    return boto3.resource("ec2").dhcp_options_setsServiceResourceImagesCollection#
Provides access to Image resource.
Type annotations and code completion for boto3.resource("ec2").images collection.
 boto3 documentation
# ServiceResourceImagesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceImagesCollection
def get_collection() -> ServiceResourceImagesCollection:
    return boto3.resource("ec2").imagesServiceResourceInstancesCollection#
Provides access to Instance resource.
Type annotations and code completion for boto3.resource("ec2").instances collection.
 boto3 documentation
# ServiceResourceInstancesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceInstancesCollection
def get_collection() -> ServiceResourceInstancesCollection:
    return boto3.resource("ec2").instancesServiceResourceInternetGatewaysCollection#
Provides access to InternetGateway resource.
Type annotations and code completion for boto3.resource("ec2").internet_gateways collection.
 boto3 documentation
# ServiceResourceInternetGatewaysCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceInternetGatewaysCollection
def get_collection() -> ServiceResourceInternetGatewaysCollection:
    return boto3.resource("ec2").internet_gatewaysServiceResourceKeyPairsCollection#
Provides access to KeyPairInfo resource.
Type annotations and code completion for boto3.resource("ec2").key_pairs collection.
 boto3 documentation
# ServiceResourceKeyPairsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceKeyPairsCollection
def get_collection() -> ServiceResourceKeyPairsCollection:
    return boto3.resource("ec2").key_pairsServiceResourceNetworkAclsCollection#
Provides access to NetworkAcl resource.
Type annotations and code completion for boto3.resource("ec2").network_acls collection.
 boto3 documentation
# ServiceResourceNetworkAclsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceNetworkAclsCollection
def get_collection() -> ServiceResourceNetworkAclsCollection:
    return boto3.resource("ec2").network_aclsServiceResourceNetworkInterfacesCollection#
Provides access to NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").network_interfaces collection.
 boto3 documentation
# ServiceResourceNetworkInterfacesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceNetworkInterfacesCollection
def get_collection() -> ServiceResourceNetworkInterfacesCollection:
    return boto3.resource("ec2").network_interfacesServiceResourcePlacementGroupsCollection#
Provides access to PlacementGroup resource.
Type annotations and code completion for boto3.resource("ec2").placement_groups collection.
 boto3 documentation
# ServiceResourcePlacementGroupsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourcePlacementGroupsCollection
def get_collection() -> ServiceResourcePlacementGroupsCollection:
    return boto3.resource("ec2").placement_groupsServiceResourceRouteTablesCollection#
Provides access to RouteTable resource.
Type annotations and code completion for boto3.resource("ec2").route_tables collection.
 boto3 documentation
# ServiceResourceRouteTablesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceRouteTablesCollection
def get_collection() -> ServiceResourceRouteTablesCollection:
    return boto3.resource("ec2").route_tablesServiceResourceSecurityGroupsCollection#
Provides access to SecurityGroup resource.
Type annotations and code completion for boto3.resource("ec2").security_groups collection.
 boto3 documentation
# ServiceResourceSecurityGroupsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceSecurityGroupsCollection
def get_collection() -> ServiceResourceSecurityGroupsCollection:
    return boto3.resource("ec2").security_groupsServiceResourceSnapshotsCollection#
Provides access to Snapshot resource.
Type annotations and code completion for boto3.resource("ec2").snapshots collection.
 boto3 documentation
# ServiceResourceSnapshotsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceSnapshotsCollection
def get_collection() -> ServiceResourceSnapshotsCollection:
    return boto3.resource("ec2").snapshotsServiceResourceSubnetsCollection#
Provides access to Subnet resource.
Type annotations and code completion for boto3.resource("ec2").subnets collection.
 boto3 documentation
# ServiceResourceSubnetsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceSubnetsCollection
def get_collection() -> ServiceResourceSubnetsCollection:
    return boto3.resource("ec2").subnetsServiceResourceVolumesCollection#
Provides access to Volume resource.
Type annotations and code completion for boto3.resource("ec2").volumes collection.
 boto3 documentation
# ServiceResourceVolumesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceVolumesCollection
def get_collection() -> ServiceResourceVolumesCollection:
    return boto3.resource("ec2").volumesServiceResourceVpcAddressesCollection#
Provides access to VpcAddress resource.
Type annotations and code completion for boto3.resource("ec2").vpc_addresses collection.
 boto3 documentation
# ServiceResourceVpcAddressesCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceVpcAddressesCollection
def get_collection() -> ServiceResourceVpcAddressesCollection:
    return boto3.resource("ec2").vpc_addressesServiceResourceVpcPeeringConnectionsCollection#
Provides access to VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").vpc_peering_connections collection.
 boto3 documentation
# ServiceResourceVpcPeeringConnectionsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceVpcPeeringConnectionsCollection
def get_collection() -> ServiceResourceVpcPeeringConnectionsCollection:
    return boto3.resource("ec2").vpc_peering_connectionsServiceResourceVpcsCollection#
Provides access to Vpc resource.
Type annotations and code completion for boto3.resource("ec2").vpcs collection.
 boto3 documentation
# ServiceResourceVpcsCollection usage example
from types_boto3_ec2.service_resource import ServiceResourceVpcsCollection
def get_collection() -> ServiceResourceVpcsCollection:
    return boto3.resource("ec2").vpcsMethods#
EC2ServiceResource.get_available_subresources method#
Returns a list of all the available sub-resources for this resource.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...EC2ServiceResource.create_dhcp_options method#
Creates a custom set of DHCP options.
Type annotations and code completion for boto3.resource("ec2").create_dhcp_options method.
 boto3 documentation
# create_dhcp_options method definition
def create_dhcp_options(
    self,
    *,
    DhcpConfigurations: Sequence[NewDhcpConfigurationTypeDef],  # (1)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (2)
    DryRun: bool = ...,
) -> _DhcpOptions:
    ...- See Sequence[NewDhcpConfigurationTypeDef]
- See Sequence[TagSpecificationUnionTypeDef]
# create_dhcp_options method usage example with argument unpacking
kwargs: CreateDhcpOptionsRequestServiceResourceCreateDhcpOptionsTypeDef = {  # (1)
    "DhcpConfigurations": ...,
}
parent.create_dhcp_options(**kwargs)EC2ServiceResource.create_instances method#
Launches the specified number of instances using an AMI for which you have permissions.
Type annotations and code completion for boto3.resource("ec2").create_instances method.
 boto3 documentation
# create_instances method definition
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 = ...,
    ElasticGpuSpecification: Sequence[ElasticGpuSpecificationTypeDef] = ...,  # (6)
    ElasticInferenceAccelerators: Sequence[ElasticInferenceAcceleratorTypeDef] = ...,  # (7)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (8)
    LaunchTemplate: LaunchTemplateSpecificationTypeDef = ...,  # (9)
    InstanceMarketOptions: InstanceMarketOptionsRequestTypeDef = ...,  # (10)
    CreditSpecification: CreditSpecificationRequestTypeDef = ...,  # (11)
    CpuOptions: CpuOptionsRequestTypeDef = ...,  # (12)
    CapacityReservationSpecification: CapacityReservationSpecificationTypeDef = ...,  # (13)
    HibernationOptions: HibernationOptionsRequestTypeDef = ...,  # (14)
    LicenseSpecifications: Sequence[LicenseConfigurationRequestTypeDef] = ...,  # (15)
    MetadataOptions: InstanceMetadataOptionsRequestTypeDef = ...,  # (16)
    EnclaveOptions: EnclaveOptionsRequestTypeDef = ...,  # (17)
    PrivateDnsNameOptions: PrivateDnsNameOptionsRequestTypeDef = ...,  # (18)
    MaintenanceOptions: InstanceMaintenanceOptionsRequestTypeDef = ...,  # (19)
    DisableApiStop: bool = ...,
    EnablePrimaryIpv6: bool = ...,
    NetworkPerformanceOptions: InstanceNetworkPerformanceOptionsRequestTypeDef = ...,  # (20)
    Operator: OperatorRequestTypeDef = ...,  # (21)
    DryRun: bool = ...,
    DisableApiTermination: bool = ...,
    InstanceInitiatedShutdownBehavior: ShutdownBehaviorType = ...,  # (22)
    PrivateIpAddress: str = ...,
    ClientToken: str = ...,
    AdditionalInfo: str = ...,
    NetworkInterfaces: Sequence[InstanceNetworkInterfaceSpecificationUnionTypeDef] = ...,  # (23)
    IamInstanceProfile: IamInstanceProfileSpecificationTypeDef = ...,  # (24)
    EbsOptimized: bool = ...,
) -> List[_Instance]:
    ...- See Sequence[BlockDeviceMappingTypeDef]
- See InstanceTypeType
- See Sequence[InstanceIpv6AddressTypeDef]
- See RunInstancesMonitoringEnabledTypeDef
- See PlacementTypeDef
- See Sequence[ElasticGpuSpecificationTypeDef]
- See Sequence[ElasticInferenceAcceleratorTypeDef]
- See Sequence[TagSpecificationUnionTypeDef]
- See LaunchTemplateSpecificationTypeDef
- See InstanceMarketOptionsRequestTypeDef
- See CreditSpecificationRequestTypeDef
- See CpuOptionsRequestTypeDef
- See CapacityReservationSpecificationTypeDef
- See HibernationOptionsRequestTypeDef
- See Sequence[LicenseConfigurationRequestTypeDef]
- See InstanceMetadataOptionsRequestTypeDef
- See EnclaveOptionsRequestTypeDef
- See PrivateDnsNameOptionsRequestTypeDef
- See InstanceMaintenanceOptionsRequestTypeDef
- See InstanceNetworkPerformanceOptionsRequestTypeDef
- See OperatorRequestTypeDef
- See ShutdownBehaviorType
- See Sequence[InstanceNetworkInterfaceSpecificationUnionTypeDef]
- See IamInstanceProfileSpecificationTypeDef
# create_instances method usage example with argument unpacking
kwargs: RunInstancesRequestServiceResourceCreateInstancesTypeDef = {  # (1)
    "MaxCount": ...,
    "MinCount": ...,
}
parent.create_instances(**kwargs)EC2ServiceResource.create_internet_gateway method#
Creates an internet gateway for use with a VPC.
Type annotations and code completion for boto3.resource("ec2").create_internet_gateway method.
 boto3 documentation
# create_internet_gateway method definition
def create_internet_gateway(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> _InternetGateway:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_internet_gateway method usage example with argument unpacking
kwargs: CreateInternetGatewayRequestServiceResourceCreateInternetGatewayTypeDef = {  # (1)
    "TagSpecifications": ...,
}
parent.create_internet_gateway(**kwargs)EC2ServiceResource.create_key_pair method#
Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified format.
Type annotations and code completion for boto3.resource("ec2").create_key_pair method.
 boto3 documentation
# create_key_pair method definition
def create_key_pair(
    self,
    *,
    KeyName: str,
    KeyType: KeyTypeType = ...,  # (1)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (2)
    KeyFormat: KeyFormatType = ...,  # (3)
    DryRun: bool = ...,
) -> _KeyPair:
    ...- See KeyTypeType
- See Sequence[TagSpecificationUnionTypeDef]
- See KeyFormatType
# create_key_pair method usage example with argument unpacking
kwargs: CreateKeyPairRequestServiceResourceCreateKeyPairTypeDef = {  # (1)
    "KeyName": ...,
}
parent.create_key_pair(**kwargs)EC2ServiceResource.create_network_acl method#
Creates a network ACL in a VPC.
Type annotations and code completion for boto3.resource("ec2").create_network_acl method.
 boto3 documentation
# create_network_acl method definition
def create_network_acl(
    self,
    *,
    VpcId: str,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    ClientToken: str = ...,
    DryRun: bool = ...,
) -> _NetworkAcl:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_network_acl method usage example with argument unpacking
kwargs: CreateNetworkAclRequestServiceResourceCreateNetworkAclTypeDef = {  # (1)
    "VpcId": ...,
}
parent.create_network_acl(**kwargs)EC2ServiceResource.create_network_interface method#
Creates a network interface in the specified subnet.
Type annotations and code completion for boto3.resource("ec2").create_network_interface method.
 boto3 documentation
# create_network_interface method definition
def create_network_interface(
    self,
    *,
    SubnetId: str,
    Ipv4Prefixes: Sequence[Ipv4PrefixSpecificationRequestTypeDef] = ...,  # (1)
    Ipv4PrefixCount: int = ...,
    Ipv6Prefixes: Sequence[Ipv6PrefixSpecificationRequestTypeDef] = ...,  # (2)
    Ipv6PrefixCount: int = ...,
    InterfaceType: NetworkInterfaceCreationTypeType = ...,  # (3)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (4)
    ClientToken: str = ...,
    EnablePrimaryIpv6: bool = ...,
    ConnectionTrackingSpecification: ConnectionTrackingSpecificationRequestTypeDef = ...,  # (5)
    Operator: OperatorRequestTypeDef = ...,  # (6)
    Description: str = ...,
    PrivateIpAddress: str = ...,
    Groups: Sequence[str] = ...,
    PrivateIpAddresses: Sequence[PrivateIpAddressSpecificationTypeDef] = ...,  # (7)
    SecondaryPrivateIpAddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (8)
    Ipv6AddressCount: int = ...,
    DryRun: bool = ...,
) -> _NetworkInterface:
    ...- See Sequence[Ipv4PrefixSpecificationRequestTypeDef]
- See Sequence[Ipv6PrefixSpecificationRequestTypeDef]
- See NetworkInterfaceCreationTypeType
- See Sequence[TagSpecificationUnionTypeDef]
- See ConnectionTrackingSpecificationRequestTypeDef
- See OperatorRequestTypeDef
- See Sequence[PrivateIpAddressSpecificationTypeDef]
- See Sequence[InstanceIpv6AddressTypeDef]
# create_network_interface method usage example with argument unpacking
kwargs: CreateNetworkInterfaceRequestServiceResourceCreateNetworkInterfaceTypeDef = {  # (1)
    "SubnetId": ...,
}
parent.create_network_interface(**kwargs)EC2ServiceResource.create_placement_group method#
Creates a placement group in which to launch instances.
Type annotations and code completion for boto3.resource("ec2").create_placement_group method.
 boto3 documentation
# create_placement_group method definition
def create_placement_group(
    self,
    *,
    PartitionCount: int = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    SpreadLevel: SpreadLevelType = ...,  # (2)
    DryRun: bool = ...,
    GroupName: str = ...,
    Strategy: PlacementStrategyType = ...,  # (3)
) -> _PlacementGroup:
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See SpreadLevelType
- See PlacementStrategyType
# create_placement_group method usage example with argument unpacking
kwargs: CreatePlacementGroupRequestServiceResourceCreatePlacementGroupTypeDef = {  # (1)
    "PartitionCount": ...,
}
parent.create_placement_group(**kwargs)EC2ServiceResource.create_route_table method#
Creates a route table for the specified VPC.
Type annotations and code completion for boto3.resource("ec2").create_route_table method.
 boto3 documentation
# create_route_table method definition
def create_route_table(
    self,
    *,
    VpcId: str,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    ClientToken: str = ...,
    DryRun: bool = ...,
) -> _RouteTable:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_route_table method usage example with argument unpacking
kwargs: CreateRouteTableRequestServiceResourceCreateRouteTableTypeDef = {  # (1)
    "VpcId": ...,
}
parent.create_route_table(**kwargs)EC2ServiceResource.create_security_group method#
Creates a security group.
Type annotations and code completion for boto3.resource("ec2").create_security_group method.
 boto3 documentation
# create_security_group method definition
def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    VpcId: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> _SecurityGroup:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_security_group method usage example with argument unpacking
kwargs: CreateSecurityGroupRequestServiceResourceCreateSecurityGroupTypeDef = {  # (1)
    "Description": ...,
    "GroupName": ...,
}
parent.create_security_group(**kwargs)EC2ServiceResource.create_snapshot method#
Creates a snapshot of an EBS volume and stores it in Amazon S3.
Type annotations and code completion for boto3.resource("ec2").create_snapshot method.
 boto3 documentation
# create_snapshot method definition
def create_snapshot(
    self,
    *,
    VolumeId: str,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    Location: SnapshotLocationEnumType = ...,  # (2)
    DryRun: bool = ...,
) -> _Snapshot:
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See SnapshotLocationEnumType
# create_snapshot method usage example with argument unpacking
kwargs: CreateSnapshotRequestServiceResourceCreateSnapshotTypeDef = {  # (1)
    "VolumeId": ...,
}
parent.create_snapshot(**kwargs)EC2ServiceResource.create_subnet method#
Creates a subnet in the specified VPC.
Type annotations and code completion for boto3.resource("ec2").create_subnet method.
 boto3 documentation
# create_subnet method definition
def create_subnet(
    self,
    *,
    VpcId: str,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    AvailabilityZone: str = ...,
    AvailabilityZoneId: str = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    OutpostArn: str = ...,
    Ipv6Native: bool = ...,
    Ipv4IpamPoolId: str = ...,
    Ipv4NetmaskLength: int = ...,
    Ipv6IpamPoolId: str = ...,
    Ipv6NetmaskLength: int = ...,
    DryRun: bool = ...,
) -> _Subnet:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_subnet method usage example with argument unpacking
kwargs: CreateSubnetRequestServiceResourceCreateSubnetTypeDef = {  # (1)
    "VpcId": ...,
}
parent.create_subnet(**kwargs)EC2ServiceResource.create_tags method#
Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources.
Type annotations and code completion for boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Resources: Sequence[str],
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: CreateTagsRequestServiceResourceCreateTagsTypeDef = {  # (1)
    "Resources": ...,
    "Tags": ...,
}
parent.create_tags(**kwargs)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 boto3.resource("ec2").create_volume method.
 boto3 documentation
# create_volume method definition
def create_volume(
    self,
    *,
    AvailabilityZone: str = ...,
    AvailabilityZoneId: str = ...,
    Encrypted: bool = ...,
    Iops: int = ...,
    KmsKeyId: str = ...,
    OutpostArn: str = ...,
    Size: int = ...,
    SnapshotId: str = ...,
    VolumeType: VolumeTypeType = ...,  # (1)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (2)
    MultiAttachEnabled: bool = ...,
    Throughput: int = ...,
    ClientToken: str = ...,
    VolumeInitializationRate: int = ...,
    Operator: OperatorRequestTypeDef = ...,  # (3)
    DryRun: bool = ...,
) -> _Volume:
    ...- See VolumeTypeType
- See Sequence[TagSpecificationUnionTypeDef]
- See OperatorRequestTypeDef
# create_volume method usage example with argument unpacking
kwargs: CreateVolumeRequestServiceResourceCreateVolumeTypeDef = {  # (1)
    "AvailabilityZone": ...,
}
parent.create_volume(**kwargs)EC2ServiceResource.create_vpc method#
Creates a VPC with the specified CIDR blocks.
Type annotations and code completion for boto3.resource("ec2").create_vpc method.
 boto3 documentation
# create_vpc method definition
def create_vpc(
    self,
    *,
    CidrBlock: str = ...,
    Ipv6Pool: str = ...,
    Ipv6CidrBlock: str = ...,
    Ipv4IpamPoolId: str = ...,
    Ipv4NetmaskLength: int = ...,
    Ipv6IpamPoolId: str = ...,
    Ipv6NetmaskLength: int = ...,
    Ipv6CidrBlockNetworkBorderGroup: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
    InstanceTenancy: TenancyType = ...,  # (2)
    AmazonProvidedIpv6CidrBlock: bool = ...,
) -> _Vpc:
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See TenancyType
# create_vpc method usage example with argument unpacking
kwargs: CreateVpcRequestServiceResourceCreateVpcTypeDef = {  # (1)
    "CidrBlock": ...,
}
parent.create_vpc(**kwargs)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 boto3.resource("ec2").create_vpc_peering_connection method.
 boto3 documentation
# create_vpc_peering_connection method definition
def create_vpc_peering_connection(
    self,
    *,
    VpcId: str,
    PeerRegion: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
    PeerVpcId: str = ...,
    PeerOwnerId: str = ...,
) -> _VpcPeeringConnection:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_vpc_peering_connection method usage example with argument unpacking
kwargs: CreateVpcPeeringConnectionRequestServiceResourceCreateVpcPeeringConnectionTypeDef = {  # (1)
    "VpcId": ...,
}
parent.create_vpc_peering_connection(**kwargs)EC2ServiceResource.disassociate_route_table method#
Disassociates a subnet or gateway from a route table.
Type annotations and code completion for boto3.resource("ec2").disassociate_route_table method.
 boto3 documentation
# disassociate_route_table method definition
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)EC2ServiceResource.import_key_pair method#
Imports the public key from an RSA or ED25519 key pair that you created using a third-party tool.
Type annotations and code completion for boto3.resource("ec2").import_key_pair method.
 boto3 documentation
# import_key_pair method definition
def import_key_pair(
    self,
    *,
    KeyName: str,
    PublicKeyMaterial: BlobTypeDef,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> _KeyPairInfo:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# import_key_pair method usage example with argument unpacking
kwargs: ImportKeyPairRequestServiceResourceImportKeyPairTypeDef = {  # (1)
    "KeyName": ...,
    "PublicKeyMaterial": ...,
}
parent.import_key_pair(**kwargs)EC2ServiceResource.register_image method#
Registers an AMI.
Type annotations and code completion for boto3.resource("ec2").register_image method.
 boto3 documentation
# register_image method definition
def register_image(
    self,
    *,
    Name: str,
    ImageLocation: str = ...,
    BillingProducts: Sequence[str] = ...,
    BootMode: BootModeValuesType = ...,  # (1)
    TpmSupport: TpmSupportValuesType = ...,  # (2)
    UefiData: str = ...,
    ImdsSupport: ImdsSupportValuesType = ...,  # (3)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (4)
    DryRun: bool = ...,
    Description: str = ...,
    Architecture: ArchitectureValuesType = ...,  # (5)
    KernelId: str = ...,
    RamdiskId: str = ...,
    RootDeviceName: str = ...,
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (6)
    VirtualizationType: str = ...,
    SriovNetSupport: str = ...,
    EnaSupport: bool = ...,
) -> _Image:
    ...- See BootModeValuesType
- See TpmSupportValuesType
- See ImdsSupportValuesType
- See Sequence[TagSpecificationUnionTypeDef]
- See ArchitectureValuesType
- See Sequence[BlockDeviceMappingTypeDef]
# register_image method usage example with argument unpacking
kwargs: RegisterImageRequestServiceResourceRegisterImageTypeDef = {  # (1)
    "Name": ...,
}
parent.register_image(**kwargs)EC2ServiceResource.ClassicAddress method#
Creates a ClassicAddress resource.
Type annotations and code completion for boto3.resource("ec2").ClassicAddress method.
 boto3 documentation
# ClassicAddress method definition
def ClassicAddress(
    self,
    public_ip: str,
) -> _ClassicAddress:
    ...EC2ServiceResource.DhcpOptions method#
Creates a DhcpOptions resource.
Type annotations and code completion for boto3.resource("ec2").DhcpOptions method.
 boto3 documentation
# DhcpOptions method definition
def DhcpOptions(
    self,
    id: str,
) -> _DhcpOptions:
    ...EC2ServiceResource.Image method#
Creates a Image resource.
Type annotations and code completion for boto3.resource("ec2").Image method.
 boto3 documentation
# Image method definition
def Image(
    self,
    id: str,
) -> _Image:
    ...EC2ServiceResource.Instance method#
Creates a Instance resource.
Type annotations and code completion for boto3.resource("ec2").Instance method.
 boto3 documentation
# Instance method definition
def Instance(
    self,
    id: str,
) -> _Instance:
    ...EC2ServiceResource.InternetGateway method#
Creates a InternetGateway resource.
Type annotations and code completion for boto3.resource("ec2").InternetGateway method.
 boto3 documentation
# InternetGateway method definition
def InternetGateway(
    self,
    id: str,
) -> _InternetGateway:
    ...EC2ServiceResource.KeyPair method#
Creates a KeyPair resource.
Type annotations and code completion for boto3.resource("ec2").KeyPair method.
 boto3 documentation
# KeyPair method definition
def KeyPair(
    self,
    name: str,
) -> _KeyPair:
    ...EC2ServiceResource.NetworkAcl method#
Creates a NetworkAcl resource.
Type annotations and code completion for boto3.resource("ec2").NetworkAcl method.
 boto3 documentation
# NetworkAcl method definition
def NetworkAcl(
    self,
    id: str,
) -> _NetworkAcl:
    ...EC2ServiceResource.NetworkInterface method#
Creates a NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").NetworkInterface method.
 boto3 documentation
# NetworkInterface method definition
def NetworkInterface(
    self,
    id: str,
) -> _NetworkInterface:
    ...EC2ServiceResource.NetworkInterfaceAssociation method#
Creates a NetworkInterfaceAssociation resource.
Type annotations and code completion for boto3.resource("ec2").NetworkInterfaceAssociation method.
 boto3 documentation
# NetworkInterfaceAssociation method definition
def NetworkInterfaceAssociation(
    self,
    id: str,
) -> _NetworkInterfaceAssociation:
    ...EC2ServiceResource.PlacementGroup method#
Creates a PlacementGroup resource.
Type annotations and code completion for boto3.resource("ec2").PlacementGroup method.
 boto3 documentation
# PlacementGroup method definition
def PlacementGroup(
    self,
    name: str,
) -> _PlacementGroup:
    ...EC2ServiceResource.Route method#
Creates a Route resource.
Type annotations and code completion for boto3.resource("ec2").Route method.
 boto3 documentation
# Route method definition
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 boto3.resource("ec2").RouteTable method.
 boto3 documentation
# RouteTable method definition
def RouteTable(
    self,
    id: str,
) -> _RouteTable:
    ...EC2ServiceResource.RouteTableAssociation method#
Creates a RouteTableAssociation resource.
Type annotations and code completion for boto3.resource("ec2").RouteTableAssociation method.
 boto3 documentation
# RouteTableAssociation method definition
def RouteTableAssociation(
    self,
    id: str,
) -> _RouteTableAssociation:
    ...EC2ServiceResource.SecurityGroup method#
Creates a SecurityGroup resource.
Type annotations and code completion for boto3.resource("ec2").SecurityGroup method.
 boto3 documentation
# SecurityGroup method definition
def SecurityGroup(
    self,
    id: str,
) -> _SecurityGroup:
    ...EC2ServiceResource.Snapshot method#
Creates a Snapshot resource.
Type annotations and code completion for boto3.resource("ec2").Snapshot method.
 boto3 documentation
# Snapshot method definition
def Snapshot(
    self,
    id: str,
) -> _Snapshot:
    ...EC2ServiceResource.Subnet method#
Creates a Subnet resource.
Type annotations and code completion for boto3.resource("ec2").Subnet method.
 boto3 documentation
# Subnet method definition
def Subnet(
    self,
    id: str,
) -> _Subnet:
    ...EC2ServiceResource.Tag method#
Creates a Tag resource.
Type annotations and code completion for boto3.resource("ec2").Tag method.
 boto3 documentation
# Tag method definition
def Tag(
    self,
    resource_id: str,
    key: str,
    value: str,
) -> _Tag:
    ...EC2ServiceResource.Volume method#
Creates a Volume resource.
Type annotations and code completion for boto3.resource("ec2").Volume method.
 boto3 documentation
# Volume method definition
def Volume(
    self,
    id: str,
) -> _Volume:
    ...EC2ServiceResource.Vpc method#
Creates a Vpc resource.
Type annotations and code completion for boto3.resource("ec2").Vpc method.
 boto3 documentation
# Vpc method definition
def Vpc(
    self,
    id: str,
) -> _Vpc:
    ...EC2ServiceResource.VpcPeeringConnection method#
Creates a VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").VpcPeeringConnection method.
 boto3 documentation
# VpcPeeringConnection method definition
def VpcPeeringConnection(
    self,
    id: str,
) -> _VpcPeeringConnection:
    ...EC2ServiceResource.VpcAddress method#
Creates a VpcAddress resource.
Type annotations and code completion for boto3.resource("ec2").VpcAddress method.
 boto3 documentation
# VpcAddress method definition
def VpcAddress(
    self,
    allocation_id: str,
) -> _VpcAddress:
    ...ClassicAddress#
Type annotations and code completion for boto3.resource("ec2").ClassicAddress class.
 boto3 documentation
# ClassicAddress usage example
from types_boto3_ec2.service_resource import ClassicAddress
def get_resource() -> ClassicAddress:
    return boto3.resource("ec2").ClassicAddress(...)ClassicAddress attributes#
- public_ip:- str
- allocation_id:- str
- association_id:- str
- domain: DomainTypeType
- network_interface_id:- str
- network_interface_owner_id:- str
- private_ip_address:- str
- tags:- List[TagTypeDef]
- public_ipv4_pool:- str
- network_border_group:- str
- customer_owned_ip:- str
- customer_owned_ipv4_pool:- str
- carrier_ip:- str
- subnet_id:- str
- service_managed: ServiceManagedType
- instance_id:- str
- meta:- EC2ResourceMeta
ClassicAddress methods#
ClassicAddress.get_available_subresources method#
Returns a list of all the available sub-resources for this ClassicAddress.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").associate method.
 boto3 documentation
# associate method definition
def associate(
    self,
    *,
    AllocationId: str = ...,
    InstanceId: str = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
    AllowReassociation: bool = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...# associate method usage example with argument unpacking
kwargs: AssociateAddressRequestClassicAddressAssociateTypeDef = {  # (1)
    "AllocationId": ...,
}
parent.associate(**kwargs)ClassicAddress.disassociate method#
Disassociates an Elastic IP address from the instance or network interface it's associated with.
Type annotations and code completion for boto3.resource("ec2").disassociate method.
 boto3 documentation
# disassociate method definition
def disassociate(
    self,
    *,
    AssociationId: str = ...,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...# disassociate method usage example with argument unpacking
kwargs: DisassociateAddressRequestClassicAddressDisassociateTypeDef = {  # (1)
    "AssociationId": ...,
}
parent.disassociate(**kwargs)ClassicAddress.release method#
Releases the specified Elastic IP address.
Type annotations and code completion for boto3.resource("ec2").release method.
 boto3 documentation
# release method definition
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)ClassicAddress.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...ClassicAddress.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...DhcpOptions#
Type annotations and code completion for boto3.resource("ec2").DhcpOptions class.
 boto3 documentation
# DhcpOptions usage example
from types_boto3_ec2.service_resource import DhcpOptions
def get_resource() -> DhcpOptions:
    return boto3.resource("ec2").DhcpOptions(...)DhcpOptions attributes#
- id:- str
- owner_id:- str
- tags:- List[TagTypeDef]
- dhcp_options_id:- str
- dhcp_configurations:- List[DhcpConfigurationTypeDef]
- meta:- EC2ResourceMeta
DhcpOptions methods#
DhcpOptions.get_available_subresources method#
Returns a list of all the available sub-resources for this DhcpOptions.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").associate_with_vpc method.
 boto3 documentation
# associate_with_vpc method definition
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)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: DhcpOptionsCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)DhcpOptions.delete method#
Deletes the specified set of DHCP options.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteDhcpOptionsRequestDhcpOptionsDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)DhcpOptions.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...DhcpOptions.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Image#
Type annotations and code completion for boto3.resource("ec2").Image class.
 boto3 documentation
# Image usage example
from types_boto3_ec2.service_resource import Image
def get_resource() -> Image:
    return boto3.resource("ec2").Image(...)Image attributes#
- id:- str
- platform_details:- str
- usage_operation:- str
- block_device_mappings:- List[BlockDeviceMappingTypeDef]
- description:- str
- ena_support:- bool
- hypervisor: HypervisorTypeType
- image_owner_alias:- str
- name:- str
- root_device_name:- str
- root_device_type: DeviceTypeType
- sriov_net_support:- str
- state_reason: StateReasonTypeDef
- tags:- List[TagTypeDef]
- virtualization_type: VirtualizationTypeType
- boot_mode: BootModeValuesType
- tpm_support:- Literal['v2.0'](see TpmSupportValuesType)
- deprecation_time:- str
- imds_support:- Literal['v2.0'](see ImdsSupportValuesType)
- source_instance_id:- str
- deregistration_protection:- str
- last_launched_time:- str
- image_allowed:- bool
- source_image_id:- str
- source_image_region:- str
- free_tier_eligible:- bool
- image_id:- str
- image_location:- str
- state: ImageStateType
- owner_id:- str
- creation_date:- str
- public:- bool
- product_codes:- List[ProductCodeTypeDef]
- architecture: ArchitectureValuesType
- image_type: ImageTypeValuesType
- kernel_id:- str
- ramdisk_id:- str
- platform:- Literal['windows'](see PlatformValuesType)
- meta:- EC2ResourceMeta
Image methods#
Image.get_available_subresources method#
Returns a list of all the available sub-resources for this Image.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: ImageCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Image.deregister method#
Deregisters the specified AMI.
Type annotations and code completion for boto3.resource("ec2").deregister method.
 boto3 documentation
# deregister method definition
def deregister(
    self,
    *,
    DeleteAssociatedSnapshots: bool = ...,
    DryRun: bool = ...,
) -> DeregisterImageResultTypeDef:  # (1)
    ...# deregister method usage example with argument unpacking
kwargs: DeregisterImageRequestImageDeregisterTypeDef = {  # (1)
    "DeleteAssociatedSnapshots": ...,
}
parent.deregister(**kwargs)Image.describe_attribute method#
Describes the specified attribute of the specified AMI.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    Attribute: ImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> ImageAttributeTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeImageAttributeRequestImageDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.describe_attribute(**kwargs)Image.modify_attribute method#
Modifies the specified attribute of the specified AMI.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
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 = ...,
    OrganizationArns: Sequence[str] = ...,
    OrganizationalUnitArns: Sequence[str] = ...,
    ImdsSupport: AttributeValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See AttributeValueTypeDef
- See LaunchPermissionModificationsTypeDef
- See OperationTypeType
- See AttributeValueTypeDef
# modify_attribute method usage example with argument unpacking
kwargs: ModifyImageAttributeRequestImageModifyAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.modify_attribute(**kwargs)Image.reset_attribute method#
Resets an attribute of an AMI to its default value.
Type annotations and code completion for boto3.resource("ec2").reset_attribute method.
 boto3 documentation
# reset_attribute method definition
def reset_attribute(
    self,
    *,
    Attribute: ResetImageAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_attribute method usage example with argument unpacking
kwargs: ResetImageAttributeRequestImageResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_attribute(**kwargs)Image.wait_until_exists method#
Waits until Image is exists.
Type annotations and code completion for boto3.resource("ec2").wait_until_exists method.
 boto3 documentation
# wait_until_exists method definition
def wait_until_exists(
    self,
) -> None:
    ...Image.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Image.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Instance#
Type annotations and code completion for boto3.resource("ec2").Instance class.
 boto3 documentation
# Instance usage example
from types_boto3_ec2.service_resource import Instance
def get_resource() -> Instance:
    return boto3.resource("ec2").Instance(...)Instance attributes#
- id:- str
- classic_address:- ClassicAddress
- image:- Image
- key_pair:- KeyPairInfo
- network_interfaces:- List[- NetworkInterface]
- placement_group:- PlacementGroup
- subnet:- Subnet
- vpc:- Vpc
- volumes:- InstanceVolumesCollection
- vpc_addresses:- InstanceVpcAddressesCollection
- architecture: ArchitectureValuesType
- block_device_mappings:- List[InstanceBlockDeviceMappingTypeDef]
- client_token:- str
- ebs_optimized:- bool
- ena_support:- bool
- hypervisor: HypervisorTypeType
- iam_instance_profile: IamInstanceProfileTypeDef
- instance_lifecycle: InstanceLifecycleTypeType
- elastic_gpu_associations:- List[ElasticGpuAssociationTypeDef]
- elastic_inference_accelerator_associations:- List[ElasticInferenceAcceleratorAssociationTypeDef]
- network_interfaces_attribute:- List[InstanceNetworkInterfaceTypeDef]
- outpost_arn:- str
- root_device_name:- str
- root_device_type: DeviceTypeType
- security_groups:- List[GroupIdentifierTypeDef]
- source_dest_check:- bool
- spot_instance_request_id:- str
- sriov_net_support:- str
- state_reason: StateReasonTypeDef
- tags:- List[TagTypeDef]
- virtualization_type: VirtualizationTypeType
- cpu_options: CpuOptionsTypeDef
- capacity_block_id:- str
- capacity_reservation_id:- str
- capacity_reservation_specification: CapacityReservationSpecificationResponseTypeDef
- hibernation_options: HibernationOptionsTypeDef
- licenses:- List[LicenseConfigurationTypeDef]
- metadata_options: InstanceMetadataOptionsResponseTypeDef
- enclave_options: EnclaveOptionsTypeDef
- boot_mode: BootModeValuesType
- platform_details:- str
- usage_operation:- str
- usage_operation_update_time:- datetime.datetime
- private_dns_name_options: PrivateDnsNameOptionsResponseTypeDef
- ipv6_address:- str
- tpm_support:- str
- maintenance_options: InstanceMaintenanceOptionsTypeDef
- current_instance_boot_mode: InstanceBootModeValuesType
- network_performance_options: InstanceNetworkPerformanceOptionsTypeDef
- operator: OperatorResponseTypeDef
- instance_id:- str
- image_id:- str
- state: InstanceStateTypeDef
- private_dns_name:- str
- public_dns_name:- str
- state_transition_reason:- str
- key_name:- str
- ami_launch_index:- int
- product_codes:- List[ProductCodeTypeDef]
- instance_type: InstanceTypeType
- launch_time:- datetime.datetime
- placement: PlacementTypeDef
- kernel_id:- str
- ramdisk_id:- str
- platform:- Literal['windows'](see PlatformValuesType)
- monitoring: MonitoringTypeDef
- subnet_id:- str
- vpc_id:- str
- private_ip_address:- str
- public_ip_address:- str
- meta:- EC2ResourceMeta
Instance collections#
Instance.volumes#
Provides access to Volume resource.
Type annotations and code completion for boto3.resource("ec2").Instance(...).volumes collection.
 boto3 documentation
# InstanceVolumesCollection usage example
from types_boto3_ec2.service_resource import InstanceVolumesCollection
def get_collection() -> InstanceVolumesCollection:
    resource = boto3.resource("ec2").Instance(...)
    return resource.volumesInstance.vpc_addresses#
Provides access to VpcAddress resource.
Type annotations and code completion for boto3.resource("ec2").Instance(...).vpc_addresses collection.
 boto3 documentation
# InstanceVpcAddressesCollection usage example
from types_boto3_ec2.service_resource import InstanceVpcAddressesCollection
def get_collection() -> InstanceVpcAddressesCollection:
    resource = boto3.resource("ec2").Instance(...)
    return resource.vpc_addressesInstance methods#
Instance.get_available_subresources method#
Returns a list of all the available sub-resources for this Instance.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Instance.attach_classic_link_vpc method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").attach_classic_link_vpc method.
 boto3 documentation
# attach_classic_link_vpc method definition
def attach_classic_link_vpc(
    self,
    *,
    VpcId: str,
    Groups: Sequence[str],
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...# attach_classic_link_vpc method usage example with argument unpacking
kwargs: AttachClassicLinkVpcRequestInstanceAttachClassicLinkVpcTypeDef = {  # (1)
    "VpcId": ...,
    "Groups": ...,
}
parent.attach_classic_link_vpc(**kwargs)Instance.attach_volume method#
Attaches an Amazon 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 boto3.resource("ec2").attach_volume method.
 boto3 documentation
# attach_volume method definition
def attach_volume(
    self,
    *,
    Device: str,
    VolumeId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...# attach_volume method usage example with argument unpacking
kwargs: AttachVolumeRequestInstanceAttachVolumeTypeDef = {  # (1)
    "Device": ...,
    "VolumeId": ...,
}
parent.attach_volume(**kwargs)Instance.console_output method#
Gets the console output for the specified instance.
Type annotations and code completion for boto3.resource("ec2").console_output method.
 boto3 documentation
# console_output method definition
def console_output(
    self,
    *,
    Latest: bool = ...,
    DryRun: bool = ...,
) -> GetConsoleOutputResultTypeDef:  # (1)
    ...# console_output method usage example with argument unpacking
kwargs: GetConsoleOutputRequestInstanceConsoleOutputTypeDef = {  # (1)
    "Latest": ...,
}
parent.console_output(**kwargs)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 boto3.resource("ec2").create_image method.
 boto3 documentation
# create_image method definition
def create_image(
    self,
    *,
    Name: str,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    SnapshotLocation: SnapshotLocationEnumType = ...,  # (2)
    DryRun: bool = ...,
    Description: str = ...,
    NoReboot: bool = ...,
    BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ...,  # (3)
) -> _Image:
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See SnapshotLocationEnumType
- See Sequence[BlockDeviceMappingTypeDef]
# create_image method usage example with argument unpacking
kwargs: CreateImageRequestInstanceCreateImageTypeDef = {  # (1)
    "Name": ...,
}
parent.create_image(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: InstanceCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Instance.describe_attribute method#
Describes the specified attribute of the specified instance.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> InstanceAttributeTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeInstanceAttributeRequestInstanceDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.describe_attribute(**kwargs)Instance.detach_classic_link_vpc method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").detach_classic_link_vpc method.
 boto3 documentation
# detach_classic_link_vpc method definition
def detach_classic_link_vpc(
    self,
    *,
    VpcId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...# detach_classic_link_vpc method usage example with argument unpacking
kwargs: DetachClassicLinkVpcRequestInstanceDetachClassicLinkVpcTypeDef = {  # (1)
    "VpcId": ...,
}
parent.detach_classic_link_vpc(**kwargs)Instance.detach_volume method#
Detaches an EBS volume from an instance.
Type annotations and code completion for boto3.resource("ec2").detach_volume method.
 boto3 documentation
# detach_volume method definition
def detach_volume(
    self,
    *,
    VolumeId: str,
    Device: str = ...,
    Force: bool = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...# detach_volume method usage example with argument unpacking
kwargs: DetachVolumeRequestInstanceDetachVolumeTypeDef = {  # (1)
    "VolumeId": ...,
}
parent.detach_volume(**kwargs)Instance.modify_attribute method#
Modifies the specified attribute of the specified instance.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
def modify_attribute(
    self,
    *,
    SourceDestCheck: AttributeBooleanValueTypeDef = ...,  # (1)
    DisableApiStop: AttributeBooleanValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
    Attribute: InstanceAttributeNameType = ...,  # (3)
    Value: str = ...,
    BlockDeviceMappings: Sequence[InstanceBlockDeviceMappingSpecificationTypeDef] = ...,  # (4)
    DisableApiTermination: AttributeBooleanValueTypeDef = ...,  # (1)
    InstanceType: AttributeValueTypeDef = ...,  # (6)
    Kernel: AttributeValueTypeDef = ...,  # (6)
    Ramdisk: AttributeValueTypeDef = ...,  # (6)
    UserData: BlobAttributeValueTypeDef = ...,  # (9)
    InstanceInitiatedShutdownBehavior: AttributeValueTypeDef = ...,  # (6)
    Groups: Sequence[str] = ...,
    EbsOptimized: AttributeBooleanValueTypeDef = ...,  # (1)
    SriovNetSupport: AttributeValueTypeDef = ...,  # (6)
    EnaSupport: AttributeBooleanValueTypeDef = ...,  # (1)
) -> None:
    ...- See AttributeBooleanValueTypeDef
- See AttributeBooleanValueTypeDef
- See InstanceAttributeNameType
- See Sequence[InstanceBlockDeviceMappingSpecificationTypeDef]
- See AttributeBooleanValueTypeDef
- See AttributeValueTypeDef
- See AttributeValueTypeDef
- See AttributeValueTypeDef
- See BlobAttributeValueTypeDef
- See AttributeValueTypeDef
- See AttributeBooleanValueTypeDef
- See AttributeValueTypeDef
- See AttributeBooleanValueTypeDef
# modify_attribute method usage example with argument unpacking
kwargs: ModifyInstanceAttributeRequestInstanceModifyAttributeTypeDef = {  # (1)
    "SourceDestCheck": ...,
}
parent.modify_attribute(**kwargs)Instance.monitor method#
Enables detailed monitoring for a running instance.
Type annotations and code completion for boto3.resource("ec2").monitor method.
 boto3 documentation
# monitor method definition
def monitor(
    self,
    *,
    DryRun: bool = ...,
) -> MonitorInstancesResultTypeDef:  # (1)
    ...# monitor method usage example with argument unpacking
kwargs: MonitorInstancesRequestInstanceMonitorTypeDef = {  # (1)
    "DryRun": ...,
}
parent.monitor(**kwargs)Instance.password_data method#
Retrieves the encrypted administrator password for a running Windows instance.
Type annotations and code completion for boto3.resource("ec2").password_data method.
 boto3 documentation
# password_data method definition
def password_data(
    self,
    *,
    DryRun: bool = ...,
) -> GetPasswordDataResultTypeDef:  # (1)
    ...# password_data method usage example with argument unpacking
kwargs: GetPasswordDataRequestInstancePasswordDataTypeDef = {  # (1)
    "DryRun": ...,
}
parent.password_data(**kwargs)Instance.reboot method#
Requests a reboot of the specified instances.
Type annotations and code completion for boto3.resource("ec2").reboot method.
 boto3 documentation
# reboot method definition
def reboot(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# reboot method usage example with argument unpacking
kwargs: RebootInstancesRequestInstanceRebootTypeDef = {  # (1)
    "DryRun": ...,
}
parent.reboot(**kwargs)Instance.report_status method#
Submits feedback about the status of an instance.
Type annotations and code completion for boto3.resource("ec2").report_status method.
 boto3 documentation
# report_status method definition
def report_status(
    self,
    *,
    Status: ReportStatusTypeType,  # (1)
    ReasonCodes: Sequence[ReportInstanceReasonCodesType],  # (2)
    DryRun: bool = ...,
    StartTime: TimestampTypeDef = ...,
    EndTime: TimestampTypeDef = ...,
    Description: str = ...,
) -> None:
    ...- See ReportStatusTypeType
- See Sequence[ReportInstanceReasonCodesType]
# report_status method usage example with argument unpacking
kwargs: ReportInstanceStatusRequestInstanceReportStatusTypeDef = {  # (1)
    "Status": ...,
    "ReasonCodes": ...,
}
parent.report_status(**kwargs)Instance.reset_attribute method#
Resets an attribute of an instance to its default value.
Type annotations and code completion for boto3.resource("ec2").reset_attribute method.
 boto3 documentation
# reset_attribute method definition
def reset_attribute(
    self,
    *,
    Attribute: InstanceAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_attribute method usage example with argument unpacking
kwargs: ResetInstanceAttributeRequestInstanceResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_attribute(**kwargs)Instance.reset_kernel method#
Resets an attribute of an instance to its default value.
Type annotations and code completion for boto3.resource("ec2").reset_kernel method.
 boto3 documentation
# reset_kernel method definition
def reset_kernel(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'kernel',  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_kernel method usage example with argument unpacking
kwargs: ResetInstanceAttributeRequestInstanceResetKernelTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_kernel(**kwargs)Instance.reset_ramdisk method#
Resets an attribute of an instance to its default value.
Type annotations and code completion for boto3.resource("ec2").reset_ramdisk method.
 boto3 documentation
# reset_ramdisk method definition
def reset_ramdisk(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'ramdisk',  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_ramdisk method usage example with argument unpacking
kwargs: ResetInstanceAttributeRequestInstanceResetRamdiskTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_ramdisk(**kwargs)Instance.reset_source_dest_check method#
Resets an attribute of an instance to its default value.
Type annotations and code completion for boto3.resource("ec2").reset_source_dest_check method.
 boto3 documentation
# reset_source_dest_check method definition
def reset_source_dest_check(
    self,
    *,
    Attribute: InstanceAttributeNameType = 'sourceDestCheck',  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_source_dest_check method usage example with argument unpacking
kwargs: ResetInstanceAttributeRequestInstanceResetSourceDestCheckTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_source_dest_check(**kwargs)Instance.start method#
Starts an Amazon EBS-backed instance that you've previously stopped.
Type annotations and code completion for boto3.resource("ec2").start method.
 boto3 documentation
# start method definition
def start(
    self,
    *,
    AdditionalInfo: str = ...,
    DryRun: bool = ...,
) -> StartInstancesResultTypeDef:  # (1)
    ...# start method usage example with argument unpacking
kwargs: StartInstancesRequestInstanceStartTypeDef = {  # (1)
    "AdditionalInfo": ...,
}
parent.start(**kwargs)Instance.stop method#
Stops an Amazon EBS-backed instance.
Type annotations and code completion for boto3.resource("ec2").stop method.
 boto3 documentation
# stop method definition
def stop(
    self,
    *,
    Hibernate: bool = ...,
    SkipOsShutdown: bool = ...,
    DryRun: bool = ...,
    Force: bool = ...,
) -> StopInstancesResultTypeDef:  # (1)
    ...# stop method usage example with argument unpacking
kwargs: StopInstancesRequestInstanceStopTypeDef = {  # (1)
    "Hibernate": ...,
}
parent.stop(**kwargs)Instance.terminate method#
Shuts down the specified instances.
Type annotations and code completion for boto3.resource("ec2").terminate method.
 boto3 documentation
# terminate method definition
def terminate(
    self,
    *,
    Force: bool = ...,
    SkipOsShutdown: bool = ...,
    DryRun: bool = ...,
) -> TerminateInstancesResultTypeDef:  # (1)
    ...# terminate method usage example with argument unpacking
kwargs: TerminateInstancesRequestInstanceTerminateTypeDef = {  # (1)
    "Force": ...,
}
parent.terminate(**kwargs)Instance.unmonitor method#
Disables detailed monitoring for a running instance.
Type annotations and code completion for boto3.resource("ec2").unmonitor method.
 boto3 documentation
# unmonitor method definition
def unmonitor(
    self,
    *,
    DryRun: bool = ...,
) -> UnmonitorInstancesResultTypeDef:  # (1)
    ...# unmonitor method usage example with argument unpacking
kwargs: UnmonitorInstancesRequestInstanceUnmonitorTypeDef = {  # (1)
    "DryRun": ...,
}
parent.unmonitor(**kwargs)Instance.wait_until_exists method#
Waits until Instance is exists.
Type annotations and code completion for boto3.resource("ec2").wait_until_exists method.
 boto3 documentation
# wait_until_exists method definition
def wait_until_exists(
    self,
) -> None:
    ...Instance.wait_until_running method#
Waits until Instance is running.
Type annotations and code completion for boto3.resource("ec2").wait_until_running method.
 boto3 documentation
# wait_until_running method definition
def wait_until_running(
    self,
) -> None:
    ...Instance.wait_until_stopped method#
Waits until Instance is stopped.
Type annotations and code completion for boto3.resource("ec2").wait_until_stopped method.
 boto3 documentation
# wait_until_stopped method definition
def wait_until_stopped(
    self,
) -> None:
    ...Instance.wait_until_terminated method#
Waits until Instance is terminated.
Type annotations and code completion for boto3.resource("ec2").wait_until_terminated method.
 boto3 documentation
# wait_until_terminated method definition
def wait_until_terminated(
    self,
) -> None:
    ...Instance.delete_tags method#
Deletes the specified set of tags from the specified set of resources.
Type annotations and code completion for boto3.resource("ec2").delete_tags method.
 boto3 documentation
# delete_tags method definition
def delete_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# delete_tags method usage example with argument unpacking
kwargs: InstanceDeleteTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.delete_tags(**kwargs)Instance.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Instance.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...InternetGateway#
Type annotations and code completion for boto3.resource("ec2").InternetGateway class.
 boto3 documentation
# InternetGateway usage example
from types_boto3_ec2.service_resource import InternetGateway
def get_resource() -> InternetGateway:
    return boto3.resource("ec2").InternetGateway(...)InternetGateway attributes#
- id:- str
- attachments:- List[InternetGatewayAttachmentTypeDef]
- internet_gateway_id:- str
- owner_id:- str
- tags:- List[TagTypeDef]
- meta:- EC2ResourceMeta
InternetGateway methods#
InternetGateway.get_available_subresources method#
Returns a list of all the available sub-resources for this InternetGateway.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").attach_to_vpc method.
 boto3 documentation
# attach_to_vpc method definition
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)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: InternetGatewayCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)InternetGateway.delete method#
Deletes the specified internet gateway.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteInternetGatewayRequestInternetGatewayDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)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 boto3.resource("ec2").detach_from_vpc method.
 boto3 documentation
# detach_from_vpc method definition
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)InternetGateway.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...InternetGateway.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...KeyPair#
Type annotations and code completion for boto3.resource("ec2").KeyPair class.
 boto3 documentation
# KeyPair usage example
from types_boto3_ec2.service_resource import KeyPair
def get_resource() -> KeyPair:
    return boto3.resource("ec2").KeyPair(...)KeyPair attributes#
- name:- str
- key_pair_id:- str
- tags:- List[TagTypeDef]
- key_name:- str
- key_fingerprint:- str
- key_material:- str
- meta:- EC2ResourceMeta
KeyPair methods#
KeyPair.get_available_subresources method#
Returns a list of all the available sub-resources for this KeyPair.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...KeyPair.delete method#
Deletes the specified key pair, by removing the public key from Amazon EC2.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> DeleteKeyPairResultTypeDef:  # (1)
    ...# delete method usage example with argument unpacking
kwargs: DeleteKeyPairRequestKeyPairDeleteTypeDef = {  # (1)
    "KeyPairId": ...,
}
parent.delete(**kwargs)KeyPairInfo#
Type annotations and code completion for boto3.resource("ec2").KeyPairInfo class.
 boto3 documentation
# KeyPairInfo usage example
from types_boto3_ec2.service_resource import KeyPairInfo
def get_resource() -> KeyPairInfo:
    return boto3.resource("ec2").KeyPairInfo(...)KeyPairInfo attributes#
- name:- str
- key_pair_id:- str
- key_type: KeyTypeType
- tags:- List[TagTypeDef]
- public_key:- str
- create_time:- datetime.datetime
- key_name:- str
- key_fingerprint:- str
- meta:- EC2ResourceMeta
KeyPairInfo methods#
KeyPairInfo.get_available_subresources method#
Returns a list of all the available sub-resources for this KeyPairInfo.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...KeyPairInfo.delete method#
Deletes the specified key pair, by removing the public key from Amazon EC2.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    KeyPairId: str = ...,
    DryRun: bool = ...,
) -> DeleteKeyPairResultTypeDef:  # (1)
    ...# delete method usage example with argument unpacking
kwargs: DeleteKeyPairRequestKeyPairInfoDeleteTypeDef = {  # (1)
    "KeyPairId": ...,
}
parent.delete(**kwargs)KeyPairInfo.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...KeyPairInfo.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...NetworkAcl#
Type annotations and code completion for boto3.resource("ec2").NetworkAcl class.
 boto3 documentation
# NetworkAcl usage example
from types_boto3_ec2.service_resource import NetworkAcl
def get_resource() -> NetworkAcl:
    return boto3.resource("ec2").NetworkAcl(...)NetworkAcl attributes#
- id:- str
- vpc:- Vpc
- associations:- List[NetworkAclAssociationTypeDef]
- entries:- List[NetworkAclEntryTypeDef]
- is_default:- bool
- network_acl_id:- str
- tags:- List[TagTypeDef]
- vpc_id:- str
- owner_id:- str
- meta:- EC2ResourceMeta
NetworkAcl methods#
NetworkAcl.get_available_subresources method#
Returns a list of all the available sub-resources for this NetworkAcl.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...NetworkAcl.create_entry method#
Creates an entry (a rule) in a network ACL with the specified rule number.
Type annotations and code completion for boto3.resource("ec2").create_entry method.
 boto3 documentation
# create_entry method definition
def create_entry(
    self,
    *,
    RuleNumber: int,
    Protocol: str,
    RuleAction: RuleActionType,  # (1)
    Egress: bool,
    DryRun: bool = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    IcmpTypeCode: IcmpTypeCodeTypeDef = ...,  # (2)
    PortRange: PortRangeTypeDef = ...,  # (3)
) -> None:
    ...- See RuleActionType
- See IcmpTypeCodeTypeDef
- See PortRangeTypeDef
# create_entry method usage example with argument unpacking
kwargs: CreateNetworkAclEntryRequestNetworkAclCreateEntryTypeDef = {  # (1)
    "RuleNumber": ...,
    "Protocol": ...,
    "RuleAction": ...,
    "Egress": ...,
}
parent.create_entry(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: NetworkAclCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)NetworkAcl.delete method#
Deletes the specified network ACL.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteNetworkAclRequestNetworkAclDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)NetworkAcl.delete_entry method#
Deletes the specified ingress or egress entry (rule) from the specified network ACL.
Type annotations and code completion for boto3.resource("ec2").delete_entry method.
 boto3 documentation
# delete_entry method definition
def delete_entry(
    self,
    *,
    RuleNumber: int,
    Egress: bool,
    DryRun: bool = ...,
) -> None:
    ...# delete_entry method usage example with argument unpacking
kwargs: DeleteNetworkAclEntryRequestNetworkAclDeleteEntryTypeDef = {  # (1)
    "RuleNumber": ...,
    "Egress": ...,
}
parent.delete_entry(**kwargs)NetworkAcl.replace_association method#
Changes which network ACL a subnet is associated with.
Type annotations and code completion for boto3.resource("ec2").replace_association method.
 boto3 documentation
# replace_association method definition
def replace_association(
    self,
    *,
    AssociationId: str,
    DryRun: bool = ...,
) -> ReplaceNetworkAclAssociationResultTypeDef:  # (1)
    ...# replace_association method usage example with argument unpacking
kwargs: ReplaceNetworkAclAssociationRequestNetworkAclReplaceAssociationTypeDef = {  # (1)
    "AssociationId": ...,
}
parent.replace_association(**kwargs)NetworkAcl.replace_entry method#
Replaces an entry (rule) in a network ACL.
Type annotations and code completion for boto3.resource("ec2").replace_entry method.
 boto3 documentation
# replace_entry method definition
def replace_entry(
    self,
    *,
    RuleNumber: int,
    Protocol: str,
    RuleAction: RuleActionType,  # (1)
    Egress: bool,
    DryRun: bool = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    IcmpTypeCode: IcmpTypeCodeTypeDef = ...,  # (2)
    PortRange: PortRangeTypeDef = ...,  # (3)
) -> None:
    ...- See RuleActionType
- See IcmpTypeCodeTypeDef
- See PortRangeTypeDef
# replace_entry method usage example with argument unpacking
kwargs: ReplaceNetworkAclEntryRequestNetworkAclReplaceEntryTypeDef = {  # (1)
    "RuleNumber": ...,
    "Protocol": ...,
    "RuleAction": ...,
    "Egress": ...,
}
parent.replace_entry(**kwargs)NetworkAcl.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...NetworkAcl.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...NetworkInterface#
Type annotations and code completion for boto3.resource("ec2").NetworkInterface class.
 boto3 documentation
# NetworkInterface usage example
from types_boto3_ec2.service_resource import NetworkInterface
def get_resource() -> NetworkInterface:
    return boto3.resource("ec2").NetworkInterface(...)NetworkInterface attributes#
- id:- str
- association:- NetworkInterfaceAssociation
- subnet:- Subnet
- vpc:- Vpc
- association_attribute: NetworkInterfaceAssociationTypeDef
- attachment: NetworkInterfaceAttachmentTypeDef
- availability_zone:- str
- connection_tracking_configuration: ConnectionTrackingConfigurationTypeDef
- description:- str
- groups:- List[GroupIdentifierTypeDef]
- interface_type: NetworkInterfaceTypeType
- ipv6_addresses:- List[NetworkInterfaceIpv6AddressTypeDef]
- mac_address:- str
- network_interface_id:- str
- outpost_arn:- str
- owner_id:- str
- private_dns_name:- str
- public_dns_name:- str
- public_ip_dns_name_options: PublicIpDnsNameOptionsTypeDef
- private_ip_address:- str
- private_ip_addresses:- List[NetworkInterfacePrivateIpAddressTypeDef]
- ipv4_prefixes:- List[Ipv4PrefixSpecificationTypeDef]
- ipv6_prefixes:- List[Ipv6PrefixSpecificationTypeDef]
- requester_id:- str
- requester_managed:- bool
- source_dest_check:- bool
- status: NetworkInterfaceStatusType
- subnet_id:- str
- tag_set:- List[TagTypeDef]
- vpc_id:- str
- deny_all_igw_traffic:- bool
- ipv6_native:- bool
- ipv6_address:- str
- operator: OperatorResponseTypeDef
- associated_subnets:- List[- str]
- availability_zone_id:- str
- meta:- EC2ResourceMeta
NetworkInterface methods#
NetworkInterface.get_available_subresources method#
Returns a list of all the available sub-resources for this NetworkInterface.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...NetworkInterface.assign_private_ip_addresses method#
Assigns the specified secondary private IP addresses to the specified network interface.
Type annotations and code completion for boto3.resource("ec2").assign_private_ip_addresses method.
 boto3 documentation
# assign_private_ip_addresses method definition
def assign_private_ip_addresses(
    self,
    *,
    Ipv4Prefixes: Sequence[str] = ...,
    Ipv4PrefixCount: int = ...,
    PrivateIpAddresses: Sequence[str] = ...,
    SecondaryPrivateIpAddressCount: int = ...,
    AllowReassignment: bool = ...,
) -> AssignPrivateIpAddressesResultTypeDef:  # (1)
    ...# assign_private_ip_addresses method usage example with argument unpacking
kwargs: AssignPrivateIpAddressesRequestNetworkInterfaceAssignPrivateIpAddressesTypeDef = {  # (1)
    "Ipv4Prefixes": ...,
}
parent.assign_private_ip_addresses(**kwargs)NetworkInterface.attach method#
Attaches a network interface to an instance.
Type annotations and code completion for boto3.resource("ec2").attach method.
 boto3 documentation
# attach method definition
def attach(
    self,
    *,
    InstanceId: str,
    DeviceIndex: int,
    NetworkCardIndex: int = ...,
    EnaSrdSpecification: EnaSrdSpecificationTypeDef = ...,  # (1)
    EnaQueueCount: int = ...,
    DryRun: bool = ...,
) -> AttachNetworkInterfaceResultTypeDef:  # (2)
    ...# attach method usage example with argument unpacking
kwargs: AttachNetworkInterfaceRequestNetworkInterfaceAttachTypeDef = {  # (1)
    "InstanceId": ...,
    "DeviceIndex": ...,
}
parent.attach(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: NetworkInterfaceCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)NetworkInterface.delete method#
Deletes the specified network interface.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteNetworkInterfaceRequestNetworkInterfaceDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)NetworkInterface.describe_attribute method#
Describes a network interface attribute.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    DryRun: bool = ...,
    Attribute: NetworkInterfaceAttributeType = ...,  # (1)
) -> DescribeNetworkInterfaceAttributeResultTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeNetworkInterfaceAttributeRequestNetworkInterfaceDescribeAttributeTypeDef = {  # (1)
    "DryRun": ...,
}
parent.describe_attribute(**kwargs)NetworkInterface.detach method#
Detaches a network interface from an instance.
Type annotations and code completion for boto3.resource("ec2").detach method.
 boto3 documentation
# detach method definition
def detach(
    self,
    *,
    AttachmentId: str,
    DryRun: bool = ...,
    Force: bool = ...,
) -> None:
    ...# detach method usage example with argument unpacking
kwargs: DetachNetworkInterfaceRequestNetworkInterfaceDetachTypeDef = {  # (1)
    "AttachmentId": ...,
}
parent.detach(**kwargs)NetworkInterface.modify_attribute method#
Modifies the specified network interface attribute.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
def modify_attribute(
    self,
    *,
    EnaSrdSpecification: EnaSrdSpecificationTypeDef = ...,  # (1)
    EnablePrimaryIpv6: bool = ...,
    ConnectionTrackingSpecification: ConnectionTrackingSpecificationRequestTypeDef = ...,  # (2)
    AssociatePublicIpAddress: bool = ...,
    AssociatedSubnetIds: Sequence[str] = ...,
    DryRun: bool = ...,
    Description: AttributeValueTypeDef = ...,  # (3)
    SourceDestCheck: AttributeBooleanValueTypeDef = ...,  # (4)
    Groups: Sequence[str] = ...,
    Attachment: NetworkInterfaceAttachmentChangesTypeDef = ...,  # (5)
) -> None:
    ...- See EnaSrdSpecificationTypeDef
- See ConnectionTrackingSpecificationRequestTypeDef
- See AttributeValueTypeDef
- See AttributeBooleanValueTypeDef
- See NetworkInterfaceAttachmentChangesTypeDef
# modify_attribute method usage example with argument unpacking
kwargs: ModifyNetworkInterfaceAttributeRequestNetworkInterfaceModifyAttributeTypeDef = {  # (1)
    "EnaSrdSpecification": ...,
}
parent.modify_attribute(**kwargs)NetworkInterface.reset_attribute method#
Resets a network interface attribute.
Type annotations and code completion for boto3.resource("ec2").reset_attribute method.
 boto3 documentation
# reset_attribute method definition
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)NetworkInterface.unassign_private_ip_addresses method#
Unassigns the specified secondary private IP addresses or IPv4 Prefix Delegation prefixes from a network interface.
Type annotations and code completion for boto3.resource("ec2").unassign_private_ip_addresses method.
 boto3 documentation
# unassign_private_ip_addresses method definition
def unassign_private_ip_addresses(
    self,
    *,
    Ipv4Prefixes: Sequence[str] = ...,
    PrivateIpAddresses: Sequence[str] = ...,
) -> None:
    ...# unassign_private_ip_addresses method usage example with argument unpacking
kwargs: UnassignPrivateIpAddressesRequestNetworkInterfaceUnassignPrivateIpAddressesTypeDef = {  # (1)
    "Ipv4Prefixes": ...,
}
parent.unassign_private_ip_addresses(**kwargs)NetworkInterface.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...NetworkInterface.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...NetworkInterfaceAssociation#
Type annotations and code completion for boto3.resource("ec2").NetworkInterfaceAssociation class.
 boto3 documentation
# NetworkInterfaceAssociation usage example
from types_boto3_ec2.service_resource import NetworkInterfaceAssociation
def get_resource() -> NetworkInterfaceAssociation:
    return boto3.resource("ec2").NetworkInterfaceAssociation(...)NetworkInterfaceAssociation attributes#
- id:- str
- address:- VpcAddress
- carrier_ip:- str
- customer_owned_ip:- str
- ip_owner_id:- str
- public_dns_name:- str
- public_ip:- str
- meta:- EC2ResourceMeta
NetworkInterfaceAssociation methods#
NetworkInterfaceAssociation.get_available_subresources method#
Returns a list of all the available sub-resources for this NetworkInterfaceAssociation.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...NetworkInterfaceAssociation.delete method#
Disassociates an Elastic IP address from the instance or network interface it's associated with.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    PublicIp: str = ...,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DisassociateAddressRequestNetworkInterfaceAssociationDeleteTypeDef = {  # (1)
    "PublicIp": ...,
}
parent.delete(**kwargs)NetworkInterfaceAssociation.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...NetworkInterfaceAssociation.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...PlacementGroup#
Type annotations and code completion for boto3.resource("ec2").PlacementGroup class.
 boto3 documentation
# PlacementGroup usage example
from types_boto3_ec2.service_resource import PlacementGroup
def get_resource() -> PlacementGroup:
    return boto3.resource("ec2").PlacementGroup(...)PlacementGroup attributes#
- name:- str
- instances:- PlacementGroupInstancesCollection
- group_name:- str
- state: PlacementGroupStateType
- strategy: PlacementStrategyType
- partition_count:- int
- group_id:- str
- tags:- List[TagTypeDef]
- group_arn:- str
- spread_level: SpreadLevelType
- meta:- EC2ResourceMeta
PlacementGroup collections#
PlacementGroup.instances#
Provides access to Instance resource.
Type annotations and code completion for boto3.resource("ec2").PlacementGroup(...).instances collection.
 boto3 documentation
# PlacementGroupInstancesCollection usage example
from types_boto3_ec2.service_resource import PlacementGroupInstancesCollection
def get_collection() -> PlacementGroupInstancesCollection:
    resource = boto3.resource("ec2").PlacementGroup(...)
    return resource.instancesPlacementGroup methods#
PlacementGroup.get_available_subresources method#
Returns a list of all the available sub-resources for this PlacementGroup.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...PlacementGroup.delete method#
Deletes the specified placement group.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeletePlacementGroupRequestPlacementGroupDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)PlacementGroup.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...PlacementGroup.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Route#
Type annotations and code completion for boto3.resource("ec2").Route class.
 boto3 documentation
# Route usage example
from types_boto3_ec2.service_resource import Route
def get_resource() -> Route:
    return boto3.resource("ec2").Route(...)Route attributes#
- route_table_id:- str
- destination_cidr_block:- str
- destination_ipv6_cidr_block:- str
- destination_prefix_list_id:- str
- egress_only_internet_gateway_id:- str
- gateway_id:- str
- instance_id:- str
- instance_owner_id:- str
- nat_gateway_id:- str
- transit_gateway_id:- str
- local_gateway_id:- str
- carrier_gateway_id:- str
- network_interface_id:- str
- origin: RouteOriginType
- state: RouteStateType
- vpc_peering_connection_id:- str
- core_network_arn:- str
- odb_network_arn:- str
- ip_address:- str
- meta:- EC2ResourceMeta
Route methods#
Route.get_available_subresources method#
Returns a list of all the available sub-resources for this Route.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Route.delete method#
Deletes the specified route from the specified route table.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DestinationPrefixListId: str = ...,
    DryRun: bool = ...,
    DestinationIpv6CidrBlock: str = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteRouteRequestRouteDeleteTypeDef = {  # (1)
    "DestinationPrefixListId": ...,
}
parent.delete(**kwargs)Route.replace method#
Replaces an existing route within a route table in a VPC.
Type annotations and code completion for boto3.resource("ec2").replace method.
 boto3 documentation
# replace method definition
def replace(
    self,
    *,
    DestinationPrefixListId: str = ...,
    VpcEndpointId: str = ...,
    LocalTarget: bool = ...,
    TransitGatewayId: str = ...,
    LocalGatewayId: str = ...,
    CarrierGatewayId: str = ...,
    CoreNetworkArn: str = ...,
    OdbNetworkArn: str = ...,
    DryRun: bool = ...,
    GatewayId: str = ...,
    DestinationIpv6CidrBlock: str = ...,
    EgressOnlyInternetGatewayId: str = ...,
    InstanceId: str = ...,
    NetworkInterfaceId: str = ...,
    VpcPeeringConnectionId: str = ...,
    NatGatewayId: str = ...,
) -> None:
    ...# replace method usage example with argument unpacking
kwargs: ReplaceRouteRequestRouteReplaceTypeDef = {  # (1)
    "DestinationPrefixListId": ...,
}
parent.replace(**kwargs)Route.RouteTable method#
Creates a RouteTable resource.
Type annotations and code completion for boto3.resource("ec2").RouteTable method.
 boto3 documentation
# RouteTable method definition
def RouteTable(
    self,
) -> _RouteTable:
    ...RouteTable#
Type annotations and code completion for boto3.resource("ec2").RouteTable class.
 boto3 documentation
# RouteTable usage example
from types_boto3_ec2.service_resource import RouteTable
def get_resource() -> RouteTable:
    return boto3.resource("ec2").RouteTable(...)RouteTable attributes#
- id:- str
- associations:- List[- RouteTableAssociation]
- routes:- List[- Route]
- vpc:- Vpc
- associations_attribute:- List[RouteTableAssociationTypeDef]
- propagating_vgws:- List[PropagatingVgwTypeDef]
- route_table_id:- str
- routes_attribute:- List[RouteTypeDef]
- tags:- List[TagTypeDef]
- vpc_id:- str
- owner_id:- str
- meta:- EC2ResourceMeta
RouteTable methods#
RouteTable.get_available_subresources method#
Returns a list of all the available sub-resources for this RouteTable.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").associate_with_subnet method.
 boto3 documentation
# associate_with_subnet method definition
def associate_with_subnet(
    self,
    *,
    GatewayId: str = ...,
    PublicIpv4Pool: str = ...,
    DryRun: bool = ...,
    SubnetId: str = ...,
) -> _RouteTableAssociation:
    ...# associate_with_subnet method usage example with argument unpacking
kwargs: AssociateRouteTableRequestRouteTableAssociateWithSubnetTypeDef = {  # (1)
    "GatewayId": ...,
}
parent.associate_with_subnet(**kwargs)RouteTable.create_route method#
Creates a route in a route table within a VPC.
Type annotations and code completion for boto3.resource("ec2").create_route method.
 boto3 documentation
# create_route method definition
def create_route(
    self,
    *,
    DestinationPrefixListId: str = ...,
    VpcEndpointId: str = ...,
    TransitGatewayId: str = ...,
    LocalGatewayId: str = ...,
    CarrierGatewayId: str = ...,
    CoreNetworkArn: str = ...,
    OdbNetworkArn: str = ...,
    DryRun: bool = ...,
    DestinationCidrBlock: str = ...,
    GatewayId: str = ...,
    DestinationIpv6CidrBlock: str = ...,
    EgressOnlyInternetGatewayId: str = ...,
    InstanceId: str = ...,
    NetworkInterfaceId: str = ...,
    VpcPeeringConnectionId: str = ...,
    NatGatewayId: str = ...,
) -> _Route:
    ...# create_route method usage example with argument unpacking
kwargs: CreateRouteRequestRouteTableCreateRouteTypeDef = {  # (1)
    "DestinationPrefixListId": ...,
}
parent.create_route(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: RouteTableCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)RouteTable.delete method#
Deletes the specified route table.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteRouteTableRequestRouteTableDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)RouteTable.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...RouteTable.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...RouteTableAssociation#
Type annotations and code completion for boto3.resource("ec2").RouteTableAssociation class.
 boto3 documentation
# RouteTableAssociation usage example
from types_boto3_ec2.service_resource import RouteTableAssociation
def get_resource() -> RouteTableAssociation:
    return boto3.resource("ec2").RouteTableAssociation(...)RouteTableAssociation attributes#
- id:- str
- route_table:- RouteTable
- subnet:- Subnet
- main:- bool
- route_table_association_id:- str
- route_table_id:- str
- subnet_id:- str
- gateway_id:- str
- public_ipv4_pool:- str
- association_state: RouteTableAssociationStateTypeDef
- meta:- EC2ResourceMeta
RouteTableAssociation methods#
RouteTableAssociation.get_available_subresources method#
Returns a list of all the available sub-resources for this RouteTableAssociation.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...RouteTableAssociation.delete method#
Disassociates a subnet or gateway from a route table.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DisassociateRouteTableRequestRouteTableAssociationDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)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 boto3.resource("ec2").replace_subnet method.
 boto3 documentation
# replace_subnet method definition
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)SecurityGroup#
Type annotations and code completion for boto3.resource("ec2").SecurityGroup class.
 boto3 documentation
# SecurityGroup usage example
from types_boto3_ec2.service_resource import SecurityGroup
def get_resource() -> SecurityGroup:
    return boto3.resource("ec2").SecurityGroup(...)SecurityGroup attributes#
- id:- str
- group_id:- str
- ip_permissions_egress:- List[IpPermissionOutputTypeDef]
- tags:- List[TagTypeDef]
- vpc_id:- str
- security_group_arn:- str
- owner_id:- str
- group_name:- str
- description:- str
- ip_permissions:- List[IpPermissionOutputTypeDef]
- meta:- EC2ResourceMeta
SecurityGroup methods#
SecurityGroup.get_available_subresources method#
Returns a list of all the available sub-resources for this SecurityGroup.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...SecurityGroup.authorize_egress method#
Adds the specified outbound (egress) rules to a security group.
Type annotations and code completion for boto3.resource("ec2").authorize_egress method.
 boto3 documentation
# authorize_egress method definition
def authorize_egress(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    IpProtocol: str = ...,
    FromPort: int = ...,
    ToPort: int = ...,
    CidrIp: str = ...,
    IpPermissions: Sequence[IpPermissionUnionTypeDef] = ...,  # (2)
) -> AuthorizeSecurityGroupEgressResultTypeDef:  # (3)
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See Sequence[IpPermissionUnionTypeDef]
- See AuthorizeSecurityGroupEgressResultTypeDef
# authorize_egress method usage example with argument unpacking
kwargs: AuthorizeSecurityGroupEgressRequestSecurityGroupAuthorizeEgressTypeDef = {  # (1)
    "TagSpecifications": ...,
}
parent.authorize_egress(**kwargs)SecurityGroup.authorize_ingress method#
Adds the specified inbound (ingress) rules to a security group.
Type annotations and code completion for boto3.resource("ec2").authorize_ingress method.
 boto3 documentation
# authorize_ingress method definition
def authorize_ingress(
    self,
    *,
    CidrIp: str = ...,
    FromPort: int = ...,
    GroupName: str = ...,
    IpPermissions: Sequence[IpPermissionUnionTypeDef] = ...,  # (1)
    IpProtocol: str = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    ToPort: int = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (2)
    DryRun: bool = ...,
) -> AuthorizeSecurityGroupIngressResultTypeDef:  # (3)
    ...- See Sequence[IpPermissionUnionTypeDef]
- See Sequence[TagSpecificationUnionTypeDef]
- See AuthorizeSecurityGroupIngressResultTypeDef
# authorize_ingress method usage example with argument unpacking
kwargs: AuthorizeSecurityGroupIngressRequestSecurityGroupAuthorizeIngressTypeDef = {  # (1)
    "CidrIp": ...,
}
parent.authorize_ingress(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: SecurityGroupCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)SecurityGroup.delete method#
Deletes a security group.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    GroupName: str = ...,
    DryRun: bool = ...,
) -> DeleteSecurityGroupResultTypeDef:  # (1)
    ...# delete method usage example with argument unpacking
kwargs: DeleteSecurityGroupRequestSecurityGroupDeleteTypeDef = {  # (1)
    "GroupName": ...,
}
parent.delete(**kwargs)SecurityGroup.revoke_egress method#
Removes the specified outbound (egress) rules from the specified security group.
Type annotations and code completion for boto3.resource("ec2").revoke_egress method.
 boto3 documentation
# revoke_egress method definition
def revoke_egress(
    self,
    *,
    SecurityGroupRuleIds: Sequence[str] = ...,
    DryRun: bool = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    IpProtocol: str = ...,
    FromPort: int = ...,
    ToPort: int = ...,
    CidrIp: str = ...,
    IpPermissions: Sequence[IpPermissionUnionTypeDef] = ...,  # (1)
) -> RevokeSecurityGroupEgressResultTypeDef:  # (2)
    ...- See Sequence[IpPermissionUnionTypeDef]
- See RevokeSecurityGroupEgressResultTypeDef
# revoke_egress method usage example with argument unpacking
kwargs: RevokeSecurityGroupEgressRequestSecurityGroupRevokeEgressTypeDef = {  # (1)
    "SecurityGroupRuleIds": ...,
}
parent.revoke_egress(**kwargs)SecurityGroup.revoke_ingress method#
Removes the specified inbound (ingress) rules from a security group.
Type annotations and code completion for boto3.resource("ec2").revoke_ingress method.
 boto3 documentation
# revoke_ingress method definition
def revoke_ingress(
    self,
    *,
    CidrIp: str = ...,
    FromPort: int = ...,
    GroupName: str = ...,
    IpPermissions: Sequence[IpPermissionUnionTypeDef] = ...,  # (1)
    IpProtocol: str = ...,
    SourceSecurityGroupName: str = ...,
    SourceSecurityGroupOwnerId: str = ...,
    ToPort: int = ...,
    SecurityGroupRuleIds: Sequence[str] = ...,
    DryRun: bool = ...,
) -> RevokeSecurityGroupIngressResultTypeDef:  # (2)
    ...- See Sequence[IpPermissionUnionTypeDef]
- See RevokeSecurityGroupIngressResultTypeDef
# revoke_ingress method usage example with argument unpacking
kwargs: RevokeSecurityGroupIngressRequestSecurityGroupRevokeIngressTypeDef = {  # (1)
    "CidrIp": ...,
}
parent.revoke_ingress(**kwargs)SecurityGroup.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...SecurityGroup.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Snapshot#
Type annotations and code completion for boto3.resource("ec2").Snapshot class.
 boto3 documentation
# Snapshot usage example
from types_boto3_ec2.service_resource import Snapshot
def get_resource() -> Snapshot:
    return boto3.resource("ec2").Snapshot(...)Snapshot attributes#
- id:- str
- volume:- Volume
- owner_alias:- str
- outpost_arn:- str
- tags:- List[TagTypeDef]
- storage_tier: StorageTierType
- restore_expiry_time:- datetime.datetime
- sse_type: SSETypeType
- availability_zone:- str
- transfer_type: TransferTypeType
- completion_duration_minutes:- int
- completion_time:- datetime.datetime
- full_snapshot_size_in_bytes:- int
- snapshot_id:- str
- volume_id:- str
- state: SnapshotStateType
- state_message:- str
- start_time:- datetime.datetime
- progress:- str
- owner_id:- str
- description:- str
- volume_size:- int
- encrypted:- bool
- kms_key_id:- str
- data_encryption_key_id:- str
- meta:- EC2ResourceMeta
Snapshot methods#
Snapshot.get_available_subresources method#
Returns a list of all the available sub-resources for this Snapshot.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Snapshot.copy method#
Creates an exact copy of an Amazon EBS snapshot.
Type annotations and code completion for boto3.resource("ec2").copy method.
 boto3 documentation
# copy method definition
def copy(
    self,
    *,
    SourceRegion: str,
    Description: str = ...,
    DestinationOutpostArn: str = ...,
    DestinationRegion: str = ...,
    Encrypted: bool = ...,
    KmsKeyId: str = ...,
    PresignedUrl: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    CompletionDurationMinutes: int = ...,
    DestinationAvailabilityZone: str = ...,
    DryRun: bool = ...,
) -> CopySnapshotResultTypeDef:  # (2)
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See CopySnapshotResultTypeDef
# copy method usage example with argument unpacking
kwargs: CopySnapshotRequestSnapshotCopyTypeDef = {  # (1)
    "SourceRegion": ...,
}
parent.copy(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: SnapshotCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Snapshot.delete method#
Deletes the specified snapshot.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteSnapshotRequestSnapshotDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)Snapshot.describe_attribute method#
Describes the specified attribute of the specified snapshot.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeSnapshotAttributeResultTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeSnapshotAttributeRequestSnapshotDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.describe_attribute(**kwargs)Snapshot.modify_attribute method#
Adds or removes permission settings for the specified snapshot.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
def modify_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType = ...,  # (1)
    CreateVolumePermission: CreateVolumePermissionModificationsTypeDef = ...,  # (2)
    GroupNames: Sequence[str] = ...,
    OperationType: OperationTypeType = ...,  # (3)
    UserIds: Sequence[str] = ...,
    DryRun: bool = ...,
) -> None:
    ...# modify_attribute method usage example with argument unpacking
kwargs: ModifySnapshotAttributeRequestSnapshotModifyAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.modify_attribute(**kwargs)Snapshot.reset_attribute method#
Resets permission settings for the specified snapshot.
Type annotations and code completion for boto3.resource("ec2").reset_attribute method.
 boto3 documentation
# reset_attribute method definition
def reset_attribute(
    self,
    *,
    Attribute: SnapshotAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> None:
    ...# reset_attribute method usage example with argument unpacking
kwargs: ResetSnapshotAttributeRequestSnapshotResetAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.reset_attribute(**kwargs)Snapshot.wait_until_completed method#
Waits until Snapshot is completed.
Type annotations and code completion for boto3.resource("ec2").wait_until_completed method.
 boto3 documentation
# wait_until_completed method definition
def wait_until_completed(
    self,
) -> None:
    ...Snapshot.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Snapshot.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Subnet#
Type annotations and code completion for boto3.resource("ec2").Subnet class.
 boto3 documentation
# Subnet usage example
from types_boto3_ec2.service_resource import Subnet
def get_resource() -> Subnet:
    return boto3.resource("ec2").Subnet(...)Subnet attributes#
- id:- str
- vpc:- Vpc
- instances:- SubnetInstancesCollection
- network_interfaces:- SubnetNetworkInterfacesCollection
- availability_zone_id:- str
- enable_lni_at_device_index:- int
- map_customer_owned_ip_on_launch:- bool
- customer_owned_ipv4_pool:- str
- owner_id:- str
- assign_ipv6_address_on_creation:- bool
- ipv6_cidr_block_association_set:- List[SubnetIpv6CidrBlockAssociationTypeDef]
- tags:- List[TagTypeDef]
- subnet_arn:- str
- outpost_arn:- str
- enable_dns64:- bool
- ipv6_native:- bool
- private_dns_name_options_on_launch: PrivateDnsNameOptionsOnLaunchTypeDef
- block_public_access_states: BlockPublicAccessStatesTypeDef
- type:- str
- subnet_id:- str
- state: SubnetStateType
- vpc_id:- str
- cidr_block:- str
- available_ip_address_count:- int
- availability_zone:- str
- default_for_az:- bool
- map_public_ip_on_launch:- bool
- meta:- EC2ResourceMeta
Subnet collections#
Subnet.instances#
Provides access to Instance resource.
Type annotations and code completion for boto3.resource("ec2").Subnet(...).instances collection.
 boto3 documentation
# SubnetInstancesCollection usage example
from types_boto3_ec2.service_resource import SubnetInstancesCollection
def get_collection() -> SubnetInstancesCollection:
    resource = boto3.resource("ec2").Subnet(...)
    return resource.instancesSubnet.network_interfaces#
Provides access to NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").Subnet(...).network_interfaces collection.
 boto3 documentation
# SubnetNetworkInterfacesCollection usage example
from types_boto3_ec2.service_resource import SubnetNetworkInterfacesCollection
def get_collection() -> SubnetNetworkInterfacesCollection:
    resource = boto3.resource("ec2").Subnet(...)
    return resource.network_interfacesSubnet methods#
Subnet.get_available_subresources method#
Returns a list of all the available sub-resources for this Subnet.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Subnet.create_instances method#
Launches the specified number of instances using an AMI for which you have permissions.
Type annotations and code completion for boto3.resource("ec2").create_instances method.
 boto3 documentation
# create_instances method definition
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 = ...,
    ElasticGpuSpecification: Sequence[ElasticGpuSpecificationTypeDef] = ...,  # (6)
    ElasticInferenceAccelerators: Sequence[ElasticInferenceAcceleratorTypeDef] = ...,  # (7)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (8)
    LaunchTemplate: LaunchTemplateSpecificationTypeDef = ...,  # (9)
    InstanceMarketOptions: InstanceMarketOptionsRequestTypeDef = ...,  # (10)
    CreditSpecification: CreditSpecificationRequestTypeDef = ...,  # (11)
    CpuOptions: CpuOptionsRequestTypeDef = ...,  # (12)
    CapacityReservationSpecification: CapacityReservationSpecificationTypeDef = ...,  # (13)
    HibernationOptions: HibernationOptionsRequestTypeDef = ...,  # (14)
    LicenseSpecifications: Sequence[LicenseConfigurationRequestTypeDef] = ...,  # (15)
    MetadataOptions: InstanceMetadataOptionsRequestTypeDef = ...,  # (16)
    EnclaveOptions: EnclaveOptionsRequestTypeDef = ...,  # (17)
    PrivateDnsNameOptions: PrivateDnsNameOptionsRequestTypeDef = ...,  # (18)
    MaintenanceOptions: InstanceMaintenanceOptionsRequestTypeDef = ...,  # (19)
    DisableApiStop: bool = ...,
    EnablePrimaryIpv6: bool = ...,
    NetworkPerformanceOptions: InstanceNetworkPerformanceOptionsRequestTypeDef = ...,  # (20)
    Operator: OperatorRequestTypeDef = ...,  # (21)
    DryRun: bool = ...,
    DisableApiTermination: bool = ...,
    InstanceInitiatedShutdownBehavior: ShutdownBehaviorType = ...,  # (22)
    PrivateIpAddress: str = ...,
    ClientToken: str = ...,
    AdditionalInfo: str = ...,
    NetworkInterfaces: Sequence[InstanceNetworkInterfaceSpecificationUnionTypeDef] = ...,  # (23)
    IamInstanceProfile: IamInstanceProfileSpecificationTypeDef = ...,  # (24)
    EbsOptimized: bool = ...,
) -> List[_Instance]:
    ...- See Sequence[BlockDeviceMappingTypeDef]
- See InstanceTypeType
- See Sequence[InstanceIpv6AddressTypeDef]
- See RunInstancesMonitoringEnabledTypeDef
- See PlacementTypeDef
- See Sequence[ElasticGpuSpecificationTypeDef]
- See Sequence[ElasticInferenceAcceleratorTypeDef]
- See Sequence[TagSpecificationUnionTypeDef]
- See LaunchTemplateSpecificationTypeDef
- See InstanceMarketOptionsRequestTypeDef
- See CreditSpecificationRequestTypeDef
- See CpuOptionsRequestTypeDef
- See CapacityReservationSpecificationTypeDef
- See HibernationOptionsRequestTypeDef
- See Sequence[LicenseConfigurationRequestTypeDef]
- See InstanceMetadataOptionsRequestTypeDef
- See EnclaveOptionsRequestTypeDef
- See PrivateDnsNameOptionsRequestTypeDef
- See InstanceMaintenanceOptionsRequestTypeDef
- See InstanceNetworkPerformanceOptionsRequestTypeDef
- See OperatorRequestTypeDef
- See ShutdownBehaviorType
- See Sequence[InstanceNetworkInterfaceSpecificationUnionTypeDef]
- See IamInstanceProfileSpecificationTypeDef
# create_instances method usage example with argument unpacking
kwargs: RunInstancesRequestSubnetCreateInstancesTypeDef = {  # (1)
    "MaxCount": ...,
    "MinCount": ...,
}
parent.create_instances(**kwargs)Subnet.create_network_interface method#
Creates a network interface in the specified subnet.
Type annotations and code completion for boto3.resource("ec2").create_network_interface method.
 boto3 documentation
# create_network_interface method definition
def create_network_interface(
    self,
    *,
    Ipv4Prefixes: Sequence[Ipv4PrefixSpecificationRequestTypeDef] = ...,  # (1)
    Ipv4PrefixCount: int = ...,
    Ipv6Prefixes: Sequence[Ipv6PrefixSpecificationRequestTypeDef] = ...,  # (2)
    Ipv6PrefixCount: int = ...,
    InterfaceType: NetworkInterfaceCreationTypeType = ...,  # (3)
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (4)
    ClientToken: str = ...,
    EnablePrimaryIpv6: bool = ...,
    ConnectionTrackingSpecification: ConnectionTrackingSpecificationRequestTypeDef = ...,  # (5)
    Operator: OperatorRequestTypeDef = ...,  # (6)
    Description: str = ...,
    PrivateIpAddress: str = ...,
    Groups: Sequence[str] = ...,
    PrivateIpAddresses: Sequence[PrivateIpAddressSpecificationTypeDef] = ...,  # (7)
    SecondaryPrivateIpAddressCount: int = ...,
    Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ...,  # (8)
    Ipv6AddressCount: int = ...,
    DryRun: bool = ...,
) -> _NetworkInterface:
    ...- See Sequence[Ipv4PrefixSpecificationRequestTypeDef]
- See Sequence[Ipv6PrefixSpecificationRequestTypeDef]
- See NetworkInterfaceCreationTypeType
- See Sequence[TagSpecificationUnionTypeDef]
- See ConnectionTrackingSpecificationRequestTypeDef
- See OperatorRequestTypeDef
- See Sequence[PrivateIpAddressSpecificationTypeDef]
- See Sequence[InstanceIpv6AddressTypeDef]
# create_network_interface method usage example with argument unpacking
kwargs: CreateNetworkInterfaceRequestSubnetCreateNetworkInterfaceTypeDef = {  # (1)
    "Ipv4Prefixes": ...,
}
parent.create_network_interface(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: SubnetCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Subnet.delete method#
Deletes the specified subnet.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteSubnetRequestSubnetDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)Subnet.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Subnet.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Tag#
Type annotations and code completion for boto3.resource("ec2").Tag class.
 boto3 documentation
# Tag usage example
from types_boto3_ec2.service_resource import Tag
def get_resource() -> Tag:
    return boto3.resource("ec2").Tag(...)Tag attributes#
- resource_id:- str
- key:- str
- value:- str
- resource_type: ResourceTypeType
- meta:- EC2ResourceMeta
Tag methods#
Tag.get_available_subresources method#
Returns a list of all the available sub-resources for this Tag.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Tag.delete method#
Deletes the specified set of tags from the specified set of resources.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteTagsRequestTagDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)Tag.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Tag.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Volume#
Type annotations and code completion for boto3.resource("ec2").Volume class.
 boto3 documentation
# Volume usage example
from types_boto3_ec2.service_resource import Volume
def get_resource() -> Volume:
    return boto3.resource("ec2").Volume(...)Volume attributes#
- id:- str
- snapshots:- VolumeSnapshotsCollection
- availability_zone_id:- str
- outpost_arn:- str
- source_volume_id:- str
- iops:- int
- tags:- List[TagTypeDef]
- volume_type: VolumeTypeType
- fast_restored:- bool
- multi_attach_enabled:- bool
- throughput:- int
- sse_type: SSETypeType
- operator: OperatorResponseTypeDef
- volume_initialization_rate:- int
- volume_id:- str
- size:- int
- snapshot_id:- str
- availability_zone:- str
- state: VolumeStateType
- create_time:- datetime.datetime
- attachments:- List[VolumeAttachmentTypeDef]
- encrypted:- bool
- kms_key_id:- str
- meta:- EC2ResourceMeta
Volume collections#
Volume.snapshots#
Provides access to Snapshot resource.
Type annotations and code completion for boto3.resource("ec2").Volume(...).snapshots collection.
 boto3 documentation
# VolumeSnapshotsCollection usage example
from types_boto3_ec2.service_resource import VolumeSnapshotsCollection
def get_collection() -> VolumeSnapshotsCollection:
    resource = boto3.resource("ec2").Volume(...)
    return resource.snapshotsVolume methods#
Volume.get_available_subresources method#
Returns a list of all the available sub-resources for this Volume.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Volume.attach_to_instance method#
Attaches an Amazon 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 boto3.resource("ec2").attach_to_instance method.
 boto3 documentation
# attach_to_instance method definition
def attach_to_instance(
    self,
    *,
    Device: str,
    InstanceId: str,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...# attach_to_instance method usage example with argument unpacking
kwargs: AttachVolumeRequestVolumeAttachToInstanceTypeDef = {  # (1)
    "Device": ...,
    "InstanceId": ...,
}
parent.attach_to_instance(**kwargs)Volume.create_snapshot method#
Creates a snapshot of an EBS volume and stores it in Amazon S3.
Type annotations and code completion for boto3.resource("ec2").create_snapshot method.
 boto3 documentation
# create_snapshot method definition
def create_snapshot(
    self,
    *,
    Description: str = ...,
    OutpostArn: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    Location: SnapshotLocationEnumType = ...,  # (2)
    DryRun: bool = ...,
) -> _Snapshot:
    ...- See Sequence[TagSpecificationUnionTypeDef]
- See SnapshotLocationEnumType
# create_snapshot method usage example with argument unpacking
kwargs: CreateSnapshotRequestVolumeCreateSnapshotTypeDef = {  # (1)
    "Description": ...,
}
parent.create_snapshot(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: VolumeCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Volume.delete method#
Deletes the specified EBS volume.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteVolumeRequestVolumeDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)Volume.describe_attribute method#
Describes the specified attribute of the specified volume.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    Attribute: VolumeAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVolumeAttributeResultTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeVolumeAttributeRequestVolumeDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.describe_attribute(**kwargs)Volume.describe_status method#
Describes the status of the specified volumes.
Type annotations and code completion for boto3.resource("ec2").describe_status method.
 boto3 documentation
# describe_status method definition
def describe_status(
    self,
    *,
    MaxResults: int = ...,
    NextToken: str = ...,
    DryRun: bool = ...,
    Filters: Sequence[FilterTypeDef] = ...,  # (1)
) -> DescribeVolumeStatusResultTypeDef:  # (2)
    ...- See Sequence[FilterTypeDef]
- See DescribeVolumeStatusResultTypeDef
# describe_status method usage example with argument unpacking
kwargs: DescribeVolumeStatusRequestVolumeDescribeStatusTypeDef = {  # (1)
    "MaxResults": ...,
}
parent.describe_status(**kwargs)Volume.detach_from_instance method#
Detaches an EBS volume from an instance.
Type annotations and code completion for boto3.resource("ec2").detach_from_instance method.
 boto3 documentation
# detach_from_instance method definition
def detach_from_instance(
    self,
    *,
    Device: str = ...,
    Force: bool = ...,
    InstanceId: str = ...,
    DryRun: bool = ...,
) -> VolumeAttachmentResponseTypeDef:  # (1)
    ...# detach_from_instance method usage example with argument unpacking
kwargs: DetachVolumeRequestVolumeDetachFromInstanceTypeDef = {  # (1)
    "Device": ...,
}
parent.detach_from_instance(**kwargs)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 boto3.resource("ec2").enable_io method.
 boto3 documentation
# enable_io method definition
def enable_io(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# enable_io method usage example with argument unpacking
kwargs: EnableVolumeIORequestVolumeEnableIoTypeDef = {  # (1)
    "DryRun": ...,
}
parent.enable_io(**kwargs)Volume.modify_attribute method#
Modifies a volume attribute.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
def modify_attribute(
    self,
    *,
    AutoEnableIO: AttributeBooleanValueTypeDef = ...,  # (1)
    DryRun: bool = ...,
) -> None:
    ...# modify_attribute method usage example with argument unpacking
kwargs: ModifyVolumeAttributeRequestVolumeModifyAttributeTypeDef = {  # (1)
    "AutoEnableIO": ...,
}
parent.modify_attribute(**kwargs)Volume.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Volume.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...Vpc#
Type annotations and code completion for boto3.resource("ec2").Vpc class.
 boto3 documentation
# Vpc usage example
from types_boto3_ec2.service_resource import Vpc
def get_resource() -> Vpc:
    return boto3.resource("ec2").Vpc(...)Vpc attributes#
- id:- str
- dhcp_options:- DhcpOptions
- accepted_vpc_peering_connections:- VpcAcceptedVpcPeeringConnectionsCollection
- instances:- VpcInstancesCollection
- internet_gateways:- VpcInternetGatewaysCollection
- network_acls:- VpcNetworkAclsCollection
- network_interfaces:- VpcNetworkInterfacesCollection
- requested_vpc_peering_connections:- VpcRequestedVpcPeeringConnectionsCollection
- route_tables:- VpcRouteTablesCollection
- security_groups:- VpcSecurityGroupsCollection
- subnets:- VpcSubnetsCollection
- owner_id:- str
- instance_tenancy: TenancyType
- ipv6_cidr_block_association_set:- List[VpcIpv6CidrBlockAssociationTypeDef]
- cidr_block_association_set:- List[VpcCidrBlockAssociationTypeDef]
- is_default:- bool
- encryption_control: VpcEncryptionControlTypeDef
- tags:- List[TagTypeDef]
- block_public_access_states: BlockPublicAccessStatesTypeDef
- vpc_id:- str
- state: VpcStateType
- cidr_block:- str
- dhcp_options_id:- str
- meta:- EC2ResourceMeta
Vpc collections#
Vpc.accepted_vpc_peering_connections#
Provides access to VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).accepted_vpc_peering_connections collection.
 boto3 documentation
# VpcAcceptedVpcPeeringConnectionsCollection usage example
from types_boto3_ec2.service_resource import VpcAcceptedVpcPeeringConnectionsCollection
def get_collection() -> VpcAcceptedVpcPeeringConnectionsCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.accepted_vpc_peering_connectionsVpc.instances#
Provides access to Instance resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).instances collection.
 boto3 documentation
# VpcInstancesCollection usage example
from types_boto3_ec2.service_resource import VpcInstancesCollection
def get_collection() -> VpcInstancesCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.instancesVpc.internet_gateways#
Provides access to InternetGateway resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).internet_gateways collection.
 boto3 documentation
# VpcInternetGatewaysCollection usage example
from types_boto3_ec2.service_resource import VpcInternetGatewaysCollection
def get_collection() -> VpcInternetGatewaysCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.internet_gatewaysVpc.network_acls#
Provides access to NetworkAcl resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).network_acls collection.
 boto3 documentation
# VpcNetworkAclsCollection usage example
from types_boto3_ec2.service_resource import VpcNetworkAclsCollection
def get_collection() -> VpcNetworkAclsCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.network_aclsVpc.network_interfaces#
Provides access to NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).network_interfaces collection.
 boto3 documentation
# VpcNetworkInterfacesCollection usage example
from types_boto3_ec2.service_resource import VpcNetworkInterfacesCollection
def get_collection() -> VpcNetworkInterfacesCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.network_interfacesVpc.requested_vpc_peering_connections#
Provides access to VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).requested_vpc_peering_connections collection.
 boto3 documentation
# VpcRequestedVpcPeeringConnectionsCollection usage example
from types_boto3_ec2.service_resource import VpcRequestedVpcPeeringConnectionsCollection
def get_collection() -> VpcRequestedVpcPeeringConnectionsCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.requested_vpc_peering_connectionsVpc.route_tables#
Provides access to RouteTable resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).route_tables collection.
 boto3 documentation
# VpcRouteTablesCollection usage example
from types_boto3_ec2.service_resource import VpcRouteTablesCollection
def get_collection() -> VpcRouteTablesCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.route_tablesVpc.security_groups#
Provides access to SecurityGroup resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).security_groups collection.
 boto3 documentation
# VpcSecurityGroupsCollection usage example
from types_boto3_ec2.service_resource import VpcSecurityGroupsCollection
def get_collection() -> VpcSecurityGroupsCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.security_groupsVpc.subnets#
Provides access to Subnet resource.
Type annotations and code completion for boto3.resource("ec2").Vpc(...).subnets collection.
 boto3 documentation
# VpcSubnetsCollection usage example
from types_boto3_ec2.service_resource import VpcSubnetsCollection
def get_collection() -> VpcSubnetsCollection:
    resource = boto3.resource("ec2").Vpc(...)
    return resource.subnetsVpc methods#
Vpc.get_available_subresources method#
Returns a list of all the available sub-resources for this Vpc.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").associate_dhcp_options method.
 boto3 documentation
# associate_dhcp_options method definition
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)Vpc.attach_classic_link_instance method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").attach_classic_link_instance method.
 boto3 documentation
# attach_classic_link_instance method definition
def attach_classic_link_instance(
    self,
    *,
    InstanceId: str,
    Groups: Sequence[str],
    DryRun: bool = ...,
) -> AttachClassicLinkVpcResultTypeDef:  # (1)
    ...# attach_classic_link_instance method usage example with argument unpacking
kwargs: AttachClassicLinkVpcRequestVpcAttachClassicLinkInstanceTypeDef = {  # (1)
    "InstanceId": ...,
    "Groups": ...,
}
parent.attach_classic_link_instance(**kwargs)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 boto3.resource("ec2").attach_internet_gateway method.
 boto3 documentation
# attach_internet_gateway method definition
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)Vpc.create_network_acl method#
Creates a network ACL in a VPC.
Type annotations and code completion for boto3.resource("ec2").create_network_acl method.
 boto3 documentation
# create_network_acl method definition
def create_network_acl(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    ClientToken: str = ...,
    DryRun: bool = ...,
) -> _NetworkAcl:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_network_acl method usage example with argument unpacking
kwargs: CreateNetworkAclRequestVpcCreateNetworkAclTypeDef = {  # (1)
    "TagSpecifications": ...,
}
parent.create_network_acl(**kwargs)Vpc.create_route_table method#
Creates a route table for the specified VPC.
Type annotations and code completion for boto3.resource("ec2").create_route_table method.
 boto3 documentation
# create_route_table method definition
def create_route_table(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    ClientToken: str = ...,
    DryRun: bool = ...,
) -> _RouteTable:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_route_table method usage example with argument unpacking
kwargs: CreateRouteTableRequestVpcCreateRouteTableTypeDef = {  # (1)
    "TagSpecifications": ...,
}
parent.create_route_table(**kwargs)Vpc.create_security_group method#
Creates a security group.
Type annotations and code completion for boto3.resource("ec2").create_security_group method.
 boto3 documentation
# create_security_group method definition
def create_security_group(
    self,
    *,
    Description: str,
    GroupName: str,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
) -> _SecurityGroup:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_security_group method usage example with argument unpacking
kwargs: CreateSecurityGroupRequestVpcCreateSecurityGroupTypeDef = {  # (1)
    "Description": ...,
    "GroupName": ...,
}
parent.create_security_group(**kwargs)Vpc.create_subnet method#
Creates a subnet in the specified VPC.
Type annotations and code completion for boto3.resource("ec2").create_subnet method.
 boto3 documentation
# create_subnet method definition
def create_subnet(
    self,
    *,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    AvailabilityZone: str = ...,
    AvailabilityZoneId: str = ...,
    CidrBlock: str = ...,
    Ipv6CidrBlock: str = ...,
    OutpostArn: str = ...,
    Ipv6Native: bool = ...,
    Ipv4IpamPoolId: str = ...,
    Ipv4NetmaskLength: int = ...,
    Ipv6IpamPoolId: str = ...,
    Ipv6NetmaskLength: int = ...,
    DryRun: bool = ...,
) -> _Subnet:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# create_subnet method usage example with argument unpacking
kwargs: CreateSubnetRequestVpcCreateSubnetTypeDef = {  # (1)
    "TagSpecifications": ...,
}
parent.create_subnet(**kwargs)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 boto3.resource("ec2").create_tags method.
 boto3 documentation
# create_tags method definition
def create_tags(
    self,
    *,
    Tags: Sequence[TagTypeDef],  # (1)
    DryRun: bool = ...,
) -> None:
    ...- See Sequence[TagTypeDef]
# create_tags method usage example with argument unpacking
kwargs: VpcCreateTagsRequestTypeDef = {  # (1)
    "Tags": ...,
}
parent.create_tags(**kwargs)Vpc.delete method#
Deletes the specified VPC.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> None:
    ...# delete method usage example with argument unpacking
kwargs: DeleteVpcRequestVpcDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)Vpc.describe_attribute method#
Describes the specified attribute of the specified VPC.
Type annotations and code completion for boto3.resource("ec2").describe_attribute method.
 boto3 documentation
# describe_attribute method definition
def describe_attribute(
    self,
    *,
    Attribute: VpcAttributeNameType,  # (1)
    DryRun: bool = ...,
) -> DescribeVpcAttributeResultTypeDef:  # (2)
    ...# describe_attribute method usage example with argument unpacking
kwargs: DescribeVpcAttributeRequestVpcDescribeAttributeTypeDef = {  # (1)
    "Attribute": ...,
}
parent.describe_attribute(**kwargs)Vpc.detach_classic_link_instance method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").detach_classic_link_instance method.
 boto3 documentation
# detach_classic_link_instance method definition
def detach_classic_link_instance(
    self,
    *,
    InstanceId: str,
    DryRun: bool = ...,
) -> DetachClassicLinkVpcResultTypeDef:  # (1)
    ...# detach_classic_link_instance method usage example with argument unpacking
kwargs: DetachClassicLinkVpcRequestVpcDetachClassicLinkInstanceTypeDef = {  # (1)
    "InstanceId": ...,
}
parent.detach_classic_link_instance(**kwargs)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 boto3.resource("ec2").detach_internet_gateway method.
 boto3 documentation
# detach_internet_gateway method definition
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)Vpc.disable_classic_link method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").disable_classic_link method.
 boto3 documentation
# disable_classic_link method definition
def disable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> DisableVpcClassicLinkResultTypeDef:  # (1)
    ...# disable_classic_link method usage example with argument unpacking
kwargs: DisableVpcClassicLinkRequestVpcDisableClassicLinkTypeDef = {  # (1)
    "DryRun": ...,
}
parent.disable_classic_link(**kwargs)Vpc.enable_classic_link method#
This action is deprecated.
Type annotations and code completion for boto3.resource("ec2").enable_classic_link method.
 boto3 documentation
# enable_classic_link method definition
def enable_classic_link(
    self,
    *,
    DryRun: bool = ...,
) -> EnableVpcClassicLinkResultTypeDef:  # (1)
    ...# enable_classic_link method usage example with argument unpacking
kwargs: EnableVpcClassicLinkRequestVpcEnableClassicLinkTypeDef = {  # (1)
    "DryRun": ...,
}
parent.enable_classic_link(**kwargs)Vpc.modify_attribute method#
Modifies the specified attribute of the specified VPC.
Type annotations and code completion for boto3.resource("ec2").modify_attribute method.
 boto3 documentation
# modify_attribute method definition
def modify_attribute(
    self,
    *,
    EnableDnsHostnames: AttributeBooleanValueTypeDef = ...,  # (1)
    EnableDnsSupport: AttributeBooleanValueTypeDef = ...,  # (1)
    EnableNetworkAddressUsageMetrics: AttributeBooleanValueTypeDef = ...,  # (1)
) -> None:
    ...# modify_attribute method usage example with argument unpacking
kwargs: ModifyVpcAttributeRequestVpcModifyAttributeTypeDef = {  # (1)
    "EnableDnsHostnames": ...,
}
parent.modify_attribute(**kwargs)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 boto3.resource("ec2").request_vpc_peering_connection method.
 boto3 documentation
# request_vpc_peering_connection method definition
def request_vpc_peering_connection(
    self,
    *,
    PeerRegion: str = ...,
    TagSpecifications: Sequence[TagSpecificationUnionTypeDef] = ...,  # (1)
    DryRun: bool = ...,
    PeerVpcId: str = ...,
    PeerOwnerId: str = ...,
) -> _VpcPeeringConnection:
    ...- See Sequence[TagSpecificationUnionTypeDef]
# request_vpc_peering_connection method usage example with argument unpacking
kwargs: CreateVpcPeeringConnectionRequestVpcRequestVpcPeeringConnectionTypeDef = {  # (1)
    "PeerRegion": ...,
}
parent.request_vpc_peering_connection(**kwargs)Vpc.wait_until_available method#
Waits until Vpc is available.
Type annotations and code completion for boto3.resource("ec2").wait_until_available method.
 boto3 documentation
# wait_until_available method definition
def wait_until_available(
    self,
) -> None:
    ...Vpc.wait_until_exists method#
Waits until Vpc is exists.
Type annotations and code completion for boto3.resource("ec2").wait_until_exists method.
 boto3 documentation
# wait_until_exists method definition
def wait_until_exists(
    self,
) -> None:
    ...Vpc.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Vpc.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...VpcPeeringConnection#
Type annotations and code completion for boto3.resource("ec2").VpcPeeringConnection class.
 boto3 documentation
# VpcPeeringConnection usage example
from types_boto3_ec2.service_resource import VpcPeeringConnection
def get_resource() -> VpcPeeringConnection:
    return boto3.resource("ec2").VpcPeeringConnection(...)VpcPeeringConnection attributes#
- id:- str
- accepter_vpc:- Vpc
- requester_vpc:- Vpc
- accepter_vpc_info: VpcPeeringConnectionVpcInfoTypeDef
- expiration_time:- datetime.datetime
- requester_vpc_info: VpcPeeringConnectionVpcInfoTypeDef
- status: VpcPeeringConnectionStateReasonTypeDef
- tags:- List[TagTypeDef]
- vpc_peering_connection_id:- str
- meta:- EC2ResourceMeta
VpcPeeringConnection methods#
VpcPeeringConnection.get_available_subresources method#
Returns a list of all the available sub-resources for this VpcPeeringConnection.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...VpcPeeringConnection.accept method#
Accept a VPC peering connection request.
Type annotations and code completion for boto3.resource("ec2").accept method.
 boto3 documentation
# accept method definition
def accept(
    self,
    *,
    DryRun: bool = ...,
) -> AcceptVpcPeeringConnectionResultTypeDef:  # (1)
    ...# accept method usage example with argument unpacking
kwargs: AcceptVpcPeeringConnectionRequestVpcPeeringConnectionAcceptTypeDef = {  # (1)
    "DryRun": ...,
}
parent.accept(**kwargs)VpcPeeringConnection.delete method#
Deletes a VPC peering connection.
Type annotations and code completion for boto3.resource("ec2").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
    *,
    DryRun: bool = ...,
) -> DeleteVpcPeeringConnectionResultTypeDef:  # (1)
    ...# delete method usage example with argument unpacking
kwargs: DeleteVpcPeeringConnectionRequestVpcPeeringConnectionDeleteTypeDef = {  # (1)
    "DryRun": ...,
}
parent.delete(**kwargs)VpcPeeringConnection.reject method#
Rejects a VPC peering connection request.
Type annotations and code completion for boto3.resource("ec2").reject method.
 boto3 documentation
# reject method definition
def reject(
    self,
    *,
    DryRun: bool = ...,
) -> RejectVpcPeeringConnectionResultTypeDef:  # (1)
    ...# reject method usage example with argument unpacking
kwargs: RejectVpcPeeringConnectionRequestVpcPeeringConnectionRejectTypeDef = {  # (1)
    "DryRun": ...,
}
parent.reject(**kwargs)VpcPeeringConnection.wait_until_exists method#
Waits until VpcPeeringConnection is exists.
Type annotations and code completion for boto3.resource("ec2").wait_until_exists method.
 boto3 documentation
# wait_until_exists method definition
def wait_until_exists(
    self,
) -> None:
    ...VpcPeeringConnection.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...VpcPeeringConnection.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...VpcAddress#
Type annotations and code completion for boto3.resource("ec2").VpcAddress class.
 boto3 documentation
# VpcAddress usage example
from types_boto3_ec2.service_resource import VpcAddress
def get_resource() -> VpcAddress:
    return boto3.resource("ec2").VpcAddress(...)VpcAddress attributes#
- allocation_id:- str
- association:- NetworkInterfaceAssociation
- association_id:- str
- domain: DomainTypeType
- network_interface_id:- str
- network_interface_owner_id:- str
- private_ip_address:- str
- tags:- List[TagTypeDef]
- public_ipv4_pool:- str
- network_border_group:- str
- customer_owned_ip:- str
- customer_owned_ipv4_pool:- str
- carrier_ip:- str
- subnet_id:- str
- service_managed: ServiceManagedType
- instance_id:- str
- public_ip:- str
- meta:- EC2ResourceMeta
VpcAddress methods#
VpcAddress.get_available_subresources method#
Returns a list of all the available sub-resources for this VpcAddress.
Type annotations and code completion for boto3.resource("ec2").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...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 boto3.resource("ec2").associate method.
 boto3 documentation
# associate method definition
def associate(
    self,
    *,
    InstanceId: str = ...,
    PublicIp: str = ...,
    DryRun: bool = ...,
    NetworkInterfaceId: str = ...,
    PrivateIpAddress: str = ...,
    AllowReassociation: bool = ...,
) -> AssociateAddressResultTypeDef:  # (1)
    ...# associate method usage example with argument unpacking
kwargs: AssociateAddressRequestVpcAddressAssociateTypeDef = {  # (1)
    "InstanceId": ...,
}
parent.associate(**kwargs)VpcAddress.release method#
Releases the specified Elastic IP address.
Type annotations and code completion for boto3.resource("ec2").release method.
 boto3 documentation
# release method definition
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)VpcAddress.load method#
Type annotations and code completion for boto3.resource("ec2").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...VpcAddress.reload method#
Type annotations and code completion for boto3.resource("ec2").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...