Table of Contents
EC2.
Client
¶A low-level client representing Amazon Elastic Compute Cloud (EC2):
import boto3
client = boto3.client('ec2')
These are the available methods:
accept_vpc_peering_connection()
allocate_address()
assign_private_ip_addresses()
associate_address()
associate_dhcp_options()
associate_route_table()
attach_classic_link_vpc()
attach_internet_gateway()
attach_network_interface()
attach_volume()
attach_vpn_gateway()
authorize_security_group_egress()
authorize_security_group_ingress()
bundle_instance()
can_paginate()
cancel_bundle_task()
cancel_conversion_task()
cancel_export_task()
cancel_import_task()
cancel_reserved_instances_listing()
cancel_spot_fleet_requests()
cancel_spot_instance_requests()
confirm_product_instance()
copy_image()
copy_snapshot()
create_customer_gateway()
create_dhcp_options()
create_flow_logs()
create_image()
create_instance_export_task()
create_internet_gateway()
create_key_pair()
create_network_acl()
create_network_acl_entry()
create_network_interface()
create_placement_group()
create_reserved_instances_listing()
create_route()
create_route_table()
create_security_group()
create_snapshot()
create_spot_datafeed_subscription()
create_subnet()
create_tags()
create_volume()
create_vpc()
create_vpc_endpoint()
create_vpc_peering_connection()
create_vpn_connection()
create_vpn_connection_route()
create_vpn_gateway()
delete_customer_gateway()
delete_dhcp_options()
delete_flow_logs()
delete_internet_gateway()
delete_key_pair()
delete_network_acl()
delete_network_acl_entry()
delete_network_interface()
delete_placement_group()
delete_route()
delete_route_table()
delete_security_group()
delete_snapshot()
delete_spot_datafeed_subscription()
delete_subnet()
delete_tags()
delete_volume()
delete_vpc()
delete_vpc_endpoints()
delete_vpc_peering_connection()
delete_vpn_connection()
delete_vpn_connection_route()
delete_vpn_gateway()
deregister_image()
describe_account_attributes()
describe_addresses()
describe_availability_zones()
describe_bundle_tasks()
describe_classic_link_instances()
describe_conversion_tasks()
describe_customer_gateways()
describe_dhcp_options()
describe_export_tasks()
describe_flow_logs()
describe_image_attribute()
describe_images()
describe_import_image_tasks()
describe_import_snapshot_tasks()
describe_instance_attribute()
describe_instance_status()
describe_instances()
describe_internet_gateways()
describe_key_pairs()
describe_moving_addresses()
describe_network_acls()
describe_network_interface_attribute()
describe_network_interfaces()
describe_placement_groups()
describe_prefix_lists()
describe_regions()
describe_reserved_instances()
describe_reserved_instances_listings()
describe_reserved_instances_modifications()
describe_reserved_instances_offerings()
describe_route_tables()
describe_security_groups()
describe_snapshot_attribute()
describe_snapshots()
describe_spot_datafeed_subscription()
describe_spot_fleet_instances()
describe_spot_fleet_request_history()
describe_spot_fleet_requests()
describe_spot_instance_requests()
describe_spot_price_history()
describe_subnets()
describe_tags()
describe_volume_attribute()
describe_volume_status()
describe_volumes()
describe_vpc_attribute()
describe_vpc_classic_link()
describe_vpc_endpoint_services()
describe_vpc_endpoints()
describe_vpc_peering_connections()
describe_vpcs()
describe_vpn_connections()
describe_vpn_gateways()
detach_classic_link_vpc()
detach_internet_gateway()
detach_network_interface()
detach_volume()
detach_vpn_gateway()
disable_vgw_route_propagation()
disable_vpc_classic_link()
disassociate_address()
disassociate_route_table()
enable_vgw_route_propagation()
enable_volume_io()
enable_vpc_classic_link()
generate_presigned_url()
get_console_output()
get_paginator()
get_password_data()
get_waiter()
import_image()
import_instance()
import_key_pair()
import_snapshot()
import_volume()
modify_image_attribute()
modify_instance_attribute()
modify_network_interface_attribute()
modify_reserved_instances()
modify_snapshot_attribute()
modify_subnet_attribute()
modify_volume_attribute()
modify_vpc_attribute()
modify_vpc_endpoint()
monitor_instances()
move_address_to_vpc()
purchase_reserved_instances_offering()
reboot_instances()
register_image()
reject_vpc_peering_connection()
release_address()
replace_network_acl_association()
replace_network_acl_entry()
replace_route()
replace_route_table_association()
report_instance_status()
request_spot_fleet()
request_spot_instances()
reset_image_attribute()
reset_instance_attribute()
reset_network_interface_attribute()
reset_snapshot_attribute()
restore_address_to_classic()
revoke_security_group_egress()
revoke_security_group_ingress()
run_instances()
start_instances()
stop_instances()
terminate_instances()
unassign_private_ip_addresses()
unmonitor_instances()
accept_vpc_peering_connection
(**kwargs)¶Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the pending-acceptance
state, and you must be the owner of the peer VPC. Use the DescribeVpcPeeringConnections
request to view your outstanding VPC peering connection requests.
Request Syntax
response = client.accept_vpc_peering_connection(
DryRun=True|False,
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcPeeringConnection': {
'AccepterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'ExpirationTime': datetime(2015, 1, 1),
'RequesterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'Status': {
'Code': 'initiating-request'|'pending-acceptance'|'active'|'deleted'|'rejected'|'failed'|'expired'|'provisioning'|'deleting',
'Message': 'string'
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VpcPeeringConnectionId': 'string'
}
}
Response Structure
|
allocate_address
(**kwargs)¶Acquires an Elastic IP address.
An Elastic IP address is for use either in the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.allocate_address(
DryRun=True|False,
Domain='vpc'|'standard'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'PublicIp': 'string',
'Domain': 'vpc'|'standard',
'AllocationId': 'string'
}
Response Structure
|
assign_private_ip_addresses
(**kwargs)¶Assigns one or more secondary private IP addresses to the specified network interface. You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Instance Types in the Amazon Elastic Compute Cloud User Guide . For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
AssignPrivateIpAddresses is available only in EC2-VPC.
Request Syntax
response = client.assign_private_ip_addresses(
NetworkInterfaceId='string',
PrivateIpAddresses=[
'string',
],
SecondaryPrivateIpAddressCount=123,
AllowReassignment=True|False
)
Parameters: |
|
---|---|
Returns: | None |
associate_address
(**kwargs)¶Associates an Elastic IP address with an instance or a network interface.
An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
[EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address is already associated with a different instance, it is disassociated from that instance and associated with the specified instance.
[VPC in an EC2-Classic account] If you don't specify a private IP address, the Elastic IP address is associated with the primary IP address. If the Elastic IP address is already associated with a different instance or a network interface, you get an error unless you allow reassociation.
This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.
Request Syntax
response = client.associate_address(
DryRun=True|False,
InstanceId='string',
PublicIp='string',
AllocationId='string',
NetworkInterfaceId='string',
PrivateIpAddress='string',
AllowReassociation=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AssociationId': 'string'
}
Response Structure
|
associate_dhcp_options
(**kwargs)¶Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.
After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.
For more information, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.associate_dhcp_options(
DryRun=True|False,
DhcpOptionsId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
associate_route_table
(**kwargs)¶Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. The action returns an association ID, which you need in order to disassociate the route table from the subnet later. A route table can be associated with multiple subnets.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.associate_route_table(
DryRun=True|False,
SubnetId='string',
RouteTableId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AssociationId': 'string'
}
Response Structure
|
attach_classic_link_vpc
(**kwargs)¶Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC's security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running
state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.
After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.
Linking your instance to a VPC is sometimes referred to as attaching your instance.
Request Syntax
response = client.attach_classic_link_vpc(
DryRun=True|False,
InstanceId='string',
VpcId='string',
Groups=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
attach_internet_gateway
(**kwargs)¶Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.attach_internet_gateway(
DryRun=True|False,
InternetGatewayId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
attach_network_interface
(**kwargs)¶Attaches a network interface to an instance.
Request Syntax
response = client.attach_network_interface(
DryRun=True|False,
NetworkInterfaceId='string',
InstanceId='string',
DeviceIndex=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AttachmentId': 'string'
}
Response Structure
|
attach_volume
(**kwargs)¶Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.
Encrypted EBS volumes may only be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
For a list of supported device names, see Attaching an EBS Volume to an Instance . Any device names that aren't reserved for instance store volumes can be used for EBS volumes. For more information, see Amazon EC2 Instance Store in the Amazon Elastic Compute Cloud User Guide .
If a volume has an AWS Marketplace product code:
For an overview of the AWS Marketplace, see Introducing AWS Marketplace .
For more information about EBS volumes, see Attaching Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.attach_volume(
DryRun=True|False,
VolumeId='string',
InstanceId='string',
Device='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
attach_vpn_gateway
(**kwargs)¶Attaches a virtual private gateway to a VPC. For more information, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.attach_vpn_gateway(
DryRun=True|False,
VpnGatewayId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcAttachment': {
'VpcId': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached'
}
}
Response Structure
|
Adds one or more egress rules to a security group for use with a VPC. Specifically, this action permits instances to send traffic to one or more destination CIDR IP address ranges, or to one or more destination security groups for the same VPC.
Warning
You can have up to 50 rules per security group (covering both ingress and egress rules).
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. This action doesn't apply to security groups for use in EC2-Classic. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Each rule consists of the protocol (for example, TCP), plus either a CIDR range or a source group. For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes.
Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur.
Request Syntax
response = client.authorize_security_group_egress(
DryRun=True|False,
GroupId='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
Adds one or more ingress rules to a security group.
Warning
EC2-Classic: You can have up to 100 rules per group.
EC2-VPC: You can have up to 50 rules per group (covering both ingress and egress rules).
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
[EC2-Classic] This action gives one or more CIDR IP address ranges permission to access a security group in your account, or gives one or more security groups (called the source groups ) permission to access a security group for your account. A source group can be for your own AWS account, or another.
[EC2-VPC] This action gives one or more CIDR IP address ranges permission to access a security group in your VPC, or gives one or more other security groups (called the source groups ) permission to access a security group for your VPC. The security groups must all be for the same VPC.
Request Syntax
response = client.authorize_security_group_ingress(
DryRun=True|False,
GroupName='string',
GroupId='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
bundle_instance
(**kwargs)¶Bundles an Amazon instance store-backed Windows instance.
During bundling, only the root device volume (C:) is bundled. Data on other instance store volumes is not preserved.
Note
This action is not applicable for Linux/Unix instances or Windows instances that are backed by Amazon EBS.
For more information, see Creating an Instance Store-Backed Windows AMI .
Request Syntax
response = client.bundle_instance(
DryRun=True|False,
InstanceId='string',
Storage={
'S3': {
'Bucket': 'string',
'Prefix': 'string',
'AWSAccessKeyId': 'string',
'UploadPolicy': b'bytes',
'UploadPolicySignature': 'string'
}
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'BundleTask': {
'InstanceId': 'string',
'BundleId': 'string',
'State': 'pending'|'waiting-for-shutdown'|'bundling'|'storing'|'cancelling'|'complete'|'failed',
'StartTime': datetime(2015, 1, 1),
'UpdateTime': datetime(2015, 1, 1),
'Storage': {
'S3': {
'Bucket': 'string',
'Prefix': 'string',
'AWSAccessKeyId': 'string',
'UploadPolicy': b'bytes',
'UploadPolicySignature': 'string'
}
},
'Progress': 'string',
'BundleTaskError': {
'Code': 'string',
'Message': 'string'
}
}
}
Response Structure
|
can_paginate
(operation_name)¶Check if an operation can be paginated.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Returns: | True if the operation can be paginated,
False otherwise. |
cancel_bundle_task
(**kwargs)¶Cancels a bundling operation for an instance store-backed Windows instance.
Request Syntax
response = client.cancel_bundle_task(
DryRun=True|False,
BundleId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'BundleTask': {
'InstanceId': 'string',
'BundleId': 'string',
'State': 'pending'|'waiting-for-shutdown'|'bundling'|'storing'|'cancelling'|'complete'|'failed',
'StartTime': datetime(2015, 1, 1),
'UpdateTime': datetime(2015, 1, 1),
'Storage': {
'S3': {
'Bucket': 'string',
'Prefix': 'string',
'AWSAccessKeyId': 'string',
'UploadPolicy': b'bytes',
'UploadPolicySignature': 'string'
}
},
'Progress': 'string',
'BundleTaskError': {
'Code': 'string',
'Message': 'string'
}
}
}
Response Structure
|
cancel_conversion_task
(**kwargs)¶Cancels an active conversion task. The task can be the import of an instance or volume. The action removes all artifacts of the conversion, including a partially uploaded volume or instance. If the conversion is complete or is in the process of transferring the final disk image, the command fails and returns an exception.
For more information, see Using the Command Line Tools to Import Your Virtual Machine to Amazon EC2 in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.cancel_conversion_task(
DryRun=True|False,
ConversionTaskId='string',
ReasonMessage='string'
)
Parameters: |
|
---|---|
Returns: | None |
cancel_export_task
(**kwargs)¶Cancels an active export task. The request removes all artifacts of the export, including any partially-created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.
Request Syntax
response = client.cancel_export_task(
ExportTaskId='string'
)
Parameters: | ExportTaskId (string) -- [REQUIRED] The ID of the export task. This is the ID returned by |
---|---|
Returns: | None |
cancel_import_task
(**kwargs)¶Cancels an in-process import virtual machine or import snapshot task.
Request Syntax
response = client.cancel_import_task(
DryRun=True|False,
ImportTaskId='string',
CancelReason='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImportTaskId': 'string',
'State': 'string',
'PreviousState': 'string'
}
Response Structure
|
cancel_reserved_instances_listing
(**kwargs)¶Cancels the specified Reserved Instance listing in the Reserved Instance Marketplace.
For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.cancel_reserved_instances_listing(
ReservedInstancesListingId='string'
)
Parameters: | ReservedInstancesListingId (string) -- [REQUIRED] The ID of the Reserved Instance listing. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'ReservedInstancesListings': [
{
'ReservedInstancesListingId': 'string',
'ReservedInstancesId': 'string',
'CreateDate': datetime(2015, 1, 1),
'UpdateDate': datetime(2015, 1, 1),
'Status': 'active'|'pending'|'cancelled'|'closed',
'StatusMessage': 'string',
'InstanceCounts': [
{
'State': 'available'|'sold'|'cancelled'|'pending',
'InstanceCount': 123
},
],
'PriceSchedules': [
{
'Term': 123,
'Price': 123.0,
'CurrencyCode': 'USD',
'Active': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'ClientToken': 'string'
},
]
}
Response Structure
|
cancel_spot_fleet_requests
(**kwargs)¶Cancels the specified Spot fleet requests.
Request Syntax
response = client.cancel_spot_fleet_requests(
DryRun=True|False,
SpotFleetRequestIds=[
'string',
],
TerminateInstances=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'UnsuccessfulFleetRequests': [
{
'SpotFleetRequestId': 'string',
'Error': {
'Code': 'fleetRequestIdDoesNotExist'|'fleetRequestIdMalformed'|'fleetRequestNotInCancellableState'|'unexpectedError',
'Message': 'string'
}
},
],
'SuccessfulFleetRequests': [
{
'SpotFleetRequestId': 'string',
'CurrentSpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating',
'PreviousSpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating'
},
]
}
Response Structure
|
cancel_spot_instance_requests
(**kwargs)¶Cancels one or more Spot Instance requests. Spot Instances are instances that Amazon EC2 starts on your behalf when the bid price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide .
Warning
Canceling a Spot Instance request does not terminate running Spot Instances associated with the request.
Request Syntax
response = client.cancel_spot_instance_requests(
DryRun=True|False,
SpotInstanceRequestIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'CancelledSpotInstanceRequests': [
{
'SpotInstanceRequestId': 'string',
'State': 'active'|'open'|'closed'|'cancelled'|'completed'
},
]
}
Response Structure
|
confirm_product_instance
(**kwargs)¶Determines whether a product code is associated with an instance. This action can only be used by the owner of the product code. It is useful when a product code owner needs to verify whether another user's instance is eligible for support.
Request Syntax
response = client.confirm_product_instance(
DryRun=True|False,
ProductCode='string',
InstanceId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'OwnerId': 'string',
'Return': True|False
}
Response Structure
|
copy_image
(**kwargs)¶Initiates the copy of an AMI from the specified source region to the current region. You specify the destination region by using its endpoint when making the request. AMIs that use encrypted EBS snapshots cannot be copied with this method.
For more information, see Copying AMIs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.copy_image(
DryRun=True|False,
SourceRegion='string',
SourceImageId='string',
Name='string',
Description='string',
ClientToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImageId': 'string'
}
Response Structure
|
copy_snapshot
(**kwargs)¶Copies a point-in-time snapshot of an EBS volume and stores it in Amazon S3. You can copy the snapshot within the same region or from one region to another. You can use the snapshot to create EBS volumes or Amazon Machine Images (AMIs). The snapshot is copied to the regional endpoint that you send the HTTP request to.
Copies of encrypted EBS snapshots remain encrypted. Copies of unencrypted snapshots remain unencrypted, unless the Encrypted
flag is specified during the snapshot copy operation. By default, encrypted snapshot copies use the default AWS Key Management Service (AWS KMS) customer master key (CMK); however, you can specify a non-default CMK with the KmsKeyId
parameter.
For more information, see Copying an Amazon EBS Snapshot in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.copy_snapshot(
DryRun=True|False,
SourceRegion='string',
SourceSnapshotId='string',
Description='string',
Encrypted=True|False,
KmsKeyId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SnapshotId': 'string'
}
Response Structure
|
create_customer_gateway
(**kwargs)¶Provides information to AWS about your VPN customer gateway device. The customer gateway is the appliance at your end of the VPN connection. (The device on the AWS side of the VPN connection is the virtual private gateway.) You must provide the Internet-routable IP address of the customer gateway's external interface. The IP address must be static and can't be behind a device performing network address translation (NAT).
For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN (in the 64512 - 65534 range).
Note
Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception of 7224, which is reserved in the us-east-1
region, and 9059, which is reserved in the eu-west-1
region.
For more information about VPN customer gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Warning
You cannot create more than one customer gateway with the same VPN type, IP address, and BGP ASN parameter values. If you run an identical request more than one time, the first request creates the customer gateway, and subsequent requests return information about the existing customer gateway. The subsequent requests do not create new customer gateway resources.
Request Syntax
response = client.create_customer_gateway(
DryRun=True|False,
Type='ipsec.1',
PublicIp='string',
BgpAsn=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'CustomerGateway': {
'CustomerGatewayId': 'string',
'State': 'string',
'Type': 'string',
'IpAddress': 'string',
'BgpAsn': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
create_dhcp_options
(**kwargs)¶Creates a set of DHCP options for your VPC. After creating the set, you must associate it with the VPC, causing all existing and new instances that you launch in the VPC to use this set of DHCP options. The following are the individual DHCP options you can specify. For more information about the options, see RFC 2132 .
domain-name-servers
- The IP addresses of up to four domain name servers, or AmazonProvidedDNS
. The default DHCP option set specifies AmazonProvidedDNS
. If specifying more than one domain name server, specify the IP addresses in a single parameter, separated by commas.domain-name
- If you're using AmazonProvidedDNS in us-east-1
, specify ec2.internal
. If you're using AmazonProvidedDNS in another region, specify region.compute.internal
(for example, ap-northeast-1.compute.internal
). Otherwise, specify a domain name (for example, MyCompany.com
). Important : Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP options set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.ntp-servers
- The IP addresses of up to four Network Time Protocol (NTP) servers.netbios-name-servers
- The IP addresses of up to four NetBIOS name servers.netbios-node-type
- The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast are not currently supported). For more information about these node types, see RFC 2132 .Your VPC automatically starts out with a set of DHCP options that includes only a DNS server that we provide (AmazonProvidedDNS). If you create a set of options, and if your VPC has an Internet gateway, make sure to set the domain-name-servers
option either to AmazonProvidedDNS
or to a domain name server of your choice. For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_dhcp_options(
DryRun=True|False,
DhcpConfigurations=[
{
'Key': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'DhcpOptions': {
'DhcpOptionsId': 'string',
'DhcpConfigurations': [
{
'Key': 'string',
'Values': [
{
'Value': 'string'
},
]
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
create_flow_logs
(**kwargs)¶Creates one or more flow logs to capture IP traffic for a specific network interface, subnet, or VPC. Flow logs are delivered to a specified log group in Amazon CloudWatch Logs. If you specify a VPC or subnet in the request, a log stream is created in CloudWatch Logs for each network interface in the subnet or VPC. Log streams can include information about accepted and rejected traffic to a network interface. You can view the data in your log streams using Amazon CloudWatch Logs.
In your request, you must also specify an IAM role that has permission to publish logs to CloudWatch Logs.
Request Syntax
response = client.create_flow_logs(
ResourceIds=[
'string',
],
ResourceType='VPC'|'Subnet'|'NetworkInterface',
TrafficType='ACCEPT'|'REJECT'|'ALL',
LogGroupName='string',
DeliverLogsPermissionArn='string',
ClientToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'FlowLogIds': [
'string',
],
'ClientToken': 'string',
'Unsuccessful': [
{
'ResourceId': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
},
]
}
Response Structure
|
create_image
(**kwargs)¶Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped.
If you customized your instance with instance store volumes or EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes.
For more information, see Creating Amazon EBS-Backed Linux AMIs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_image(
DryRun=True|False,
InstanceId='string',
Name='string',
Description='string',
NoReboot=True|False,
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImageId': 'string'
}
Response Structure
|
create_instance_export_task
(**kwargs)¶Exports a running or stopped instance to an S3 bucket.
For information about the supported operating systems, image formats, and known limitations for the types of instances you can export, see Exporting EC2 Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_instance_export_task(
Description='string',
InstanceId='string',
TargetEnvironment='citrix'|'vmware'|'microsoft',
ExportToS3Task={
'DiskImageFormat': 'VMDK'|'RAW'|'VHD',
'ContainerFormat': 'ova',
'S3Bucket': 'string',
'S3Prefix': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ExportTask': {
'ExportTaskId': 'string',
'Description': 'string',
'State': 'active'|'cancelling'|'cancelled'|'completed',
'StatusMessage': 'string',
'InstanceExportDetails': {
'InstanceId': 'string',
'TargetEnvironment': 'citrix'|'vmware'|'microsoft'
},
'ExportToS3Task': {
'DiskImageFormat': 'VMDK'|'RAW'|'VHD',
'ContainerFormat': 'ova',
'S3Bucket': 'string',
'S3Key': 'string'
}
}
}
Response Structure
|
create_internet_gateway
(**kwargs)¶Creates an Internet gateway for use with a VPC. After creating the Internet gateway, you attach it to a VPC using AttachInternetGateway .
For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_internet_gateway(
DryRun=True|False
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InternetGateway': {
'InternetGatewayId': 'string',
'Attachments': [
{
'VpcId': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
create_key_pair
(**kwargs)¶Creates a 2048-bit RSA key pair with the specified name. Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is returned as an unencrypted PEM encoded PKCS#8 private key. If a key with the specified name already exists, Amazon EC2 returns an error.
You can have up to five thousand key pairs per region.
The key pair returned to you is available only in the region in which you create it. To create a key pair that is available in all regions, use ImportKeyPair .
For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_key_pair(
DryRun=True|False,
KeyName='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'KeyName': 'string',
'KeyFingerprint': 'string',
'KeyMaterial': 'string'
}
Response Structure
|
create_network_acl
(**kwargs)¶Creates a network ACL in a VPC. Network ACLs provide an optional layer of security (in addition to security groups) for the instances in your VPC.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_network_acl(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkAcl': {
'NetworkAclId': 'string',
'VpcId': 'string',
'IsDefault': True|False,
'Entries': [
{
'RuleNumber': 123,
'Protocol': 'string',
'RuleAction': 'allow'|'deny',
'Egress': True|False,
'CidrBlock': 'string',
'IcmpTypeCode': {
'Type': 123,
'Code': 123
},
'PortRange': {
'From': 123,
'To': 123
}
},
],
'Associations': [
{
'NetworkAclAssociationId': 'string',
'NetworkAclId': 'string',
'SubnetId': 'string'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
create_network_acl_entry
(**kwargs)¶Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.
We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.
After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_network_acl_entry(
DryRun=True|False,
NetworkAclId='string',
RuleNumber=123,
Protocol='string',
RuleAction='allow'|'deny',
Egress=True|False,
CidrBlock='string',
IcmpTypeCode={
'Type': 123,
'Code': 123
},
PortRange={
'From': 123,
'To': 123
}
)
Parameters: |
|
---|---|
Returns: | None |
create_network_interface
(**kwargs)¶Creates a network interface in the specified subnet.
For more information about network interfaces, see Elastic Network Interfaces in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_network_interface(
SubnetId='string',
Description='string',
PrivateIpAddress='string',
Groups=[
'string',
],
PrivateIpAddresses=[
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
SecondaryPrivateIpAddressCount=123,
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkInterface': {
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'AvailabilityZone': 'string',
'Description': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'RequesterManaged': True|False,
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string',
'AllocationId': 'string',
'AssociationId': 'string'
},
'TagSet': [
{
'Key': 'string',
'Value': 'string'
},
],
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string',
'AllocationId': 'string',
'AssociationId': 'string'
}
},
]
}
}
Response Structure
|
create_placement_group
(**kwargs)¶Creates a placement group that you launch cluster instances into. You must give the group a name that's unique within the scope of your account.
For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_placement_group(
DryRun=True|False,
GroupName='string',
Strategy='cluster'
)
Parameters: |
|
---|---|
Returns: | None |
create_reserved_instances_listing
(**kwargs)¶Creates a listing for Amazon EC2 Reserved Instances to be sold in the Reserved Instance Marketplace. You can submit one Reserved Instance listing at a time. To get a list of your Reserved Instances, you can use the DescribeReservedInstances operation.
The Reserved Instance Marketplace matches sellers who want to resell Reserved Instance capacity that they no longer need with buyers who want to purchase additional capacity. Reserved Instances bought and sold through the Reserved Instance Marketplace work like any other Reserved Instances.
To sell your Reserved Instances, you must first register as a seller in the Reserved Instance Marketplace. After completing the registration process, you can create a Reserved Instance Marketplace listing of some or all of your Reserved Instances, and specify the upfront price to receive for them. Your Reserved Instance listings then become available for purchase. To view the details of your Reserved Instance listing, you can use the DescribeReservedInstancesListings operation.
For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_reserved_instances_listing(
ReservedInstancesId='string',
InstanceCount=123,
PriceSchedules=[
{
'Term': 123,
'Price': 123.0,
'CurrencyCode': 'USD'
},
],
ClientToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesListings': [
{
'ReservedInstancesListingId': 'string',
'ReservedInstancesId': 'string',
'CreateDate': datetime(2015, 1, 1),
'UpdateDate': datetime(2015, 1, 1),
'Status': 'active'|'pending'|'cancelled'|'closed',
'StatusMessage': 'string',
'InstanceCounts': [
{
'State': 'available'|'sold'|'cancelled'|'pending',
'InstanceCount': 123
},
],
'PriceSchedules': [
{
'Term': 123,
'Price': 123.0,
'CurrencyCode': 'USD',
'Active': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'ClientToken': 'string'
},
]
}
Response Structure
|
create_route
(**kwargs)¶Creates a route in a route table within a VPC.
You must specify one of the following targets: Internet gateway or virtual private gateway, NAT instance, VPC peering connection, or network interface.
When determining how to route traffic, we use the route with the most specific match. For example, let's say the traffic is destined for 192.0.2.3
, and the route table includes the following two routes:
192.0.2.0/24
(goes to some target A)192.0.2.0/28
(goes to some target B)Both routes apply to the traffic destined for 192.0.2.3
. However, the second route in the list covers a smaller number of IP addresses and is therefore more specific, so we use that route to determine where to target the traffic.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_route(
DryRun=True|False,
RouteTableId='string',
DestinationCidrBlock='string',
GatewayId='string',
InstanceId='string',
NetworkInterfaceId='string',
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
create_route_table
(**kwargs)¶Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_route_table(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'RouteTable': {
'RouteTableId': 'string',
'VpcId': 'string',
'Routes': [
{
'DestinationCidrBlock': 'string',
'DestinationPrefixListId': 'string',
'GatewayId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'NetworkInterfaceId': 'string',
'VpcPeeringConnectionId': 'string',
'State': 'active'|'blackhole',
'Origin': 'CreateRouteTable'|'CreateRoute'|'EnableVgwRoutePropagation'
},
],
'Associations': [
{
'RouteTableAssociationId': 'string',
'RouteTableId': 'string',
'SubnetId': 'string',
'Main': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'PropagatingVgws': [
{
'GatewayId': 'string'
},
]
}
}
Response Structure
|
create_security_group
(**kwargs)¶Creates a security group.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Warning
EC2-Classic: You can have up to 500 security groups.
EC2-VPC: You can create up to 100 security groups per VPC.
When you create a security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.
You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.
You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress , AuthorizeSecurityGroupEgress , RevokeSecurityGroupIngress , and RevokeSecurityGroupEgress .
Request Syntax
response = client.create_security_group(
DryRun=True|False,
GroupName='string',
Description='string',
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'GroupId': 'string'
}
Response Structure
|
create_snapshot
(**kwargs)¶Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.
When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.
You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your EBS volume at the time the snapshot command is issued; this may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending
.
To create a snapshot for EBS volumes that serve as root devices, you should stop the instance before taking the snapshot.
Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.
For more information, see Amazon Elastic Block Store and Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_snapshot(
DryRun=True|False,
VolumeId='string',
Description='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SnapshotId': 'string',
'VolumeId': 'string',
'State': 'pending'|'completed'|'error',
'StartTime': datetime(2015, 1, 1),
'Progress': 'string',
'OwnerId': 'string',
'Description': 'string',
'VolumeSize': 123,
'OwnerAlias': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'Encrypted': True|False,
'KmsKeyId': 'string'
}
Response Structure
|
create_spot_datafeed_subscription
(**kwargs)¶Creates a data feed for Spot Instances, enabling you to view Spot Instance usage logs. You can create one data feed per AWS account. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_spot_datafeed_subscription(
DryRun=True|False,
Bucket='string',
Prefix='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotDatafeedSubscription': {
'OwnerId': 'string',
'Bucket': 'string',
'Prefix': 'string',
'State': 'Active'|'Inactive',
'Fault': {
'Code': 'string',
'Message': 'string'
}
}
}
Response Structure
|
create_subnet
(**kwargs)¶Creates a subnet in an existing VPC.
When you create each subnet, you provide the VPC ID and the CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you want only a single subnet in the VPC), or a subset of the VPC's CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).
Warning
AWS reserves both the first four and the last IP address in each subnet's CIDR block. They're not available for use.
If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle.
If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP address doesn't change if you stop and restart the instance (unlike a similar instance launched outside a VPC, which gets a new IP address when restarted). It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available.
For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_subnet(
DryRun=True|False,
VpcId='string',
CidrBlock='string',
AvailabilityZone='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Subnet': {
'SubnetId': 'string',
'State': 'pending'|'available',
'VpcId': 'string',
'CidrBlock': 'string',
'AvailableIpAddressCount': 123,
'AvailabilityZone': 'string',
'DefaultForAz': True|False,
'MapPublicIpOnLaunch': True|False,
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_tags(
DryRun=True|False,
Resources=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
create_volume
(**kwargs)¶Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to. For more information see Regions and Endpoints .
You can create a new empty volume or restore a volume from an EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.
You can create encrypted volumes with the Encrypted
parameter. Encrypted volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
For more information, see Creating or Restoring an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.create_volume(
DryRun=True|False,
Size=123,
SnapshotId='string',
AvailabilityZone='string',
VolumeType='standard'|'io1'|'gp2',
Iops=123,
Encrypted=True|False,
KmsKeyId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'Size': 123,
'SnapshotId': 'string',
'AvailabilityZone': 'string',
'State': 'creating'|'available'|'in-use'|'deleting'|'deleted'|'error',
'CreateTime': datetime(2015, 1, 1),
'Attachments': [
{
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False,
'KmsKeyId': 'string'
}
Response Structure
|
create_vpc
(**kwargs)¶Creates a VPC with the specified CIDR block.
The smallest VPC you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your VPC, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
By default, each instance you launch in the VPC has the default DHCP options, which includes only a default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_vpc(
DryRun=True|False,
CidrBlock='string',
InstanceTenancy='default'|'dedicated'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Vpc': {
'VpcId': 'string',
'State': 'pending'|'available',
'CidrBlock': 'string',
'DhcpOptionsId': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'InstanceTenancy': 'default'|'dedicated',
'IsDefault': True|False
}
}
Response Structure
|
create_vpc_endpoint
(**kwargs)¶Creates a VPC endpoint for a specified AWS service. An endpoint enables you to create a private connection between your VPC and another AWS service in your account. You can specify an endpoint policy to attach to the endpoint that will control access to the service from your VPC. You can also specify the VPC route tables that use the endpoint.
Currently, only endpoints to Amazon S3 are supported.
Request Syntax
response = client.create_vpc_endpoint(
DryRun=True|False,
VpcId='string',
ServiceName='string',
PolicyDocument='string',
RouteTableIds=[
'string',
],
ClientToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcEndpoint': {
'VpcEndpointId': 'string',
'VpcId': 'string',
'ServiceName': 'string',
'State': 'Pending'|'Available'|'Deleting'|'Deleted',
'PolicyDocument': 'string',
'RouteTableIds': [
'string',
],
'CreationTimestamp': datetime(2015, 1, 1)
},
'ClientToken': 'string'
}
Response Structure
|
create_vpc_peering_connection
(**kwargs)¶Requests a VPC peering connection between two VPCs: a requester VPC that you own and a peer VPC with which to create the connection. The peer VPC can belong to another AWS account. The requester VPC and peer VPC cannot have overlapping CIDR blocks.
The owner of the peer VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.
A CreateVpcPeeringConnection
request between VPCs with overlapping CIDR blocks results in the VPC peering connection having a status of failed
.
Request Syntax
response = client.create_vpc_peering_connection(
DryRun=True|False,
VpcId='string',
PeerVpcId='string',
PeerOwnerId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcPeeringConnection': {
'AccepterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'ExpirationTime': datetime(2015, 1, 1),
'RequesterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'Status': {
'Code': 'initiating-request'|'pending-acceptance'|'active'|'deleted'|'rejected'|'failed'|'expired'|'provisioning'|'deleting',
'Message': 'string'
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VpcPeeringConnectionId': 'string'
}
}
Response Structure
|
create_vpn_connection
(**kwargs)¶Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only supported connection type is ipsec.1
.
The response includes information that you need to give to your network administrator to configure your customer gateway.
Warning
We strongly recommend that you use HTTPS when calling this operation because the response contains sensitive cryptographic information for configuring your customer gateway.
If you decide to shut down your VPN connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information returned from this call.
For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_vpn_connection(
DryRun=True|False,
Type='string',
CustomerGatewayId='string',
VpnGatewayId='string',
Options={
'StaticRoutesOnly': True|False
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpnConnection': {
'VpnConnectionId': 'string',
'State': 'pending'|'available'|'deleting'|'deleted',
'CustomerGatewayConfiguration': 'string',
'Type': 'ipsec.1',
'CustomerGatewayId': 'string',
'VpnGatewayId': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VgwTelemetry': [
{
'OutsideIpAddress': 'string',
'Status': 'UP'|'DOWN',
'LastStatusChange': datetime(2015, 1, 1),
'StatusMessage': 'string',
'AcceptedRouteCount': 123
},
],
'Options': {
'StaticRoutesOnly': True|False
},
'Routes': [
{
'DestinationCidrBlock': 'string',
'Source': 'Static',
'State': 'pending'|'available'|'deleting'|'deleted'
},
]
}
}
Response Structure
|
create_vpn_connection_route
(**kwargs)¶Creates a static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.
For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_vpn_connection_route(
VpnConnectionId='string',
DestinationCidrBlock='string'
)
Parameters: |
|
---|---|
Returns: | None |
create_vpn_gateway
(**kwargs)¶Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.
For more information about virtual private gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.create_vpn_gateway(
DryRun=True|False,
Type='ipsec.1',
AvailabilityZone='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpnGateway': {
'VpnGatewayId': 'string',
'State': 'pending'|'available'|'deleting'|'deleted',
'Type': 'ipsec.1',
'AvailabilityZone': 'string',
'VpcAttachments': [
{
'VpcId': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
delete_customer_gateway
(**kwargs)¶Deletes the specified customer gateway. You must delete the VPN connection before you can delete the customer gateway.
Request Syntax
response = client.delete_customer_gateway(
DryRun=True|False,
CustomerGatewayId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_dhcp_options
(**kwargs)¶Deletes the specified set of DHCP options. You must disassociate the set of DHCP options before you can delete it. You can disassociate the set of DHCP options by associating either a new set of options or the default set of options with the VPC.
Request Syntax
response = client.delete_dhcp_options(
DryRun=True|False,
DhcpOptionsId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_flow_logs
(**kwargs)¶Deletes one or more flow logs.
Request Syntax
response = client.delete_flow_logs(
FlowLogIds=[
'string',
]
)
Parameters: | FlowLogIds (list) -- [REQUIRED] One or more flow log IDs.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Unsuccessful': [
{
'ResourceId': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
},
]
}
Response Structure
|
delete_internet_gateway
(**kwargs)¶Deletes the specified Internet gateway. You must detach the Internet gateway from the VPC before you can delete it.
Request Syntax
response = client.delete_internet_gateway(
DryRun=True|False,
InternetGatewayId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_key_pair
(**kwargs)¶Deletes the specified key pair, by removing the public key from Amazon EC2.
Request Syntax
response = client.delete_key_pair(
DryRun=True|False,
KeyName='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_network_acl
(**kwargs)¶Deletes the specified network ACL. You can't delete the ACL if it's associated with any subnets. You can't delete the default network ACL.
Request Syntax
response = client.delete_network_acl(
DryRun=True|False,
NetworkAclId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_network_acl_entry
(**kwargs)¶Deletes the specified ingress or egress entry (rule) from the specified network ACL.
Request Syntax
response = client.delete_network_acl_entry(
DryRun=True|False,
NetworkAclId='string',
RuleNumber=123,
Egress=True|False
)
Parameters: |
|
---|---|
Returns: | None |
delete_network_interface
(**kwargs)¶Deletes the specified network interface. You must detach the network interface before you can delete it.
Request Syntax
response = client.delete_network_interface(
DryRun=True|False,
NetworkInterfaceId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_placement_group
(**kwargs)¶Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.delete_placement_group(
DryRun=True|False,
GroupName='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_route
(**kwargs)¶Deletes the specified route from the specified route table.
Request Syntax
response = client.delete_route(
DryRun=True|False,
RouteTableId='string',
DestinationCidrBlock='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_route_table
(**kwargs)¶Deletes the specified route table. You must disassociate the route table from any subnets before you can delete it. You can't delete the main route table.
Request Syntax
response = client.delete_route_table(
DryRun=True|False,
RouteTableId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_security_group
(**kwargs)¶Deletes a security group.
If you attempt to delete a security group that is associated with an instance, or is referenced by another security group, the operation fails with InvalidGroup.InUse
in EC2-Classic or DependencyViolation
in EC2-VPC.
Request Syntax
response = client.delete_security_group(
DryRun=True|False,
GroupName='string',
GroupId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_snapshot
(**kwargs)¶Deletes the specified snapshot.
When you make periodic snapshots of a volume, the snapshots are incremental, and only the blocks on the device that have changed since your last snapshot are saved in the new snapshot. When you delete a snapshot, only the data not needed for any other snapshot is removed. So regardless of which prior snapshots have been deleted, all active snapshots will have access to all the information needed to restore the volume.
You cannot delete a snapshot of the root device of an EBS volume used by a registered AMI. You must first de-register the AMI before you can delete the snapshot.
For more information, see Deleting an Amazon EBS Snapshot in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.delete_snapshot(
DryRun=True|False,
SnapshotId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_spot_datafeed_subscription
(**kwargs)¶Deletes the data feed for Spot Instances. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.delete_spot_datafeed_subscription(
DryRun=True|False
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
delete_subnet
(**kwargs)¶Deletes the specified subnet. You must terminate all running instances in the subnet before you can delete the subnet.
Request Syntax
response = client.delete_subnet(
DryRun=True|False,
SubnetId='string'
)
Parameters: |
|
---|---|
Returns: | None |
Deletes the specified set of tags from the specified set of resources. This call is designed to follow a DescribeTags
request.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.delete_tags(
DryRun=True|False,
Resources=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
delete_volume
(**kwargs)¶Deletes the specified EBS volume. The volume must be in the available
state (not attached to an instance).
Note
The volume may remain in the deleting
state for several minutes.
For more information, see Deleting an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.delete_volume(
DryRun=True|False,
VolumeId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_vpc
(**kwargs)¶Deletes the specified VPC. You must detach or delete all gateways and resources that are associated with the VPC before you can delete it. For example, you must terminate all instances running in the VPC, delete all security groups associated with the VPC (except the default one), delete all route tables associated with the VPC (except the default one), and so on.
Request Syntax
response = client.delete_vpc(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_vpc_endpoints
(**kwargs)¶Deletes one or more specified VPC endpoints. Deleting the endpoint also deletes the endpoint routes in the route tables that were associated with the endpoint.
Request Syntax
response = client.delete_vpc_endpoints(
DryRun=True|False,
VpcEndpointIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Unsuccessful': [
{
'ResourceId': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
},
]
}
Response Structure
|
delete_vpc_peering_connection
(**kwargs)¶Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the peer VPC can delete the VPC peering connection if it's in the active
state. The owner of the requester VPC can delete a VPC peering connection in the pending-acceptance
state.
Request Syntax
response = client.delete_vpc_peering_connection(
DryRun=True|False,
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
delete_vpn_connection
(**kwargs)¶Deletes the specified VPN connection.
If you're deleting the VPC and its associated components, we recommend that you detach the virtual private gateway from the VPC and delete the VPC before deleting the VPN connection. If you believe that the tunnel credentials for your VPN connection have been compromised, you can delete the VPN connection and create a new one that has new keys, without needing to delete the VPC or virtual private gateway. If you create a new VPN connection, you must reconfigure the customer gateway using the new configuration information returned with the new VPN connection ID.
Request Syntax
response = client.delete_vpn_connection(
DryRun=True|False,
VpnConnectionId='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_vpn_connection_route
(**kwargs)¶Deletes the specified static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.
Request Syntax
response = client.delete_vpn_connection_route(
VpnConnectionId='string',
DestinationCidrBlock='string'
)
Parameters: |
|
---|---|
Returns: | None |
delete_vpn_gateway
(**kwargs)¶Deletes the specified virtual private gateway. We recommend that before you delete a virtual private gateway, you detach it from the VPC and delete the VPN connection. Note that you don't need to delete the virtual private gateway if you plan to delete and recreate the VPN connection between your VPC and your network.
Request Syntax
response = client.delete_vpn_gateway(
DryRun=True|False,
VpnGatewayId='string'
)
Parameters: |
|
---|---|
Returns: | None |
deregister_image
(**kwargs)¶Deregisters the specified AMI. After you deregister an AMI, it can't be used to launch new instances.
This command does not delete the AMI.
Request Syntax
response = client.deregister_image(
DryRun=True|False,
ImageId='string'
)
Parameters: |
|
---|---|
Returns: | None |
describe_account_attributes
(**kwargs)¶Describes attributes of your AWS account. The following are the supported account attributes:
supported-platforms
: Indicates whether your account can launch instances into EC2-Classic and EC2-VPC, or only into EC2-VPC.default-vpc
: The ID of the default VPC for your account, or none
.max-instances
: The maximum number of On-Demand instances that you can run.vpc-max-security-groups-per-interface
: The maximum number of security groups that you can assign to a network interface.max-elastic-ips
: The maximum number of Elastic IP addresses that you can allocate for use with EC2-Classic.vpc-max-elastic-ips
: The maximum number of Elastic IP addresses that you can allocate for use with EC2-VPC.Request Syntax
response = client.describe_account_attributes(
DryRun=True|False,
AttributeNames=[
'supported-platforms'|'default-vpc',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AccountAttributes': [
{
'AttributeName': 'string',
'AttributeValues': [
{
'AttributeValue': 'string'
},
]
},
]
}
Response Structure
|
describe_addresses
(**kwargs)¶Describes one or more of your Elastic IP addresses.
An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_addresses(
DryRun=True|False,
PublicIps=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
AllocationIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Addresses': [
{
'InstanceId': 'string',
'PublicIp': 'string',
'AllocationId': 'string',
'AssociationId': 'string',
'Domain': 'vpc'|'standard',
'NetworkInterfaceId': 'string',
'NetworkInterfaceOwnerId': 'string',
'PrivateIpAddress': 'string'
},
]
}
Response Structure
|
describe_availability_zones
(**kwargs)¶Describes one or more of the Availability Zones that are available to you. The results include zones only for the region you're currently using. If there is an event impacting an Availability Zone, you can use this request to view the state and any provided message for that Availability Zone.
For more information, see Regions and Availability Zones in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_availability_zones(
DryRun=True|False,
ZoneNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AvailabilityZones': [
{
'ZoneName': 'string',
'State': 'available',
'RegionName': 'string',
'Messages': [
{
'Message': 'string'
},
]
},
]
}
Response Structure
|
describe_bundle_tasks
(**kwargs)¶Describes one or more of your bundling tasks.
Note
Completed bundle tasks are listed for only a limited time. If your bundle task is no longer in the list, you can still register an AMI from it. Just use RegisterImage
with the Amazon S3 bucket name and image manifest name you provided to the bundle task.
Request Syntax
response = client.describe_bundle_tasks(
DryRun=True|False,
BundleIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'BundleTasks': [
{
'InstanceId': 'string',
'BundleId': 'string',
'State': 'pending'|'waiting-for-shutdown'|'bundling'|'storing'|'cancelling'|'complete'|'failed',
'StartTime': datetime(2015, 1, 1),
'UpdateTime': datetime(2015, 1, 1),
'Storage': {
'S3': {
'Bucket': 'string',
'Prefix': 'string',
'AWSAccessKeyId': 'string',
'UploadPolicy': b'bytes',
'UploadPolicySignature': 'string'
}
},
'Progress': 'string',
'BundleTaskError': {
'Code': 'string',
'Message': 'string'
}
},
]
}
Response Structure
|
describe_classic_link_instances
(**kwargs)¶Describes one or more of your linked EC2-Classic instances. This request only returns information about EC2-Classic instances linked to a VPC through ClassicLink; you cannot use this request to return information about other instances.
Request Syntax
response = client.describe_classic_link_instances(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Instances': [
{
'InstanceId': 'string',
'VpcId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
describe_conversion_tasks
(**kwargs)¶Describes one or more of your conversion tasks. For more information, see Using the Command Line Tools to Import Your Virtual Machine to Amazon EC2 in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_conversion_tasks(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
ConversionTaskIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ConversionTasks': [
{
'ConversionTaskId': 'string',
'ExpirationTime': 'string',
'ImportInstance': {
'Volumes': [
{
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
},
'Status': 'string',
'StatusMessage': 'string',
'Description': 'string'
},
],
'InstanceId': 'string',
'Platform': 'Windows',
'Description': 'string'
},
'ImportVolume': {
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Description': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
}
},
'State': 'active'|'cancelling'|'cancelled'|'completed',
'StatusMessage': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_customer_gateways
(**kwargs)¶Describes one or more of your VPN customer gateways.
For more information about VPN customer gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_customer_gateways(
DryRun=True|False,
CustomerGatewayIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'CustomerGateways': [
{
'CustomerGatewayId': 'string',
'State': 'string',
'Type': 'string',
'IpAddress': 'string',
'BgpAsn': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_dhcp_options
(**kwargs)¶Describes one or more of your DHCP options sets.
For more information about DHCP options sets, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_dhcp_options(
DryRun=True|False,
DhcpOptionsIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'DhcpOptions': [
{
'DhcpOptionsId': 'string',
'DhcpConfigurations': [
{
'Key': 'string',
'Values': [
{
'Value': 'string'
},
]
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_export_tasks
(**kwargs)¶Describes one or more of your export tasks.
Request Syntax
response = client.describe_export_tasks(
ExportTaskIds=[
'string',
]
)
Parameters: | ExportTaskIds (list) -- One or more export task IDs.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'ExportTasks': [
{
'ExportTaskId': 'string',
'Description': 'string',
'State': 'active'|'cancelling'|'cancelled'|'completed',
'StatusMessage': 'string',
'InstanceExportDetails': {
'InstanceId': 'string',
'TargetEnvironment': 'citrix'|'vmware'|'microsoft'
},
'ExportToS3Task': {
'DiskImageFormat': 'VMDK'|'RAW'|'VHD',
'ContainerFormat': 'ova',
'S3Bucket': 'string',
'S3Key': 'string'
}
},
]
}
Response Structure
|
describe_flow_logs
(**kwargs)¶Describes one or more flow logs. To view the information in your flow logs (the log streams for the network interfaces), you must use the CloudWatch Logs console or the CloudWatch Logs API.
Request Syntax
response = client.describe_flow_logs(
FlowLogIds=[
'string',
],
Filter=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'FlowLogs': [
{
'CreationTime': datetime(2015, 1, 1),
'FlowLogId': 'string',
'FlowLogStatus': 'string',
'ResourceId': 'string',
'TrafficType': 'ACCEPT'|'REJECT'|'ALL',
'LogGroupName': 'string',
'DeliverLogsStatus': 'string',
'DeliverLogsErrorMessage': 'string',
'DeliverLogsPermissionArn': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_image_attribute
(**kwargs)¶Describes the specified attribute of the specified AMI. You can specify only one attribute at a time.
Request Syntax
response = client.describe_image_attribute(
DryRun=True|False,
ImageId='string',
Attribute='description'|'kernel'|'ramdisk'|'launchPermission'|'productCodes'|'blockDeviceMapping'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImageId': 'string',
'LaunchPermissions': [
{
'UserId': 'string',
'Group': 'all'
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'KernelId': {
'Value': 'string'
},
'RamdiskId': {
'Value': 'string'
},
'Description': {
'Value': 'string'
},
'SriovNetSupport': {
'Value': 'string'
},
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
]
}
Response Structure
|
describe_images
(**kwargs)¶Describes one or more of the images (AMIs, AKIs, and ARIs) available to you. Images available to you include public images, private images that you own, and private images owned by other AWS accounts but for which you have explicit launch permissions.
Note
Deregistered images are included in the returned results for an unspecified interval after deregistration.
Request Syntax
response = client.describe_images(
DryRun=True|False,
ImageIds=[
'string',
],
Owners=[
'string',
],
ExecutableUsers=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Images': [
{
'ImageId': 'string',
'ImageLocation': 'string',
'State': 'pending'|'available'|'invalid'|'deregistered'|'transient'|'failed'|'error',
'OwnerId': 'string',
'CreationDate': 'string',
'Public': True|False,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'Architecture': 'i386'|'x86_64',
'ImageType': 'machine'|'kernel'|'ramdisk',
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'SriovNetSupport': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'ImageOwnerAlias': 'string',
'Name': 'string',
'Description': 'string',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'Hypervisor': 'ovm'|'xen'
},
]
}
Response Structure
|
describe_import_image_tasks
(**kwargs)¶Displays details about an import virtual machine or import snapshot tasks that are already created.
Request Syntax
response = client.describe_import_image_tasks(
DryRun=True|False,
ImportTaskIds=[
'string',
],
NextToken='string',
MaxResults=123,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImportImageTasks': [
{
'ImportTaskId': 'string',
'Architecture': 'string',
'LicenseType': 'string',
'Platform': 'string',
'Hypervisor': 'string',
'Description': 'string',
'SnapshotDetails': [
{
'DiskImageSize': 123.0,
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
},
'DeviceName': 'string',
'SnapshotId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
},
],
'ImageId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_import_snapshot_tasks
(**kwargs)¶Describes your import snapshot tasks.
Request Syntax
response = client.describe_import_snapshot_tasks(
DryRun=True|False,
ImportTaskIds=[
'string',
],
NextToken='string',
MaxResults=123,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImportSnapshotTasks': [
{
'ImportTaskId': 'string',
'SnapshotTaskDetail': {
'DiskImageSize': 123.0,
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
},
'SnapshotId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
},
'Description': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_instance_attribute
(**kwargs)¶Describes the specified attribute of the specified instance. You can specify only one attribute at a time. Valid attribute values are: instanceType
| kernel
| ramdisk
| userData
| disableApiTermination
| instanceInitiatedShutdownBehavior
| rootDeviceName
| blockDeviceMapping
| productCodes
| sourceDestCheck
| groupSet
| ebsOptimized
| sriovNetSupport
Request Syntax
response = client.describe_instance_attribute(
DryRun=True|False,
InstanceId='string',
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceId': 'string',
'InstanceType': {
'Value': 'string'
},
'KernelId': {
'Value': 'string'
},
'RamdiskId': {
'Value': 'string'
},
'UserData': {
'Value': 'string'
},
'DisableApiTermination': {
'Value': True|False
},
'InstanceInitiatedShutdownBehavior': {
'Value': 'string'
},
'RootDeviceName': {
'Value': 'string'
},
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'EbsOptimized': {
'Value': True|False
},
'SriovNetSupport': {
'Value': 'string'
},
'SourceDestCheck': {
'Value': True|False
},
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
]
}
Response Structure
|
describe_instance_status
(**kwargs)¶Describes the status of one or more instances.
Instance status includes the following components:
Request Syntax
response = client.describe_instance_status(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123,
IncludeAllInstances=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceStatuses': [
{
'InstanceId': 'string',
'AvailabilityZone': 'string',
'Events': [
{
'Code': 'instance-reboot'|'system-reboot'|'system-maintenance'|'instance-retirement'|'instance-stop',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1)
},
],
'InstanceState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'SystemStatus': {
'Status': 'ok'|'impaired'|'insufficient-data'|'not-applicable'|'initializing',
'Details': [
{
'Name': 'reachability',
'Status': 'passed'|'failed'|'insufficient-data'|'initializing',
'ImpairedSince': datetime(2015, 1, 1)
},
]
},
'InstanceStatus': {
'Status': 'ok'|'impaired'|'insufficient-data'|'not-applicable'|'initializing',
'Details': [
{
'Name': 'reachability',
'Status': 'passed'|'failed'|'insufficient-data'|'initializing',
'ImpairedSince': datetime(2015, 1, 1)
},
]
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_instances
(**kwargs)¶Describes one or more of your instances.
If you specify one or more instance IDs, Amazon EC2 returns information for those instances. If you do not specify instance IDs, Amazon EC2 returns information for all relevant instances. If you specify an instance ID that is not valid, an error is returned. If you specify an instance that you do not own, it is not included in the returned results.
Recently terminated instances might appear in the returned results. This interval is usually less than one hour.
Request Syntax
response = client.describe_instances(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
describe_internet_gateways
(**kwargs)¶Describes one or more of your Internet gateways.
Request Syntax
response = client.describe_internet_gateways(
DryRun=True|False,
InternetGatewayIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InternetGateways': [
{
'InternetGatewayId': 'string',
'Attachments': [
{
'VpcId': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_key_pairs
(**kwargs)¶Describes one or more of your key pairs.
For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_key_pairs(
DryRun=True|False,
KeyNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'KeyPairs': [
{
'KeyName': 'string',
'KeyFingerprint': 'string'
},
]
}
Response Structure
|
describe_moving_addresses
(**kwargs)¶Describes your Elastic IP addresses that are being moved to the EC2-VPC platform, or that are being restored to the EC2-Classic platform. This request does not return information about any other Elastic IP addresses in your account.
Request Syntax
response = client.describe_moving_addresses(
DryRun=True|False,
PublicIps=[
'string',
],
NextToken='string',
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'MovingAddressStatuses': [
{
'PublicIp': 'string',
'MoveStatus': 'movingToVpc'|'restoringToClassic'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_network_acls
(**kwargs)¶Describes one or more of your network ACLs.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_network_acls(
DryRun=True|False,
NetworkAclIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkAcls': [
{
'NetworkAclId': 'string',
'VpcId': 'string',
'IsDefault': True|False,
'Entries': [
{
'RuleNumber': 123,
'Protocol': 'string',
'RuleAction': 'allow'|'deny',
'Egress': True|False,
'CidrBlock': 'string',
'IcmpTypeCode': {
'Type': 123,
'Code': 123
},
'PortRange': {
'From': 123,
'To': 123
}
},
],
'Associations': [
{
'NetworkAclAssociationId': 'string',
'NetworkAclId': 'string',
'SubnetId': 'string'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_network_interface_attribute
(**kwargs)¶Describes a network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = client.describe_network_interface_attribute(
DryRun=True|False,
NetworkInterfaceId='string',
Attribute='description'|'groupSet'|'sourceDestCheck'|'attachment'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkInterfaceId': 'string',
'Description': {
'Value': 'string'
},
'SourceDestCheck': {
'Value': True|False
},
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
}
Response Structure
|
describe_network_interfaces
(**kwargs)¶Describes one or more of your network interfaces.
Request Syntax
response = client.describe_network_interfaces(
DryRun=True|False,
NetworkInterfaceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'AvailabilityZone': 'string',
'Description': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'RequesterManaged': True|False,
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string',
'AllocationId': 'string',
'AssociationId': 'string'
},
'TagSet': [
{
'Key': 'string',
'Value': 'string'
},
],
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string',
'AllocationId': 'string',
'AssociationId': 'string'
}
},
]
},
]
}
Response Structure
|
describe_placement_groups
(**kwargs)¶Describes one or more of your placement groups. For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_placement_groups(
DryRun=True|False,
GroupNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'PlacementGroups': [
{
'GroupName': 'string',
'Strategy': 'cluster',
'State': 'pending'|'available'|'deleting'|'deleted'
},
]
}
Response Structure
|
describe_prefix_lists
(**kwargs)¶Describes available AWS services in a prefix list format, which includes the prefix list name and prefix list ID of the service and the IP address range for the service. A prefix list ID is required for creating an outbound security group rule that allows traffic from a VPC to access an AWS service through a VPC endpoint.
Request Syntax
response = client.describe_prefix_lists(
DryRun=True|False,
PrefixListIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxResults=123,
NextToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'PrefixLists': [
{
'PrefixListId': 'string',
'PrefixListName': 'string',
'Cidrs': [
'string',
]
},
],
'NextToken': 'string'
}
Response Structure
|
describe_regions
(**kwargs)¶Describes one or more regions that are currently available to you.
For a list of the regions supported by Amazon EC2, see Regions and Endpoints .
Request Syntax
response = client.describe_regions(
DryRun=True|False,
RegionNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Regions': [
{
'RegionName': 'string',
'Endpoint': 'string'
},
]
}
Response Structure
|
describe_reserved_instances
(**kwargs)¶Describes one or more of the Reserved Instances that you purchased.
For more information about Reserved Instances, see Reserved Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_reserved_instances(
DryRun=True|False,
ReservedInstancesIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
OfferingType='Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstances': [
{
'ReservedInstancesId': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'AvailabilityZone': 'string',
'Start': datetime(2015, 1, 1),
'End': datetime(2015, 1, 1),
'Duration': 123,
'UsagePrice': ...,
'FixedPrice': ...,
'InstanceCount': 123,
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'State': 'payment-pending'|'active'|'payment-failed'|'retired',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'InstanceTenancy': 'default'|'dedicated',
'CurrencyCode': 'USD',
'OfferingType': 'Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront',
'RecurringCharges': [
{
'Frequency': 'Hourly',
'Amount': 123.0
},
]
},
]
}
Response Structure
|
describe_reserved_instances_listings
(**kwargs)¶Describes your account's Reserved Instance listings in the Reserved Instance Marketplace.
The Reserved Instance Marketplace matches sellers who want to resell Reserved Instance capacity that they no longer need with buyers who want to purchase additional capacity. Reserved Instances bought and sold through the Reserved Instance Marketplace work like any other Reserved Instances.
As a seller, you choose to list some or all of your Reserved Instances, and you specify the upfront price to receive for them. Your Reserved Instances are then listed in the Reserved Instance Marketplace and are available for purchase.
As a buyer, you specify the configuration of the Reserved Instance to purchase, and the Marketplace matches what you're searching for with what's available. The Marketplace first sells the lowest priced Reserved Instances to you, and continues to sell available Reserved Instance listings to you until your demand is met. You are charged based on the total price of all of the listings that you purchase.
For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_reserved_instances_listings(
ReservedInstancesId='string',
ReservedInstancesListingId='string',
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesListings': [
{
'ReservedInstancesListingId': 'string',
'ReservedInstancesId': 'string',
'CreateDate': datetime(2015, 1, 1),
'UpdateDate': datetime(2015, 1, 1),
'Status': 'active'|'pending'|'cancelled'|'closed',
'StatusMessage': 'string',
'InstanceCounts': [
{
'State': 'available'|'sold'|'cancelled'|'pending',
'InstanceCount': 123
},
],
'PriceSchedules': [
{
'Term': 123,
'Price': 123.0,
'CurrencyCode': 'USD',
'Active': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'ClientToken': 'string'
},
]
}
Response Structure
|
describe_reserved_instances_modifications
(**kwargs)¶Describes the modifications made to your Reserved Instances. If no parameter is specified, information about all your Reserved Instances modification requests is returned. If a modification ID is specified, only information about the specific modification is returned.
For more information, see Modifying Reserved Instances in the Amazon Elastic Compute Cloud User Guide.
Request Syntax
response = client.describe_reserved_instances_modifications(
ReservedInstancesModificationIds=[
'string',
],
NextToken='string',
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesModifications': [
{
'ReservedInstancesModificationId': 'string',
'ReservedInstancesIds': [
{
'ReservedInstancesId': 'string'
},
],
'ModificationResults': [
{
'ReservedInstancesId': 'string',
'TargetConfiguration': {
'AvailabilityZone': 'string',
'Platform': 'string',
'InstanceCount': 123,
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'
}
},
],
'CreateDate': datetime(2015, 1, 1),
'UpdateDate': datetime(2015, 1, 1),
'EffectiveDate': datetime(2015, 1, 1),
'Status': 'string',
'StatusMessage': 'string',
'ClientToken': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_reserved_instances_offerings
(**kwargs)¶Describes Reserved Instance offerings that are available for purchase. With Reserved Instances, you purchase the right to launch instances for a period of time. During that time period, you do not receive insufficient capacity errors, and you pay a lower usage rate than the rate charged for On-Demand instances for the actual time used.
For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_reserved_instances_offerings(
DryRun=True|False,
ReservedInstancesOfferingIds=[
'string',
],
InstanceType='t1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
AvailabilityZone='string',
ProductDescription='Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
InstanceTenancy='default'|'dedicated',
OfferingType='Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront',
NextToken='string',
MaxResults=123,
IncludeMarketplace=True|False,
MinDuration=123,
MaxDuration=123,
MaxInstanceCount=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesOfferings': [
{
'ReservedInstancesOfferingId': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'AvailabilityZone': 'string',
'Duration': 123,
'UsagePrice': ...,
'FixedPrice': ...,
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'InstanceTenancy': 'default'|'dedicated',
'CurrencyCode': 'USD',
'OfferingType': 'Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront',
'RecurringCharges': [
{
'Frequency': 'Hourly',
'Amount': 123.0
},
],
'Marketplace': True|False,
'PricingDetails': [
{
'Price': 123.0,
'Count': 123
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
describe_route_tables
(**kwargs)¶Describes one or more of your route tables.
Each subnet in your VPC must be associated with a route table. If a subnet is not explicitly associated with any route table, it is implicitly associated with the main route table. This command does not return the subnet ID for implicit associations.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_route_tables(
DryRun=True|False,
RouteTableIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'RouteTables': [
{
'RouteTableId': 'string',
'VpcId': 'string',
'Routes': [
{
'DestinationCidrBlock': 'string',
'DestinationPrefixListId': 'string',
'GatewayId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'NetworkInterfaceId': 'string',
'VpcPeeringConnectionId': 'string',
'State': 'active'|'blackhole',
'Origin': 'CreateRouteTable'|'CreateRoute'|'EnableVgwRoutePropagation'
},
],
'Associations': [
{
'RouteTableAssociationId': 'string',
'RouteTableId': 'string',
'SubnetId': 'string',
'Main': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'PropagatingVgws': [
{
'GatewayId': 'string'
},
]
},
]
}
Response Structure
|
describe_security_groups
(**kwargs)¶Describes one or more of your security groups.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_security_groups(
DryRun=True|False,
GroupNames=[
'string',
],
GroupIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SecurityGroups': [
{
'OwnerId': 'string',
'GroupName': 'string',
'GroupId': 'string',
'Description': 'string',
'IpPermissions': [
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
],
'IpPermissionsEgress': [
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
],
'VpcId': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_snapshot_attribute
(**kwargs)¶Describes the specified attribute of the specified snapshot. You can specify only one attribute at a time.
For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_snapshot_attribute(
DryRun=True|False,
SnapshotId='string',
Attribute='productCodes'|'createVolumePermission'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SnapshotId': 'string',
'CreateVolumePermissions': [
{
'UserId': 'string',
'Group': 'all'
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
]
}
Response Structure
|
describe_snapshots
(**kwargs)¶Describes one or more of the EBS snapshots available to you. Available snapshots include public snapshots available for any AWS account to launch, private snapshots that you own, and private snapshots owned by another AWS account but for which you've been given explicit create volume permissions.
The create volume permissions fall into the following categories:
all
group. All AWS accounts have create volume permissions for these snapshots.The list of snapshots returned can be modified by specifying snapshot IDs, snapshot owners, or AWS accounts with create volume permissions. If no options are specified, Amazon EC2 returns all snapshots for which you have create volume permissions.
If you specify one or more snapshot IDs, only snapshots that have the specified IDs are returned. If you specify an invalid snapshot ID, an error is returned. If you specify a snapshot ID for which you do not have access, it is not included in the returned results.
If you specify one or more snapshot owners, only snapshots from the specified owners and for which you have access are returned. The results can include the AWS account IDs of the specified owners, amazon
for snapshots owned by Amazon, or self
for snapshots that you own.
If you specify a list of restorable users, only snapshots with create snapshot permissions for those users are returned. You can specify AWS account IDs (if you own the snapshots), self
for snapshots for which you own or have explicit permissions, or all
for public snapshots.
If you are describing a long list of snapshots, you can paginate the output to make the list more manageable. The MaxResults
parameter sets the maximum number of results returned in a single page. If the list of results exceeds your MaxResults
value, then that number of results is returned along with a NextToken
value that can be passed to a subsequent DescribeSnapshots
request to retrieve the remaining results.
For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_snapshots(
DryRun=True|False,
SnapshotIds=[
'string',
],
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Snapshots': [
{
'SnapshotId': 'string',
'VolumeId': 'string',
'State': 'pending'|'completed'|'error',
'StartTime': datetime(2015, 1, 1),
'Progress': 'string',
'OwnerId': 'string',
'Description': 'string',
'VolumeSize': 123,
'OwnerAlias': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'Encrypted': True|False,
'KmsKeyId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_spot_datafeed_subscription
(**kwargs)¶Describes the data feed for Spot Instances. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_spot_datafeed_subscription(
DryRun=True|False
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'SpotDatafeedSubscription': {
'OwnerId': 'string',
'Bucket': 'string',
'Prefix': 'string',
'State': 'Active'|'Inactive',
'Fault': {
'Code': 'string',
'Message': 'string'
}
}
}
Response Structure
|
describe_spot_fleet_instances
(**kwargs)¶Describes the running instances for the specified Spot fleet.
Request Syntax
response = client.describe_spot_fleet_instances(
DryRun=True|False,
SpotFleetRequestId='string',
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotFleetRequestId': 'string',
'ActiveInstances': [
{
'InstanceType': 'string',
'InstanceId': 'string',
'SpotInstanceRequestId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_spot_fleet_request_history
(**kwargs)¶Describes the events for the specified Spot fleet request during the specified time.
Spot fleet events are delayed by up to 30 seconds before they can be described. This ensures that you can query by the last evaluated time and not miss a recorded event.
Request Syntax
response = client.describe_spot_fleet_request_history(
DryRun=True|False,
SpotFleetRequestId='string',
EventType='instanceChange'|'fleetRequestChange'|'error',
StartTime=datetime(2015, 1, 1),
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotFleetRequestId': 'string',
'StartTime': datetime(2015, 1, 1),
'LastEvaluatedTime': datetime(2015, 1, 1),
'HistoryRecords': [
{
'Timestamp': datetime(2015, 1, 1),
'EventType': 'instanceChange'|'fleetRequestChange'|'error',
'EventInformation': {
'InstanceId': 'string',
'EventSubType': 'string',
'EventDescription': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_spot_fleet_requests
(**kwargs)¶Describes your Spot fleet requests.
Request Syntax
response = client.describe_spot_fleet_requests(
DryRun=True|False,
SpotFleetRequestIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotFleetRequestConfigs': [
{
'SpotFleetRequestId': 'string',
'SpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating',
'SpotFleetRequestConfig': {
'ClientToken': 'string',
'SpotPrice': 'string',
'TargetCapacity': 123,
'ValidFrom': datetime(2015, 1, 1),
'ValidUntil': datetime(2015, 1, 1),
'TerminateInstancesWithExpiration': True|False,
'IamFleetRole': 'string',
'LaunchSpecifications': [
{
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'UserData': 'string',
'AddressingType': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string'
},
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'Monitoring': {
'Enabled': True|False
},
'SubnetId': 'string',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Name': 'string'
},
'EbsOptimized': True|False
},
]
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_spot_instance_requests
(**kwargs)¶Describes the Spot Instance requests that belong to your account. Spot Instances are instances that Amazon EC2 launches when the bid price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide .
You can use DescribeSpotInstanceRequests
to find a running Spot Instance by examining the response. If the status of the Spot Instance is fulfilled
, the instance ID appears in the response and contains the identifier of the instance. Alternatively, you can use DescribeInstances with a filter to look for instances where the instance lifecycle is spot
.
Request Syntax
response = client.describe_spot_instance_requests(
DryRun=True|False,
SpotInstanceRequestIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotInstanceRequests': [
{
'SpotInstanceRequestId': 'string',
'SpotPrice': 'string',
'Type': 'one-time'|'persistent',
'State': 'open'|'active'|'closed'|'cancelled'|'failed',
'Fault': {
'Code': 'string',
'Message': 'string'
},
'Status': {
'Code': 'string',
'UpdateTime': datetime(2015, 1, 1),
'Message': 'string'
},
'ValidFrom': datetime(2015, 1, 1),
'ValidUntil': datetime(2015, 1, 1),
'LaunchGroup': 'string',
'AvailabilityZoneGroup': 'string',
'LaunchSpecification': {
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'UserData': 'string',
'AddressingType': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string'
},
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'SubnetId': 'string',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Name': 'string'
},
'EbsOptimized': True|False,
'Monitoring': {
'Enabled': True|False
}
},
'InstanceId': 'string',
'CreateTime': datetime(2015, 1, 1),
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'LaunchedAvailabilityZone': 'string'
},
]
}
Response Structure
|
describe_spot_price_history
(**kwargs)¶Describes the Spot Price history. The prices returned are listed in chronological order, from the oldest to the most recent, for up to the past 90 days. For more information, see Spot Instance Pricing History in the Amazon Elastic Compute Cloud User Guide .
When you specify a start and end time, this operation returns the prices of the instance types within the time range that you specified and the time when the price changed. The price is valid within the time period that you specified; the response merely indicates the last time that the price changed.
Request Syntax
response = client.describe_spot_price_history(
DryRun=True|False,
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
InstanceTypes=[
't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
],
ProductDescriptions=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
AvailabilityZone='string',
MaxResults=123,
NextToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotPriceHistory': [
{
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'SpotPrice': 'string',
'Timestamp': datetime(2015, 1, 1),
'AvailabilityZone': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_subnets
(**kwargs)¶Describes one or more of your subnets.
For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_subnets(
DryRun=True|False,
SubnetIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Subnets': [
{
'SubnetId': 'string',
'State': 'pending'|'available',
'VpcId': 'string',
'CidrBlock': 'string',
'AvailableIpAddressCount': 123,
'AvailabilityZone': 'string',
'DefaultForAz': True|False,
'MapPublicIpOnLaunch': True|False,
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
Describes one or more of the tags for your EC2 resources.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_tags(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxResults=123,
NextToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'customer-gateway'|'dhcp-options'|'image'|'instance'|'internet-gateway'|'network-acl'|'network-interface'|'reserved-instances'|'route-table'|'snapshot'|'spot-instances-request'|'subnet'|'security-group'|'volume'|'vpc'|'vpn-connection'|'vpn-gateway',
'Key': 'string',
'Value': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_volume_attribute
(**kwargs)¶Describes the specified attribute of the specified volume. You can specify only one attribute at a time.
For more information about EBS volumes, see Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_volume_attribute(
DryRun=True|False,
VolumeId='string',
Attribute='autoEnableIO'|'productCodes'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'AutoEnableIO': {
'Value': True|False
},
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
]
}
Response Structure
|
describe_volume_status
(**kwargs)¶Describes the status of the specified volumes. Volume status provides the result of the checks performed on your volumes to determine events that can impair the performance of your volumes. The performance of a volume can be affected if an issue occurs on the volume's underlying host. If the volume's underlying host experiences a power outage or system issue, after the system is restored, there could be data inconsistencies on the volume. Volume events notify you if this occurs. Volume actions notify you if any action needs to be taken in response to the event.
The DescribeVolumeStatus
operation provides the following information about the specified volumes:
Status : Reflects the current status of the volume. The possible values are ok
, impaired
, warning
, or insufficient-data
. If all checks pass, the overall status of the volume is ok
. If the check fails, the overall status is impaired
. If the status is insufficient-data
, then the checks may still be taking place on your volume at the time. We recommend that you retry the request. For more information on volume status, see Monitoring the Status of Your Volumes .
Events : Reflect the cause of a volume status and may require you to take action. For example, if your volume returns an impaired
status, then the volume event might be potential-data-inconsistency
. This means that your volume has been affected by an issue with the underlying host, has all I/O operations disabled, and may have inconsistent data.
Actions : Reflect the actions you may have to take in response to an event. For example, if the status of the volume is impaired
and the volume event shows potential-data-inconsistency
, then the action shows enable-volume-io
. This means that you may want to enable the I/O operations for the volume by calling the EnableVolumeIO action and then check the volume for data consistency.
Note
Volume status is based on the volume status checks, and does not reflect the volume state. Therefore, volume status does not indicate volumes in the error
state (for example, when a volume is incapable of accepting I/O.)
Request Syntax
response = client.describe_volume_status(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeStatuses': [
{
'VolumeId': 'string',
'AvailabilityZone': 'string',
'VolumeStatus': {
'Status': 'ok'|'impaired'|'insufficient-data',
'Details': [
{
'Name': 'io-enabled'|'io-performance',
'Status': 'string'
},
]
},
'Events': [
{
'EventType': 'string',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1),
'EventId': 'string'
},
],
'Actions': [
{
'Code': 'string',
'Description': 'string',
'EventType': 'string',
'EventId': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
describe_volumes
(**kwargs)¶Describes the specified EBS volumes.
If you are describing a long list of volumes, you can paginate the output to make the list more manageable. The MaxResults
parameter sets the maximum number of results returned in a single page. If the list of results exceeds your MaxResults
value, then that number of results is returned along with a NextToken
value that can be passed to a subsequent DescribeVolumes
request to retrieve the remaining results.
For more information about EBS volumes, see Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.describe_volumes(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Volumes': [
{
'VolumeId': 'string',
'Size': 123,
'SnapshotId': 'string',
'AvailabilityZone': 'string',
'State': 'creating'|'available'|'in-use'|'deleting'|'deleted'|'error',
'CreateTime': datetime(2015, 1, 1),
'Attachments': [
{
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False,
'KmsKeyId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
describe_vpc_attribute
(**kwargs)¶Describes the specified attribute of the specified VPC. You can specify only one attribute at a time.
Request Syntax
response = client.describe_vpc_attribute(
DryRun=True|False,
VpcId='string',
Attribute='enableDnsSupport'|'enableDnsHostnames'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcId': 'string',
'EnableDnsSupport': {
'Value': True|False
},
'EnableDnsHostnames': {
'Value': True|False
}
}
Response Structure
|
describe_vpc_classic_link
(**kwargs)¶Describes the ClassicLink status of one or more VPCs.
Request Syntax
response = client.describe_vpc_classic_link(
DryRun=True|False,
VpcIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Vpcs': [
{
'VpcId': 'string',
'ClassicLinkEnabled': True|False,
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
describe_vpc_endpoint_services
(**kwargs)¶Describes all supported AWS services that can be specified when creating a VPC endpoint.
Request Syntax
response = client.describe_vpc_endpoint_services(
DryRun=True|False,
MaxResults=123,
NextToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ServiceNames': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
describe_vpc_endpoints
(**kwargs)¶Describes one or more of your VPC endpoints.
Request Syntax
response = client.describe_vpc_endpoints(
DryRun=True|False,
VpcEndpointIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxResults=123,
NextToken='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcEndpoints': [
{
'VpcEndpointId': 'string',
'VpcId': 'string',
'ServiceName': 'string',
'State': 'Pending'|'Available'|'Deleting'|'Deleted',
'PolicyDocument': 'string',
'RouteTableIds': [
'string',
],
'CreationTimestamp': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
|
describe_vpc_peering_connections
(**kwargs)¶Describes one or more of your VPC peering connections.
Request Syntax
response = client.describe_vpc_peering_connections(
DryRun=True|False,
VpcPeeringConnectionIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcPeeringConnections': [
{
'AccepterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'ExpirationTime': datetime(2015, 1, 1),
'RequesterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'Status': {
'Code': 'initiating-request'|'pending-acceptance'|'active'|'deleted'|'rejected'|'failed'|'expired'|'provisioning'|'deleting',
'Message': 'string'
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VpcPeeringConnectionId': 'string'
},
]
}
Response Structure
|
describe_vpcs
(**kwargs)¶Describes one or more of your VPCs.
Request Syntax
response = client.describe_vpcs(
DryRun=True|False,
VpcIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Vpcs': [
{
'VpcId': 'string',
'State': 'pending'|'available',
'CidrBlock': 'string',
'DhcpOptionsId': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'InstanceTenancy': 'default'|'dedicated',
'IsDefault': True|False
},
]
}
Response Structure
|
describe_vpn_connections
(**kwargs)¶Describes one or more of your VPN connections.
For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_vpn_connections(
DryRun=True|False,
VpnConnectionIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpnConnections': [
{
'VpnConnectionId': 'string',
'State': 'pending'|'available'|'deleting'|'deleted',
'CustomerGatewayConfiguration': 'string',
'Type': 'ipsec.1',
'CustomerGatewayId': 'string',
'VpnGatewayId': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VgwTelemetry': [
{
'OutsideIpAddress': 'string',
'Status': 'UP'|'DOWN',
'LastStatusChange': datetime(2015, 1, 1),
'StatusMessage': 'string',
'AcceptedRouteCount': 123
},
],
'Options': {
'StaticRoutesOnly': True|False
},
'Routes': [
{
'DestinationCidrBlock': 'string',
'Source': 'Static',
'State': 'pending'|'available'|'deleting'|'deleted'
},
]
},
]
}
Response Structure
|
describe_vpn_gateways
(**kwargs)¶Describes one or more of your virtual private gateways.
For more information about virtual private gateways, see Adding an IPsec Hardware VPN to Your VPC in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.describe_vpn_gateways(
DryRun=True|False,
VpnGatewayIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpnGateways': [
{
'VpnGatewayId': 'string',
'State': 'pending'|'available'|'deleting'|'deleted',
'Type': 'ipsec.1',
'AvailabilityZone': 'string',
'VpcAttachments': [
{
'VpcId': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached'
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
}
Response Structure
|
detach_classic_link_vpc
(**kwargs)¶Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped.
Request Syntax
response = client.detach_classic_link_vpc(
DryRun=True|False,
InstanceId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
detach_internet_gateway
(**kwargs)¶Detaches an Internet gateway from a VPC, disabling connectivity between the Internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses.
Request Syntax
response = client.detach_internet_gateway(
DryRun=True|False,
InternetGatewayId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
detach_network_interface
(**kwargs)¶Detaches a network interface from an instance.
Request Syntax
response = client.detach_network_interface(
DryRun=True|False,
AttachmentId='string',
Force=True|False
)
Parameters: |
|
---|---|
Returns: | None |
detach_volume
(**kwargs)¶Detaches an EBS volume from an instance. Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to do so results in the volume being stuck in a busy state while detaching.
If an Amazon EBS volume is the root device of an instance, it can't be detached while the instance is running. To detach the root volume, stop the instance first.
When a volume with an AWS Marketplace product code is detached from an instance, the product code is no longer associated with the instance.
For more information, see Detaching an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.detach_volume(
DryRun=True|False,
VolumeId='string',
InstanceId='string',
Device='string',
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
detach_vpn_gateway
(**kwargs)¶Detaches a virtual private gateway from a VPC. You do this if you're planning to turn off the VPC and not use it anymore. You can confirm a virtual private gateway has been completely detached from a VPC by describing the virtual private gateway (any attachments to the virtual private gateway are also described).
You must wait for the attachment's state to switch to detached
before you can delete the VPC or attach a different VPC to the virtual private gateway.
Request Syntax
response = client.detach_vpn_gateway(
DryRun=True|False,
VpnGatewayId='string',
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
disable_vgw_route_propagation
(**kwargs)¶Disables a virtual private gateway (VGW) from propagating routes to a specified route table of a VPC.
Request Syntax
response = client.disable_vgw_route_propagation(
RouteTableId='string',
GatewayId='string'
)
Parameters: |
|
---|---|
Returns: | None |
disable_vpc_classic_link
(**kwargs)¶Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC that has EC2-Classic instances linked to it.
Request Syntax
response = client.disable_vpc_classic_link(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
disassociate_address
(**kwargs)¶Disassociates an Elastic IP address from the instance or network interface it's associated with.
An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.
Request Syntax
response = client.disassociate_address(
DryRun=True|False,
PublicIp='string',
AssociationId='string'
)
Parameters: |
|
---|---|
Returns: | None |
disassociate_route_table
(**kwargs)¶Disassociates a subnet from a route table.
After you perform this action, the subnet no longer uses the routes in the route table. Instead, it uses the routes in the VPC's main route table. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.disassociate_route_table(
DryRun=True|False,
AssociationId='string'
)
Parameters: |
|
---|---|
Returns: | None |
enable_vgw_route_propagation
(**kwargs)¶Enables a virtual private gateway (VGW) to propagate routes to the specified route table of a VPC.
Request Syntax
response = client.enable_vgw_route_propagation(
RouteTableId='string',
GatewayId='string'
)
Parameters: |
|
---|---|
Returns: | None |
enable_volume_io
(**kwargs)¶Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially inconsistent.
Request Syntax
response = client.enable_volume_io(
DryRun=True|False,
VolumeId='string'
)
Parameters: |
|
---|---|
Returns: | None |
enable_vpc_classic_link
(**kwargs)¶Enables a VPC for ClassicLink. You can then link EC2-Classic instances to your ClassicLink-enabled VPC to allow communication over private IP addresses. You cannot enable your VPC for ClassicLink if any of your VPC's route tables have existing routes for address ranges within the 10.0.0.0/8
IP address range, excluding local routes for VPCs in the 10.0.0.0/16
and 10.1.0.0/16
IP address ranges. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide.
Request Syntax
response = client.enable_vpc_classic_link(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
generate_presigned_url
(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
Parameters: |
|
---|---|
Returns: | The presigned url |
get_console_output
(**kwargs)¶Gets the console output for the specified instance.
Instances do not have a physical monitor through which you can view their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. To allow these actions, we provide them through the Amazon EC2 API and command line interface.
Instance console output is buffered and posted shortly after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which is available for at least one hour after the most recent post.
For Linux instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. This output is buffered because the instance produces it and then posts it to a store where the instance's owner can retrieve it.
For Windows instances, the instance console output includes output from the EC2Config service.
Request Syntax
response = client.get_console_output(
DryRun=True|False,
InstanceId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceId': 'string',
'Timestamp': datetime(2015, 1, 1),
'Output': 'string'
}
Response Structure
|
get_paginator
(operation_name)¶Create a paginator for an operation.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Raises OperationNotPageableError: | |
Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
|
Return type: | L{botocore.paginate.Paginator} |
Returns: | A paginator object. |
get_password_data
(**kwargs)¶Retrieves the encrypted administrator password for an instance running Windows.
The Windows password is generated at boot if the EC2Config
service plugin, Ec2SetPassword
, is enabled. This usually only happens the first time an AMI is launched, and then Ec2SetPassword
is automatically disabled. The password is not generated for rebundled AMIs unless Ec2SetPassword
is enabled before bundling.
The password is encrypted using the key pair that you specified when you launched the instance. You must provide the corresponding key pair file.
Password generation and encryption takes a few moments. We recommend that you wait up to 15 minutes after launching an instance before trying to retrieve the generated password.
Request Syntax
response = client.get_password_data(
DryRun=True|False,
InstanceId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceId': 'string',
'Timestamp': datetime(2015, 1, 1),
'PasswordData': 'string'
}
Response Structure
|
get_waiter
(waiter_name)¶import_image
(**kwargs)¶Import single or multi-volume disk images or EBS snapshots into an Amazon Machine Image (AMI).
Request Syntax
response = client.import_image(
DryRun=True|False,
Description='string',
DiskContainers=[
{
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
},
'DeviceName': 'string',
'SnapshotId': 'string'
},
],
LicenseType='string',
Hypervisor='string',
Architecture='string',
Platform='string',
ClientData={
'UploadStart': datetime(2015, 1, 1),
'UploadEnd': datetime(2015, 1, 1),
'UploadSize': 123.0,
'Comment': 'string'
},
ClientToken='string',
RoleName='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImportTaskId': 'string',
'Architecture': 'string',
'LicenseType': 'string',
'Platform': 'string',
'Hypervisor': 'string',
'Description': 'string',
'SnapshotDetails': [
{
'DiskImageSize': 123.0,
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
},
'DeviceName': 'string',
'SnapshotId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
},
],
'ImageId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
}
Response Structure
|
import_instance
(**kwargs)¶Creates an import instance task using metadata from the specified disk image. ImportInstance
only supports single-volume VMs. To import multi-volume VMs, use ImportImage . After importing the image, you then upload it using the ec2-import-volume
command in the EC2 command line tools. For more information, see Using the Command Line Tools to Import Your Virtual Machine to Amazon EC2 in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.import_instance(
DryRun=True|False,
Description='string',
LaunchSpecification={
'Architecture': 'i386'|'x86_64',
'GroupNames': [
'string',
],
'GroupIds': [
'string',
],
'AdditionalInfo': 'string',
'UserData': {
'Data': 'string'
},
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'Monitoring': True|False,
'SubnetId': 'string',
'InstanceInitiatedShutdownBehavior': 'stop'|'terminate',
'PrivateIpAddress': 'string'
},
DiskImages=[
{
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Bytes': 123,
'ImportManifestUrl': 'string'
},
'Description': 'string',
'Volume': {
'Size': 123
}
},
],
Platform='Windows'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ConversionTask': {
'ConversionTaskId': 'string',
'ExpirationTime': 'string',
'ImportInstance': {
'Volumes': [
{
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
},
'Status': 'string',
'StatusMessage': 'string',
'Description': 'string'
},
],
'InstanceId': 'string',
'Platform': 'Windows',
'Description': 'string'
},
'ImportVolume': {
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Description': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
}
},
'State': 'active'|'cancelling'|'cancelled'|'completed',
'StatusMessage': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
import_key_pair
(**kwargs)¶Imports the public key from an RSA key pair that you created with a third-party tool. Compare this with CreateKeyPair , in which AWS creates the key pair and gives the keys to you (AWS keeps a copy of the public key). With ImportKeyPair, you create the key pair and give AWS just the public key. The private key is never transferred between you and AWS.
For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.import_key_pair(
DryRun=True|False,
KeyName='string',
PublicKeyMaterial=b'bytes'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'KeyName': 'string',
'KeyFingerprint': 'string'
}
Response Structure
|
import_snapshot
(**kwargs)¶Imports a disk into an EBS snapshot.
Request Syntax
response = client.import_snapshot(
DryRun=True|False,
Description='string',
DiskContainer={
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
}
},
ClientData={
'UploadStart': datetime(2015, 1, 1),
'UploadEnd': datetime(2015, 1, 1),
'UploadSize': 123.0,
'Comment': 'string'
},
ClientToken='string',
RoleName='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImportTaskId': 'string',
'SnapshotTaskDetail': {
'DiskImageSize': 123.0,
'Description': 'string',
'Format': 'string',
'Url': 'string',
'UserBucket': {
'S3Bucket': 'string',
'S3Key': 'string'
},
'SnapshotId': 'string',
'Progress': 'string',
'StatusMessage': 'string',
'Status': 'string'
},
'Description': 'string'
}
Response Structure
|
import_volume
(**kwargs)¶Creates an import volume task using metadata from the specified disk image. After importing the image, you then upload it using the ec2-import-volume
command in the Amazon EC2 command-line interface (CLI) tools. For more information, see Using the Command Line Tools to Import Your Virtual Machine to Amazon EC2 in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.import_volume(
DryRun=True|False,
AvailabilityZone='string',
Image={
'Format': 'VMDK'|'RAW'|'VHD',
'Bytes': 123,
'ImportManifestUrl': 'string'
},
Description='string',
Volume={
'Size': 123
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ConversionTask': {
'ConversionTaskId': 'string',
'ExpirationTime': 'string',
'ImportInstance': {
'Volumes': [
{
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
},
'Status': 'string',
'StatusMessage': 'string',
'Description': 'string'
},
],
'InstanceId': 'string',
'Platform': 'Windows',
'Description': 'string'
},
'ImportVolume': {
'BytesConverted': 123,
'AvailabilityZone': 'string',
'Description': 'string',
'Image': {
'Format': 'VMDK'|'RAW'|'VHD',
'Size': 123,
'ImportManifestUrl': 'string',
'Checksum': 'string'
},
'Volume': {
'Size': 123,
'Id': 'string'
}
},
'State': 'active'|'cancelling'|'cancelled'|'completed',
'StatusMessage': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
|
modify_image_attribute
(**kwargs)¶Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.
Note
AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace product code cannot be made public.
Request Syntax
response = client.modify_image_attribute(
DryRun=True|False,
ImageId='string',
Attribute='string',
OperationType='string',
UserIds=[
'string',
],
UserGroups=[
'string',
],
ProductCodes=[
'string',
],
Value='string',
LaunchPermission={
'Add': [
{
'UserId': 'string',
'Group': 'all'
},
],
'Remove': [
{
'UserId': 'string',
'Group': 'all'
},
]
},
Description={
'Value': 'string'
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_instance_attribute
(**kwargs)¶Modifies the specified attribute of the specified instance. You can specify only one attribute at a time.
To modify some attributes, the instance must be stopped. For more information, see Modifying Attributes of a Stopped Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.modify_instance_attribute(
DryRun=True|False,
InstanceId='string',
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport',
Value='string',
BlockDeviceMappings=[
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'DeleteOnTermination': True|False
},
'VirtualName': 'string',
'NoDevice': 'string'
},
],
SourceDestCheck={
'Value': True|False
},
DisableApiTermination={
'Value': True|False
},
InstanceType={
'Value': 'string'
},
Kernel={
'Value': 'string'
},
Ramdisk={
'Value': 'string'
},
UserData={
'Value': b'bytes'
},
InstanceInitiatedShutdownBehavior={
'Value': 'string'
},
Groups=[
'string',
],
EbsOptimized={
'Value': True|False
},
SriovNetSupport={
'Value': 'string'
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_network_interface_attribute
(**kwargs)¶Modifies the specified network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = client.modify_network_interface_attribute(
DryRun=True|False,
NetworkInterfaceId='string',
Description={
'Value': 'string'
},
SourceDestCheck={
'Value': True|False
},
Groups=[
'string',
],
Attachment={
'AttachmentId': 'string',
'DeleteOnTermination': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_reserved_instances
(**kwargs)¶Modifies the Availability Zone, instance count, instance type, or network platform (EC2-Classic or EC2-VPC) of your Reserved Instances. The Reserved Instances to be modified must be identical, except for Availability Zone, network platform, and instance type.
For more information, see Modifying Reserved Instances in the Amazon Elastic Compute Cloud User Guide.
Request Syntax
response = client.modify_reserved_instances(
ClientToken='string',
ReservedInstancesIds=[
'string',
],
TargetConfigurations=[
{
'AvailabilityZone': 'string',
'Platform': 'string',
'InstanceCount': 123,
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesModificationId': 'string'
}
Response Structure
|
modify_snapshot_attribute
(**kwargs)¶Adds or removes permission settings for the specified snapshot. You may add or remove specified AWS account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single API call. If you need to both add and remove account IDs for a snapshot, you must use multiple API calls.
For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide .
Note
Snapshots with AWS Marketplace product codes cannot be made public.
Request Syntax
response = client.modify_snapshot_attribute(
DryRun=True|False,
SnapshotId='string',
Attribute='productCodes'|'createVolumePermission',
OperationType='string',
UserIds=[
'string',
],
GroupNames=[
'string',
],
CreateVolumePermission={
'Add': [
{
'UserId': 'string',
'Group': 'all'
},
],
'Remove': [
{
'UserId': 'string',
'Group': 'all'
},
]
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_subnet_attribute
(**kwargs)¶Modifies a subnet attribute.
Request Syntax
response = client.modify_subnet_attribute(
SubnetId='string',
MapPublicIpOnLaunch={
'Value': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_volume_attribute
(**kwargs)¶Modifies a volume attribute.
By default, all I/O operations for the volume are suspended when the data on the volume is determined to be potentially inconsistent, to prevent undetectable, latent data corruption. The I/O access to the volume can be resumed by first enabling I/O access and then checking the data consistency on your volume.
You can change the default behavior to resume I/O operations. We recommend that you change this only for boot volumes or for volumes that are stateless or disposable.
Request Syntax
response = client.modify_volume_attribute(
DryRun=True|False,
VolumeId='string',
AutoEnableIO={
'Value': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_vpc_attribute
(**kwargs)¶Modifies the specified attribute of the specified VPC.
Request Syntax
response = client.modify_vpc_attribute(
VpcId='string',
EnableDnsSupport={
'Value': True|False
},
EnableDnsHostnames={
'Value': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
modify_vpc_endpoint
(**kwargs)¶Modifies attributes of a specified VPC endpoint. You can modify the policy associated with the endpoint, and you can add and remove route tables associated with the endpoint.
Request Syntax
response = client.modify_vpc_endpoint(
DryRun=True|False,
VpcEndpointId='string',
ResetPolicy=True|False,
PolicyDocument='string',
AddRouteTableIds=[
'string',
],
RemoveRouteTableIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
monitor_instances
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.monitor_instances(
DryRun=True|False,
InstanceIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
move_address_to_vpc
(**kwargs)¶Moves an Elastic IP address from the EC2-Classic platform to the EC2-VPC platform. The Elastic IP address must be allocated to your account, and it must not be associated with an instance. After the Elastic IP address is moved, it is no longer available for use in the EC2-Classic platform, unless you move it back using the RestoreAddressToClassic request. You cannot move an Elastic IP address that's allocated for use in the EC2-VPC platform to the EC2-Classic platform.
Request Syntax
response = client.move_address_to_vpc(
DryRun=True|False,
PublicIp='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AllocationId': 'string',
'Status': 'MoveInProgress'|'InVpc'|'InClassic'
}
Response Structure
|
purchase_reserved_instances_offering
(**kwargs)¶Purchases a Reserved Instance for use with your account. With Amazon EC2 Reserved Instances, you obtain a capacity reservation for a certain instance configuration over a specified period of time and pay a lower hourly rate compared to on-Demand Instance pricing.
Use DescribeReservedInstancesOfferings to get a list of Reserved Instance offerings that match your specifications. After you've purchased a Reserved Instance, you can check for your new Reserved Instance with DescribeReservedInstances .
For more information, see Reserved Instances and Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.purchase_reserved_instances_offering(
DryRun=True|False,
ReservedInstancesOfferingId='string',
InstanceCount=123,
LimitPrice={
'Amount': 123.0,
'CurrencyCode': 'USD'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesId': 'string'
}
Response Structure
|
reboot_instances
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.reboot_instances(
DryRun=True|False,
InstanceIds=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
register_image
(**kwargs)¶Registers an AMI. When you're creating an AMI, this is the final step you must complete before you can launch an instance from the AMI. This step is required if you're creating an instance store-backed Linux or Windows AMI. For more information, see Creating an Instance Store-Backed Linux AMI and Creating an Instance Store-Backed Windows AMI in the Amazon Elastic Compute Cloud User Guide .
Note
For Amazon EBS-backed instances, CreateImage creates and registers the AMI in a single request, so you don't have to register the AMI yourself.
You can also use RegisterImage
to create an Amazon EBS-backed AMI from a snapshot of a root device volume. For more information, see Launching an Instance from a Backup in the Amazon Elastic Compute Cloud User Guide . Note that although you can create a Windows AMI from a snapshot, you can't launch an instance from the AMI - use the CreateImage command instead.
If needed, you can deregister an AMI at any time. Any modifications you make to an AMI backed by an instance store volume invalidates its registration. If you make changes to an image, deregister the previous image and register the new image.
Note
You can't register an image where a secondary (non-root) snapshot has AWS Marketplace product codes.
Request Syntax
response = client.register_image(
DryRun=True|False,
ImageLocation='string',
Name='string',
Description='string',
Architecture='i386'|'x86_64',
KernelId='string',
RamdiskId='string',
RootDeviceName='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
VirtualizationType='string',
SriovNetSupport='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImageId': 'string'
}
Response Structure
|
reject_vpc_peering_connection
(**kwargs)¶Rejects a VPC peering connection request. The VPC peering connection must be in the pending-acceptance
state. Use the DescribeVpcPeeringConnections request to view your outstanding VPC peering connection requests. To delete an active VPC peering connection, or to delete a VPC peering connection request that you initiated, use DeleteVpcPeeringConnection .
Request Syntax
response = client.reject_vpc_peering_connection(
DryRun=True|False,
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
release_address
(**kwargs)¶Releases the specified Elastic IP address.
After releasing an Elastic IP address, it is released to the IP address pool and might be unavailable to you. Be sure to update your DNS records and any servers or devices that communicate with the address. If you attempt to release an Elastic IP address that you already released, you'll get an AuthFailure
error if the address is already allocated to another AWS account.
[EC2-Classic, default VPC] Releasing an Elastic IP address automatically disassociates it from any instance that it's associated with. To disassociate an Elastic IP address without releasing it, use DisassociateAddress .
[Nondefault VPC] You must use DisassociateAddress to disassociate the Elastic IP address before you try to release it. Otherwise, Amazon EC2 returns an error (InvalidIPAddress.InUse
).
Request Syntax
response = client.release_address(
DryRun=True|False,
PublicIp='string',
AllocationId='string'
)
Parameters: |
|
---|---|
Returns: | None |
replace_network_acl_association
(**kwargs)¶Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.replace_network_acl_association(
DryRun=True|False,
AssociationId='string',
NetworkAclId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NewAssociationId': 'string'
}
Response Structure
|
replace_network_acl_entry
(**kwargs)¶Replaces an entry (rule) in a network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.replace_network_acl_entry(
DryRun=True|False,
NetworkAclId='string',
RuleNumber=123,
Protocol='string',
RuleAction='allow'|'deny',
Egress=True|False,
CidrBlock='string',
IcmpTypeCode={
'Type': 123,
'Code': 123
},
PortRange={
'From': 123,
'To': 123
}
)
Parameters: |
|
---|---|
Returns: | None |
replace_route
(**kwargs)¶Replaces an existing route within a route table in a VPC. You must provide only one of the following: Internet gateway or virtual private gateway, NAT instance, VPC peering connection, or network interface.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.replace_route(
DryRun=True|False,
RouteTableId='string',
DestinationCidrBlock='string',
GatewayId='string',
InstanceId='string',
NetworkInterfaceId='string',
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Returns: | None |
replace_route_table_association
(**kwargs)¶Changes the route table associated with a given subnet in a VPC. After the operation completes, the subnet uses the routes in the new route table it's associated with. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
You can also use ReplaceRouteTableAssociation to change which table is the main route table in the VPC. You just specify the main route table's association ID and the route table to be the new main route table.
Request Syntax
response = client.replace_route_table_association(
DryRun=True|False,
AssociationId='string',
RouteTableId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NewAssociationId': 'string'
}
Response Structure
|
report_instance_status
(**kwargs)¶Submits feedback about the status of an instance. The instance must be in the running
state. If your experience with the instance differs from the instance status returned by DescribeInstanceStatus , use ReportInstanceStatus to report your experience with the instance. Amazon EC2 collects this information to improve the accuracy of status checks.
Use of this action does not change the value returned by DescribeInstanceStatus .
Request Syntax
response = client.report_instance_status(
DryRun=True|False,
Instances=[
'string',
],
Status='ok'|'impaired',
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
ReasonCodes=[
'instance-stuck-in-state'|'unresponsive'|'not-accepting-credentials'|'password-not-available'|'performance-network'|'performance-instance-store'|'performance-ebs-volume'|'performance-other'|'other',
],
Description='string'
)
Parameters: |
|
---|---|
Returns: | None |
request_spot_fleet
(**kwargs)¶Creates a Spot fleet request.
For more information, see Spot Fleets in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.request_spot_fleet(
DryRun=True|False,
SpotFleetRequestConfig={
'ClientToken': 'string',
'SpotPrice': 'string',
'TargetCapacity': 123,
'ValidFrom': datetime(2015, 1, 1),
'ValidUntil': datetime(2015, 1, 1),
'TerminateInstancesWithExpiration': True|False,
'IamFleetRole': 'string',
'LaunchSpecifications': [
{
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'UserData': 'string',
'AddressingType': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string'
},
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'Monitoring': {
'Enabled': True|False
},
'SubnetId': 'string',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Name': 'string'
},
'EbsOptimized': True|False
},
]
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotFleetRequestId': 'string'
}
Response Structure
|
request_spot_instances
(**kwargs)¶Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 launches when the bid price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.request_spot_instances(
DryRun=True|False,
SpotPrice='string',
ClientToken='string',
InstanceCount=123,
Type='one-time'|'persistent',
ValidFrom=datetime(2015, 1, 1),
ValidUntil=datetime(2015, 1, 1),
LaunchGroup='string',
AvailabilityZoneGroup='string',
LaunchSpecification={
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
'string',
],
'UserData': 'string',
'AddressingType': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string'
},
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'SubnetId': 'string',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Name': 'string'
},
'EbsOptimized': True|False,
'Monitoring': {
'Enabled': True|False
},
'SecurityGroupIds': [
'string',
]
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotInstanceRequests': [
{
'SpotInstanceRequestId': 'string',
'SpotPrice': 'string',
'Type': 'one-time'|'persistent',
'State': 'open'|'active'|'closed'|'cancelled'|'failed',
'Fault': {
'Code': 'string',
'Message': 'string'
},
'Status': {
'Code': 'string',
'UpdateTime': datetime(2015, 1, 1),
'Message': 'string'
},
'ValidFrom': datetime(2015, 1, 1),
'ValidUntil': datetime(2015, 1, 1),
'LaunchGroup': 'string',
'AvailabilityZoneGroup': 'string',
'LaunchSpecification': {
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'UserData': 'string',
'AddressingType': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string'
},
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
'SubnetId': 'string',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Name': 'string'
},
'EbsOptimized': True|False,
'Monitoring': {
'Enabled': True|False
}
},
'InstanceId': 'string',
'CreateTime': datetime(2015, 1, 1),
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'LaunchedAvailabilityZone': 'string'
},
]
}
Response Structure
|
reset_image_attribute
(**kwargs)¶Resets an attribute of an AMI to its default value.
Note
The productCodes attribute can't be reset.
Request Syntax
response = client.reset_image_attribute(
DryRun=True|False,
ImageId='string',
Attribute='launchPermission'
)
Parameters: |
|
---|---|
Returns: | None |
reset_instance_attribute
(**kwargs)¶Resets an attribute of an instance to its default value. To reset the kernel
or ramdisk
, the instance must be in a stopped state. To reset the SourceDestCheck
, the instance can be either running or stopped.
The SourceDestCheck
attribute controls whether source/destination checking is enabled. The default value is true
, which means checking is enabled. This value must be false
for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = client.reset_instance_attribute(
DryRun=True|False,
InstanceId='string',
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Returns: | None |
reset_network_interface_attribute
(**kwargs)¶Resets a network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = client.reset_network_interface_attribute(
DryRun=True|False,
NetworkInterfaceId='string',
SourceDestCheck='string'
)
Parameters: |
|
---|---|
Returns: | None |
reset_snapshot_attribute
(**kwargs)¶Resets permission settings for the specified snapshot.
For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.reset_snapshot_attribute(
DryRun=True|False,
SnapshotId='string',
Attribute='productCodes'|'createVolumePermission'
)
Parameters: |
|
---|---|
Returns: | None |
restore_address_to_classic
(**kwargs)¶Restores an Elastic IP address that was previously moved to the EC2-VPC platform back to the EC2-Classic platform. You cannot move an Elastic IP address that was originally allocated for use in EC2-VPC. The Elastic IP address must not be associated with an instance or network interface.
Request Syntax
response = client.restore_address_to_classic(
DryRun=True|False,
PublicIp='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Status': 'MoveInProgress'|'InVpc'|'InClassic',
'PublicIp': 'string'
}
Response Structure
|
revoke_security_group_egress
(**kwargs)¶Removes one or more egress rules from a security group for EC2-VPC. The values that you specify in the revoke request (for example, ports) must match the existing rule's values for the rule to be revoked.
Each rule consists of the protocol and the CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code.
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
Request Syntax
response = client.revoke_security_group_egress(
DryRun=True|False,
GroupId='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
revoke_security_group_ingress
(**kwargs)¶Removes one or more ingress rules from a security group. The values that you specify in the revoke request (for example, ports) must match the existing rule's values for the rule to be removed.
Each rule consists of the protocol and the CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code.
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
Request Syntax
response = client.revoke_security_group_ingress(
DryRun=True|False,
GroupName='string',
GroupId='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
run_instances
(**kwargs)¶Launches the specified number of instances using an AMI for which you have permissions.
When you launch an instance, it enters the pending
state. After the instance is ready for you, it enters the running
state. To check the state of your instance, call DescribeInstances .
If you don't specify a security group when launching an instance, Amazon EC2 uses the default security group. For more information, see Security Groups in the Amazon Elastic Compute Cloud User Guide .
Linux instances have access to the public key of the key pair at boot. You can use this key to provide secure access to the instance. Amazon EC2 public images use this feature to provide secure access without passwords. For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
You can provide optional user data when launching an instance. For more information, see Instance Metadata in the Amazon Elastic Compute Cloud User Guide .
If any of the AMIs have a product code attached for which the user has not subscribed, RunInstances
fails.
T2 instance types can only be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID in the request, RunInstances
fails.
For more information about troubleshooting, see What To Do If An Instance Immediately Terminates , and Troubleshooting Connecting to Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.run_instances(
DryRun=True|False,
ImageId='string',
MinCount=123,
MaxCount=123,
KeyName='string',
SecurityGroups=[
'string',
],
SecurityGroupIds=[
'string',
],
UserData='string',
InstanceType='t1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
Placement={
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
Monitoring={
'Enabled': True|False
},
SubnetId='string',
DisableApiTermination=True|False,
InstanceInitiatedShutdownBehavior='stop'|'terminate',
PrivateIpAddress='string',
ClientToken='string',
AdditionalInfo='string',
NetworkInterfaces=[
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
IamInstanceProfile={
'Arn': 'string',
'Name': 'string'
},
EbsOptimized=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
}
Response Structure
|
start_instances
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.start_instances(
InstanceIds=[
'string',
],
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop_instances
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.stop_instances(
DryRun=True|False,
InstanceIds=[
'string',
],
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate_instances
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.terminate_instances(
DryRun=True|False,
InstanceIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unassign_private_ip_addresses
(**kwargs)¶Unassigns one or more secondary private IP addresses from a network interface.
Request Syntax
response = client.unassign_private_ip_addresses(
NetworkInterfaceId='string',
PrivateIpAddresses=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
unmonitor_instances
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = client.unmonitor_instances(
DryRun=True|False,
InstanceIds=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
The available paginators are:
EC2.Paginator.describe_instance_status
EC2.Paginator.describe_instances
EC2.Paginator.describe_reserved_instances_modifications
EC2.Paginator.describe_reserved_instances_offerings
EC2.Paginator.describe_snapshots
EC2.Paginator.describe_spot_price_history
EC2.Paginator.describe_tags
EC2.Paginator.describe_volume_status
EC2.Paginator.
describe_instance_status
¶paginator = client.get_paginator('describe_instance_status')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_instance_status()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
IncludeAllInstances=True|False,
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceStatuses': [
{
'InstanceId': 'string',
'AvailabilityZone': 'string',
'Events': [
{
'Code': 'instance-reboot'|'system-reboot'|'system-maintenance'|'instance-retirement'|'instance-stop',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1)
},
],
'InstanceState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'SystemStatus': {
'Status': 'ok'|'impaired'|'insufficient-data'|'not-applicable'|'initializing',
'Details': [
{
'Name': 'reachability',
'Status': 'passed'|'failed'|'insufficient-data'|'initializing',
'ImpairedSince': datetime(2015, 1, 1)
},
]
},
'InstanceStatus': {
'Status': 'ok'|'impaired'|'insufficient-data'|'not-applicable'|'initializing',
'Details': [
{
'Name': 'reachability',
'Status': 'passed'|'failed'|'insufficient-data'|'initializing',
'ImpairedSince': datetime(2015, 1, 1)
},
]
}
},
],
}
Response Structure
|
EC2.Paginator.
describe_instances
¶paginator = client.get_paginator('describe_instances')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_instances()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
}
Response Structure
|
EC2.Paginator.
describe_reserved_instances_modifications
¶paginator = client.get_paginator('describe_reserved_instances_modifications')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_reserved_instances_modifications()
.
Request Syntax
response_iterator = paginator.paginate(
ReservedInstancesModificationIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesModifications': [
{
'ReservedInstancesModificationId': 'string',
'ReservedInstancesIds': [
{
'ReservedInstancesId': 'string'
},
],
'ModificationResults': [
{
'ReservedInstancesId': 'string',
'TargetConfiguration': {
'AvailabilityZone': 'string',
'Platform': 'string',
'InstanceCount': 123,
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'
}
},
],
'CreateDate': datetime(2015, 1, 1),
'UpdateDate': datetime(2015, 1, 1),
'EffectiveDate': datetime(2015, 1, 1),
'Status': 'string',
'StatusMessage': 'string',
'ClientToken': 'string'
},
],
}
Response Structure
|
EC2.Paginator.
describe_reserved_instances_offerings
¶paginator = client.get_paginator('describe_reserved_instances_offerings')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_reserved_instances_offerings()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
ReservedInstancesOfferingIds=[
'string',
],
InstanceType='t1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
AvailabilityZone='string',
ProductDescription='Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
InstanceTenancy='default'|'dedicated',
OfferingType='Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront',
IncludeMarketplace=True|False,
MinDuration=123,
MaxDuration=123,
MaxInstanceCount=123,
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ReservedInstancesOfferings': [
{
'ReservedInstancesOfferingId': 'string',
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'AvailabilityZone': 'string',
'Duration': 123,
'UsagePrice': ...,
'FixedPrice': ...,
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'InstanceTenancy': 'default'|'dedicated',
'CurrencyCode': 'USD',
'OfferingType': 'Heavy Utilization'|'Medium Utilization'|'Light Utilization'|'No Upfront'|'Partial Upfront'|'All Upfront',
'RecurringCharges': [
{
'Frequency': 'Hourly',
'Amount': 123.0
},
],
'Marketplace': True|False,
'PricingDetails': [
{
'Price': 123.0,
'Count': 123
},
]
},
],
}
Response Structure
|
EC2.Paginator.
describe_snapshots
¶paginator = client.get_paginator('describe_snapshots')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_snapshots()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
SnapshotIds=[
'string',
],
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Snapshots': [
{
'SnapshotId': 'string',
'VolumeId': 'string',
'State': 'pending'|'completed'|'error',
'StartTime': datetime(2015, 1, 1),
'Progress': 'string',
'OwnerId': 'string',
'Description': 'string',
'VolumeSize': 123,
'OwnerAlias': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'Encrypted': True|False,
'KmsKeyId': 'string'
},
],
}
Response Structure
|
EC2.Paginator.
describe_spot_price_history
¶paginator = client.get_paginator('describe_spot_price_history')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_spot_price_history()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
InstanceTypes=[
't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
],
ProductDescriptions=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
AvailabilityZone='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SpotPriceHistory': [
{
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
'SpotPrice': 'string',
'Timestamp': datetime(2015, 1, 1),
'AvailabilityZone': 'string'
},
],
}
Response Structure
|
paginator = client.get_paginator('describe_tags')
Creates an iterator that will paginate through responses from EC2.Client.describe_tags()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'customer-gateway'|'dhcp-options'|'image'|'instance'|'internet-gateway'|'network-acl'|'network-interface'|'reserved-instances'|'route-table'|'snapshot'|'spot-instances-request'|'subnet'|'security-group'|'volume'|'vpc'|'vpn-connection'|'vpn-gateway',
'Key': 'string',
'Value': 'string'
},
],
}
Response Structure
|
EC2.Paginator.
describe_volume_status
¶paginator = client.get_paginator('describe_volume_status')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EC2.Client.describe_volume_status()
.
Request Syntax
response_iterator = paginator.paginate(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeStatuses': [
{
'VolumeId': 'string',
'AvailabilityZone': 'string',
'VolumeStatus': {
'Status': 'ok'|'impaired'|'insufficient-data',
'Details': [
{
'Name': 'io-enabled'|'io-performance',
'Status': 'string'
},
]
},
'Events': [
{
'EventType': 'string',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1),
'EventId': 'string'
},
],
'Actions': [
{
'Code': 'string',
'Description': 'string',
'EventType': 'string',
'EventId': 'string'
},
]
},
],
}
Response Structure
|
The available waiters are:
EC2.Waiter.bundle_task_complete
EC2.Waiter.conversion_task_cancelled
EC2.Waiter.conversion_task_completed
EC2.Waiter.conversion_task_deleted
EC2.Waiter.customer_gateway_available
EC2.Waiter.export_task_cancelled
EC2.Waiter.export_task_completed
EC2.Waiter.image_available
EC2.Waiter.instance_exists
EC2.Waiter.instance_running
EC2.Waiter.instance_status_ok
EC2.Waiter.instance_stopped
EC2.Waiter.instance_terminated
EC2.Waiter.password_data_available
EC2.Waiter.snapshot_completed
EC2.Waiter.spot_instance_request_fulfilled
EC2.Waiter.subnet_available
EC2.Waiter.system_status_ok
EC2.Waiter.volume_available
EC2.Waiter.volume_deleted
EC2.Waiter.volume_in_use
EC2.Waiter.vpc_available
EC2.Waiter.vpn_connection_available
EC2.Waiter.vpn_connection_deleted
EC2.Waiter.
bundle_task_complete
¶waiter = client.get_waiter('bundle_task_complete')
wait
(**kwargs)¶This polls EC2.Client.describe_bundle_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
BundleIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
conversion_task_cancelled
¶waiter = client.get_waiter('conversion_task_cancelled')
wait
(**kwargs)¶This polls EC2.Client.describe_conversion_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
ConversionTaskIds=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
conversion_task_completed
¶waiter = client.get_waiter('conversion_task_completed')
wait
(**kwargs)¶This polls EC2.Client.describe_conversion_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
ConversionTaskIds=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
conversion_task_deleted
¶waiter = client.get_waiter('conversion_task_deleted')
wait
(**kwargs)¶This polls EC2.Client.describe_conversion_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
ConversionTaskIds=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
customer_gateway_available
¶waiter = client.get_waiter('customer_gateway_available')
wait
(**kwargs)¶This polls EC2.Client.describe_customer_gateways()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
CustomerGatewayIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
export_task_cancelled
¶waiter = client.get_waiter('export_task_cancelled')
wait
(**kwargs)¶This polls EC2.Client.describe_export_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
ExportTaskIds=[
'string',
]
)
Parameters: | ExportTaskIds (list) -- One or more export task IDs.
|
---|---|
Returns: | None |
EC2.Waiter.
export_task_completed
¶waiter = client.get_waiter('export_task_completed')
wait
(**kwargs)¶This polls EC2.Client.describe_export_tasks()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
ExportTaskIds=[
'string',
]
)
Parameters: | ExportTaskIds (list) -- One or more export task IDs.
|
---|---|
Returns: | None |
EC2.Waiter.
image_available
¶waiter = client.get_waiter('image_available')
wait
(**kwargs)¶This polls EC2.Client.describe_images()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
ImageIds=[
'string',
],
Owners=[
'string',
],
ExecutableUsers=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
instance_exists
¶waiter = client.get_waiter('instance_exists')
wait
(**kwargs)¶This polls EC2.Client.describe_instances()
every 5 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
instance_running
¶waiter = client.get_waiter('instance_running')
wait
(**kwargs)¶This polls EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
instance_status_ok
¶waiter = client.get_waiter('instance_status_ok')
wait
(**kwargs)¶This polls EC2.Client.describe_instance_status()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123,
IncludeAllInstances=True|False
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
instance_stopped
¶waiter = client.get_waiter('instance_stopped')
wait
(**kwargs)¶This polls EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
instance_terminated
¶waiter = client.get_waiter('instance_terminated')
wait
(**kwargs)¶This polls EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
password_data_available
¶waiter = client.get_waiter('password_data_available')
wait
(**kwargs)¶This polls EC2.Client.get_password_data()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceId='string'
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
snapshot_completed
¶waiter = client.get_waiter('snapshot_completed')
wait
(**kwargs)¶This polls EC2.Client.describe_snapshots()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
SnapshotIds=[
'string',
],
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
spot_instance_request_fulfilled
¶waiter = client.get_waiter('spot_instance_request_fulfilled')
wait
(**kwargs)¶This polls EC2.Client.describe_spot_instance_requests()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
SpotInstanceRequestIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
subnet_available
¶waiter = client.get_waiter('subnet_available')
wait
(**kwargs)¶This polls EC2.Client.describe_subnets()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
SubnetIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
system_status_ok
¶waiter = client.get_waiter('system_status_ok')
wait
(**kwargs)¶This polls EC2.Client.describe_instance_status()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123,
IncludeAllInstances=True|False
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
volume_available
¶waiter = client.get_waiter('volume_available')
wait
(**kwargs)¶This polls EC2.Client.describe_volumes()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
volume_deleted
¶waiter = client.get_waiter('volume_deleted')
wait
(**kwargs)¶This polls EC2.Client.describe_volumes()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
volume_in_use
¶waiter = client.get_waiter('volume_in_use')
wait
(**kwargs)¶This polls EC2.Client.describe_volumes()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
vpc_available
¶waiter = client.get_waiter('vpc_available')
wait
(**kwargs)¶This polls EC2.Client.describe_vpcs()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VpcIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
vpn_connection_available
¶waiter = client.get_waiter('vpn_connection_available')
wait
(**kwargs)¶This polls EC2.Client.describe_vpn_connections()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VpnConnectionIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.Waiter.
vpn_connection_deleted
¶waiter = client.get_waiter('vpn_connection_deleted')
wait
(**kwargs)¶This polls EC2.Client.describe_vpn_connections()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
DryRun=True|False,
VpnConnectionIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.
ServiceResource
¶A resource representing Amazon Elastic Compute Cloud (EC2):
import boto3
ec2 = boto3.resource('ec2')
These are the resource's available actions:
create_dhcp_options()
create_instances()
create_internet_gateway()
create_key_pair()
create_network_acl()
create_network_interface()
create_placement_group()
create_route_table()
create_security_group()
create_snapshot()
create_subnet()
create_tags()
create_volume()
create_vpc()
create_vpc_peering_connection()
disassociate_route_table()
import_key_pair()
register_image()
These are the resource's available sub-resources:
DhcpOptions()
Image()
Instance()
InternetGateway()
KeyPair()
NetworkAcl()
NetworkInterface()
PlacementGroup()
RouteTable()
RouteTableAssociation()
SecurityGroup()
Snapshot()
Subnet()
Tag()
Volume()
Vpc()
VpcPeeringConnection()
These are the resource's available collections:
dhcp_options_sets
images
instances
internet_gateways
key_pairs
network_acls
network_interfaces
placement_groups
route_tables
security_groups
snapshots
subnets
volumes
vpc_peering_connections
vpcs
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
create_dhcp_options
(**kwargs)¶Creates a set of DHCP options for your VPC. After creating the set, you must associate it with the VPC, causing all existing and new instances that you launch in the VPC to use this set of DHCP options. The following are the individual DHCP options you can specify. For more information about the options, see RFC 2132 .
domain-name-servers
- The IP addresses of up to four domain name servers, or AmazonProvidedDNS
. The default DHCP option set specifies AmazonProvidedDNS
. If specifying more than one domain name server, specify the IP addresses in a single parameter, separated by commas.domain-name
- If you're using AmazonProvidedDNS in us-east-1
, specify ec2.internal
. If you're using AmazonProvidedDNS in another region, specify region.compute.internal
(for example, ap-northeast-1.compute.internal
). Otherwise, specify a domain name (for example, MyCompany.com
). Important : Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP options set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.ntp-servers
- The IP addresses of up to four Network Time Protocol (NTP) servers.netbios-name-servers
- The IP addresses of up to four NetBIOS name servers.netbios-node-type
- The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast are not currently supported). For more information about these node types, see RFC 2132 .Your VPC automatically starts out with a set of DHCP options that includes only a DNS server that we provide (AmazonProvidedDNS). If you create a set of options, and if your VPC has an Internet gateway, make sure to set the domain-name-servers
option either to AmazonProvidedDNS
or to a domain name server of your choice. For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
dhcp_options = ec2.create_dhcp_options(
DryRun=True|False,
DhcpConfigurations=[
{
'Key': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A DhcpOptions resource |
create_instances
(**kwargs)¶Launches the specified number of instances using an AMI for which you have permissions.
When you launch an instance, it enters the pending
state. After the instance is ready for you, it enters the running
state. To check the state of your instance, call DescribeInstances .
If you don't specify a security group when launching an instance, Amazon EC2 uses the default security group. For more information, see Security Groups in the Amazon Elastic Compute Cloud User Guide .
Linux instances have access to the public key of the key pair at boot. You can use this key to provide secure access to the instance. Amazon EC2 public images use this feature to provide secure access without passwords. For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
You can provide optional user data when launching an instance. For more information, see Instance Metadata in the Amazon Elastic Compute Cloud User Guide .
If any of the AMIs have a product code attached for which the user has not subscribed, RunInstances
fails.
T2 instance types can only be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID in the request, RunInstances
fails.
For more information about troubleshooting, see What To Do If An Instance Immediately Terminates , and Troubleshooting Connecting to Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
instance = ec2.create_instances(
DryRun=True|False,
ImageId='string',
MinCount=123,
MaxCount=123,
KeyName='string',
SecurityGroups=[
'string',
],
SecurityGroupIds=[
'string',
],
UserData='string',
InstanceType='t1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
Placement={
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
Monitoring={
'Enabled': True|False
},
SubnetId='string',
DisableApiTermination=True|False,
InstanceInitiatedShutdownBehavior='stop'|'terminate',
PrivateIpAddress='string',
ClientToken='string',
AdditionalInfo='string',
NetworkInterfaces=[
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
IamInstanceProfile={
'Arn': 'string',
'Name': 'string'
},
EbsOptimized=True|False
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
create_internet_gateway
(**kwargs)¶Creates an Internet gateway for use with a VPC. After creating the Internet gateway, you attach it to a VPC using AttachInternetGateway .
For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide .
Request Syntax
internet_gateway = ec2.create_internet_gateway(
DryRun=True|False
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | ec2.InternetGateway |
Returns: | A InternetGateway resource |
create_key_pair
(**kwargs)¶Creates a 2048-bit RSA key pair with the specified name. Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is returned as an unencrypted PEM encoded PKCS#8 private key. If a key with the specified name already exists, Amazon EC2 returns an error.
You can have up to five thousand key pairs per region.
The key pair returned to you is available only in the region in which you create it. To create a key pair that is available in all regions, use ImportKeyPair .
For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
key_pair = ec2.create_key_pair(
DryRun=True|False,
KeyName='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A KeyPair resource |
create_network_acl
(**kwargs)¶Creates a network ACL in a VPC. Network ACLs provide an optional layer of security (in addition to security groups) for the instances in your VPC.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
network_acl = ec2.create_network_acl(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkAcl resource |
create_network_interface
(**kwargs)¶Creates a network interface in the specified subnet.
For more information about network interfaces, see Elastic Network Interfaces in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
network_interface = ec2.create_network_interface(
SubnetId='string',
Description='string',
PrivateIpAddress='string',
Groups=[
'string',
],
PrivateIpAddresses=[
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
SecondaryPrivateIpAddressCount=123,
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkInterface resource |
create_placement_group
(**kwargs)¶Creates a placement group that you launch cluster instances into. You must give the group a name that's unique within the scope of your account.
For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
placement_group = ec2.create_placement_group(
DryRun=True|False,
GroupName='string',
Strategy='cluster'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A PlacementGroup resource |
create_route_table
(**kwargs)¶Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
route_table = ec2.create_route_table(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTable resource |
create_security_group
(**kwargs)¶Creates a security group.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Warning
EC2-Classic: You can have up to 500 security groups.
EC2-VPC: You can create up to 100 security groups per VPC.
When you create a security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.
You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.
You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress , AuthorizeSecurityGroupEgress , RevokeSecurityGroupIngress , and RevokeSecurityGroupEgress .
Request Syntax
security_group = ec2.create_security_group(
DryRun=True|False,
GroupName='string',
Description='string',
VpcId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A SecurityGroup resource |
create_snapshot
(**kwargs)¶Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.
When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.
You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your EBS volume at the time the snapshot command is issued; this may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending
.
To create a snapshot for EBS volumes that serve as root devices, you should stop the instance before taking the snapshot.
Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.
For more information, see Amazon Elastic Block Store and Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
snapshot = ec2.create_snapshot(
DryRun=True|False,
VolumeId='string',
Description='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Snapshot resource |
create_subnet
(**kwargs)¶Creates a subnet in an existing VPC.
When you create each subnet, you provide the VPC ID and the CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you want only a single subnet in the VPC), or a subset of the VPC's CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).
Warning
AWS reserves both the first four and the last IP address in each subnet's CIDR block. They're not available for use.
If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle.
If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP address doesn't change if you stop and restart the instance (unlike a similar instance launched outside a VPC, which gets a new IP address when restarted). It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available.
For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
subnet = ec2.create_subnet(
DryRun=True|False,
VpcId='string',
CidrBlock='string',
AvailabilityZone='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Subnet resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = ec2.create_tags(
DryRun=True|False,
Resources=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
create_volume
(**kwargs)¶Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to. For more information see Regions and Endpoints .
You can create a new empty volume or restore a volume from an EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.
You can create encrypted volumes with the Encrypted
parameter. Encrypted volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
For more information, see Creating or Restoring an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
volume = ec2.create_volume(
DryRun=True|False,
Size=123,
SnapshotId='string',
AvailabilityZone='string',
VolumeType='standard'|'io1'|'gp2',
Iops=123,
Encrypted=True|False,
KmsKeyId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Volume resource |
create_vpc
(**kwargs)¶Creates a VPC with the specified CIDR block.
The smallest VPC you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your VPC, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
By default, each instance you launch in the VPC has the default DHCP options, which includes only a default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
vpc = ec2.create_vpc(
DryRun=True|False,
CidrBlock='string',
InstanceTenancy='default'|'dedicated'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Vpc resource |
create_vpc_peering_connection
(**kwargs)¶Requests a VPC peering connection between two VPCs: a requester VPC that you own and a peer VPC with which to create the connection. The peer VPC can belong to another AWS account. The requester VPC and peer VPC cannot have overlapping CIDR blocks.
The owner of the peer VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.
A CreateVpcPeeringConnection
request between VPCs with overlapping CIDR blocks results in the VPC peering connection having a status of failed
.
Request Syntax
vpc_peering_connection = ec2.create_vpc_peering_connection(
DryRun=True|False,
VpcId='string',
PeerVpcId='string',
PeerOwnerId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A VpcPeeringConnection resource |
disassociate_route_table
(**kwargs)¶Disassociates a subnet from a route table.
After you perform this action, the subnet no longer uses the routes in the route table. Instead, it uses the routes in the VPC's main route table. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = ec2.disassociate_route_table(
DryRun=True|False,
AssociationId='string'
)
Parameters: |
|
---|---|
Returns: | None |
import_key_pair
(**kwargs)¶Imports the public key from an RSA key pair that you created with a third-party tool. Compare this with CreateKeyPair , in which AWS creates the key pair and gives the keys to you (AWS keeps a copy of the public key). With ImportKeyPair, you create the key pair and give AWS just the public key. The private key is never transferred between you and AWS.
For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
key_pair = ec2.import_key_pair(
DryRun=True|False,
KeyName='string',
PublicKeyMaterial=b'bytes'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A KeyPair resource |
register_image
(**kwargs)¶Registers an AMI. When you're creating an AMI, this is the final step you must complete before you can launch an instance from the AMI. This step is required if you're creating an instance store-backed Linux or Windows AMI. For more information, see Creating an Instance Store-Backed Linux AMI and Creating an Instance Store-Backed Windows AMI in the Amazon Elastic Compute Cloud User Guide .
Note
For Amazon EBS-backed instances, CreateImage creates and registers the AMI in a single request, so you don't have to register the AMI yourself.
You can also use RegisterImage
to create an Amazon EBS-backed AMI from a snapshot of a root device volume. For more information, see Launching an Instance from a Backup in the Amazon Elastic Compute Cloud User Guide . Note that although you can create a Windows AMI from a snapshot, you can't launch an instance from the AMI - use the CreateImage command instead.
If needed, you can deregister an AMI at any time. Any modifications you make to an AMI backed by an instance store volume invalidates its registration. If you make changes to an image, deregister the previous image and register the new image.
Note
You can't register an image where a secondary (non-root) snapshot has AWS Marketplace product codes.
Request Syntax
image = ec2.register_image(
DryRun=True|False,
ImageLocation='string',
Name='string',
Description='string',
Architecture='i386'|'x86_64',
KernelId='string',
RamdiskId='string',
RootDeviceName='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
VirtualizationType='string',
SriovNetSupport='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Image resource |
Sub-resources
Sub-resources are methods that create a new instance of a child resource. This resource's identifiers get passed along to the child. For more information about sub-resources refer to the Resources Introduction Guide.
DhcpOptions
(id)¶Creates a DhcpOptions resource.:
dhcp_options = ec2.DhcpOptions('id')
Parameters: | id (string) -- The DhcpOptions's id identifier. This must be set. |
---|---|
Return type: | EC2.DhcpOptions |
Returns: | A DhcpOptions resource |
Image
(id)¶Creates a Image resource.:
image = ec2.Image('id')
Parameters: | id (string) -- The Image's id identifier. This must be set. |
---|---|
Return type: | EC2.Image |
Returns: | A Image resource |
Instance
(id)¶Creates a Instance resource.:
instance = ec2.Instance('id')
Parameters: | id (string) -- The Instance's id identifier. This must be set. |
---|---|
Return type: | EC2.Instance |
Returns: | A Instance resource |
InternetGateway
(id)¶Creates a InternetGateway resource.:
internet_gateway = ec2.InternetGateway('id')
Parameters: | id (string) -- The InternetGateway's id identifier. This must be set. |
---|---|
Return type: | EC2.InternetGateway |
Returns: | A InternetGateway resource |
KeyPair
(name)¶Creates a KeyPair resource.:
key_pair = ec2.KeyPair('name')
Parameters: | name (string) -- The KeyPair's name identifier. This must be set. |
---|---|
Return type: | EC2.KeyPair |
Returns: | A KeyPair resource |
NetworkAcl
(id)¶Creates a NetworkAcl resource.:
network_acl = ec2.NetworkAcl('id')
Parameters: | id (string) -- The NetworkAcl's id identifier. This must be set. |
---|---|
Return type: | EC2.NetworkAcl |
Returns: | A NetworkAcl resource |
NetworkInterface
(id)¶Creates a NetworkInterface resource.:
network_interface = ec2.NetworkInterface('id')
Parameters: | id (string) -- The NetworkInterface's id identifier. This must be set. |
---|---|
Return type: | EC2.NetworkInterface |
Returns: | A NetworkInterface resource |
PlacementGroup
(name)¶Creates a PlacementGroup resource.:
placement_group = ec2.PlacementGroup('name')
Parameters: | name (string) -- The PlacementGroup's name identifier. This must be set. |
---|---|
Return type: | EC2.PlacementGroup |
Returns: | A PlacementGroup resource |
RouteTable
(id)¶Creates a RouteTable resource.:
route_table = ec2.RouteTable('id')
Parameters: | id (string) -- The RouteTable's id identifier. This must be set. |
---|---|
Return type: | EC2.RouteTable |
Returns: | A RouteTable resource |
RouteTableAssociation
(id)¶Creates a RouteTableAssociation resource.:
route_table_association = ec2.RouteTableAssociation('id')
Parameters: | id (string) -- The RouteTableAssociation's id identifier. This must be set. |
---|---|
Return type: | EC2.RouteTableAssociation |
Returns: | A RouteTableAssociation resource |
SecurityGroup
(id)¶Creates a SecurityGroup resource.:
security_group = ec2.SecurityGroup('id')
Parameters: | id (string) -- The SecurityGroup's id identifier. This must be set. |
---|---|
Return type: | EC2.SecurityGroup |
Returns: | A SecurityGroup resource |
Snapshot
(id)¶Creates a Snapshot resource.:
snapshot = ec2.Snapshot('id')
Parameters: | id (string) -- The Snapshot's id identifier. This must be set. |
---|---|
Return type: | EC2.Snapshot |
Returns: | A Snapshot resource |
Subnet
(id)¶Creates a Subnet resource.:
subnet = ec2.Subnet('id')
Parameters: | id (string) -- The Subnet's id identifier. This must be set. |
---|---|
Return type: | EC2.Subnet |
Returns: | A Subnet resource |
Tag
(resource_id, key, value)¶Creates a Tag resource.:
tag = ec2.Tag('resource_id','key','value')
Parameters: |
|
---|---|
Return type: | |
Returns: | A Tag resource |
Volume
(id)¶Creates a Volume resource.:
volume = ec2.Volume('id')
Parameters: | id (string) -- The Volume's id identifier. This must be set. |
---|---|
Return type: | EC2.Volume |
Returns: | A Volume resource |
Vpc
(id)¶Creates a Vpc resource.:
vpc = ec2.Vpc('id')
Parameters: | id (string) -- The Vpc's id identifier. This must be set. |
---|---|
Return type: | EC2.Vpc |
Returns: | A Vpc resource |
VpcPeeringConnection
(id)¶Creates a VpcPeeringConnection resource.:
vpc_peering_connection = ec2.VpcPeeringConnection('id')
Parameters: | id (string) -- The VpcPeeringConnection's id identifier. This must be set. |
---|---|
Return type: | EC2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
dhcp_options_sets
¶all
()¶Creates an iterable of all DhcpOptions resources in the collection.
Request Syntax
dhcp_options_iterator = ec2.dhcp_options_sets.all()
Return type: | ec2.DhcpOptions |
---|---|
Returns: | A DhcpOptions resource |
filter
(**kwargs)¶Creates an iterable of all DhcpOptions resources in the collection filtered by kwargs passed to method.
Request Syntax
dhcp_options_iterator = ec2.dhcp_options_sets.filter(
DryRun=True|False,
DhcpOptionsIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A DhcpOptions resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of DhcpOptions resources in the collection.
Request Syntax
dhcp_options_iterator = ec2.dhcp_options_sets.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.DhcpOptions |
Returns: | A DhcpOptions resource |
page_size
(**kwargs)¶Creates an iterable of all DhcpOptions resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
dhcp_options_iterator = ec2.dhcp_options_sets.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.DhcpOptions |
Returns: | A DhcpOptions resource |
images
¶all
()Creates an iterable of all Image resources in the collection.
Request Syntax
image_iterator = ec2.images.all()
Return type: | ec2.Image |
---|---|
Returns: | A Image resource |
filter
(**kwargs)Creates an iterable of all Image resources in the collection filtered by kwargs passed to method.
Request Syntax
image_iterator = ec2.images.filter(
DryRun=True|False,
ImageIds=[
'string',
],
Owners=[
'string',
],
ExecutableUsers=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Image resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Image resources in the collection.
Request Syntax
image_iterator = ec2.images.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Image |
Returns: | A Image resource |
page_size
(**kwargs)Creates an iterable of all Image resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
image_iterator = ec2.images.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Image |
Returns: | A Image resource |
instances
¶all
()Creates an iterable of all Instance resources in the collection.
Request Syntax
instance_iterator = ec2.instances.all()
Return type: | ec2.Instance |
---|---|
Returns: | A Instance resource |
create_tags
(**kwargs)Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
filter
(**kwargs)Creates an iterable of all Instance resources in the collection filtered by kwargs passed to method.
Request Syntax
instance_iterator = ec2.instances.filter(
DryRun=True|False,
InstanceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Instance resources in the collection.
Request Syntax
instance_iterator = ec2.instances.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
monitor
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.monitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
page_size
(**kwargs)Creates an iterable of all Instance resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
instance_iterator = ec2.instances.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
reboot
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.reboot(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
start
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.start(
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.stop(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.terminate(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unmonitor
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = ec2.instances.unmonitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
internet_gateways
¶all
()Creates an iterable of all InternetGateway resources in the collection.
Request Syntax
internet_gateway_iterator = ec2.internet_gateways.all()
Return type: | ec2.InternetGateway |
---|---|
Returns: | A InternetGateway resource |
filter
(**kwargs)Creates an iterable of all InternetGateway resources in the collection filtered by kwargs passed to method.
Request Syntax
internet_gateway_iterator = ec2.internet_gateways.filter(
DryRun=True|False,
InternetGatewayIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A InternetGateway resource |
limit
(**kwargs)Creates an iterable up to a specified amount of InternetGateway resources in the collection.
Request Syntax
internet_gateway_iterator = ec2.internet_gateways.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.InternetGateway |
Returns: | A InternetGateway resource |
page_size
(**kwargs)Creates an iterable of all InternetGateway resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
internet_gateway_iterator = ec2.internet_gateways.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.InternetGateway |
Returns: | A InternetGateway resource |
key_pairs
¶all
()Creates an iterable of all KeyPair resources in the collection.
Request Syntax
key_pair_iterator = ec2.key_pairs.all()
Return type: | ec2.KeyPair |
---|---|
Returns: | A KeyPair resource |
filter
(**kwargs)Creates an iterable of all KeyPair resources in the collection filtered by kwargs passed to method.
Request Syntax
key_pair_iterator = ec2.key_pairs.filter(
DryRun=True|False,
KeyNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A KeyPair resource |
limit
(**kwargs)Creates an iterable up to a specified amount of KeyPair resources in the collection.
Request Syntax
key_pair_iterator = ec2.key_pairs.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.KeyPair |
Returns: | A KeyPair resource |
page_size
(**kwargs)Creates an iterable of all KeyPair resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
key_pair_iterator = ec2.key_pairs.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.KeyPair |
Returns: | A KeyPair resource |
network_acls
¶all
()Creates an iterable of all NetworkAcl resources in the collection.
Request Syntax
network_acl_iterator = ec2.network_acls.all()
Return type: | ec2.NetworkAcl |
---|---|
Returns: | A NetworkAcl resource |
filter
(**kwargs)Creates an iterable of all NetworkAcl resources in the collection filtered by kwargs passed to method.
Request Syntax
network_acl_iterator = ec2.network_acls.filter(
DryRun=True|False,
NetworkAclIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkAcl resource |
limit
(**kwargs)Creates an iterable up to a specified amount of NetworkAcl resources in the collection.
Request Syntax
network_acl_iterator = ec2.network_acls.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.NetworkAcl |
Returns: | A NetworkAcl resource |
page_size
(**kwargs)Creates an iterable of all NetworkAcl resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
network_acl_iterator = ec2.network_acls.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.NetworkAcl |
Returns: | A NetworkAcl resource |
network_interfaces
¶all
()Creates an iterable of all NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = ec2.network_interfaces.all()
Return type: | ec2.NetworkInterface |
---|---|
Returns: | A NetworkInterface resource |
filter
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection filtered by kwargs passed to method.
Request Syntax
network_interface_iterator = ec2.network_interfaces.filter(
DryRun=True|False,
NetworkInterfaceIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkInterface resource |
limit
(**kwargs)Creates an iterable up to a specified amount of NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = ec2.network_interfaces.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
page_size
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
network_interface_iterator = ec2.network_interfaces.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
placement_groups
¶all
()Creates an iterable of all PlacementGroup resources in the collection.
Request Syntax
placement_group_iterator = ec2.placement_groups.all()
Return type: | ec2.PlacementGroup |
---|---|
Returns: | A PlacementGroup resource |
filter
(**kwargs)Creates an iterable of all PlacementGroup resources in the collection filtered by kwargs passed to method.
Request Syntax
placement_group_iterator = ec2.placement_groups.filter(
DryRun=True|False,
GroupNames=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A PlacementGroup resource |
limit
(**kwargs)Creates an iterable up to a specified amount of PlacementGroup resources in the collection.
Request Syntax
placement_group_iterator = ec2.placement_groups.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.PlacementGroup |
Returns: | A PlacementGroup resource |
page_size
(**kwargs)Creates an iterable of all PlacementGroup resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
placement_group_iterator = ec2.placement_groups.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.PlacementGroup |
Returns: | A PlacementGroup resource |
route_tables
¶all
()Creates an iterable of all RouteTable resources in the collection.
Request Syntax
route_table_iterator = ec2.route_tables.all()
Return type: | ec2.RouteTable |
---|---|
Returns: | A RouteTable resource |
filter
(**kwargs)Creates an iterable of all RouteTable resources in the collection filtered by kwargs passed to method.
Request Syntax
route_table_iterator = ec2.route_tables.filter(
DryRun=True|False,
RouteTableIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTable resource |
limit
(**kwargs)Creates an iterable up to a specified amount of RouteTable resources in the collection.
Request Syntax
route_table_iterator = ec2.route_tables.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.RouteTable |
Returns: | A RouteTable resource |
page_size
(**kwargs)Creates an iterable of all RouteTable resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
route_table_iterator = ec2.route_tables.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.RouteTable |
Returns: | A RouteTable resource |
security_groups
¶all
()Creates an iterable of all SecurityGroup resources in the collection.
Request Syntax
security_group_iterator = ec2.security_groups.all()
Return type: | ec2.SecurityGroup |
---|---|
Returns: | A SecurityGroup resource |
filter
(**kwargs)Creates an iterable of all SecurityGroup resources in the collection filtered by kwargs passed to method.
Request Syntax
security_group_iterator = ec2.security_groups.filter(
DryRun=True|False,
GroupNames=[
'string',
],
GroupIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A SecurityGroup resource |
limit
(**kwargs)Creates an iterable up to a specified amount of SecurityGroup resources in the collection.
Request Syntax
security_group_iterator = ec2.security_groups.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.SecurityGroup |
Returns: | A SecurityGroup resource |
page_size
(**kwargs)Creates an iterable of all SecurityGroup resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
security_group_iterator = ec2.security_groups.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.SecurityGroup |
Returns: | A SecurityGroup resource |
snapshots
¶all
()Creates an iterable of all Snapshot resources in the collection.
Request Syntax
snapshot_iterator = ec2.snapshots.all()
Return type: | ec2.Snapshot |
---|---|
Returns: | A Snapshot resource |
filter
(**kwargs)Creates an iterable of all Snapshot resources in the collection filtered by kwargs passed to method.
Request Syntax
snapshot_iterator = ec2.snapshots.filter(
DryRun=True|False,
SnapshotIds=[
'string',
],
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Snapshot resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Snapshot resources in the collection.
Request Syntax
snapshot_iterator = ec2.snapshots.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Snapshot |
Returns: | A Snapshot resource |
page_size
(**kwargs)Creates an iterable of all Snapshot resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
snapshot_iterator = ec2.snapshots.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Snapshot |
Returns: | A Snapshot resource |
subnets
¶all
()Creates an iterable of all Subnet resources in the collection.
Request Syntax
subnet_iterator = ec2.subnets.all()
Return type: | ec2.Subnet |
---|---|
Returns: | A Subnet resource |
filter
(**kwargs)Creates an iterable of all Subnet resources in the collection filtered by kwargs passed to method.
Request Syntax
subnet_iterator = ec2.subnets.filter(
DryRun=True|False,
SubnetIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Subnet resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Subnet resources in the collection.
Request Syntax
subnet_iterator = ec2.subnets.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Subnet |
Returns: | A Subnet resource |
page_size
(**kwargs)Creates an iterable of all Subnet resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
subnet_iterator = ec2.subnets.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Subnet |
Returns: | A Subnet resource |
volumes
¶all
()Creates an iterable of all Volume resources in the collection.
Request Syntax
volume_iterator = ec2.volumes.all()
Return type: | ec2.Volume |
---|---|
Returns: | A Volume resource |
filter
(**kwargs)Creates an iterable of all Volume resources in the collection filtered by kwargs passed to method.
Request Syntax
volume_iterator = ec2.volumes.filter(
DryRun=True|False,
VolumeIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Volume resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Volume resources in the collection.
Request Syntax
volume_iterator = ec2.volumes.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Volume |
Returns: | A Volume resource |
page_size
(**kwargs)Creates an iterable of all Volume resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
volume_iterator = ec2.volumes.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Volume |
Returns: | A Volume resource |
vpc_peering_connections
¶all
()Creates an iterable of all VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = ec2.vpc_peering_connections.all()
Return type: | ec2.VpcPeeringConnection |
---|---|
Returns: | A VpcPeeringConnection resource |
filter
(**kwargs)Creates an iterable of all VpcPeeringConnection resources in the collection filtered by kwargs passed to method.
Request Syntax
vpc_peering_connection_iterator = ec2.vpc_peering_connections.filter(
DryRun=True|False,
VpcPeeringConnectionIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A VpcPeeringConnection resource |
limit
(**kwargs)Creates an iterable up to a specified amount of VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = ec2.vpc_peering_connections.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
page_size
(**kwargs)Creates an iterable of all VpcPeeringConnection resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
vpc_peering_connection_iterator = ec2.vpc_peering_connections.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
vpcs
¶all
()Creates an iterable of all Vpc resources in the collection.
Request Syntax
vpc_iterator = ec2.vpcs.all()
Return type: | ec2.Vpc |
---|---|
Returns: | A Vpc resource |
filter
(**kwargs)Creates an iterable of all Vpc resources in the collection filtered by kwargs passed to method.
Request Syntax
vpc_iterator = ec2.vpcs.filter(
DryRun=True|False,
VpcIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Vpc resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Vpc resources in the collection.
Request Syntax
vpc_iterator = ec2.vpcs.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Vpc |
Returns: | A Vpc resource |
page_size
(**kwargs)Creates an iterable of all Vpc resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
vpc_iterator = ec2.vpcs.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Vpc |
Returns: | A Vpc resource |
EC2.
DhcpOptions
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) DhcpOptions:
import boto3
ec2 = boto3.resource('ec2')
dhcp_options = ec2.DhcpOptions('id')
Parameters: | id (string) -- The DhcpOptions's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The DhcpOptions's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
dhcp_configurations
¶(list)
One or more DHCP options in the set.
dhcp_options_id
¶(string)
The ID of the set of DHCP options.
(list)
Any tags assigned to the DHCP options set.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
associate_with_vpc
(**kwargs)¶Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.
After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.
For more information, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = dhcp_options.associate_with_vpc(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = dhcp_options.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified set of DHCP options. You must disassociate the set of DHCP options before you can delete it. You can disassociate the set of DHCP options by associating either a new set of options or the default set of options with the VPC.
Request Syntax
response = dhcp_options.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_dhcp_options()
to update the attributes of the DhcpOptions resource
Request Syntax
dhcp_options.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_dhcp_options()
to update the attributes of the DhcpOptions resource
Request Syntax
dhcp_options.reload()
Returns: | None |
---|
EC2.
Image
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Image:
import boto3
ec2 = boto3.resource('ec2')
image = ec2.Image('id')
Parameters: | id (string) -- The Image's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
root_device_type
ramdisk_id
creation_date
state_reason
image_type
platform
state
virtualization_type
sriov_net_support
root_device_name
image_location
description
tags
kernel_id
image_owner_alias
owner_id
image_id
block_device_mappings
name
hypervisor
public
architecture
product_codes
These are the resource's available actions:
create_tags()
deregister()
describe_attribute()
load()
modify_attribute()
reload()
reset_attribute()
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Image's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
root_device_type
¶(string)
The type of root device used by the AMI. The AMI can use an EBS volume or an instance store volume.
ramdisk_id
¶(string)
The RAM disk associated with the image, if any. Only applicable for machine images.
creation_date
¶(string)
The date and time the image was created.
state_reason
¶(dict)
The reason for the state change.
image_type
¶(string)
The type of image.
platform
¶(string)
The value is Windows
for Windows AMIs; otherwise blank.
state
¶(string)
The current state of the AMI. If the state is available
, the image is successfully registered and can be used to launch an instance.
virtualization_type
¶(string)
The type of virtualization of the AMI.
sriov_net_support
¶(string)
Specifies whether enhanced networking is enabled.
root_device_name
¶(string)
The device name of the root device (for example, /dev/sda1
or /dev/xvda
).
image_location
¶(string)
The location of the AMI.
description
¶(string)
The description of the AMI that was provided during image creation.
(list)
Any tags assigned to the image.
kernel_id
¶(string)
The kernel associated with the image, if any. Only applicable for machine images.
image_owner_alias
¶(string)
The AWS account alias (for example, amazon
, self
) or the AWS account ID of the AMI owner.
owner_id
¶(string)
The AWS account ID of the image owner.
image_id
¶(string)
The ID of the AMI.
block_device_mappings
¶(list)
Any block device mapping entries.
name
¶(string)
The name of the AMI that was provided during image creation.
hypervisor
¶(string)
The hypervisor type of the image.
public
¶(boolean)
Indicates whether the image has public launch permissions. The value is true
if this image has public launch permissions or false
if it has only implicit and explicit launch permissions.
architecture
¶(string)
The architecture of the image.
product_codes
¶(list)
Any product codes associated with the AMI.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = image.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
deregister
(**kwargs)¶Deregisters the specified AMI. After you deregister an AMI, it can't be used to launch new instances.
This command does not delete the AMI.
Request Syntax
response = image.deregister(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
describe_attribute
(**kwargs)¶Describes the specified attribute of the specified AMI. You can specify only one attribute at a time.
Request Syntax
response = image.describe_attribute(
DryRun=True|False,
Attribute='description'|'kernel'|'ramdisk'|'launchPermission'|'productCodes'|'blockDeviceMapping'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'ImageId': 'string',
'LaunchPermissions': [
{
'UserId': 'string',
'Group': 'all'
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'KernelId': {
'Value': 'string'
},
'RamdiskId': {
'Value': 'string'
},
'Description': {
'Value': 'string'
},
'SriovNetSupport': {
'Value': 'string'
},
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
]
}
Response Structure
|
load
()¶Calls ec2.Client.describe_images()
to update the attributes of the Image resource
Request Syntax
image.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.
Note
AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace product code cannot be made public.
Request Syntax
response = image.modify_attribute(
DryRun=True|False,
Attribute='string',
OperationType='string',
UserIds=[
'string',
],
UserGroups=[
'string',
],
ProductCodes=[
'string',
],
Value='string',
LaunchPermission={
'Add': [
{
'UserId': 'string',
'Group': 'all'
},
],
'Remove': [
{
'UserId': 'string',
'Group': 'all'
},
]
},
Description={
'Value': 'string'
}
)
Parameters: |
|
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_images()
to update the attributes of the Image resource
Request Syntax
image.reload()
Returns: | None |
---|
reset_attribute
(**kwargs)¶Resets an attribute of an AMI to its default value.
Note
The productCodes attribute can't be reset.
Request Syntax
response = image.reset_attribute(
DryRun=True|False,
Attribute='launchPermission'
)
Parameters: |
|
---|---|
Returns: | None |
EC2.
Instance
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Instance:
import boto3
ec2 = boto3.resource('ec2')
instance = ec2.Instance('id')
Parameters: | id (string) -- The Instance's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
root_device_type
private_dns_name
ramdisk_id
spot_instance_request_id
security_groups
state_reason
monitoring
subnet_id
ebs_optimized
iam_instance_profile
platform
state
source_dest_check
client_token
virtualization_type
sriov_net_support
root_device_name
public_ip_address
tags
kernel_id
key_name
image_id
public_dns_name
instance_lifecycle
block_device_mappings
placement
ami_launch_index
state_transition_reason
network_interfaces
launch_time
instance_id
instance_type
architecture
hypervisor
private_ip_address
vpc_id
product_codes
These are the resource's available references:
These are the resource's available actions:
attach_classic_link_vpc()
attach_volume()
console_output()
create_image()
create_tags()
describe_attribute()
detach_classic_link_vpc()
detach_volume()
load()
modify_attribute()
monitor()
password_data()
reboot()
reload()
report_status()
reset_attribute()
reset_kernel()
reset_ramdisk()
reset_source_dest_check()
start()
stop()
terminate()
unmonitor()
These are the resource's available collections:
These are the resource's available waiters:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Instance's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
root_device_type
¶(string)
The root device type used by the AMI. The AMI can use an EBS volume or an instance store volume.
private_dns_name
¶(string)
The private DNS name assigned to the instance. This DNS name can only be used inside the Amazon EC2 network. This name is not available until the instance enters the running
state.
ramdisk_id
¶(string)
The RAM disk associated with this instance.
spot_instance_request_id
¶(string)
The ID of the Spot Instance request.
security_groups
¶(list)
One or more security groups for the instance.
state_reason
¶(dict)
The reason for the most recent state transition.
monitoring
¶(dict)
The monitoring information for the instance.
subnet_id
¶(string)
The ID of the subnet in which the instance is running.
ebs_optimized
¶(boolean)
Indicates whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.
iam_instance_profile
¶(dict)
The IAM instance profile associated with the instance.
platform
¶(string)
The value is Windows
for Windows instances; otherwise blank.
state
¶(dict)
The current state of the instance.
source_dest_check
¶(boolean)
Specifies whether to enable an instance launched in a VPC to perform NAT. This controls whether source/destination checking is enabled on the instance. A value of true
means checking is enabled, and false
means checking is disabled. The value must be false
for the instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
client_token
¶(string)
The idempotency token you provided when you launched the instance.
virtualization_type
¶(string)
The virtualization type of the instance.
sriov_net_support
¶(string)
Specifies whether enhanced networking is enabled.
root_device_name
¶(string)
The root device name (for example, /dev/sda1
or /dev/xvda
).
public_ip_address
¶(string)
The public IP address assigned to the instance.
(list)
Any tags assigned to the instance.
kernel_id
¶(string)
The kernel associated with this instance.
key_name
¶(string)
The name of the key pair, if this instance was launched with an associated key pair.
image_id
¶(string)
The ID of the AMI used to launch the instance.
public_dns_name
¶(string)
The public DNS name assigned to the instance. This name is not available until the instance enters the running
state.
instance_lifecycle
¶(string)
Indicates whether this is a Spot Instance.
block_device_mappings
¶(list)
Any block device mapping entries for the instance.
placement
¶(dict)
The location where the instance launched.
ami_launch_index
¶(integer)
The AMI launch index, which can be used to find this instance in the launch group.
state_transition_reason
¶(string)
The reason for the most recent state transition. This might be an empty string.
network_interfaces
¶(list)
[EC2-VPC] One or more network interfaces for the instance.
launch_time
¶(datetime)
The time the instance was launched.
instance_id
¶(string)
The ID of the instance.
instance_type
¶(string)
The instance type.
architecture
¶(string)
The architecture of the image.
hypervisor
¶(string)
The hypervisor type of the instance.
private_ip_address
¶(string)
The private IP address assigned to the instance.
vpc_id
¶(string)
The ID of the VPC in which the instance is running.
product_codes
¶(list)
The product codes attached to this instance.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
image
¶(Image
) The related image if set, otherwise None
.
key_pair
¶(KeyPair
) The related key_pair if set, otherwise None
.
placement_group
¶(PlacementGroup
) The related placement_group if set, otherwise None
.
subnet
¶(Subnet
) The related subnet if set, otherwise None
.
vpc
¶(Vpc
) The related vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
attach_classic_link_vpc
(**kwargs)¶Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC's security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running
state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.
After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.
Linking your instance to a VPC is sometimes referred to as attaching your instance.
Request Syntax
response = instance.attach_classic_link_vpc(
DryRun=True|False,
VpcId='string',
Groups=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
attach_volume
(**kwargs)¶Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.
Encrypted EBS volumes may only be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
For a list of supported device names, see Attaching an EBS Volume to an Instance . Any device names that aren't reserved for instance store volumes can be used for EBS volumes. For more information, see Amazon EC2 Instance Store in the Amazon Elastic Compute Cloud User Guide .
If a volume has an AWS Marketplace product code:
For an overview of the AWS Marketplace, see Introducing AWS Marketplace .
For more information about EBS volumes, see Attaching Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.attach_volume(
DryRun=True|False,
VolumeId='string',
Device='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
console_output
(**kwargs)¶Gets the console output for the specified instance.
Instances do not have a physical monitor through which you can view their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. To allow these actions, we provide them through the Amazon EC2 API and command line interface.
Instance console output is buffered and posted shortly after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which is available for at least one hour after the most recent post.
For Linux instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. This output is buffered because the instance produces it and then posts it to a store where the instance's owner can retrieve it.
For Windows instances, the instance console output includes output from the EC2Config service.
Request Syntax
response = instance.console_output(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceId': 'string',
'Timestamp': datetime(2015, 1, 1),
'Output': 'string'
}
Response Structure
|
create_image
(**kwargs)¶Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped.
If you customized your instance with instance store volumes or EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes.
For more information, see Creating Amazon EBS-Backed Linux AMIs in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
image = instance.create_image(
DryRun=True|False,
Name='string',
Description='string',
NoReboot=True|False,
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Image resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = instance.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
describe_attribute
(**kwargs)¶Describes the specified attribute of the specified instance. You can specify only one attribute at a time. Valid attribute values are: instanceType
| kernel
| ramdisk
| userData
| disableApiTermination
| instanceInitiatedShutdownBehavior
| rootDeviceName
| blockDeviceMapping
| productCodes
| sourceDestCheck
| groupSet
| ebsOptimized
| sriovNetSupport
Request Syntax
response = instance.describe_attribute(
DryRun=True|False,
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceId': 'string',
'InstanceType': {
'Value': 'string'
},
'KernelId': {
'Value': 'string'
},
'RamdiskId': {
'Value': 'string'
},
'UserData': {
'Value': 'string'
},
'DisableApiTermination': {
'Value': True|False
},
'InstanceInitiatedShutdownBehavior': {
'Value': 'string'
},
'RootDeviceName': {
'Value': 'string'
},
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'EbsOptimized': {
'Value': True|False
},
'SriovNetSupport': {
'Value': 'string'
},
'SourceDestCheck': {
'Value': True|False
},
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
]
}
Response Structure
|
detach_classic_link_vpc
(**kwargs)¶Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped.
Request Syntax
response = instance.detach_classic_link_vpc(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
detach_volume
(**kwargs)¶Detaches an EBS volume from an instance. Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to do so results in the volume being stuck in a busy state while detaching.
If an Amazon EBS volume is the root device of an instance, it can't be detached while the instance is running. To detach the root volume, stop the instance first.
When a volume with an AWS Marketplace product code is detached from an instance, the product code is no longer associated with the instance.
For more information, see Detaching an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.detach_volume(
DryRun=True|False,
VolumeId='string',
Device='string',
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
load
()¶Calls ec2.Client.describe_instances()
to update the attributes of the Instance resource
Request Syntax
instance.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Modifies the specified attribute of the specified instance. You can specify only one attribute at a time.
To modify some attributes, the instance must be stopped. For more information, see Modifying Attributes of a Stopped Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.modify_attribute(
DryRun=True|False,
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport',
Value='string',
BlockDeviceMappings=[
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'DeleteOnTermination': True|False
},
'VirtualName': 'string',
'NoDevice': 'string'
},
],
SourceDestCheck={
'Value': True|False
},
DisableApiTermination={
'Value': True|False
},
InstanceType={
'Value': 'string'
},
Kernel={
'Value': 'string'
},
Ramdisk={
'Value': 'string'
},
UserData={
'Value': b'bytes'
},
InstanceInitiatedShutdownBehavior={
'Value': 'string'
},
Groups=[
'string',
],
EbsOptimized={
'Value': True|False
},
SriovNetSupport={
'Value': 'string'
}
)
Parameters: |
|
---|---|
Returns: | None |
monitor
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.monitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
password_data
(**kwargs)¶Retrieves the encrypted administrator password for an instance running Windows.
The Windows password is generated at boot if the EC2Config
service plugin, Ec2SetPassword
, is enabled. This usually only happens the first time an AMI is launched, and then Ec2SetPassword
is automatically disabled. The password is not generated for rebundled AMIs unless Ec2SetPassword
is enabled before bundling.
The password is encrypted using the key pair that you specified when you launched the instance. You must provide the corresponding key pair file.
Password generation and encryption takes a few moments. We recommend that you wait up to 15 minutes after launching an instance before trying to retrieve the generated password.
Request Syntax
response = instance.password_data(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceId': 'string',
'Timestamp': datetime(2015, 1, 1),
'PasswordData': 'string'
}
Response Structure
|
reboot
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.reboot(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_instances()
to update the attributes of the Instance resource
Request Syntax
instance.reload()
Returns: | None |
---|
report_status
(**kwargs)¶Submits feedback about the status of an instance. The instance must be in the running
state. If your experience with the instance differs from the instance status returned by DescribeInstanceStatus , use ReportInstanceStatus to report your experience with the instance. Amazon EC2 collects this information to improve the accuracy of status checks.
Use of this action does not change the value returned by DescribeInstanceStatus .
Request Syntax
response = instance.report_status(
DryRun=True|False,
Status='ok'|'impaired',
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
ReasonCodes=[
'instance-stuck-in-state'|'unresponsive'|'not-accepting-credentials'|'password-not-available'|'performance-network'|'performance-instance-store'|'performance-ebs-volume'|'performance-other'|'other',
],
Description='string'
)
Parameters: |
|
---|---|
Returns: | None |
reset_attribute
(**kwargs)¶Resets an attribute of an instance to its default value. To reset the kernel
or ramdisk
, the instance must be in a stopped state. To reset the SourceDestCheck
, the instance can be either running or stopped.
The SourceDestCheck
attribute controls whether source/destination checking is enabled. The default value is true
, which means checking is enabled. This value must be false
for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = instance.reset_attribute(
DryRun=True|False,
Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport'
)
Parameters: |
|
---|---|
Returns: | None |
reset_kernel
(**kwargs)¶Resets an attribute of an instance to its default value. To reset the kernel
or ramdisk
, the instance must be in a stopped state. To reset the SourceDestCheck
, the instance can be either running or stopped.
The SourceDestCheck
attribute controls whether source/destination checking is enabled. The default value is true
, which means checking is enabled. This value must be false
for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = instance.reset_kernel(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
reset_ramdisk
(**kwargs)¶Resets an attribute of an instance to its default value. To reset the kernel
or ramdisk
, the instance must be in a stopped state. To reset the SourceDestCheck
, the instance can be either running or stopped.
The SourceDestCheck
attribute controls whether source/destination checking is enabled. The default value is true
, which means checking is enabled. This value must be false
for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = instance.reset_ramdisk(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
reset_source_dest_check
(**kwargs)¶Resets an attribute of an instance to its default value. To reset the kernel
or ramdisk
, the instance must be in a stopped state. To reset the SourceDestCheck
, the instance can be either running or stopped.
The SourceDestCheck
attribute controls whether source/destination checking is enabled. The default value is true
, which means checking is enabled. This value must be false
for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = instance.reset_source_dest_check(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
start
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.start(
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.stop(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.terminate(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unmonitor
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = instance.unmonitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
volumes
¶all
()¶Creates an iterable of all Volume resources in the collection.
Request Syntax
volume_iterator = instance.volumes.all()
Return type: | ec2.Volume |
---|---|
Returns: | A Volume resource |
filter
(**kwargs)¶Creates an iterable of all Volume resources in the collection filtered by kwargs passed to method.
Request Syntax
volume_iterator = instance.volumes.filter(
DryRun=True|False,
VolumeIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Volume resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of Volume resources in the collection.
Request Syntax
volume_iterator = instance.volumes.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Volume |
Returns: | A Volume resource |
page_size
(**kwargs)¶Creates an iterable of all Volume resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
volume_iterator = instance.volumes.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Volume |
Returns: | A Volume resource |
Waiters
Waiters provide an interface to wait for a resource to reach a specific state. For more information about waiters refer to the Resources Introduction Guide.
wait_until_exists
(**kwargs)¶Waits until this Instance is exists. This method calls EC2.Waiter.instance_exists.wait()
which polls. EC2.Client.describe_instances()
every 5 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
instance.wait_until_exists(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
wait_until_running
(**kwargs)¶Waits until this Instance is running. This method calls EC2.Waiter.instance_running.wait()
which polls. EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
instance.wait_until_running(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
wait_until_stopped
(**kwargs)¶Waits until this Instance is stopped. This method calls EC2.Waiter.instance_stopped.wait()
which polls. EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
instance.wait_until_stopped(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
wait_until_terminated
(**kwargs)¶Waits until this Instance is terminated. This method calls EC2.Waiter.instance_terminated.wait()
which polls. EC2.Client.describe_instances()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
instance.wait_until_terminated(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Reservations': [
{
'ReservationId': 'string',
'OwnerId': 'string',
'RequesterId': 'string',
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Instances': [
{
'InstanceId': 'string',
'ImageId': 'string',
'State': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PrivateDnsName': 'string',
'PublicDnsName': 'string',
'StateTransitionReason': 'string',
'KeyName': 'string',
'AmiLaunchIndex': 123,
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
],
'InstanceType': 't1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
'LaunchTime': datetime(2015, 1, 1),
'Placement': {
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
'KernelId': 'string',
'RamdiskId': 'string',
'Platform': 'Windows',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
},
'SubnetId': 'string',
'VpcId': 'string',
'PrivateIpAddress': 'string',
'PublicIpAddress': 'string',
'StateReason': {
'Code': 'string',
'Message': 'string'
},
'Architecture': 'i386'|'x86_64',
'RootDeviceType': 'ebs'|'instance-store',
'RootDeviceName': 'string',
'BlockDeviceMappings': [
{
'DeviceName': 'string',
'Ebs': {
'VolumeId': 'string',
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
},
],
'VirtualizationType': 'hvm'|'paravirtual',
'InstanceLifecycle': 'spot',
'SpotInstanceRequestId': 'string',
'ClientToken': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SecurityGroups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'SourceDestCheck': True|False,
'Hypervisor': 'ovm'|'xen',
'NetworkInterfaces': [
{
'NetworkInterfaceId': 'string',
'SubnetId': 'string',
'VpcId': 'string',
'Description': 'string',
'OwnerId': 'string',
'Status': 'available'|'attaching'|'in-use'|'detaching',
'MacAddress': 'string',
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'SourceDestCheck': True|False,
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
},
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
},
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'PrivateDnsName': 'string',
'Primary': True|False,
'Association': {
'PublicIp': 'string',
'PublicDnsName': 'string',
'IpOwnerId': 'string'
}
},
]
},
],
'IamInstanceProfile': {
'Arn': 'string',
'Id': 'string'
},
'EbsOptimized': True|False,
'SriovNetSupport': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
EC2.
InternetGateway
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) InternetGateway:
import boto3
ec2 = boto3.resource('ec2')
internet_gateway = ec2.InternetGateway('id')
Parameters: | id (string) -- The InternetGateway's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The InternetGateway's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
internet_gateway_id
¶(string)
The ID of the Internet gateway.
attachments
¶(list)
Any VPCs attached to the Internet gateway.
(list)
Any tags assigned to the Internet gateway.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
attach_to_vpc
(**kwargs)¶Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = internet_gateway.attach_to_vpc(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = internet_gateway.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified Internet gateway. You must detach the Internet gateway from the VPC before you can delete it.
Request Syntax
response = internet_gateway.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
detach_from_vpc
(**kwargs)¶Detaches an Internet gateway from a VPC, disabling connectivity between the Internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses.
Request Syntax
response = internet_gateway.detach_from_vpc(
DryRun=True|False,
VpcId='string'
)
Parameters: |
|
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_internet_gateways()
to update the attributes of the InternetGateway resource
Request Syntax
internet_gateway.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_internet_gateways()
to update the attributes of the InternetGateway resource
Request Syntax
internet_gateway.reload()
Returns: | None |
---|
EC2.
KeyPair
(name)¶A resource representing an Amazon Elastic Compute Cloud (EC2) KeyPair:
import boto3
ec2 = boto3.resource('ec2')
key_pair = ec2.KeyPair('name')
Parameters: | name (string) -- The KeyPair's name identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
name
¶(string) The KeyPair's name identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
key_name
¶(string)
The name of the key pair.
key_fingerprint
¶(string)
If you used CreateKeyPair to create the key pair, this is the SHA-1 digest of the DER encoded private key. If you used ImportKeyPair to provide AWS the public key, this is the MD5 public key fingerprint as specified in section 4 of RFC4716.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
delete
(**kwargs)¶Deletes the specified key pair, by removing the public key from Amazon EC2.
Request Syntax
response = key_pair.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_key_pairs()
to update the attributes of the KeyPair resource
Request Syntax
key_pair.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_key_pairs()
to update the attributes of the KeyPair resource
Request Syntax
key_pair.reload()
Returns: | None |
---|
EC2.
NetworkAcl
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) NetworkAcl:
import boto3
ec2 = boto3.resource('ec2')
network_acl = ec2.NetworkAcl('id')
Parameters: | id (string) -- The NetworkAcl's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available references:
These are the resource's available actions:
create_entry()
create_tags()
delete()
delete_entry()
load()
reload()
replace_association()
replace_entry()
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The NetworkAcl's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
associations
¶(list)
Any associations between the network ACL and one or more subnets
network_acl_id
¶(string)
The ID of the network ACL.
(list)
Any tags assigned to the network ACL.
is_default
¶(boolean)
Indicates whether this is the default network ACL for the VPC.
entries
¶(list)
One or more entries (rules) in the network ACL.
vpc_id
¶(string)
The ID of the VPC for the network ACL.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
vpc
¶(Vpc
) The related vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
create_entry
(**kwargs)¶Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.
We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.
After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = network_acl.create_entry(
DryRun=True|False,
RuleNumber=123,
Protocol='string',
RuleAction='allow'|'deny',
Egress=True|False,
CidrBlock='string',
IcmpTypeCode={
'Type': 123,
'Code': 123
},
PortRange={
'From': 123,
'To': 123
}
)
Parameters: |
|
---|---|
Returns: | None |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = network_acl.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified network ACL. You can't delete the ACL if it's associated with any subnets. You can't delete the default network ACL.
Request Syntax
response = network_acl.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
delete_entry
(**kwargs)¶Deletes the specified ingress or egress entry (rule) from the specified network ACL.
Request Syntax
response = network_acl.delete_entry(
DryRun=True|False,
RuleNumber=123,
Egress=True|False
)
Parameters: |
|
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_network_acls()
to update the attributes of the NetworkAcl resource
Request Syntax
network_acl.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_network_acls()
to update the attributes of the NetworkAcl resource
Request Syntax
network_acl.reload()
Returns: | None |
---|
replace_association
(**kwargs)¶Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = network_acl.replace_association(
DryRun=True|False,
AssociationId='string',
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NewAssociationId': 'string'
}
Response Structure
|
replace_entry
(**kwargs)¶Replaces an entry (rule) in a network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = network_acl.replace_entry(
DryRun=True|False,
RuleNumber=123,
Protocol='string',
RuleAction='allow'|'deny',
Egress=True|False,
CidrBlock='string',
IcmpTypeCode={
'Type': 123,
'Code': 123
},
PortRange={
'From': 123,
'To': 123
}
)
Parameters: |
|
---|---|
Returns: | None |
EC2.
NetworkInterface
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) NetworkInterface:
import boto3
ec2 = boto3.resource('ec2')
network_interface = ec2.NetworkInterface('id')
Parameters: | id (string) -- The NetworkInterface's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
status
private_ip_addresses
description
availability_zone
subnet_id
attachment
tag_set
private_dns_name
network_interface_id
requester_managed
groups
mac_address
private_ip_address
vpc_id
requester_id
association
source_dest_check
owner_id
These are the resource's available references:
These are the resource's available actions:
assign_private_ip_addresses()
attach()
create_tags()
delete()
describe_attribute()
detach()
load()
modify_attribute()
reload()
reset_attribute()
unassign_private_ip_addresses()
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The NetworkInterface's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
status
¶(string)
The status of the network interface.
private_ip_addresses
¶(list)
The private IP addresses associated with the network interface.
description
¶(string)
A description.
availability_zone
¶(string)
The Availability Zone.
subnet_id
¶(string)
The ID of the subnet.
attachment
¶(dict)
The network interface attachment.
tag_set
¶(list)
Any tags assigned to the network interface.
private_dns_name
¶(string)
The private DNS name.
network_interface_id
¶(string)
The ID of the network interface.
requester_managed
¶(boolean)
Indicates whether the network interface is being managed by AWS.
groups
¶(list)
Any security groups for the network interface.
mac_address
¶(string)
The MAC address.
private_ip_address
¶(string)
The IP address of the network interface within the subnet.
vpc_id
¶(string)
The ID of the VPC.
requester_id
¶(string)
The ID of the entity that launched the instance on your behalf (for example, AWS Management Console or Auto Scaling).
association
¶(dict)
The association information for an Elastic IP associated with the network interface.
source_dest_check
¶(boolean)
Indicates whether traffic to or from the instance is validated.
owner_id
¶(string)
The AWS account ID of the owner of the network interface.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
subnet
¶(Subnet
) The related subnet if set, otherwise None
.
vpc
¶(Vpc
) The related vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
assign_private_ip_addresses
(**kwargs)¶Assigns one or more secondary private IP addresses to the specified network interface. You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Instance Types in the Amazon Elastic Compute Cloud User Guide . For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .
AssignPrivateIpAddresses is available only in EC2-VPC.
Request Syntax
response = network_interface.assign_private_ip_addresses(
PrivateIpAddresses=[
'string',
],
SecondaryPrivateIpAddressCount=123,
AllowReassignment=True|False
)
Parameters: |
|
---|---|
Returns: | None |
attach
(**kwargs)¶Attaches a network interface to an instance.
Request Syntax
response = network_interface.attach(
DryRun=True|False,
InstanceId='string',
DeviceIndex=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'AttachmentId': 'string'
}
Response Structure
|
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = network_interface.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified network interface. You must detach the network interface before you can delete it.
Request Syntax
response = network_interface.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
describe_attribute
(**kwargs)¶Describes a network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = network_interface.describe_attribute(
DryRun=True|False,
Attribute='description'|'groupSet'|'sourceDestCheck'|'attachment'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'NetworkInterfaceId': 'string',
'Description': {
'Value': 'string'
},
'SourceDestCheck': {
'Value': True|False
},
'Groups': [
{
'GroupName': 'string',
'GroupId': 'string'
},
],
'Attachment': {
'AttachmentId': 'string',
'InstanceId': 'string',
'InstanceOwnerId': 'string',
'DeviceIndex': 123,
'Status': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
}
Response Structure
|
detach
(**kwargs)¶Detaches a network interface from an instance.
Request Syntax
response = network_interface.detach(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_network_interfaces()
to update the attributes of the NetworkInterface resource
Request Syntax
network_interface.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Modifies the specified network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = network_interface.modify_attribute(
DryRun=True|False,
Description={
'Value': 'string'
},
SourceDestCheck={
'Value': True|False
},
Groups=[
'string',
],
Attachment={
'AttachmentId': 'string',
'DeleteOnTermination': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_network_interfaces()
to update the attributes of the NetworkInterface resource
Request Syntax
network_interface.reload()
Returns: | None |
---|
reset_attribute
(**kwargs)¶Resets a network interface attribute. You can specify only one attribute at a time.
Request Syntax
response = network_interface.reset_attribute(
DryRun=True|False,
SourceDestCheck='string'
)
Parameters: |
|
---|---|
Returns: | None |
unassign_private_ip_addresses
(**kwargs)¶Unassigns one or more secondary private IP addresses from a network interface.
Request Syntax
response = network_interface.unassign_private_ip_addresses(
PrivateIpAddresses=[
'string',
]
)
Parameters: | PrivateIpAddresses (list) -- [REQUIRED] The secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address.
|
---|---|
Returns: | None |
EC2.
PlacementGroup
(name)¶A resource representing an Amazon Elastic Compute Cloud (EC2) PlacementGroup:
import boto3
ec2 = boto3.resource('ec2')
placement_group = ec2.PlacementGroup('name')
Parameters: | name (string) -- The PlacementGroup's name identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
These are the resource's available collections:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
name
¶(string) The PlacementGroup's name identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
state
¶(string)
The state of the placement group.
strategy
¶(string)
The placement strategy.
group_name
¶(string)
The name of the placement group.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
delete
(**kwargs)¶Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_placement_groups()
to update the attributes of the PlacementGroup resource
Request Syntax
placement_group.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_placement_groups()
to update the attributes of the PlacementGroup resource
Request Syntax
placement_group.reload()
Returns: | None |
---|
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
instances
¶all
()¶Creates an iterable of all Instance resources in the collection.
Request Syntax
instance_iterator = placement_group.instances.all()
Return type: | ec2.Instance |
---|---|
Returns: | A Instance resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
filter
(**kwargs)¶Creates an iterable of all Instance resources in the collection filtered by kwargs passed to method.
Request Syntax
instance_iterator = placement_group.instances.filter(
DryRun=True|False,
InstanceIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of Instance resources in the collection.
Request Syntax
instance_iterator = placement_group.instances.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
monitor
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.monitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
page_size
(**kwargs)¶Creates an iterable of all Instance resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
instance_iterator = placement_group.instances.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
reboot
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.reboot(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
start
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.start(
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.stop(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.terminate(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unmonitor
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = placement_group.instances.unmonitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
EC2.
RouteTable
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) RouteTable:
import boto3
ec2 = boto3.resource('ec2')
route_table = ec2.RouteTable('id')
Parameters: | id (string) -- The RouteTable's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available references:
These are the resource's available actions:
These are the resource's available collections:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The RouteTable's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
(list)
Any tags assigned to the route table.
routes
¶(list)
The routes in the route table.
route_table_id
¶(string)
The ID of the route table.
vpc_id
¶(string)
The ID of the VPC.
propagating_vgws
¶(list)
Any virtual private gateway (VGW) propagating routes.
associations_attribute
¶(list)
The associations between the route table and one or more subnets.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
vpc
¶(Vpc
) The related vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
associate_with_subnet
(**kwargs)¶Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. The action returns an association ID, which you need in order to disassociate the route table from the subnet later. A route table can be associated with multiple subnets.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
route_table_association = route_table.associate_with_subnet(
DryRun=True|False,
SubnetId='string',
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTableAssociation resource |
create_route
(**kwargs)¶Creates a route in a route table within a VPC.
You must specify one of the following targets: Internet gateway or virtual private gateway, NAT instance, VPC peering connection, or network interface.
When determining how to route traffic, we use the route with the most specific match. For example, let's say the traffic is destined for 192.0.2.3
, and the route table includes the following two routes:
192.0.2.0/24
(goes to some target A)192.0.2.0/28
(goes to some target B)Both routes apply to the traffic destined for 192.0.2.3
. However, the second route in the list covers a smaller number of IP addresses and is therefore more specific, so we use that route to determine where to target the traffic.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = route_table.create_route(
DryRun=True|False,
DestinationCidrBlock='string',
GatewayId='string',
InstanceId='string',
NetworkInterfaceId='string',
VpcPeeringConnectionId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = route_table.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified route table. You must disassociate the route table from any subnets before you can delete it. You can't delete the main route table.
Request Syntax
response = route_table.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_route_tables()
to update the attributes of the RouteTable resource
Request Syntax
route_table.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_route_tables()
to update the attributes of the RouteTable resource
Request Syntax
route_table.reload()
Returns: | None |
---|
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
associations
¶all
()¶Creates an iterable of all RouteTableAssociation resources in the collection.
Request Syntax
route_table_association_iterator = route_table.associations.all()
Return type: | ec2.RouteTableAssociation |
---|---|
Returns: | A RouteTableAssociation resource |
filter
(**kwargs)¶Creates an iterable of all RouteTableAssociation resources in the collection filtered by kwargs passed to method.
Request Syntax
route_table_association_iterator = route_table.associations.filter(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTableAssociation resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of RouteTableAssociation resources in the collection.
Request Syntax
route_table_association_iterator = route_table.associations.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.RouteTableAssociation |
Returns: | A RouteTableAssociation resource |
page_size
(**kwargs)¶Creates an iterable of all RouteTableAssociation resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
route_table_association_iterator = route_table.associations.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.RouteTableAssociation |
Returns: | A RouteTableAssociation resource |
EC2.
RouteTableAssociation
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) RouteTableAssociation:
import boto3
ec2 = boto3.resource('ec2')
route_table_association = ec2.RouteTableAssociation('id')
Parameters: | id (string) -- The RouteTableAssociation's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available references:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The RouteTableAssociation's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
route_table_id
¶(string)
The ID of the route table.
subnet_id
¶(string)
The ID of the subnet. A subnet ID is not returned for an implicit association.
main
¶(boolean)
Indicates whether this is the main route table.
route_table_association_id
¶(string)
The ID of the association between a route table and a subnet.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
route_table
¶(RouteTable
) The related route_table if set, otherwise None
.
subnet
¶(Subnet
) The related subnet if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
delete
(**kwargs)¶Disassociates a subnet from a route table.
After you perform this action, the subnet no longer uses the routes in the route table. Instead, it uses the routes in the VPC's main route table. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = route_table_association.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
replace_subnet
(**kwargs)¶Changes the route table associated with a given subnet in a VPC. After the operation completes, the subnet uses the routes in the new route table it's associated with. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
You can also use ReplaceRouteTableAssociation to change which table is the main route table in the VPC. You just specify the main route table's association ID and the route table to be the new main route table.
Request Syntax
route_table_association = route_table_association.replace_subnet(
DryRun=True|False,
RouteTableId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTableAssociation resource |
EC2.
SecurityGroup
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) SecurityGroup:
import boto3
ec2 = boto3.resource('ec2')
security_group = ec2.SecurityGroup('id')
Parameters: | id (string) -- The SecurityGroup's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
authorize_egress()
authorize_ingress()
create_tags()
delete()
load()
reload()
revoke_egress()
revoke_ingress()
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The SecurityGroup's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
ip_permissions
¶(list)
One or more inbound rules associated with the security group.
description
¶(string)
A description of the security group.
(list)
Any tags assigned to the security group.
group_name
¶(string)
The name of the security group.
vpc_id
¶(string)
[EC2-VPC] The ID of the VPC for the security group.
group_id
¶(string)
The ID of the security group.
ip_permissions_egress
¶(list)
[EC2-VPC] One or more outbound rules associated with the security group.
owner_id
¶(string)
The AWS account ID of the owner of the security group.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
Adds one or more egress rules to a security group for use with a VPC. Specifically, this action permits instances to send traffic to one or more destination CIDR IP address ranges, or to one or more destination security groups for the same VPC.
Warning
You can have up to 50 rules per security group (covering both ingress and egress rules).
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. This action doesn't apply to security groups for use in EC2-Classic. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Each rule consists of the protocol (for example, TCP), plus either a CIDR range or a source group. For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes.
Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur.
Request Syntax
response = security_group.authorize_egress(
DryRun=True|False,
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
Adds one or more ingress rules to a security group.
Warning
EC2-Classic: You can have up to 100 rules per group.
EC2-VPC: You can have up to 50 rules per group (covering both ingress and egress rules).
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
[EC2-Classic] This action gives one or more CIDR IP address ranges permission to access a security group in your account, or gives one or more security groups (called the source groups ) permission to access a security group for your account. A source group can be for your own AWS account, or another.
[EC2-VPC] This action gives one or more CIDR IP address ranges permission to access a security group in your VPC, or gives one or more other security groups (called the source groups ) permission to access a security group for your VPC. The security groups must all be for the same VPC.
Request Syntax
response = security_group.authorize_ingress(
DryRun=True|False,
GroupName='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = security_group.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes a security group.
If you attempt to delete a security group that is associated with an instance, or is referenced by another security group, the operation fails with InvalidGroup.InUse
in EC2-Classic or DependencyViolation
in EC2-VPC.
Request Syntax
response = security_group.delete(
DryRun=True|False,
GroupName='string',
)
Parameters: |
|
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_security_groups()
to update the attributes of the SecurityGroup resource
Request Syntax
security_group.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_security_groups()
to update the attributes of the SecurityGroup resource
Request Syntax
security_group.reload()
Returns: | None |
---|
revoke_egress
(**kwargs)¶Removes one or more egress rules from a security group for EC2-VPC. The values that you specify in the revoke request (for example, ports) must match the existing rule's values for the rule to be revoked.
Each rule consists of the protocol and the CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code.
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
Request Syntax
response = security_group.revoke_egress(
DryRun=True|False,
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
revoke_ingress
(**kwargs)¶Removes one or more ingress rules from a security group. The values that you specify in the revoke request (for example, ports) must match the existing rule's values for the rule to be removed.
Each rule consists of the protocol and the CIDR range or source security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code.
Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.
Request Syntax
response = security_group.revoke_ingress(
DryRun=True|False,
GroupName='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
IpProtocol='string',
FromPort=123,
ToPort=123,
CidrIp='string',
IpPermissions=[
{
'IpProtocol': 'string',
'FromPort': 123,
'ToPort': 123,
'UserIdGroupPairs': [
{
'UserId': 'string',
'GroupName': 'string',
'GroupId': 'string'
},
],
'IpRanges': [
{
'CidrIp': 'string'
},
],
'PrefixListIds': [
{
'PrefixListId': 'string'
},
]
},
]
)
Parameters: |
|
---|---|
Returns: | None |
EC2.
Snapshot
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Snapshot:
import boto3
ec2 = boto3.resource('ec2')
snapshot = ec2.Snapshot('id')
Parameters: | id (string) -- The Snapshot's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
kms_key_id
description
owner_alias
encrypted
start_time
snapshot_id
volume_size
state
volume_id
progress
tags
owner_id
These are the resource's available references:
These are the resource's available actions:
copy()
create_tags()
delete()
describe_attribute()
load()
modify_attribute()
reload()
reset_attribute()
These are the resource's available waiters:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Snapshot's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
kms_key_id
¶(string)
The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the parent volume.
description
¶(string)
The description for the snapshot.
owner_alias
¶(string)
The AWS account alias (for example, amazon
, self
) or AWS account ID that owns the snapshot.
encrypted
¶(boolean)
Indicates whether the snapshot is encrypted.
start_time
¶(datetime)
The time stamp when the snapshot was initiated.
snapshot_id
¶(string)
The ID of the snapshot.
volume_size
¶(integer)
The size of the volume, in GiB.
state
¶(string)
The snapshot state.
volume_id
¶(string)
The ID of the volume.
progress
¶(string)
The progress of the snapshot, as a percentage.
(list)
Any tags assigned to the snapshot.
owner_id
¶(string)
The AWS account ID of the EBS snapshot owner.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
volume
¶(Volume
) The related volume if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
copy
(**kwargs)¶Copies a point-in-time snapshot of an EBS volume and stores it in Amazon S3. You can copy the snapshot within the same region or from one region to another. You can use the snapshot to create EBS volumes or Amazon Machine Images (AMIs). The snapshot is copied to the regional endpoint that you send the HTTP request to.
Copies of encrypted EBS snapshots remain encrypted. Copies of unencrypted snapshots remain unencrypted, unless the Encrypted
flag is specified during the snapshot copy operation. By default, encrypted snapshot copies use the default AWS Key Management Service (AWS KMS) customer master key (CMK); however, you can specify a non-default CMK with the KmsKeyId
parameter.
For more information, see Copying an Amazon EBS Snapshot in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = snapshot.copy(
DryRun=True|False,
SourceRegion='string',
Description='string',
Encrypted=True|False,
KmsKeyId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SnapshotId': 'string'
}
Response Structure
|
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = snapshot.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified snapshot.
When you make periodic snapshots of a volume, the snapshots are incremental, and only the blocks on the device that have changed since your last snapshot are saved in the new snapshot. When you delete a snapshot, only the data not needed for any other snapshot is removed. So regardless of which prior snapshots have been deleted, all active snapshots will have access to all the information needed to restore the volume.
You cannot delete a snapshot of the root device of an EBS volume used by a registered AMI. You must first de-register the AMI before you can delete the snapshot.
For more information, see Deleting an Amazon EBS Snapshot in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = snapshot.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
describe_attribute
(**kwargs)¶Describes the specified attribute of the specified snapshot. You can specify only one attribute at a time.
For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = snapshot.describe_attribute(
DryRun=True|False,
Attribute='productCodes'|'createVolumePermission'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'SnapshotId': 'string',
'CreateVolumePermissions': [
{
'UserId': 'string',
'Group': 'all'
},
],
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
]
}
Response Structure
|
load
()¶Calls ec2.Client.describe_snapshots()
to update the attributes of the Snapshot resource
Request Syntax
snapshot.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Adds or removes permission settings for the specified snapshot. You may add or remove specified AWS account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single API call. If you need to both add and remove account IDs for a snapshot, you must use multiple API calls.
For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide .
Note
Snapshots with AWS Marketplace product codes cannot be made public.
Request Syntax
response = snapshot.modify_attribute(
DryRun=True|False,
Attribute='productCodes'|'createVolumePermission',
OperationType='string',
UserIds=[
'string',
],
GroupNames=[
'string',
],
CreateVolumePermission={
'Add': [
{
'UserId': 'string',
'Group': 'all'
},
],
'Remove': [
{
'UserId': 'string',
'Group': 'all'
},
]
}
)
Parameters: |
|
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_snapshots()
to update the attributes of the Snapshot resource
Request Syntax
snapshot.reload()
Returns: | None |
---|
reset_attribute
(**kwargs)¶Resets permission settings for the specified snapshot.
For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = snapshot.reset_attribute(
DryRun=True|False,
Attribute='productCodes'|'createVolumePermission'
)
Parameters: |
|
---|---|
Returns: | None |
Waiters
Waiters provide an interface to wait for a resource to reach a specific state. For more information about waiters refer to the Resources Introduction Guide.
wait_until_completed
(**kwargs)¶Waits until this Snapshot is completed. This method calls EC2.Waiter.snapshot_completed.wait()
which polls. EC2.Client.describe_snapshots()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
snapshot.wait_until_completed(
DryRun=True|False,
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Snapshots': [
{
'SnapshotId': 'string',
'VolumeId': 'string',
'State': 'pending'|'completed'|'error',
'StartTime': datetime(2015, 1, 1),
'Progress': 'string',
'OwnerId': 'string',
'Description': 'string',
'VolumeSize': 123,
'OwnerAlias': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'Encrypted': True|False,
'KmsKeyId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
|
EC2.
Subnet
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Subnet:
import boto3
ec2 = boto3.resource('ec2')
subnet = ec2.Subnet('id')
Parameters: | id (string) -- The Subnet's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
availability_zone
subnet_id
tags
default_for_az
state
vpc_id
cidr_block
available_ip_address_count
map_public_ip_on_launch
These are the resource's available references:
These are the resource's available actions:
These are the resource's available collections:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Subnet's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
availability_zone
¶(string)
The Availability Zone of the subnet.
subnet_id
¶(string)
The ID of the subnet.
(list)
Any tags assigned to the subnet.
default_for_az
¶(boolean)
Indicates whether this is the default subnet for the Availability Zone.
state
¶(string)
The current state of the subnet.
vpc_id
¶(string)
The ID of the VPC the subnet is in.
cidr_block
¶(string)
The CIDR block assigned to the subnet.
available_ip_address_count
¶(integer)
The number of unused IP addresses in the subnet. Note that the IP addresses for any stopped instances are considered unavailable.
map_public_ip_on_launch
¶(boolean)
Indicates whether instances launched in this subnet receive a public IP address.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
vpc
¶(Vpc
) The related vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
create_instances
(**kwargs)¶Launches the specified number of instances using an AMI for which you have permissions.
When you launch an instance, it enters the pending
state. After the instance is ready for you, it enters the running
state. To check the state of your instance, call DescribeInstances .
If you don't specify a security group when launching an instance, Amazon EC2 uses the default security group. For more information, see Security Groups in the Amazon Elastic Compute Cloud User Guide .
Linux instances have access to the public key of the key pair at boot. You can use this key to provide secure access to the instance. Amazon EC2 public images use this feature to provide secure access without passwords. For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide .
You can provide optional user data when launching an instance. For more information, see Instance Metadata in the Amazon Elastic Compute Cloud User Guide .
If any of the AMIs have a product code attached for which the user has not subscribed, RunInstances
fails.
T2 instance types can only be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID in the request, RunInstances
fails.
For more information about troubleshooting, see What To Do If An Instance Immediately Terminates , and Troubleshooting Connecting to Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
instance = subnet.create_instances(
DryRun=True|False,
ImageId='string',
MinCount=123,
MaxCount=123,
KeyName='string',
SecurityGroups=[
'string',
],
SecurityGroupIds=[
'string',
],
UserData='string',
InstanceType='t1.micro'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
Placement={
'AvailabilityZone': 'string',
'GroupName': 'string',
'Tenancy': 'default'|'dedicated'
},
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'DeleteOnTermination': True|False,
'VolumeType': 'standard'|'io1'|'gp2',
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': 'string'
},
],
Monitoring={
'Enabled': True|False
},
DisableApiTermination=True|False,
InstanceInitiatedShutdownBehavior='stop'|'terminate',
PrivateIpAddress='string',
ClientToken='string',
AdditionalInfo='string',
NetworkInterfaces=[
{
'NetworkInterfaceId': 'string',
'DeviceIndex': 123,
'SubnetId': 'string',
'Description': 'string',
'PrivateIpAddress': 'string',
'Groups': [
'string',
],
'DeleteOnTermination': True|False,
'PrivateIpAddresses': [
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
'SecondaryPrivateIpAddressCount': 123,
'AssociatePublicIpAddress': True|False
},
],
IamInstanceProfile={
'Arn': 'string',
'Name': 'string'
},
EbsOptimized=True|False
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
create_network_interface
(**kwargs)¶Creates a network interface in the specified subnet.
For more information about network interfaces, see Elastic Network Interfaces in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
network_interface = subnet.create_network_interface(
Description='string',
PrivateIpAddress='string',
Groups=[
'string',
],
PrivateIpAddresses=[
{
'PrivateIpAddress': 'string',
'Primary': True|False
},
],
SecondaryPrivateIpAddressCount=123,
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkInterface resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = subnet.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified subnet. You must terminate all running instances in the subnet before you can delete the subnet.
Request Syntax
response = subnet.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_subnets()
to update the attributes of the Subnet resource
Request Syntax
subnet.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_subnets()
to update the attributes of the Subnet resource
Request Syntax
subnet.reload()
Returns: | None |
---|
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
instances
¶all
()¶Creates an iterable of all Instance resources in the collection.
Request Syntax
instance_iterator = subnet.instances.all()
Return type: | ec2.Instance |
---|---|
Returns: | A Instance resource |
create_tags
(**kwargs)Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
filter
(**kwargs)¶Creates an iterable of all Instance resources in the collection filtered by kwargs passed to method.
Request Syntax
instance_iterator = subnet.instances.filter(
DryRun=True|False,
InstanceIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of Instance resources in the collection.
Request Syntax
instance_iterator = subnet.instances.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
monitor
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.monitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
page_size
(**kwargs)¶Creates an iterable of all Instance resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
instance_iterator = subnet.instances.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
reboot
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.reboot(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
start
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.start(
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.stop(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.terminate(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unmonitor
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = subnet.instances.unmonitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
network_interfaces
¶all
()Creates an iterable of all NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = subnet.network_interfaces.all()
Return type: | ec2.NetworkInterface |
---|---|
Returns: | A NetworkInterface resource |
filter
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection filtered by kwargs passed to method.
Request Syntax
network_interface_iterator = subnet.network_interfaces.filter(
DryRun=True|False,
NetworkInterfaceIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkInterface resource |
limit
(**kwargs)Creates an iterable up to a specified amount of NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = subnet.network_interfaces.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
page_size
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
network_interface_iterator = subnet.network_interfaces.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
EC2.
Tag
(resource_id, key, value)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Tag:
import boto3
ec2 = boto3.resource('ec2')
tag = ec2.Tag('resource_id','key','value')
Parameters: |
|
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
resource_id
¶(string) The Tag's resource_id identifier. This must be set.
key
¶(string) The Tag's key identifier. This must be set.
value
¶(string) The Tag's value identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
resource_type
¶(string)
The resource type.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
delete
(**kwargs)¶Deletes the specified set of tags from the specified set of resources. This call is designed to follow a DescribeTags
request.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = tag.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_tags()
to update the attributes of the Tag resource
Request Syntax
tag.load()
Returns: | None |
---|
reload
()¶Calls ec2.Client.describe_tags()
to update the attributes of the Tag resource
Request Syntax
tag.reload()
Returns: | None |
---|
EC2.
Volume
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Volume:
import boto3
ec2 = boto3.resource('ec2')
volume = ec2.Volume('id')
Parameters: | id (string) -- The Volume's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
iops
kms_key_id
attachments
availability_zone
encrypted
volume_id
volume_type
state
create_time
snapshot_id
tags
size
These are the resource's available actions:
attach_to_instance()
create_snapshot()
create_tags()
delete()
describe_attribute()
describe_status()
detach_from_instance()
enable_io()
load()
modify_attribute()
reload()
These are the resource's available collections:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Volume's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
iops
¶(integer)
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .
Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.
Condition: This parameter is required for requests to create io1
volumes; it is not used in requests to create standard
or gp2
volumes.
kms_key_id
¶(string)
The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the volume.
attachments
¶(list)
Information about the volume attachments.
availability_zone
¶(string)
The Availability Zone for the volume.
encrypted
¶(boolean)
Indicates whether the volume will be encrypted.
volume_id
¶(string)
The ID of the volume.
volume_type
¶(string)
The volume type. This can be gp2
for General Purpose (SSD) volumes, io1
for Provisioned IOPS (SSD) volumes, or standard
for Magnetic volumes.
state
¶(string)
The volume state.
create_time
¶(datetime)
The time stamp when volume creation was initiated.
snapshot_id
¶(string)
The snapshot from which the volume was created, if applicable.
(list)
Any tags assigned to the volume.
size
¶(integer)
The size of the volume, in GiBs.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
attach_to_instance
(**kwargs)¶Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.
Encrypted EBS volumes may only be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
For a list of supported device names, see Attaching an EBS Volume to an Instance . Any device names that aren't reserved for instance store volumes can be used for EBS volumes. For more information, see Amazon EC2 Instance Store in the Amazon Elastic Compute Cloud User Guide .
If a volume has an AWS Marketplace product code:
For an overview of the AWS Marketplace, see Introducing AWS Marketplace .
For more information about EBS volumes, see Attaching Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = volume.attach_to_instance(
DryRun=True|False,
InstanceId='string',
Device='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
create_snapshot
(**kwargs)¶Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.
When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.
You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your EBS volume at the time the snapshot command is issued; this may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending
.
To create a snapshot for EBS volumes that serve as root devices, you should stop the instance before taking the snapshot.
Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.
For more information, see Amazon Elastic Block Store and Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
snapshot = volume.create_snapshot(
DryRun=True|False,
Description='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Snapshot resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = volume.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified EBS volume. The volume must be in the available
state (not attached to an instance).
Note
The volume may remain in the deleting
state for several minutes.
For more information, see Deleting an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = volume.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
describe_attribute
(**kwargs)¶Describes the specified attribute of the specified volume. You can specify only one attribute at a time.
For more information about EBS volumes, see Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = volume.describe_attribute(
DryRun=True|False,
Attribute='autoEnableIO'|'productCodes'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'AutoEnableIO': {
'Value': True|False
},
'ProductCodes': [
{
'ProductCodeId': 'string',
'ProductCodeType': 'devpay'|'marketplace'
},
]
}
Response Structure
|
describe_status
(**kwargs)¶Describes the status of the specified volumes. Volume status provides the result of the checks performed on your volumes to determine events that can impair the performance of your volumes. The performance of a volume can be affected if an issue occurs on the volume's underlying host. If the volume's underlying host experiences a power outage or system issue, after the system is restored, there could be data inconsistencies on the volume. Volume events notify you if this occurs. Volume actions notify you if any action needs to be taken in response to the event.
The DescribeVolumeStatus
operation provides the following information about the specified volumes:
Status : Reflects the current status of the volume. The possible values are ok
, impaired
, warning
, or insufficient-data
. If all checks pass, the overall status of the volume is ok
. If the check fails, the overall status is impaired
. If the status is insufficient-data
, then the checks may still be taking place on your volume at the time. We recommend that you retry the request. For more information on volume status, see Monitoring the Status of Your Volumes .
Events : Reflect the cause of a volume status and may require you to take action. For example, if your volume returns an impaired
status, then the volume event might be potential-data-inconsistency
. This means that your volume has been affected by an issue with the underlying host, has all I/O operations disabled, and may have inconsistent data.
Actions : Reflect the actions you may have to take in response to an event. For example, if the status of the volume is impaired
and the volume event shows potential-data-inconsistency
, then the action shows enable-volume-io
. This means that you may want to enable the I/O operations for the volume by calling the EnableVolumeIO action and then check the volume for data consistency.
Note
Volume status is based on the volume status checks, and does not reflect the volume state. Therefore, volume status does not indicate volumes in the error
state (for example, when a volume is incapable of accepting I/O.)
Request Syntax
response = volume.describe_status(
DryRun=True|False,
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeStatuses': [
{
'VolumeId': 'string',
'AvailabilityZone': 'string',
'VolumeStatus': {
'Status': 'ok'|'impaired'|'insufficient-data',
'Details': [
{
'Name': 'io-enabled'|'io-performance',
'Status': 'string'
},
]
},
'Events': [
{
'EventType': 'string',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1),
'EventId': 'string'
},
],
'Actions': [
{
'Code': 'string',
'Description': 'string',
'EventType': 'string',
'EventId': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
detach_from_instance
(**kwargs)¶Detaches an EBS volume from an instance. Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to do so results in the volume being stuck in a busy state while detaching.
If an Amazon EBS volume is the root device of an instance, it can't be detached while the instance is running. To detach the root volume, stop the instance first.
When a volume with an AWS Marketplace product code is detached from an instance, the product code is no longer associated with the instance.
For more information, see Detaching an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = volume.detach_from_instance(
DryRun=True|False,
InstanceId='string',
Device='string',
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VolumeId': 'string',
'InstanceId': 'string',
'Device': 'string',
'State': 'attaching'|'attached'|'detaching'|'detached',
'AttachTime': datetime(2015, 1, 1),
'DeleteOnTermination': True|False
}
Response Structure
|
enable_io
(**kwargs)¶Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially inconsistent.
Request Syntax
response = volume.enable_io(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
load
()¶Calls ec2.Client.describe_volumes()
to update the attributes of the Volume resource
Request Syntax
volume.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Modifies a volume attribute.
By default, all I/O operations for the volume are suspended when the data on the volume is determined to be potentially inconsistent, to prevent undetectable, latent data corruption. The I/O access to the volume can be resumed by first enabling I/O access and then checking the data consistency on your volume.
You can change the default behavior to resume I/O operations. We recommend that you change this only for boot volumes or for volumes that are stateless or disposable.
Request Syntax
response = volume.modify_attribute(
DryRun=True|False,
AutoEnableIO={
'Value': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_volumes()
to update the attributes of the Volume resource
Request Syntax
volume.reload()
Returns: | None |
---|
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
snapshots
¶all
()¶Creates an iterable of all Snapshot resources in the collection.
Request Syntax
snapshot_iterator = volume.snapshots.all()
Return type: | ec2.Snapshot |
---|---|
Returns: | A Snapshot resource |
filter
(**kwargs)¶Creates an iterable of all Snapshot resources in the collection filtered by kwargs passed to method.
Request Syntax
snapshot_iterator = volume.snapshots.filter(
DryRun=True|False,
SnapshotIds=[
'string',
],
OwnerIds=[
'string',
],
RestorableByUserIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Snapshot resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of Snapshot resources in the collection.
Request Syntax
snapshot_iterator = volume.snapshots.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Snapshot |
Returns: | A Snapshot resource |
page_size
(**kwargs)¶Creates an iterable of all Snapshot resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
snapshot_iterator = volume.snapshots.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Snapshot |
Returns: | A Snapshot resource |
EC2.
Vpc
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) Vpc:
import boto3
ec2 = boto3.resource('ec2')
vpc = ec2.Vpc('id')
Parameters: | id (string) -- The Vpc's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available references:
These are the resource's available actions:
associate_dhcp_options()
attach_classic_link_instance()
attach_internet_gateway()
create_network_acl()
create_route_table()
create_security_group()
create_subnet()
create_tags()
delete()
describe_attribute()
detach_classic_link_instance()
detach_internet_gateway()
disable_classic_link()
enable_classic_link()
load()
modify_attribute()
reload()
request_vpc_peering_connection()
These are the resource's available collections:
accepted_vpc_peering_connections
instances
internet_gateways
network_acls
network_interfaces
requested_vpc_peering_connections
route_tables
security_groups
subnets
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The Vpc's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
is_default
¶(boolean)
Indicates whether the VPC is the default VPC.
(list)
Any tags assigned to the VPC.
instance_tenancy
¶(string)
The allowed tenancy of instances launched into the VPC.
state
¶(string)
The current state of the VPC.
vpc_id
¶(string)
The ID of the VPC.
cidr_block
¶(string)
The CIDR block for the VPC.
dhcp_options_id
¶(string)
The ID of the set of DHCP options you've associated with the VPC (or default
if the default options are associated with the VPC).
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
dhcp_options
¶(DhcpOptions
) The related dhcp_options if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
associate_dhcp_options
(**kwargs)¶Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.
After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.
For more information, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = vpc.associate_dhcp_options(
DryRun=True|False,
DhcpOptionsId='string',
)
Parameters: |
|
---|---|
Returns: | None |
attach_classic_link_instance
(**kwargs)¶Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC's security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running
state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.
After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.
Linking your instance to a VPC is sometimes referred to as attaching your instance.
Request Syntax
response = vpc.attach_classic_link_instance(
DryRun=True|False,
InstanceId='string',
Groups=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
attach_internet_gateway
(**kwargs)¶Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide .
Request Syntax
response = vpc.attach_internet_gateway(
DryRun=True|False,
InternetGatewayId='string',
)
Parameters: |
|
---|---|
Returns: | None |
create_network_acl
(**kwargs)¶Creates a network ACL in a VPC. Network ACLs provide an optional layer of security (in addition to security groups) for the instances in your VPC.
For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide .
Request Syntax
network_acl = vpc.create_network_acl(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | ec2.NetworkAcl |
Returns: | A NetworkAcl resource |
create_route_table
(**kwargs)¶Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet.
For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide .
Request Syntax
route_table = vpc.create_route_table(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | ec2.RouteTable |
Returns: | A RouteTable resource |
create_security_group
(**kwargs)¶Creates a security group.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
Warning
EC2-Classic: You can have up to 500 security groups.
EC2-VPC: You can create up to 100 security groups per VPC.
When you create a security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.
You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.
You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress , AuthorizeSecurityGroupEgress , RevokeSecurityGroupIngress , and RevokeSecurityGroupEgress .
Request Syntax
security_group = vpc.create_security_group(
DryRun=True|False,
GroupName='string',
Description='string',
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A SecurityGroup resource |
create_subnet
(**kwargs)¶Creates a subnet in an existing VPC.
When you create each subnet, you provide the VPC ID and the CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you want only a single subnet in the VPC), or a subset of the VPC's CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).
Warning
AWS reserves both the first four and the last IP address in each subnet's CIDR block. They're not available for use.
If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle.
If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP address doesn't change if you stop and restart the instance (unlike a similar instance launched outside a VPC, which gets a new IP address when restarted). It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available.
For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide .
Request Syntax
subnet = vpc.create_subnet(
DryRun=True|False,
CidrBlock='string',
AvailabilityZone='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Subnet resource |
Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
tag = vpc.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Tag resource |
delete
(**kwargs)¶Deletes the specified VPC. You must detach or delete all gateways and resources that are associated with the VPC before you can delete it. For example, you must terminate all instances running in the VPC, delete all security groups associated with the VPC (except the default one), delete all route tables associated with the VPC (except the default one), and so on.
Request Syntax
response = vpc.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
describe_attribute
(**kwargs)¶Describes the specified attribute of the specified VPC. You can specify only one attribute at a time.
Request Syntax
response = vpc.describe_attribute(
DryRun=True|False,
Attribute='enableDnsSupport'|'enableDnsHostnames'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'VpcId': 'string',
'EnableDnsSupport': {
'Value': True|False
},
'EnableDnsHostnames': {
'Value': True|False
}
}
Response Structure
|
detach_classic_link_instance
(**kwargs)¶Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped.
Request Syntax
response = vpc.detach_classic_link_instance(
DryRun=True|False,
InstanceId='string',
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Return': True|False
}
Response Structure
|
detach_internet_gateway
(**kwargs)¶Detaches an Internet gateway from a VPC, disabling connectivity between the Internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses.
Request Syntax
response = vpc.detach_internet_gateway(
DryRun=True|False,
InternetGatewayId='string',
)
Parameters: |
|
---|---|
Returns: | None |
disable_classic_link
(**kwargs)¶Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC that has EC2-Classic instances linked to it.
Request Syntax
response = vpc.disable_classic_link(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Return': True|False
}
Response Structure
|
enable_classic_link
(**kwargs)¶Enables a VPC for ClassicLink. You can then link EC2-Classic instances to your ClassicLink-enabled VPC to allow communication over private IP addresses. You cannot enable your VPC for ClassicLink if any of your VPC's route tables have existing routes for address ranges within the 10.0.0.0/8
IP address range, excluding local routes for VPCs in the 10.0.0.0/16
and 10.1.0.0/16
IP address ranges. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide.
Request Syntax
response = vpc.enable_classic_link(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Return': True|False
}
Response Structure
|
load
()¶Calls ec2.Client.describe_vpcs()
to update the attributes of the Vpc resource
Request Syntax
vpc.load()
Returns: | None |
---|
modify_attribute
(**kwargs)¶Modifies the specified attribute of the specified VPC.
Request Syntax
response = vpc.modify_attribute(
EnableDnsSupport={
'Value': True|False
},
EnableDnsHostnames={
'Value': True|False
}
)
Parameters: |
|
---|---|
Returns: | None |
reload
()¶Calls ec2.Client.describe_vpcs()
to update the attributes of the Vpc resource
Request Syntax
vpc.reload()
Returns: | None |
---|
request_vpc_peering_connection
(**kwargs)¶Requests a VPC peering connection between two VPCs: a requester VPC that you own and a peer VPC with which to create the connection. The peer VPC can belong to another AWS account. The requester VPC and peer VPC cannot have overlapping CIDR blocks.
The owner of the peer VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.
A CreateVpcPeeringConnection
request between VPCs with overlapping CIDR blocks results in the VPC peering connection having a status of failed
.
Request Syntax
vpc_peering_connection = vpc.request_vpc_peering_connection(
DryRun=True|False,
PeerVpcId='string',
PeerOwnerId='string'
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A VpcPeeringConnection resource |
Collections
Collections provide an interface to iterate over and manipulate groups of resources. For more information about collections refer to the Resources Introduction Guide.
accepted_vpc_peering_connections
¶all
()¶Creates an iterable of all VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = vpc.accepted_vpc_peering_connections.all()
Return type: | ec2.VpcPeeringConnection |
---|---|
Returns: | A VpcPeeringConnection resource |
filter
(**kwargs)¶Creates an iterable of all VpcPeeringConnection resources in the collection filtered by kwargs passed to method.
Request Syntax
vpc_peering_connection_iterator = vpc.accepted_vpc_peering_connections.filter(
DryRun=True|False,
VpcPeeringConnectionIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A VpcPeeringConnection resource |
limit
(**kwargs)¶Creates an iterable up to a specified amount of VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = vpc.accepted_vpc_peering_connections.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
page_size
(**kwargs)¶Creates an iterable of all VpcPeeringConnection resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
vpc_peering_connection_iterator = vpc.accepted_vpc_peering_connections.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
instances
¶all
()Creates an iterable of all Instance resources in the collection.
Request Syntax
instance_iterator = vpc.instances.all()
Return type: | ec2.Instance |
---|---|
Returns: | A Instance resource |
create_tags
(**kwargs)Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.create_tags(
DryRun=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Returns: | None |
filter
(**kwargs)Creates an iterable of all Instance resources in the collection filtered by kwargs passed to method.
Request Syntax
instance_iterator = vpc.instances.filter(
DryRun=True|False,
InstanceIds=[
'string',
],
NextToken='string',
MaxResults=123
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Instance resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Instance resources in the collection.
Request Syntax
instance_iterator = vpc.instances.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
monitor
(**kwargs)¶Enables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.monitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
page_size
(**kwargs)Creates an iterable of all Instance resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
instance_iterator = vpc.instances.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Instance |
Returns: | A Instance resource |
reboot
(**kwargs)¶Requests a reboot of one or more instances. This operation is asynchronous; it only queues a request to reboot the specified instances. The operation succeeds if the instances are valid and belong to you. Requests to reboot terminated instances are ignored.
If a Linux/Unix instance does not cleanly shut down within four minutes, Amazon EC2 performs a hard reboot.
For more information about troubleshooting, see Getting Console Output and Rebooting Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.reboot(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Returns: | None |
start
(**kwargs)¶Starts an Amazon EBS-backed AMI that you've previously stopped.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
For more information, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.start(
AdditionalInfo='string',
DryRun=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StartingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
stop
(**kwargs)¶Stops an Amazon EBS-backed instance. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.
You can't start or stop Spot Instances.
Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time.
Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.
Performing this operation on an instance that uses an instance store as its root device returns an error.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Stopping Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.stop(
DryRun=True|False,
Force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StoppingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
terminate
(**kwargs)¶Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (for approximately one hour).
By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.
You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide .
For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.terminate(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'TerminatingInstances': [
{
'InstanceId': 'string',
'CurrentState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
},
'PreviousState': {
'Code': 123,
'Name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped'
}
},
]
}
Response Structure
|
unmonitor
(**kwargs)¶Disables monitoring for a running instance. For more information about monitoring instances, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide .
Request Syntax
response = vpc.instances.unmonitor(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'InstanceMonitorings': [
{
'InstanceId': 'string',
'Monitoring': {
'State': 'disabled'|'disabling'|'enabled'|'pending'
}
},
]
}
Response Structure
|
internet_gateways
¶all
()Creates an iterable of all InternetGateway resources in the collection.
Request Syntax
internet_gateway_iterator = vpc.internet_gateways.all()
Return type: | ec2.InternetGateway |
---|---|
Returns: | A InternetGateway resource |
filter
(**kwargs)Creates an iterable of all InternetGateway resources in the collection filtered by kwargs passed to method.
Request Syntax
internet_gateway_iterator = vpc.internet_gateways.filter(
DryRun=True|False,
InternetGatewayIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A InternetGateway resource |
limit
(**kwargs)Creates an iterable up to a specified amount of InternetGateway resources in the collection.
Request Syntax
internet_gateway_iterator = vpc.internet_gateways.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.InternetGateway |
Returns: | A InternetGateway resource |
page_size
(**kwargs)Creates an iterable of all InternetGateway resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
internet_gateway_iterator = vpc.internet_gateways.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.InternetGateway |
Returns: | A InternetGateway resource |
network_acls
¶all
()Creates an iterable of all NetworkAcl resources in the collection.
Request Syntax
network_acl_iterator = vpc.network_acls.all()
Return type: | ec2.NetworkAcl |
---|---|
Returns: | A NetworkAcl resource |
filter
(**kwargs)Creates an iterable of all NetworkAcl resources in the collection filtered by kwargs passed to method.
Request Syntax
network_acl_iterator = vpc.network_acls.filter(
DryRun=True|False,
NetworkAclIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkAcl resource |
limit
(**kwargs)Creates an iterable up to a specified amount of NetworkAcl resources in the collection.
Request Syntax
network_acl_iterator = vpc.network_acls.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.NetworkAcl |
Returns: | A NetworkAcl resource |
page_size
(**kwargs)Creates an iterable of all NetworkAcl resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
network_acl_iterator = vpc.network_acls.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.NetworkAcl |
Returns: | A NetworkAcl resource |
network_interfaces
¶all
()Creates an iterable of all NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = vpc.network_interfaces.all()
Return type: | ec2.NetworkInterface |
---|---|
Returns: | A NetworkInterface resource |
filter
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection filtered by kwargs passed to method.
Request Syntax
network_interface_iterator = vpc.network_interfaces.filter(
DryRun=True|False,
NetworkInterfaceIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A NetworkInterface resource |
limit
(**kwargs)Creates an iterable up to a specified amount of NetworkInterface resources in the collection.
Request Syntax
network_interface_iterator = vpc.network_interfaces.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
page_size
(**kwargs)Creates an iterable of all NetworkInterface resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
network_interface_iterator = vpc.network_interfaces.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.NetworkInterface |
Returns: | A NetworkInterface resource |
requested_vpc_peering_connections
¶all
()Creates an iterable of all VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = vpc.requested_vpc_peering_connections.all()
Return type: | ec2.VpcPeeringConnection |
---|---|
Returns: | A VpcPeeringConnection resource |
filter
(**kwargs)Creates an iterable of all VpcPeeringConnection resources in the collection filtered by kwargs passed to method.
Request Syntax
vpc_peering_connection_iterator = vpc.requested_vpc_peering_connections.filter(
DryRun=True|False,
VpcPeeringConnectionIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A VpcPeeringConnection resource |
limit
(**kwargs)Creates an iterable up to a specified amount of VpcPeeringConnection resources in the collection.
Request Syntax
vpc_peering_connection_iterator = vpc.requested_vpc_peering_connections.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
page_size
(**kwargs)Creates an iterable of all VpcPeeringConnection resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
vpc_peering_connection_iterator = vpc.requested_vpc_peering_connections.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.VpcPeeringConnection |
Returns: | A VpcPeeringConnection resource |
route_tables
¶all
()Creates an iterable of all RouteTable resources in the collection.
Request Syntax
route_table_iterator = vpc.route_tables.all()
Return type: | ec2.RouteTable |
---|---|
Returns: | A RouteTable resource |
filter
(**kwargs)Creates an iterable of all RouteTable resources in the collection filtered by kwargs passed to method.
Request Syntax
route_table_iterator = vpc.route_tables.filter(
DryRun=True|False,
RouteTableIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A RouteTable resource |
limit
(**kwargs)Creates an iterable up to a specified amount of RouteTable resources in the collection.
Request Syntax
route_table_iterator = vpc.route_tables.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.RouteTable |
Returns: | A RouteTable resource |
page_size
(**kwargs)Creates an iterable of all RouteTable resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
route_table_iterator = vpc.route_tables.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.RouteTable |
Returns: | A RouteTable resource |
security_groups
¶all
()Creates an iterable of all SecurityGroup resources in the collection.
Request Syntax
security_group_iterator = vpc.security_groups.all()
Return type: | ec2.SecurityGroup |
---|---|
Returns: | A SecurityGroup resource |
filter
(**kwargs)Creates an iterable of all SecurityGroup resources in the collection filtered by kwargs passed to method.
Request Syntax
security_group_iterator = vpc.security_groups.filter(
DryRun=True|False,
GroupNames=[
'string',
],
GroupIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A SecurityGroup resource |
limit
(**kwargs)Creates an iterable up to a specified amount of SecurityGroup resources in the collection.
Request Syntax
security_group_iterator = vpc.security_groups.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.SecurityGroup |
Returns: | A SecurityGroup resource |
page_size
(**kwargs)Creates an iterable of all SecurityGroup resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
security_group_iterator = vpc.security_groups.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.SecurityGroup |
Returns: | A SecurityGroup resource |
subnets
¶all
()Creates an iterable of all Subnet resources in the collection.
Request Syntax
subnet_iterator = vpc.subnets.all()
Return type: | ec2.Subnet |
---|---|
Returns: | A Subnet resource |
filter
(**kwargs)Creates an iterable of all Subnet resources in the collection filtered by kwargs passed to method.
Request Syntax
subnet_iterator = vpc.subnets.filter(
DryRun=True|False,
SubnetIds=[
'string',
],
)
Parameters: |
|
---|---|
Return type: |
|
Returns: | A Subnet resource |
limit
(**kwargs)Creates an iterable up to a specified amount of Subnet resources in the collection.
Request Syntax
subnet_iterator = vpc.subnets.limit(
count=123
)
Parameters: | count (integer) -- The limit to the number of resources in the iterable. |
---|---|
Return type: | ec2.Subnet |
Returns: | A Subnet resource |
page_size
(**kwargs)Creates an iterable of all Subnet resources in the collection, but limits the number of items returned by each service call by the specified amount.
Request Syntax
subnet_iterator = vpc.subnets.page_size(
count=123
)
Parameters: | count (integer) -- The number of items returned by each service call |
---|---|
Return type: | ec2.Subnet |
Returns: | A Subnet resource |
EC2.
VpcPeeringConnection
(id)¶A resource representing an Amazon Elastic Compute Cloud (EC2) VpcPeeringConnection:
import boto3
ec2 = boto3.resource('ec2')
vpc_peering_connection = ec2.VpcPeeringConnection('id')
Parameters: | id (string) -- The VpcPeeringConnection's id identifier. This must be set. |
---|
These are the resource's available identifiers:
These are the resource's available attributes:
These are the resource's available references:
These are the resource's available actions:
Identifiers
Identifiers are properties of a resource that are set upon instantation of the resource. For more information about identifiers refer to the Resources Introduction Guide.
id
¶(string) The VpcPeeringConnection's id identifier. This must be set.
Attributes
Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the load()
method.
For more information about attributes refer to the Resources Introduction Guide.
status
¶(dict)
The status of the VPC peering connection.
accepter_vpc_info
¶(dict)
The information of the peer VPC.
(list)
Any tags assigned to the resource.
vpc_peering_connection_id
¶(string)
The ID of the VPC peering connection.
requester_vpc_info
¶(dict)
The information of the requester VPC.
expiration_time
¶(datetime)
The time that an unaccepted VPC peering connection will expire.
References
References are related resource instances that have a belongs-to relationship. For more information about references refer to the Resources Introduction Guide.
accepter_vpc
¶(Vpc
) The related accepter_vpc if set, otherwise None
.
requester_vpc
¶(Vpc
) The related requester_vpc if set, otherwise None
.
Actions
Actions call operations on resources. They may automatically handle the passing in of arguments set from identifiers and some attributes. For more information about actions refer to the Resources Introduction Guide.
accept
(**kwargs)¶Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the pending-acceptance
state, and you must be the owner of the peer VPC. Use the DescribeVpcPeeringConnections
request to view your outstanding VPC peering connection requests.
Request Syntax
response = vpc_peering_connection.accept(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'VpcPeeringConnection': {
'AccepterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'ExpirationTime': datetime(2015, 1, 1),
'RequesterVpcInfo': {
'CidrBlock': 'string',
'OwnerId': 'string',
'VpcId': 'string'
},
'Status': {
'Code': 'initiating-request'|'pending-acceptance'|'active'|'deleted'|'rejected'|'failed'|'expired'|'provisioning'|'deleting',
'Message': 'string'
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'VpcPeeringConnectionId': 'string'
}
}
Response Structure
|
delete
(**kwargs)¶Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the peer VPC can delete the VPC peering connection if it's in the active
state. The owner of the requester VPC can delete a VPC peering connection in the pending-acceptance
state.
Request Syntax
response = vpc_peering_connection.delete(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Return': True|False
}
Response Structure
|
load
()¶Calls ec2.Client.describe_vpc_peering_connections()
to update the attributes of the VpcPeeringConnection resource
Request Syntax
vpc_peering_connection.load()
Returns: | None |
---|
reject
(**kwargs)¶Rejects a VPC peering connection request. The VPC peering connection must be in the pending-acceptance
state. Use the DescribeVpcPeeringConnections request to view your outstanding VPC peering connection requests. To delete an active VPC peering connection, or to delete a VPC peering connection request that you initiated, use DeleteVpcPeeringConnection .
Request Syntax
response = vpc_peering_connection.reject(
DryRun=True|False,
)
Parameters: | DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation . |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Return': True|False
}
Response Structure
|
reload
()¶Calls ec2.Client.describe_vpc_peering_connections()
to update the attributes of the VpcPeeringConnection resource
Request Syntax
vpc_peering_connection.reload()
Returns: | None |
---|