# mypy-boto3-ec2
[![PyPI - mypy-boto3-ec2](https://img.shields.io/pypi/v/mypy-boto3-ec2.svg?color=blue)](https://pypi.org/project/mypy-boto3-ec2)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mypy-boto3-ec2.svg?color=blue)](https://pypi.org/project/mypy-boto3-ec2)
[![Docs](https://img.shields.io/readthedocs/mypy-boto3-builder.svg?color=blue)](https://mypy-boto3-builder.readthedocs.io/)
Type annotations for
[boto3.EC2 1.14.2](https://boto3.amazonaws.com/v1/documentation/api/1.14.2/reference/services/ec2.html#EC2) service
compatible with [mypy](https://github.com/python/mypy), [VSCode](https://code.visualstudio.com/),
[PyCharm](https://www.jetbrains.com/pycharm/) and other tools.
Generated by [mypy-boto3-buider 2.2.0](https://github.com/vemel/mypy_boto3_builder).
More information can be found on [boto3-stubs](https://pypi.org/project/boto3-stubs/) page.
## How to install
Make sure you have [mypy](https://github.com/python/mypy) installed and activated in your IDE.
Install `boto3-stubs` for `EC2` service.
```bash
python -m pip install boto3-stubs[ec2]
```
## How to use
### Client annotations
`EC2Client` provides annotations for `boto3.client("ec2")`.
```python
import boto3
from mypy_boto3_ec2 import EC2Client, EC2ServiceResource
from mypy_boto3_ec2.paginator import (
DescribeByoipCidrsPaginator,
DescribeCapacityReservationsPaginator,
DescribeClassicLinkInstancesPaginator,
DescribeClientVpnAuthorizationRulesPaginator,
DescribeClientVpnConnectionsPaginator,
DescribeClientVpnEndpointsPaginator,
DescribeClientVpnRoutesPaginator,
DescribeClientVpnTargetNetworksPaginator,
DescribeCoipPoolsPaginator,
DescribeDhcpOptionsPaginator,
DescribeEgressOnlyInternetGatewaysPaginator,
DescribeExportImageTasksPaginator,
DescribeFastSnapshotRestoresPaginator,
DescribeFleetsPaginator,
DescribeFlowLogsPaginator,
DescribeFpgaImagesPaginator,
DescribeHostReservationOfferingsPaginator,
DescribeHostReservationsPaginator,
DescribeHostsPaginator,
DescribeIamInstanceProfileAssociationsPaginator,
DescribeImportImageTasksPaginator,
DescribeImportSnapshotTasksPaginator,
DescribeInstanceCreditSpecificationsPaginator,
DescribeInstancesPaginator,
DescribeInstanceStatusPaginator,
DescribeInstanceTypeOfferingsPaginator,
DescribeInstanceTypesPaginator,
DescribeInternetGatewaysPaginator,
DescribeIpv6PoolsPaginator,
DescribeLaunchTemplatesPaginator,
DescribeLaunchTemplateVersionsPaginator,
DescribeLocalGatewayRouteTablesPaginator,
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator,
DescribeLocalGatewayRouteTableVpcAssociationsPaginator,
DescribeLocalGatewaysPaginator,
DescribeLocalGatewayVirtualInterfaceGroupsPaginator,
DescribeLocalGatewayVirtualInterfacesPaginator,
DescribeMovingAddressesPaginator,
DescribeNatGatewaysPaginator,
DescribeNetworkAclsPaginator,
DescribeNetworkInterfacePermissionsPaginator,
DescribeNetworkInterfacesPaginator,
DescribePrefixListsPaginator,
DescribePrincipalIdFormatPaginator,
DescribePublicIpv4PoolsPaginator,
DescribeReservedInstancesModificationsPaginator,
DescribeReservedInstancesOfferingsPaginator,
DescribeRouteTablesPaginator,
DescribeScheduledInstanceAvailabilityPaginator,
DescribeScheduledInstancesPaginator,
DescribeSecurityGroupsPaginator,
DescribeSnapshotsPaginator,
DescribeSpotFleetInstancesPaginator,
DescribeSpotFleetRequestsPaginator,
DescribeSpotInstanceRequestsPaginator,
DescribeSpotPriceHistoryPaginator,
DescribeStaleSecurityGroupsPaginator,
DescribeSubnetsPaginator,
DescribeTagsPaginator,
DescribeTrafficMirrorFiltersPaginator,
DescribeTrafficMirrorSessionsPaginator,
DescribeTrafficMirrorTargetsPaginator,
DescribeTransitGatewayAttachmentsPaginator,
DescribeTransitGatewayMulticastDomainsPaginator,
DescribeTransitGatewayPeeringAttachmentsPaginator,
DescribeTransitGatewayRouteTablesPaginator,
DescribeTransitGatewaysPaginator,
DescribeTransitGatewayVpcAttachmentsPaginator,
DescribeVolumesModificationsPaginator,
DescribeVolumesPaginator,
DescribeVolumeStatusPaginator,
DescribeVpcClassicLinkDnsSupportPaginator,
DescribeVpcEndpointConnectionNotificationsPaginator,
DescribeVpcEndpointConnectionsPaginator,
DescribeVpcEndpointServiceConfigurationsPaginator,
DescribeVpcEndpointServicePermissionsPaginator,
DescribeVpcEndpointServicesPaginator,
DescribeVpcEndpointsPaginator,
DescribeVpcPeeringConnectionsPaginator,
DescribeVpcsPaginator,
GetAssociatedIpv6PoolCidrsPaginator,
GetTransitGatewayAttachmentPropagationsPaginator,
GetTransitGatewayMulticastDomainAssociationsPaginator,
GetTransitGatewayRouteTableAssociationsPaginator,
GetTransitGatewayRouteTablePropagationsPaginator,
SearchLocalGatewayRoutesPaginator,
SearchTransitGatewayMulticastGroupsPaginator,
)
from mypy_boto3_ec2.service_resource import (
ClassicAddress,
DhcpOptions,
Image,
Instance,
InternetGateway,
KeyPair,
KeyPairInfo,
NetworkAcl,
NetworkInterface,
NetworkInterfaceAssociation,
PlacementGroup,
Route,
RouteTable,
RouteTableAssociation,
SecurityGroup,
ServiceResourceClassicAddressesCollection,
ServiceResourceDhcpOptionsSetsCollection,
ServiceResourceImagesCollection,
ServiceResourceInstancesCollection,
ServiceResourceInternetGatewaysCollection,
ServiceResourceKeyPairsCollection,
ServiceResourceNetworkAclsCollection,
ServiceResourceNetworkInterfacesCollection,
ServiceResourcePlacementGroupsCollection,
ServiceResourceRouteTablesCollection,
ServiceResourceSecurityGroupsCollection,
ServiceResourceSnapshotsCollection,
ServiceResourceSubnetsCollection,
ServiceResourceVolumesCollection,
ServiceResourceVpcAddressesCollection,
ServiceResourceVpcPeeringConnectionsCollection,
ServiceResourceVpcsCollection,
Snapshot,
Subnet,
Tag,
Volume,
Vpc,
VpcAddress,
VpcPeeringConnection,
)
from mypy_boto3_ec2.type_defs import AccountAttributeTypeDef, ...
from mypy_boto3_ec2.waiter import (
BundleTaskCompleteWaiter,
ConversionTaskCancelledWaiter,
ConversionTaskCompletedWaiter,
ConversionTaskDeletedWaiter,
CustomerGatewayAvailableWaiter,
ExportTaskCancelledWaiter,
ExportTaskCompletedWaiter,
ImageAvailableWaiter,
ImageExistsWaiter,
InstanceExistsWaiter,
InstanceRunningWaiter,
InstanceStatusOkWaiter,
InstanceStoppedWaiter,
InstanceTerminatedWaiter,
KeyPairExistsWaiter,
NatGatewayAvailableWaiter,
NetworkInterfaceAvailableWaiter,
PasswordDataAvailableWaiter,
SecurityGroupExistsWaiter,
SnapshotCompletedWaiter,
SpotInstanceRequestFulfilledWaiter,
SubnetAvailableWaiter,
SystemStatusOkWaiter,
VolumeAvailableWaiter,
VolumeDeletedWaiter,
VolumeInUseWaiter,
VpcAvailableWaiter,
VpcExistsWaiter,
VpcPeeringConnectionDeletedWaiter,
VpcPeeringConnectionExistsWaiter,
VpnConnectionAvailableWaiter,
VpnConnectionDeletedWaiter,
)
client: EC2Client = boto3.client("ec2")
# now client usage is checked by mypy and IDE should provide code auto-complete
# works for session as well
session = boto3.session.Session(region="us-west-1")
session_client: EC2Client = session.client("ec2")
```
### Paginators annotations
`mypy_boto3_ec2.paginator` module contains type annotations for all paginators.
```python
client: EC2Client = boto3.client("ec2")
# Explicit type annotations are optional here
# Type should be correctly discovered by mypy and IDEs
# VSCode requires explicit type annotations
describe_byoip_cidrs_paginator: DescribeByoipCidrsPaginator = client.get_paginator("describe_byoip_cidrs")
describe_capacity_reservations_paginator: DescribeCapacityReservationsPaginator = clien