EC2ServiceResource
Auto-generated documentation for EC2 type annotations stubs module mypy-boto3-ec2.
EC2ServiceResource
Type annotations and code completion for boto3.resource("ec2")
, included resources and collections.
boto3 documentation
from mypy_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
Collections
ServiceResourceClassicAddressesCollection
Provides access to ClassicAddress resource.
Type annotations and code completion for boto3.resource("ec2").classic_addresses
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceClassicAddressesCollection
def get_collection() -> ServiceResourceClassicAddressesCollection:
return boto3.resource("ec2").classic_addresses
ServiceResourceDhcpOptionsSetsCollection
Provides access to DhcpOptions resource.
Type annotations and code completion for boto3.resource("ec2").dhcp_options_sets
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceDhcpOptionsSetsCollection
def get_collection() -> ServiceResourceDhcpOptionsSetsCollection:
return boto3.resource("ec2").dhcp_options_sets
ServiceResourceImagesCollection
Provides access to Image resource.
Type annotations and code completion for boto3.resource("ec2").images
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceImagesCollection
def get_collection() -> ServiceResourceImagesCollection:
return boto3.resource("ec2").images
ServiceResourceInstancesCollection
Provides access to Instance resource.
Type annotations and code completion for boto3.resource("ec2").instances
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceInstancesCollection
def get_collection() -> ServiceResourceInstancesCollection:
return boto3.resource("ec2").instances
ServiceResourceInternetGatewaysCollection
Provides access to InternetGateway resource.
Type annotations and code completion for boto3.resource("ec2").internet_gateways
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceInternetGatewaysCollection
def get_collection() -> ServiceResourceInternetGatewaysCollection:
return boto3.resource("ec2").internet_gateways
ServiceResourceKeyPairsCollection
Provides access to KeyPairInfo resource.
Type annotations and code completion for boto3.resource("ec2").key_pairs
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceKeyPairsCollection
def get_collection() -> ServiceResourceKeyPairsCollection:
return boto3.resource("ec2").key_pairs
ServiceResourceNetworkAclsCollection
Provides access to NetworkAcl resource.
Type annotations and code completion for boto3.resource("ec2").network_acls
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceNetworkAclsCollection
def get_collection() -> ServiceResourceNetworkAclsCollection:
return boto3.resource("ec2").network_acls
ServiceResourceNetworkInterfacesCollection
Provides access to NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").network_interfaces
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceNetworkInterfacesCollection
def get_collection() -> ServiceResourceNetworkInterfacesCollection:
return boto3.resource("ec2").network_interfaces
ServiceResourcePlacementGroupsCollection
Provides access to PlacementGroup resource.
Type annotations and code completion for boto3.resource("ec2").placement_groups
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourcePlacementGroupsCollection
def get_collection() -> ServiceResourcePlacementGroupsCollection:
return boto3.resource("ec2").placement_groups
ServiceResourceRouteTablesCollection
Provides access to RouteTable resource.
Type annotations and code completion for boto3.resource("ec2").route_tables
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceRouteTablesCollection
def get_collection() -> ServiceResourceRouteTablesCollection:
return boto3.resource("ec2").route_tables
ServiceResourceSecurityGroupsCollection
Provides access to SecurityGroup resource.
Type annotations and code completion for boto3.resource("ec2").security_groups
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceSecurityGroupsCollection
def get_collection() -> ServiceResourceSecurityGroupsCollection:
return boto3.resource("ec2").security_groups
ServiceResourceSnapshotsCollection
Provides access to Snapshot resource.
Type annotations and code completion for boto3.resource("ec2").snapshots
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceSnapshotsCollection
def get_collection() -> ServiceResourceSnapshotsCollection:
return boto3.resource("ec2").snapshots
ServiceResourceSubnetsCollection
Provides access to Subnet resource.
Type annotations and code completion for boto3.resource("ec2").subnets
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceSubnetsCollection
def get_collection() -> ServiceResourceSubnetsCollection:
return boto3.resource("ec2").subnets
ServiceResourceVolumesCollection
Provides access to Volume resource.
Type annotations and code completion for boto3.resource("ec2").volumes
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceVolumesCollection
def get_collection() -> ServiceResourceVolumesCollection:
return boto3.resource("ec2").volumes
ServiceResourceVpcAddressesCollection
Provides access to VpcAddress resource.
Type annotations and code completion for boto3.resource("ec2").vpc_addresses
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceVpcAddressesCollection
def get_collection() -> ServiceResourceVpcAddressesCollection:
return boto3.resource("ec2").vpc_addresses
ServiceResourceVpcPeeringConnectionsCollection
Provides access to VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").vpc_peering_connections
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceVpcPeeringConnectionsCollection
def get_collection() -> ServiceResourceVpcPeeringConnectionsCollection:
return boto3.resource("ec2").vpc_peering_connections
ServiceResourceVpcsCollection
Provides access to Vpc resource.
Type annotations and code completion for boto3.resource("ec2").vpcs
collection.
boto3 documentation
from mypy_boto3_ec2.service_resource import ServiceResourceVpcsCollection
def get_collection() -> ServiceResourceVpcsCollection:
return boto3.resource("ec2").vpcs
Methods
EC2ServiceResource.ClassicAddress method
Creates a ClassicAddress resource.
Type annotations and code completion for boto3.resource("ec2").ClassicAddress
method.
boto3 documentation
kwargs: ServiceResourceClassicAddressRequestTypeDef = { # (1)
"public_ip": ...,
}
parent.ClassicAddress(**kwargs)
EC2ServiceResource.DhcpOptions method
Creates a DhcpOptions resource.
Type annotations and code completion for boto3.resource("ec2").DhcpOptions
method.
boto3 documentation
kwargs: ServiceResourceDhcpOptionsRequestTypeDef = { # (1)
"id": ...,
}
parent.DhcpOptions(**kwargs)
EC2ServiceResource.Image method
Creates a Image resource.
Type annotations and code completion for boto3.resource("ec2").Image
method.
boto3 documentation
kwargs: ServiceResourceImageRequestTypeDef = { # (1)
"id": ...,
}
parent.Image(**kwargs)
EC2ServiceResource.Instance method
Creates a Instance resource.
Type annotations and code completion for boto3.resource("ec2").Instance
method.
boto3 documentation
kwargs: ServiceResourceInstanceRequestTypeDef = { # (1)
"id": ...,
}
parent.Instance(**kwargs)
EC2ServiceResource.InternetGateway method
Creates a InternetGateway resource.
Type annotations and code completion for boto3.resource("ec2").InternetGateway
method.
boto3 documentation
kwargs: ServiceResourceInternetGatewayRequestTypeDef = { # (1)
"id": ...,
}
parent.InternetGateway(**kwargs)
EC2ServiceResource.KeyPair method
Creates a KeyPairInfo resource.
Type annotations and code completion for boto3.resource("ec2").KeyPair
method.
boto3 documentation
kwargs: ServiceResourceKeyPairRequestTypeDef = { # (1)
"name": ...,
}
parent.KeyPair(**kwargs)
EC2ServiceResource.NetworkAcl method
Creates a NetworkAcl resource.
Type annotations and code completion for boto3.resource("ec2").NetworkAcl
method.
boto3 documentation
kwargs: ServiceResourceNetworkAclRequestTypeDef = { # (1)
"id": ...,
}
parent.NetworkAcl(**kwargs)
EC2ServiceResource.NetworkInterface method
Creates a NetworkInterface resource.
Type annotations and code completion for boto3.resource("ec2").NetworkInterface
method.
boto3 documentation
kwargs: ServiceResourceNetworkInterfaceRequestTypeDef = { # (1)
"id": ...,
}
parent.NetworkInterface(**kwargs)
EC2ServiceResource.NetworkInterfaceAssociation method
Creates a NetworkInterfaceAssociation resource.
Type annotations and code completion for boto3.resource("ec2").NetworkInterfaceAssociation
method.
boto3 documentation
def NetworkInterfaceAssociation(
self,
id: str,
) -> NetworkInterfaceAssociation:
...
kwargs: ServiceResourceNetworkInterfaceAssociationRequestTypeDef = { # (1)
"id": ...,
}
parent.NetworkInterfaceAssociation(**kwargs)
EC2ServiceResource.PlacementGroup method
Creates a PlacementGroup resource.
Type annotations and code completion for boto3.resource("ec2").PlacementGroup
method.
boto3 documentation
kwargs: ServiceResourcePlacementGroupRequestTypeDef = { # (1)
"name": ...,
}
parent.PlacementGroup(**kwargs)
EC2ServiceResource.Route method
Creates a Route resource.
Type annotations and code completion for boto3.resource("ec2").Route
method.
boto3 documentation
kwargs: ServiceResourceRouteRequestTypeDef = { # (1)
"route_table_id": ...,
"destination_cidr_block": ...,
}
parent.Route(**kwargs)
EC2ServiceResource.RouteTable method
Creates a RouteTable resource.
Type annotations and code completion for boto3.resource("ec2").RouteTable
method.
boto3 documentation
kwargs: ServiceResourceRouteTableRequestTypeDef = { # (1)
"id": ...,
}
parent.RouteTable(**kwargs)
EC2ServiceResource.RouteTableAssociation method
Creates a RouteTableAssociation resource.
Type annotations and code completion for boto3.resource("ec2").RouteTableAssociation
method.
boto3 documentation
kwargs: ServiceResourceRouteTableAssociationRequestTypeDef = { # (1)
"id": ...,
}
parent.RouteTableAssociation(**kwargs)
EC2ServiceResource.SecurityGroup method
Creates a SecurityGroup resource.
Type annotations and code completion for boto3.resource("ec2").SecurityGroup
method.
boto3 documentation
kwargs: ServiceResourceSecurityGroupRequestTypeDef = { # (1)
"id": ...,
}
parent.SecurityGroup(**kwargs)
EC2ServiceResource.Snapshot method
Creates a Snapshot resource.
Type annotations and code completion for boto3.resource("ec2").Snapshot
method.
boto3 documentation
kwargs: ServiceResourceSnapshotRequestTypeDef = { # (1)
"id": ...,
}
parent.Snapshot(**kwargs)
EC2ServiceResource.Subnet method
Creates a Subnet resource.
Type annotations and code completion for boto3.resource("ec2").Subnet
method.
boto3 documentation
kwargs: ServiceResourceSubnetRequestTypeDef = { # (1)
"id": ...,
}
parent.Subnet(**kwargs)
EC2ServiceResource.Tag method
Creates a Tag resource.
Type annotations and code completion for boto3.resource("ec2").Tag
method.
boto3 documentation
kwargs: ServiceResourceTagRequestTypeDef = { # (1)
"resource_id": ...,
"key": ...,
"value": ...,
}
parent.Tag(**kwargs)
EC2ServiceResource.Volume method
Creates a Volume resource.
Type annotations and code completion for boto3.resource("ec2").Volume
method.
boto3 documentation
kwargs: ServiceResourceVolumeRequestTypeDef = { # (1)
"id": ...,
}
parent.Volume(**kwargs)
EC2ServiceResource.Vpc method
Creates a Vpc resource.
Type annotations and code completion for boto3.resource("ec2").Vpc
method.
boto3 documentation
kwargs: ServiceResourceVpcRequestTypeDef = { # (1)
"id": ...,
}
parent.Vpc(**kwargs)
EC2ServiceResource.VpcAddress method
Creates a VpcAddress resource.
Type annotations and code completion for boto3.resource("ec2").VpcAddress
method.
boto3 documentation
kwargs: ServiceResourceVpcAddressRequestTypeDef = { # (1)
"allocation_id": ...,
}
parent.VpcAddress(**kwargs)
EC2ServiceResource.VpcPeeringConnection method
Creates a VpcPeeringConnection resource.
Type annotations and code completion for boto3.resource("ec2").VpcPeeringConnection
method.
boto3 documentation
kwargs: ServiceResourceVpcPeeringConnectionRequestTypeDef = { # (1)
"id": ...,
}
parent.VpcPeeringConnection(**kwargs)
EC2ServiceResource.create_dhcp_options method
Creates a set of DHCP options for your VPC.
Type annotations and code completion for boto3.resource("ec2").create_dhcp_options
method.
boto3 documentation
def create_dhcp_options(
self,
*,
DhcpConfigurations: Sequence[NewDhcpConfigurationTypeDef], # (1)
TagSpecifications: Sequence[TagSpecificationTypeDef] = ..., # (2)
DryRun: bool = ...,
) -> DhcpOptions:
...
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
def create_instances(
self,
*,
MaxCount: int,
MinCount: int,
BlockDeviceMappings: Sequence[BlockDeviceMappingTypeDef] = ..., # (1)
ImageId: str = ...,
InstanceType: InstanceTypeType = ..., # (2)
Ipv6AddressCount: int = ...,
Ipv6Addresses: Sequence[InstanceIpv6AddressTypeDef] = ..., # (3)
KernelId: str = ...,
KeyName: str = ...,
Monitoring: RunInstancesMonitoringEnabledTypeDef = ..., # (4)
Placement: PlacementTypeDef = ..., # (5)
RamdiskId: str = ...,
SecurityGroupIds: Sequence[str] = ...,
SecurityGroups: Sequence[str] = ...,
SubnetId: str = ...,
UserData: str = ...,
AdditionalInfo: str = ...,
ClientToken: str = ...,
DisableApiTermination: bool = ...,
DryRun: bool = ...,
EbsOptimized: bool = ...,
IamInstanceProfile: IamInstanceProfileSpecificationTypeDef = ..., # (6)
InstanceInitiatedShutdownBehavior: ShutdownBehaviorType = ..., # (7)
NetworkInterfaces: Sequence[InstanceNetworkInterfaceSpecificationTypeDef] = ..., # (8)
PrivateIpAddress: str = ...,
ElasticGpuSpecification: Sequence[ElasticGpuSpecificationTypeDef] = ..., # (9)
ElasticInferenceAccelerators: Sequence[ElasticInferenceAcceleratorTypeDef] = ..., # (10)
TagSpecifications: Sequence[TagSpecificationTypeDef] = ..., # (11)
LaunchTemplate: LaunchTemplateSpecificationTypeDef = ..., # (12)
InstanceMarketOptions: InstanceMarketOptionsRequestTypeDef = ..., # (13)
CreditSpecification: CreditSpecificationRequestTypeDef = ..., # (14)
CpuOptions: CpuOptionsRequestTypeDef = ..., # (15)
CapacityReservationSpecification: CapacityReservationSpecificationTypeDef = ..., # (16)
HibernationOptions: HibernationOptionsRequestTypeDef = ..., # (17)
LicenseSpecifications: Sequence[LicenseConfigurationRequestTypeDef] = ..., # (18)
MetadataOptions: InstanceMetadataOptionsRequestTypeDef = ..., # (19)
EnclaveOptions: EnclaveOptionsRequestTypeDef = ..., # (20)
PrivateDnsNameOptions: PrivateDnsNameOptionsRequestTypeDef = ..., # (21)
MaintenanceOptions: InstanceMaintenanceOptionsRequestTypeDef = ..., # (22)
DisableApiStop: bool = ...,
) -> List[Instance]:
...
- See BlockDeviceMappingTypeDef
- See InstanceTypeType
- See InstanceIpv6AddressTypeDef
- See RunInstancesMonitoringEnabledTypeDef
- See PlacementTypeDef
- See IamInstanceProfileSpecificationTypeDef
- See ShutdownBehaviorType
- See InstanceNetworkInterfaceSpecificationTypeDef
- See ElasticGpuSpecificationTypeDef
- See ElasticInferenceAcceleratorTypeDef
- See