EC2

boto.ec2

This module provides an interface to the Elastic Compute Cloud (EC2) service from AWS.

boto.ec2.connect_to_region(region_name, **kw_params)

Given a valid region name, return a boto.ec2.connection.EC2Connection. Any additional parameters after the region_name are passed on to the connect method of the region object.

Type:str
Parameters:region_name – The name of the region to connect to.
Return type:boto.ec2.connection.EC2Connection or None
Returns:A connection to the given region, or None if an invalid region name is given
boto.ec2.get_region(region_name, **kw_params)

Find and return a boto.ec2.regioninfo.RegionInfo object given a region name.

Type:str
Param:The name of the region.
Return type:boto.ec2.regioninfo.RegionInfo
Returns:The RegionInfo object for the given region or None if an invalid region name is provided.
boto.ec2.regions(**kw_params)

Get all available regions for the EC2 service. You may pass any of the arguments accepted by the EC2Connection object’s constructor as keyword arguments and they will be passed along to the EC2Connection object.

Return type:list
Returns:A list of boto.ec2.regioninfo.RegionInfo

boto.ec2.address

class boto.ec2.address.Address(connection=None, public_ip=None, instance_id=None)

Represents an EC2 Elastic IP Address

Variables:
  • public_ip – The Elastic IP address.
  • instance_id – The instance the address is associated with (if any).
  • domain – Indicates whether the address is a EC2 address or a VPC address (standard|vpc).
  • allocation_id – The allocation ID for the address (VPC addresses only).
  • association_id – The association ID for the address (VPC addresses only).
  • network_interface_id – The network interface (if any) that the address is associated with (VPC addresses only).
  • network_interface_owner_id – The owner IID (VPC addresses only).
  • private_ip_address – The private IP address associated with the Elastic IP address (VPC addresses only).
associate(instance_id=None, network_interface_id=None, private_ip_address=None, allow_reassociation=False, dry_run=False)

Associate this Elastic IP address with a currently running instance. :see: boto.ec2.connection.EC2Connection.associate_address()

delete(dry_run=False)

Free up this Elastic IP address. :see: boto.ec2.connection.EC2Connection.release_address()

disassociate(dry_run=False)

Disassociate this Elastic IP address from a currently running instance. :see: boto.ec2.connection.EC2Connection.disassociate_address()

endElement(name, value, connection)
release(dry_run=False)

Free up this Elastic IP address. :see: boto.ec2.connection.EC2Connection.release_address()

boto.ec2.autoscale

See the Auto Scaling Reference.

boto.ec2.blockdevicemapping

class boto.ec2.blockdevicemapping.BlockDeviceMapping(connection=None)

Represents a collection of BlockDeviceTypes when creating ec2 instances.

Example: dev_sda1 = BlockDeviceType() dev_sda1.size = 100 # change root volume to 100GB instead of default bdm = BlockDeviceMapping() bdm[‘/dev/sda1’] = dev_sda1 reservation = image.run(..., block_device_map=bdm, ...)

Parameters:connection (boto.ec2.EC2Connection) – Optional connection.
autoscale_build_list_params(params, prefix='')
ec2_build_list_params(params, prefix='')
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.blockdevicemapping.BlockDeviceType(connection=None, ephemeral_name=None, no_device=False, volume_id=None, snapshot_id=None, status=None, attach_time=None, delete_on_termination=False, size=None, volume_type=None, iops=None, encrypted=None)

Represents parameters for a block device.

endElement(name, value, connection)
startElement(name, attrs, connection)
boto.ec2.blockdevicemapping.EBSBlockDeviceType

alias of BlockDeviceType

boto.ec2.buyreservation

class boto.ec2.buyreservation.BuyReservation
get(params)
get_instance_type(params)
get_quantity(params)
get_region(params)
get_zone(params)

boto.ec2.cloudwatch

See the CloudWatch Reference.

boto.ec2.connection

Represents a connection to the EC2 service.

class boto.ec2.connection.EC2Connection(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, host=None, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', api_version=None, security_token=None, validate_certs=True, profile_name=None)

Init method to create a new connection to EC2.

APIVersion = '2014-05-01'
DefaultRegionEndpoint = 'ec2.us-east-1.amazonaws.com'
DefaultRegionName = 'us-east-1'
ResponseError

alias of EC2ResponseError

allocate_address(domain=None, dry_run=False)

Allocate a new Elastic IP address and associate it with your account.

Parameters:
  • domain (string) – Optional string. If domain is set to “vpc” the address will be allocated to VPC . Will return address object with allocation_id.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.address.Address

Returns:

The newly allocated Address

assign_private_ip_addresses(network_interface_id=None, private_ip_addresses=None, secondary_private_ip_address_count=None, allow_reassignment=False, dry_run=False)

Assigns one or more secondary private IP addresses to a network interface in Amazon VPC.

Parameters:
  • network_interface_id (string) – The network interface to which the IP address will be assigned.
  • private_ip_addresses (list) – Assigns the specified IP addresses as secondary IP addresses to the network interface.
  • secondary_private_ip_address_count (int) – The number of secondary IP addresses to assign to the network interface. You cannot specify this parameter when also specifying private_ip_addresses.
  • allow_reassignment (bool) – Specifies whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

associate_address(instance_id=None, public_ip=None, allocation_id=None, network_interface_id=None, private_ip_address=None, allow_reassociation=False, dry_run=False)

Associate an Elastic IP address with a currently running instance. This requires one of public_ip or allocation_id depending on if you’re associating a VPC address or a plain EC2 address.

When using an Allocation ID, make sure to pass None for public_ip as EC2 expects a single parameter and if public_ip is passed boto will preference that instead of allocation_id.

Parameters:
  • instance_id (string) – The ID of the instance
  • public_ip (string) – The public IP address for EC2 based allocations.
  • allocation_id (string) – The allocation ID for a VPC-based elastic IP.
  • network_interface_id (string) – The network interface ID to which elastic IP is to be assigned to
  • private_ip_address (string) – The primary or secondary private IP address to associate with the Elastic IP address.
  • allow_reassociation (bool) – Specify this option to allow an Elastic IP address that is already associated with another network interface or instance to be re-associated with the specified instance or interface.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

associate_address_object(instance_id=None, public_ip=None, allocation_id=None, network_interface_id=None, private_ip_address=None, allow_reassociation=False, dry_run=False)

Associate an Elastic IP address with a currently running instance. This requires one of public_ip or allocation_id depending on if you’re associating a VPC address or a plain EC2 address.

When using an Allocation ID, make sure to pass None for public_ip as EC2 expects a single parameter and if public_ip is passed boto will preference that instead of allocation_id.

Parameters:
  • instance_id (string) – The ID of the instance
  • public_ip (string) – The public IP address for EC2 based allocations.
  • allocation_id (string) – The allocation ID for a VPC-based elastic IP.
  • network_interface_id (string) – The network interface ID to which elastic IP is to be assigned to
  • private_ip_address (string) – The primary or secondary private IP address to associate with the Elastic IP address.
  • allow_reassociation (bool) – Specify this option to allow an Elastic IP address that is already associated with another network interface or instance to be re-associated with the specified instance or interface.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

class:boto.ec2.address.Address

Returns:

The associated address instance

attach_network_interface(network_interface_id, instance_id, device_index, dry_run=False)

Attaches a network interface to an instance.

Parameters:
  • network_interface_id (str) – The ID of the network interface to attach.
  • instance_id (str) – The ID of the instance that will be attached to the network interface.
  • device_index (int) – The index of the device for the network interface attachment on the instance.
  • dry_run (bool) – Set to True if the operation should not actually run.
attach_volume(volume_id, instance_id, device, dry_run=False)

Attach an EBS volume to an EC2 instance.

Parameters:
  • volume_id (str) – The ID of the EBS volume to be attached.
  • instance_id (str) – The ID of the EC2 instance to which it will be attached.
  • device (str) – The device on the instance through which the volume will be exposted (e.g. /dev/sdh)
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

authorize_security_group(group_name=None, src_security_group_name=None, src_security_group_owner_id=None, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, group_id=None, src_security_group_group_id=None, dry_run=False)

Add a new rule to an existing security group. You need to pass in either src_security_group_name and src_security_group_owner_id OR ip_protocol, from_port, to_port, and cidr_ip. In other words, either you are authorizing another group or you are authorizing some ip-based rule.

Parameters:
  • group_name (string) – The name of the security group you are adding the rule to.
  • src_security_group_name (string) – The name of the security group you are granting access to.
  • src_security_group_owner_id (string) – The ID of the owner of the security group you are granting access to.
  • ip_protocol (string) – Either tcp | udp | icmp
  • from_port (int) – The beginning port number you are enabling
  • to_port (int) – The ending port number you are enabling
  • cidr_ip (string or list of strings) – The CIDR block you are providing access to. See http://goo.gl/Yj5QC
  • group_id (string) – ID of the EC2 or VPC security group to modify. This is required for VPC security groups and can be used instead of group_name for EC2 security groups.
  • src_security_group_group_id (string) – The ID of the security group you are granting access to. Can be used instead of src_security_group_name
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

authorize_security_group_deprecated(group_name, src_security_group_name=None, src_security_group_owner_id=None, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, dry_run=False)
NOTE: This method uses the old-style request parameters
that did not allow a port to be specified when authorizing a group.
Parameters:
  • group_name (string) – The name of the security group you are adding the rule to.
  • src_security_group_name (string) – The name of the security group you are granting access to.
  • src_security_group_owner_id (string) – The ID of the owner of the security group you are granting access to.
  • ip_protocol (string) – Either tcp | udp | icmp
  • from_port (int) – The beginning port number you are enabling
  • to_port (string) – The ending port number you are enabling
  • to_port – The CIDR block you are providing access to. See http://goo.gl/Yj5QC
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

authorize_security_group_egress(group_id, ip_protocol, from_port=None, to_port=None, src_group_id=None, cidr_ip=None, dry_run=False)

The action adds one or more egress rules to a VPC security group. Specifically, this action permits instances in a security group to send traffic to one or more destination CIDR IP address ranges, or to one or more destination security groups in the same VPC.

Parameters:dry_run (bool) – Set to True if the operation should not actually run.
build_configurations_param_list(params, target_configurations)
build_filter_params(params, filters)
build_tag_param_list(params, tags)
bundle_instance(instance_id, s3_bucket, s3_prefix, s3_upload_policy, dry_run=False)

Bundle Windows instance.

Parameters:
  • instance_id (string) – The instance id
  • s3_bucket (string) – The bucket in which the AMI should be stored.
  • s3_prefix (string) – The beginning of the file name for the AMI.
  • s3_upload_policy (string) – Base64 encoded policy that specifies condition and permissions for Amazon EC2 to upload the user’s image into Amazon S3.
  • dry_run (bool) – Set to True if the operation should not actually run.
cancel_bundle_task(bundle_id, dry_run=False)

Cancel a previously submitted bundle task

Parameters:
  • bundle_id (string) – The identifier of the bundle task to cancel.
  • dry_run (bool) – Set to True if the operation should not actually run.
cancel_reserved_instances_listing(reserved_instances_listing_ids=None, dry_run=False)

Cancels the specified Reserved Instance listing.

Parameters:
  • reserved_instances_listing_ids (List of strings) – The ID of the Reserved Instance listing to be cancelled.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.reservedinstance.ReservedInstanceListing

cancel_spot_instance_requests(request_ids, dry_run=False)

Cancel the specified Spot Instance Requests.

Parameters:
  • request_ids (list) – A list of strings of the Request IDs to terminate
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of the instances terminated

confirm_product_instance(product_code, instance_id, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
copy_image(source_region, source_image_id, name=None, description=None, client_token=None, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
Return type:boto.ec2.image.CopyImage
Returns:Object containing the image_id of the copied image.
copy_snapshot(source_region, source_snapshot_id, description=None, dry_run=False)

Copies a point-in-time snapshot of an Amazon Elastic Block Store (Amazon EBS) volume and stores it in Amazon Simple Storage Service (Amazon S3). You can copy the snapshot within the same region or from one region to another. You can use the snapshot to create new Amazon EBS volumes or Amazon Machine Images (AMIs).

Parameters:
  • source_region (str) – The ID of the AWS region that contains the snapshot to be copied (e.g ‘us-east-1’, ‘us-west-2’, etc.).
  • source_snapshot_id (str) – The ID of the Amazon EBS snapshot to copy
  • description (str) – A description of the new Amazon EBS snapshot.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

str

Returns:

The snapshot ID

create_image(instance_id, name, description=None, no_reboot=False, block_device_mapping=None, dry_run=False)

Will create an AMI from the instance in the running or stopped state.

Parameters:
  • instance_id (string) – the ID of the instance to image.
  • name (string) – The name of the new image
  • description (string) – An optional human-readable string describing the contents and purpose of the AMI.
  • no_reboot (bool) – An optional flag indicating that the bundling process should not attempt to shutdown the instance before bundling. If this flag is True, the responsibility of maintaining file system integrity is left to the owner of the instance.
  • block_device_mapping (boto.ec2.blockdevicemapping.BlockDeviceMapping) – A BlockDeviceMapping data structure describing the EBS volumes associated with the Image.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

string

Returns:

The new image id

create_key_pair(key_name, dry_run=False)

Create a new key pair for your account. This will create the key pair within the region you are currently connected to.

Parameters:
  • key_name (string) – The name of the new keypair
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.keypair.KeyPair

Returns:

The newly created boto.ec2.keypair.KeyPair. The material attribute of the new KeyPair object will contain the the unencrypted PEM encoded RSA private key.

create_network_interface(subnet_id, private_ip_address=None, description=None, groups=None, dry_run=False)

Creates a network interface in the specified subnet.

Parameters:
  • subnet_id (str) – The ID of the subnet to associate with the network interface.
  • private_ip_address (str) – The private IP address of the network interface. If not supplied, one will be chosen for you.
  • description (str) – The description of the network interface.
  • groups (list) – Lists the groups for use by the network interface. This can be either a list of group ID’s or a list of boto.ec2.securitygroup.SecurityGroup objects.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.networkinterface.NetworkInterface

Returns:

The newly created network interface.

create_placement_group(name, strategy='cluster', dry_run=False)

Create a new placement group for your account. This will create the placement group within the region you are currently connected to.

Parameters:
  • name (string) – The name of the new placement group
  • strategy (string) – The placement strategy of the new placement group. Currently, the only acceptable value is “cluster”.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

create_reserved_instances_listing(reserved_instances_id, instance_count, price_schedules, client_token, dry_run=False)

Creates a new listing for Reserved Instances.

Creates a new listing for Amazon EC2 Reserved Instances that will be sold in the Reserved Instance Marketplace. You can submit one Reserved Instance listing at a time.

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.

If you want 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 you want to receive for them. Your Reserved Instance listings then become available for purchase.

Parameters:
  • reserved_instances_id (string) – The ID of the Reserved Instance that will be listed.
  • instance_count (int) – The number of instances that are a part of a Reserved Instance account that will be listed in the Reserved Instance Marketplace. This number should be less than or equal to the instance count associated with the Reserved Instance ID specified in this call.
  • price_schedules (List of tuples) –

    A list specifying the price of the Reserved Instance for each month remaining in the Reserved Instance term. Each tuple contains two elements, the price and the term. For example, for an instance that 11 months remaining in its term, we can have a price schedule with an upfront price of $2.50. At 8 months remaining we can drop the price down to $2.00. This would be expressed as:

    price_schedules=[('2.50', 11), ('2.00', 8)]
    
  • client_token (string) – Unique, case-sensitive identifier you provide to ensure idempotency of the request. Maximum 64 ASCII characters.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.reservedinstance.ReservedInstanceListing

create_security_group(name, description, vpc_id=None, dry_run=False)

Create a new security group for your account. This will create the security group within the region you are currently connected to.

Parameters:
  • name (string) – The name of the new security group
  • description (string) – The description of the new security group
  • vpc_id (string) – The ID of the VPC to create the security group in, if any.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.securitygroup.SecurityGroup

Returns:

The newly created boto.ec2.securitygroup.SecurityGroup.

create_snapshot(volume_id, description=None, dry_run=False)

Create a snapshot of an existing EBS Volume.

Parameters:
  • volume_id (str) – The ID of the volume to be snapshot’ed
  • description (str) – A description of the snapshot. Limited to 255 characters.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.snapshot.Snapshot

Returns:

The created Snapshot object

create_spot_datafeed_subscription(bucket, prefix, dry_run=False)

Create a spot instance datafeed subscription for this account.

Parameters:
  • bucket (str or unicode) – The name of the bucket where spot instance data will be written. The account issuing this request must have FULL_CONTROL access to the bucket specified in the request.
  • prefix (str or unicode) – An optional prefix that will be pre-pended to all data files written to the bucket.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription

Returns:

The datafeed subscription object or None

create_tags(resource_ids, tags, dry_run=False)

Create new metadata tags for the specified resource ids.

Parameters:
  • resource_ids (list) – List of strings
  • tags (dict) – A dictionary containing the name/value pairs. If you want to create only a tag name, the value for that tag should be the empty string (e.g. ‘’).
  • dry_run (bool) – Set to True if the operation should not actually run.
create_volume(size, zone, snapshot=None, volume_type=None, iops=None, encrypted=False, dry_run=False)

Create a new EBS Volume.

Parameters:
  • size (int) – The size of the new volume, in GiB
  • zone (string or boto.ec2.zone.Zone) – The availability zone in which the Volume will be created.
  • snapshot (string or boto.ec2.snapshot.Snapshot) – The snapshot from which the new Volume will be created.
  • volume_type (string) – The type of the volume. (optional). Valid values are: standard | io1 | gp2.
  • iops (int) – The provisioned IOPS you want to associate with this volume. (optional)
  • encrypted (bool) – Specifies whether the volume should be encrypted. (optional)
  • dry_run (bool) – Set to True if the operation should not actually run.
delete_key_pair(key_name, dry_run=False)

Delete a key pair from your account.

Parameters:
  • key_name (string) – The name of the keypair to delete
  • dry_run (bool) – Set to True if the operation should not actually run.
delete_network_interface(network_interface_id, dry_run=False)

Delete the specified network interface.

Parameters:
  • network_interface_id (str) – The ID of the network interface to delete.
  • dry_run (bool) – Set to True if the operation should not actually run.
delete_placement_group(name, dry_run=False)

Delete a placement group from your account.

Parameters:
  • key_name (string) – The name of the keypair to delete
  • dry_run (bool) – Set to True if the operation should not actually run.
delete_security_group(name=None, group_id=None, dry_run=False)

Delete a security group from your account.

Parameters:
  • name (string) – The name of the security group to delete.
  • group_id (string) – The ID of the security group to delete within a VPC.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

delete_snapshot(snapshot_id, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
delete_spot_datafeed_subscription(dry_run=False)

Delete the current spot instance data feed subscription associated with this account

Parameters:dry_run (bool) – Set to True if the operation should not actually run.
Return type:bool
Returns:True if successful
delete_tags(resource_ids, tags, dry_run=False)

Delete metadata tags for the specified resource ids.

Parameters:
  • resource_ids (list) – List of strings
  • tags (dict or list) – Either a dictionary containing name/value pairs or a list containing just tag names. If you pass in a dictionary, the values must match the actual tag values or the tag will not be deleted. If you pass in a value of None for the tag value, all tags with that name will be deleted.
  • dry_run (bool) – Set to True if the operation should not actually run.
delete_volume(volume_id, dry_run=False)

Delete an EBS volume.

Parameters:
  • volume_id (str) – The ID of the volume to be delete.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

deregister_image(image_id, delete_snapshot=False, dry_run=False)

Unregister an AMI.

Parameters:
  • image_id (string) – the ID of the Image to unregister
  • delete_snapshot (bool) – Set to True if we should delete the snapshot associated with an EBS volume mounted at /dev/sda1
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

describe_account_attributes(attribute_names=None, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
describe_reserved_instances_modifications(reserved_instances_modification_ids=None, next_token=None, filters=None)

A request to describe the modifications made to Reserved Instances in your account.

Parameters:
  • reserved_instances_modification_ids (list) – An optional list of Reserved Instances modification IDs to describe.
  • next_token (str) – A string specifying the next paginated set of results to return.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
Return type:

list

Returns:

A list of boto.ec2.reservedinstance.ReservedInstance

describe_vpc_attribute(vpc_id, attribute=None, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
detach_network_interface(attachment_id, force=False, dry_run=False)

Detaches a network interface from an instance.

Parameters:
  • attachment_id (str) – The ID of the attachment.
  • force (bool) – Set to true to force a detachment.
  • dry_run (bool) – Set to True if the operation should not actually run.
detach_volume(volume_id, instance_id=None, device=None, force=False, dry_run=False)

Detach an EBS volume from an EC2 instance.

Parameters:
  • volume_id (str) – The ID of the EBS volume to be attached.
  • instance_id (str) – The ID of the EC2 instance from which it will be detached.
  • device (str) – The device on the instance through which the volume is exposted (e.g. /dev/sdh)
  • force (bool) – Forces detachment if the previous detachment attempt did not occur cleanly. This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

disassociate_address(public_ip=None, association_id=None, dry_run=False)

Disassociate an Elastic IP address from a currently running instance.

Parameters:
  • public_ip (string) – The public IP address for EC2 elastic IPs.
  • association_id (string) – The association ID for a VPC based elastic ip.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

enable_volume_io(volume_id, dry_run=False)

Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially inconsistent.

Parameters:
  • volume_id (str) – The ID of the volume.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

get_all_addresses(addresses=None, filters=None, allocation_ids=None, dry_run=False)

Get all EIP’s associated with the current credentials.

Parameters:
  • addresses (list) – Optional list of addresses. If this list is present, only the Addresses associated with these addresses will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • allocation_ids (list) – Optional list of allocation IDs. If this list is present, only the Addresses associated with the given allocation IDs will be returned.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.address.Address

Returns:

The requested Address objects

get_all_bundle_tasks(bundle_ids=None, filters=None, dry_run=False)

Retrieve current bundling tasks. If no bundle id is specified, all tasks are retrieved.

Parameters:
  • bundle_ids (list) – A list of strings containing identifiers for previously created bundling tasks.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
get_all_images(image_ids=None, owners=None, executable_by=None, filters=None, dry_run=False)

Retrieve all the EC2 images available on your account.

Parameters:
  • image_ids (list) – A list of strings with the image IDs wanted
  • owners (list) – A list of owner IDs, the special strings ‘self’, ‘amazon’, and ‘aws-marketplace’, may be used to describe images owned by you, Amazon or AWS Marketplace respectively
  • executable_by (list) – Returns AMIs for which the specified user ID has explicit launch permissions
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.image.Image

get_all_instance_status(instance_ids=None, max_results=None, next_token=None, filters=None, dry_run=False, include_all_instances=False)

Retrieve all the instances in your account scheduled for maintenance.

Parameters:
  • instance_ids (list) – A list of strings of instance IDs
  • max_results (int) – The maximum number of paginated instance items per response.
  • next_token (str) – A string specifying the next paginated set of results to return.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • include_all_instances (bool) – Set to True if all instances should be returned. (Only running instances are included by default.)
Return type:

list

Returns:

A list of instances that have maintenance scheduled.

get_all_instance_types()

Get all instance_types available on this cloud (eucalyptus specific)

Return type:list of boto.ec2.instancetype.InstanceType
Returns:The requested InstanceType objects
get_all_instances(instance_ids=None, filters=None, dry_run=False, max_results=None)

Retrieve all the instance reservations associated with your account.

This method’s current behavior is deprecated in favor of get_all_reservations(). A future major release will change get_all_instances() to return a list of boto.ec2.instance.Instance objects as its name suggests. To obtain that behavior today, use get_only_instances().

Parameters:
  • instance_ids (list) – A list of strings of instance IDs
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • max_results (int) – The maximum number of paginated instance items per response.
Return type:

list

Returns:

A list of boto.ec2.instance.Reservation

get_all_kernels(kernel_ids=None, owners=None, dry_run=False)

Retrieve all the EC2 kernels available on your account. Constructs a filter to allow the processing to happen server side.

Parameters:
  • kernel_ids (list) – A list of strings with the image IDs wanted
  • owners (list) – A list of owner IDs
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.image.Image

get_all_key_pairs(keynames=None, filters=None, dry_run=False)

Get all key pairs associated with your account.

Parameters:
  • keynames (list) – A list of the names of keypairs to retrieve. If not provided, all key pairs will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.keypair.KeyPair

get_all_network_interfaces(network_interface_ids=None, filters=None, dry_run=False)

Retrieve all of the Elastic Network Interfaces (ENI’s) associated with your account.

Parameters:
  • network_interface_ids (list) – a list of strings representing ENI IDs
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.networkinterface.NetworkInterface

get_all_placement_groups(groupnames=None, filters=None, dry_run=False)

Get all placement groups associated with your account in a region.

Parameters:
  • groupnames (list) – A list of the names of placement groups to retrieve. If not provided, all placement groups will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.placementgroup.PlacementGroup

get_all_ramdisks(ramdisk_ids=None, owners=None, dry_run=False)

Retrieve all the EC2 ramdisks available on your account. Constructs a filter to allow the processing to happen server side.

Parameters:
  • ramdisk_ids (list) – A list of strings with the image IDs wanted
  • owners (list) – A list of owner IDs
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.image.Image

get_all_regions(region_names=None, filters=None, dry_run=False)

Get all available regions for the EC2 service.

Parameters:
  • region_names (list of str) – Names of regions to limit output
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.regioninfo.RegionInfo

get_all_reservations(instance_ids=None, filters=None, dry_run=False, max_results=None, next_token=None)

Retrieve all the instance reservations associated with your account.

Parameters:
  • instance_ids (list) – A list of strings of instance IDs
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • max_results (int) – The maximum number of paginated instance items per response.
  • next_token (str) – A string specifying the next paginated set of results to return.
Return type:

list

Returns:

A list of boto.ec2.instance.Reservation

get_all_reserved_instances(reserved_instances_id=None, filters=None, dry_run=False)

Describes one or more of the Reserved Instances that you purchased.

Parameters:
  • reserved_instance_ids (list) – A list of the reserved instance ids that will be returned. If not provided, all reserved instances will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.reservedinstance.ReservedInstance

get_all_reserved_instances_offerings(reserved_instances_offering_ids=None, instance_type=None, availability_zone=None, product_description=None, filters=None, instance_tenancy=None, offering_type=None, include_marketplace=None, min_duration=None, max_duration=None, max_instance_count=None, next_token=None, max_results=None, dry_run=False)

Describes Reserved Instance offerings that are available for purchase.

Parameters:
  • reserved_instances_id – One or more Reserved Instances offering IDs.
  • instance_type (str) – Displays Reserved Instances of the specified instance type.
  • availability_zone (str) – Displays Reserved Instances within the specified Availability Zone.
  • product_description (str) – Displays Reserved Instances with the specified product description.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • instance_tenancy (string) – The tenancy of the Reserved Instance offering. A Reserved Instance with tenancy of dedicated will run on single-tenant hardware and can only be launched within a VPC.
  • offering_type (string) – The Reserved Instance offering type. Valid Values: “Heavy Utilization” | “Medium Utilization” | “Light Utilization”
  • include_marketplace (bool) – Include Marketplace offerings in the response.
  • max_duration (int) – Maximum duration (in seconds) to filter when searching for offerings.
  • max_instance_count (int) – Maximum number of instances to filter when searching for offerings.
  • next_token (string) – Token to use when requesting the next paginated set of offerings.
  • max_results (int) – Maximum number of offerings to return per call.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.reservedinstance.ReservedInstancesOffering.

get_all_security_groups(groupnames=None, group_ids=None, filters=None, dry_run=False)

Get all security groups associated with your account in a region.

Parameters:
  • groupnames (list) – A list of the names of security groups to retrieve. If not provided, all security groups will be returned.
  • group_ids (list) – A list of IDs of security groups to retrieve for security groups within a VPC.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.securitygroup.SecurityGroup

get_all_snapshots(snapshot_ids=None, owner=None, restorable_by=None, filters=None, dry_run=False)

Get all EBS Snapshots associated with the current credentials.

Parameters:
  • snapshot_ids (list) – Optional list of snapshot ids. If this list is present, only the Snapshots associated with these snapshot ids will be returned.
  • owner (str or list) –

    If present, only the snapshots owned by the specified user(s) will be returned. Valid values are:

    • self
    • amazon
    • AWS Account ID
  • restorable_by (str or list) – If present, only the snapshots that are restorable by the specified account id(s) will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.snapshot.Snapshot

Returns:

The requested Snapshot objects

get_all_spot_instance_requests(request_ids=None, filters=None, dry_run=False)

Retrieve all the spot instances requests associated with your account.

Parameters:
  • request_ids (list) – A list of strings of spot instance request IDs
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.spotinstancerequest.SpotInstanceRequest

get_all_tags(filters=None, dry_run=False, max_results=None)

Retrieve all the metadata tags associated with your account.

Parameters:
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • max_results (int) – The maximum number of paginated instance items per response.
Return type:

list

Returns:

A list of boto.ec2.tag.Tag objects

get_all_volume_status(volume_ids=None, max_results=None, next_token=None, filters=None, dry_run=False)

Retrieve the status of one or more volumes.

Parameters:
  • volume_ids (list) – A list of strings of volume IDs
  • max_results (int) – The maximum number of paginated instance items per response.
  • next_token (str) – A string specifying the next paginated set of results to return.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of volume status.

get_all_volumes(volume_ids=None, filters=None, dry_run=False)

Get all Volumes associated with the current credentials.

Parameters:
  • volume_ids (list) – Optional list of volume ids. If this list is present, only the volumes associated with these volume ids will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.volume.Volume

Returns:

The requested Volume objects

get_all_zones(zones=None, filters=None, dry_run=False)

Get all Availability Zones associated with the current region.

Parameters:
  • zones (list) – Optional list of zones. If this list is present, only the Zones associated with these zone names will be returned.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.zone.Zone

Returns:

The requested Zone objects

get_console_output(instance_id, dry_run=False)

Retrieves the console output for the specified instance.

Parameters:
  • instance_id (string) – The instance ID of a running instance on the cloud.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.instance.ConsoleOutput

Returns:

The console output as a ConsoleOutput object

get_image(image_id, dry_run=False)

Shortcut method to retrieve a specific image (AMI).

Parameters:
  • image_id (string) – the ID of the Image to retrieve
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.image.Image

Returns:

The EC2 Image specified or None if the image is not found

get_image_attribute(image_id, attribute='launchPermission', dry_run=False)

Gets an attribute from an image.

Parameters:
  • image_id (string) – The Amazon image id for which you want info about
  • attribute (string) – The attribute you need information about. Valid choices are: * launchPermission * productCodes * blockDeviceMapping
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.image.ImageAttribute

Returns:

An ImageAttribute object representing the value of the attribute requested

get_instance_attribute(instance_id, attribute, dry_run=False)

Gets an attribute from an instance.

Parameters:
  • instance_id (string) – The Amazon id of the instance
  • attribute (string) –

    The attribute you need information about Valid choices are:

    • instanceType
    • kernel
    • ramdisk
    • userData
    • disableApiTermination
    • instanceInitiatedShutdownBehavior
    • rootDeviceName
    • blockDeviceMapping
    • productCodes
    • sourceDestCheck
    • groupSet
    • ebsOptimized
    • sriovNetSupport
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.image.InstanceAttribute

Returns:

An InstanceAttribute object representing the value of the attribute requested

get_key_pair(keyname, dry_run=False)

Convenience method to retrieve a specific keypair (KeyPair).

Parameters:
  • keyname (string) – The name of the keypair to retrieve
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.keypair.KeyPair

Returns:

The KeyPair specified or None if it is not found

get_only_instances(instance_ids=None, filters=None, dry_run=False, max_results=None)

Retrieve all the instances associated with your account.

Parameters:
  • instance_ids (list) – A list of strings of instance IDs
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • max_results (int) – The maximum number of paginated instance items per response.
Return type:

list

Returns:

A list of boto.ec2.instance.Instance

get_params()

Returns a dictionary containing the value of all of the keyword arguments passed when constructing this connection.

get_password_data(instance_id, dry_run=False)

Get encrypted administrator password for a Windows instance.

Parameters:
  • instance_id (string) – The identifier of the instance to retrieve the password for.
  • dry_run (bool) – Set to True if the operation should not actually run.
get_snapshot_attribute(snapshot_id, attribute='createVolumePermission', dry_run=False)

Get information about an attribute of a snapshot. Only one attribute can be specified per call.

Parameters:
  • snapshot_id (str) – The ID of the snapshot.
  • attribute (str) –

    The requested attribute. Valid values are:

    • createVolumePermission
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.snapshotattribute.SnapshotAttribute

Returns:

The requested Snapshot attribute

get_spot_datafeed_subscription(dry_run=False)

Return the current spot instance data feed subscription associated with this account, if any.

Parameters:dry_run (bool) – Set to True if the operation should not actually run.
Return type:boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription
Returns:The datafeed subscription object or None
get_spot_price_history(start_time=None, end_time=None, instance_type=None, product_description=None, availability_zone=None, dry_run=False, max_results=None, next_token=None, filters=None)

Retrieve the recent history of spot instances pricing.

Parameters:
  • start_time (str) – An indication of how far back to provide price changes for. An ISO8601 DateTime string.
  • end_time (str) – An indication of how far forward to provide price changes for. An ISO8601 DateTime string.
  • instance_type (str) – Filter responses to a particular instance type.
  • product_description (str) –

    Filter responses to a particular platform. Valid values are currently:

    • Linux/UNIX
    • SUSE Linux
    • Windows
    • Linux/UNIX (Amazon VPC)
    • SUSE Linux (Amazon VPC)
    • Windows (Amazon VPC)
  • availability_zone (str) – The availability zone for which prices should be returned. If not specified, data for all availability zones will be returned.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • max_results (int) – The maximum number of paginated items per response.
  • next_token (str) – The next set of rows to return. This should be the value of the next_token attribute from a previous call to get_spot_price_history.
  • filters (dict) – Optional filters that can be used to limit the results returned. Filters are provided in the form of a dictionary consisting of filter names as the key and filter values as the value. The set of allowable filter names/values is dependent on the request being performed. Check the EC2 API guide for details.
Return type:

list

Returns:

A list tuples containing price and timestamp.

get_volume_attribute(volume_id, attribute='autoEnableIO', dry_run=False)

Describes attribute of the volume.

Parameters:
  • volume_id (str) – The ID of the volume.
  • attribute (str) –

    The requested attribute. Valid values are:

    • autoEnableIO
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list of boto.ec2.volume.VolumeAttribute

Returns:

The requested Volume attribute

import_key_pair(key_name, public_key_material, dry_run=False)

imports the public key from an RSA key pair that you created with a third-party tool.

Supported formats:

  • OpenSSH public key format (e.g., the format in ~/.ssh/authorized_keys)
  • Base64 encoded DER format
  • SSH public key file format as specified in RFC4716

DSA keys are not supported. Make sure your key generator is set up to create RSA keys.

Supported lengths: 1024, 2048, and 4096.

Parameters:
  • key_name (string) – The name of the new keypair
  • public_key_material (string) – The public key. You must base64 encode the public key material before sending it to AWS.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.keypair.KeyPair

Returns:

A boto.ec2.keypair.KeyPair object representing the newly imported key pair. This object will contain only the key name and the fingerprint.

modify_image_attribute(image_id, attribute='launchPermission', operation='add', user_ids=None, groups=None, product_codes=None, dry_run=False)

Changes an attribute of an image.

Parameters:
  • image_id (string) – The image id you wish to change
  • attribute (string) – The attribute you wish to change
  • operation (string) – Either add or remove (this is required for changing launchPermissions)
  • user_ids (list) – The Amazon IDs of users to add/remove attributes
  • groups (list) – The groups to add/remove attributes
  • product_codes (list) – Amazon DevPay product code. Currently only one product code can be associated with an AMI. Once set, the product code cannot be changed or reset.
  • dry_run (bool) – Set to True if the operation should not actually run.
modify_instance_attribute(instance_id, attribute, value, dry_run=False)

Changes an attribute of an instance

Parameters:
  • instance_id (string) – The instance id you wish to change
  • attribute (string) –

    The attribute you wish to change.

    • instanceType - A valid instance type (m1.small)
    • kernel - Kernel ID (None)
    • ramdisk - Ramdisk ID (None)
    • userData - Base64 encoded String (None)
    • disableApiTermination - Boolean (true)
    • instanceInitiatedShutdownBehavior - stop|terminate
    • blockDeviceMapping - List of strings - ie: [‘/dev/sda=false’]
    • sourceDestCheck - Boolean (true)
    • groupSet - Set of Security Groups or IDs
    • ebsOptimized - Boolean (false)
    • sriovNetSupport - String - ie: ‘simple’
  • value (string) – The new value for the attribute
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

Whether the operation succeeded or not

modify_network_interface_attribute(interface_id, attr, value, attachment_id=None, dry_run=False)

Changes an attribute of a network interface.

Parameters:
  • interface_id (string) – The interface id. Looks like ‘eni-xxxxxxxx’
  • attr (string) –

    The attribute you wish to change.

    Learn more at http://docs.aws.amazon.com/AWSEC2/latest/API Reference/ApiReference-query-ModifyNetworkInterfaceAttribute.html

    • description - Textual description of interface
    • groupSet - List of security group ids or group objects
    • sourceDestCheck - Boolean
    • deleteOnTermination - Boolean. Must also specify attachment_id
  • value (string) – The new value for the attribute
  • attachment_id (string) – If you’re modifying DeleteOnTermination you must specify the attachment_id.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

Whether the operation succeeded or not

modify_reserved_instances(client_token, reserved_instance_ids, target_configurations)

Modifies the specified Reserved Instances.

Parameters:
  • client_token (string) – A unique, case-sensitive, token you provide to ensure idempotency of your modification request.
  • reserved_instance_ids (List of strings) – The IDs of the Reserved Instances to modify.
  • target_configurations (List of boto.ec2.reservedinstance.ReservedInstancesConfiguration) – The configuration settings for the modified Reserved Instances.
Return type:

string

Returns:

The unique ID for the submitted modification request.

modify_snapshot_attribute(snapshot_id, attribute='createVolumePermission', operation='add', user_ids=None, groups=None, dry_run=False)

Changes an attribute of an image.

Parameters:
  • snapshot_id (string) – The snapshot id you wish to change
  • attribute (string) – The attribute you wish to change. Valid values are: createVolumePermission
  • operation (string) – Either add or remove (this is required for changing snapshot ermissions)
  • user_ids (list) – The Amazon IDs of users to add/remove attributes
  • groups (list) – The groups to add/remove attributes. The only valid value at this time is ‘all’.
  • dry_run (bool) – Set to True if the operation should not actually run.
modify_volume_attribute(volume_id, attribute, new_value, dry_run=False)

Changes an attribute of an Volume.

Parameters:
  • volume_id (string) – The volume id you wish to change
  • attribute (string) – The attribute you wish to change. Valid values are: AutoEnableIO.
  • new_value (string) – The new value of the attribute.
  • dry_run (bool) – Set to True if the operation should not actually run.
modify_vpc_attribute(vpc_id, enable_dns_support=None, enable_dns_hostnames=None, dry_run=False)
Parameters:dry_run (bool) – Set to True if the operation should not actually run.
monitor_instance(instance_id, dry_run=False)

Deprecated Version, maintained for backward compatibility. Enable detailed CloudWatch monitoring for the supplied instance.

Parameters:
  • instance_id (string) – The instance id
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.instanceinfo.InstanceInfo

monitor_instances(instance_ids, dry_run=False)

Enable detailed CloudWatch monitoring for the supplied instances.

Parameters:
  • instance_id (list of strings) – The instance ids
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.instanceinfo.InstanceInfo

purchase_reserved_instance_offering(reserved_instances_offering_id, instance_count=1, limit_price=None, dry_run=False)

Purchase a Reserved Instance for use with your account. ** CAUTION ** This request can result in large amounts of money being charged to your AWS account. Use with caution!

Parameters:
  • reserved_instances_offering_id (string) – The offering ID of the Reserved Instance to purchase
  • instance_count (int) – The number of Reserved Instances to purchase. Default value is 1.
  • instance_count – Limit the price on the total order. Must be a tuple of (amount, currency_code), for example: (100.0, ‘USD’).
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

boto.ec2.reservedinstance.ReservedInstance

Returns:

The newly created Reserved Instance

reboot_instances(instance_ids=None, dry_run=False)

Reboot the specified instances.

Parameters:
  • instance_ids (list) – The instances to terminate and reboot
  • dry_run (bool) – Set to True if the operation should not actually run.
register_image(name=None, description=None, image_location=None, architecture=None, kernel_id=None, ramdisk_id=None, root_device_name=None, block_device_map=None, dry_run=False, virtualization_type=None, sriov_net_support=None, snapshot_id=None, delete_root_volume_on_termination=False)

Register an image.

Parameters:
  • name (string) – The name of the AMI. Valid only for EBS-based images.
  • description (string) – The description of the AMI.
  • image_location (string) – Full path to your AMI manifest in Amazon S3 storage. Only used for S3-based AMI’s.
  • architecture (string) – The architecture of the AMI. Valid choices are: * i386 * x86_64
  • kernel_id (string) – The ID of the kernel with which to launch the instances
  • root_device_name (string) – The root device name (e.g. /dev/sdh)
  • block_device_map (boto.ec2.blockdevicemapping.BlockDeviceMapping) – A BlockDeviceMapping data structure describing the EBS volumes associated with the Image.
  • dry_run (bool) – Set to True if the operation should not actually run.
  • virtualization_type (string) – The virutalization_type of the image. Valid choices are: * paravirtual * hvm
  • sriov_net_support (string) – Advanced networking support. Valid choices are: * simple
  • snapshot_id (string) – A snapshot ID for the snapshot to be used as root device for the image. Mutually exclusive with block_device_map, requires root_device_name
  • delete_root_volume_on_termination (bool) – Whether to delete the root volume of the image after instance termination. Only applies when creating image from snapshot_id. Defaults to False. Note that leaving volumes behind after instance termination is not free.
Return type:

string

Returns:

The new image id

release_address(public_ip=None, allocation_id=None, dry_run=False)

Free up an Elastic IP address. Pass a public IP address to release an EC2 Elastic IP address and an AllocationId to release a VPC Elastic IP address. You should only pass one value.

This requires one of public_ip or allocation_id depending on if you’re associating a VPC address or a plain EC2 address.

When using an Allocation ID, make sure to pass None for public_ip as EC2 expects a single parameter and if public_ip is passed boto will preference that instead of allocation_id.

Parameters:
  • public_ip (string) – The public IP address for EC2 elastic IPs.
  • allocation_id (string) – The Allocation ID for VPC elastic IPs.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

request_spot_instances(price, image_id, count=1, type='one-time', valid_from=None, valid_until=None, launch_group=None, availability_zone_group=None, key_name=None, security_groups=None, user_data=None, addressing_type=None, instance_type='m1.small', placement=None, kernel_id=None, ramdisk_id=None, monitoring_enabled=False, subnet_id=None, placement_group=None, block_device_map=None, instance_profile_arn=None, instance_profile_name=None, security_group_ids=None, ebs_optimized=False, network_interfaces=None, dry_run=False)

Request instances on the spot market at a particular price.

Parameters:
  • price (str) – The maximum price of your bid
  • image_id (string) – The ID of the image to run
  • count (int) – The of instances to requested
  • type (str) – Type of request. Can be ‘one-time’ or ‘persistent’. Default is one-time.
  • valid_from (str) – Start date of the request. An ISO8601 time string.
  • valid_until (str) – End date of the request. An ISO8601 time string.
  • launch_group (str) – If supplied, all requests will be fulfilled as a group.
  • availability_zone_group (str) – If supplied, all requests will be fulfilled within a single availability zone.
  • key_name (string) – The name of the key pair with which to launch instances
  • security_groups (list of strings) – The names of the security groups with which to associate instances
  • user_data (string) – The user data passed to the launched instances
  • instance_type (string) –

    The type of instance to run:

    • t1.micro
    • m1.small
    • m1.medium
    • m1.large
    • m1.xlarge
    • m3.medium
    • m3.large
    • m3.xlarge
    • m3.2xlarge
    • c1.medium
    • c1.xlarge
    • m2.xlarge
    • m2.2xlarge
    • m2.4xlarge
    • cr1.8xlarge
    • hi1.4xlarge
    • hs1.8xlarge
    • cc1.4xlarge
    • cg1.4xlarge
    • cc2.8xlarge
    • g2.2xlarge
    • c3.large
    • c3.xlarge
    • c3.2xlarge
    • c3.4xlarge
    • c3.8xlarge
    • i2.xlarge
    • i2.2xlarge
    • i2.4xlarge
    • i2.8xlarge
    • t2.micro
    • t2.small
    • t2.medium
  • placement (string) – The availability zone in which to launch the instances
  • kernel_id (string) – The ID of the kernel with which to launch the instances
  • ramdisk_id (string) – The ID of the RAM disk with which to launch the instances
  • monitoring_enabled (bool) – Enable detailed CloudWatch monitoring on the instance.
  • subnet_id (string) – The subnet ID within which to launch the instances for VPC.
  • placement_group (string) – If specified, this is the name of the placement group in which the instance(s) will be launched.
  • block_device_map (boto.ec2.blockdevicemapping.BlockDeviceMapping) – A BlockDeviceMapping data structure describing the EBS volumes associated with the Image.
  • security_group_ids (list of strings) – The ID of the VPC security groups with which to associate instances.
  • instance_profile_arn (string) – The Amazon resource name (ARN) of the IAM Instance Profile (IIP) to associate with the instances.
  • instance_profile_name (string) – The name of the IAM Instance Profile (IIP) to associate with the instances.
  • ebs_optimized (bool) – 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 EBS I/O performance. This optimization isn’t available with all instance types.
  • network_interfaces (list) – A list of boto.ec2.networkinterface.NetworkInterfaceSpecification
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

Reservation

Returns:

The boto.ec2.spotinstancerequest.SpotInstanceRequest associated with the request for machines

reset_image_attribute(image_id, attribute='launchPermission', dry_run=False)

Resets an attribute of an AMI to its default value.

Parameters:
  • image_id (string) – ID of the AMI for which an attribute will be described
  • attribute (string) – The attribute to reset
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

Whether the operation succeeded or not

reset_instance_attribute(instance_id, attribute, dry_run=False)

Resets an attribute of an instance to its default value.

Parameters:
  • instance_id (string) – ID of the instance
  • attribute (string) – The attribute to reset. Valid values are: kernel|ramdisk
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

Whether the operation succeeded or not

reset_snapshot_attribute(snapshot_id, attribute='createVolumePermission', dry_run=False)

Resets an attribute of a snapshot to its default value.

Parameters:
  • snapshot_id (string) – ID of the snapshot
  • attribute (string) – The attribute to reset
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

Whether the operation succeeded or not

revoke_security_group(group_name=None, src_security_group_name=None, src_security_group_owner_id=None, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, group_id=None, src_security_group_group_id=None, dry_run=False)

Remove an existing rule from an existing security group. You need to pass in either src_security_group_name and src_security_group_owner_id OR ip_protocol, from_port, to_port, and cidr_ip. In other words, either you are revoking another group or you are revoking some ip-based rule.

Parameters:
  • group_name (string) – The name of the security group you are removing the rule from.
  • src_security_group_name (string) – The name of the security group you are revoking access to.
  • src_security_group_owner_id (string) – The ID of the owner of the security group you are revoking access to.
  • ip_protocol (string) – Either tcp | udp | icmp
  • from_port (int) – The beginning port number you are disabling
  • to_port (int) – The ending port number you are disabling
  • cidr_ip (string) – The CIDR block you are revoking access to. See http://goo.gl/Yj5QC
  • group_id (string) – ID of the EC2 or VPC security group to modify. This is required for VPC security groups and can be used instead of group_name for EC2 security groups.
  • src_security_group_group_id (string) – The ID of the security group for which you are revoking access. Can be used instead of src_security_group_name
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

revoke_security_group_deprecated(group_name, src_security_group_name=None, src_security_group_owner_id=None, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, dry_run=False)
NOTE: This method uses the old-style request parameters
that did not allow a port to be specified when authorizing a group.

Remove an existing rule from an existing security group. You need to pass in either src_security_group_name and src_security_group_owner_id OR ip_protocol, from_port, to_port, and cidr_ip. In other words, either you are revoking another group or you are revoking some ip-based rule.

Parameters:
  • group_name (string) – The name of the security group you are removing the rule from.
  • src_security_group_name (string) – The name of the security group you are revoking access to.
  • src_security_group_owner_id (string) – The ID of the owner of the security group you are revoking access to.
  • ip_protocol (string) – Either tcp | udp | icmp
  • from_port (int) – The beginning port number you are disabling
  • to_port (string) – The ending port number you are disabling
  • to_port – The CIDR block you are revoking access to. http://goo.gl/Yj5QC
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

revoke_security_group_egress(group_id, ip_protocol, from_port=None, to_port=None, src_group_id=None, cidr_ip=None, dry_run=False)

Remove an existing egress rule from an existing VPC security group. You need to pass in an ip_protocol, from_port and to_port range only if the protocol you are using is port-based. You also need to pass in either a src_group_id or cidr_ip.

Parameters:
  • group_id – The name of the security group you are removing the rule from.
  • ip_protocol (string) – Either tcp | udp | icmp | -1
  • from_port (int) – The beginning port number you are disabling
  • to_port (int) – The ending port number you are disabling
  • src_group_id (src_group_id) – The source security group you are revoking access to.
  • cidr_ip (string) – The CIDR block you are revoking access to. See http://goo.gl/Yj5QC
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful.

run_instances(image_id, min_count=1, max_count=1, key_name=None, security_groups=None, user_data=None, addressing_type=None, instance_type='m1.small', placement=None, kernel_id=None, ramdisk_id=None, monitoring_enabled=False, subnet_id=None, block_device_map=None, disable_api_termination=False, instance_initiated_shutdown_behavior=None, private_ip_address=None, placement_group=None, client_token=None, security_group_ids=None, additional_info=None, instance_profile_name=None, instance_profile_arn=None, tenancy=None, ebs_optimized=False, network_interfaces=None, dry_run=False)

Runs an image on EC2.

Parameters:
  • image_id (string) – The ID of the image to run.
  • min_count (int) – The minimum number of instances to launch.
  • max_count (int) – The maximum number of instances to launch.
  • key_name (string) – The name of the key pair with which to launch instances.
  • security_groups (list of strings) – The names of the EC2 classic security groups with which to associate instances
  • user_data (string) – The Base64-encoded MIME user data to be made available to the instance(s) in this reservation.
  • instance_type (string) –

    The type of instance to run:

    • t1.micro
    • m1.small
    • m1.medium
    • m1.large
    • m1.xlarge
    • m3.medium
    • m3.large
    • m3.xlarge
    • m3.2xlarge
    • c1.medium
    • c1.xlarge
    • m2.xlarge
    • m2.2xlarge
    • m2.4xlarge
    • cr1.8xlarge
    • hi1.4xlarge
    • hs1.8xlarge
    • cc1.4xlarge
    • cg1.4xlarge
    • cc2.8xlarge
    • g2.2xlarge
    • c3.large
    • c3.xlarge
    • c3.2xlarge
    • c3.4xlarge
    • c3.8xlarge
    • i2.xlarge
    • i2.2xlarge
    • i2.4xlarge
    • i2.8xlarge
    • t2.micro
    • t2.small
    • t2.medium
  • placement (string) – The Availability Zone to launch the instance into.
  • kernel_id (string) – The ID of the kernel with which to launch the instances.
  • ramdisk_id (string) – The ID of the RAM disk with which to launch the instances.
  • monitoring_enabled (bool) – Enable detailed CloudWatch monitoring on the instance.
  • subnet_id (string) – The subnet ID within which to launch the instances for VPC.
  • private_ip_address (string) – If you’re using VPC, you can optionally use this parameter to assign the instance a specific available IP address from the subnet (e.g., 10.0.0.25).
  • block_device_map (boto.ec2.blockdevicemapping.BlockDeviceMapping) – A BlockDeviceMapping data structure describing the EBS volumes associated with the Image.
  • disable_api_termination (bool) – If True, the instances will be locked and will not be able to be terminated via the API.
  • instance_initiated_shutdown_behavior (string) –

    Specifies whether the instance stops or terminates on instance-initiated shutdown. Valid values are:

    • stop
    • terminate
  • placement_group (string) – If specified, this is the name of the placement group in which the instance(s) will be launched.
  • client_token (string) – Unique, case-sensitive identifier you provide to ensure idempotency of the request. Maximum 64 ASCII characters.
  • security_group_ids (list of strings) – The ID of the VPC security groups with which to associate instances.
  • additional_info (string) – Specifies additional information to make available to the instance(s).
  • tenancy (string) – The tenancy of the instance you want to launch. An instance with a tenancy of ‘dedicated’ runs on single-tenant hardware and can only be launched into a VPC. Valid values are:”default” or “dedicated”. NOTE: To use dedicated tenancy you MUST specify a VPC subnet-ID as well.
  • instance_profile_arn (string) – The Amazon resource name (ARN) of the IAM Instance Profile (IIP) to associate with the instances.
  • instance_profile_name (string) – The name of the IAM Instance Profile (IIP) to associate with the instances.
  • ebs_optimized (bool) – 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 EBS I/O performance. This optimization isn’t available with all instance types.
  • network_interfaces (boto.ec2.networkinterface.NetworkInterfaceCollection) – A NetworkInterfaceCollection data structure containing the ENI specifications for the instance.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

Reservation

Returns:

The boto.ec2.instance.Reservation associated with the request for machines

start_instances(instance_ids=None, dry_run=False)

Start the instances specified

Parameters:
  • instance_ids (list) – A list of strings of the Instance IDs to start
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of the instances started

stop_instances(instance_ids=None, force=False, dry_run=False)

Stop the instances specified

Parameters:
  • instance_ids (list) – A list of strings of the Instance IDs to stop
  • force (bool) – Forces the instance to stop
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of the instances stopped

terminate_instances(instance_ids=None, dry_run=False)

Terminate the instances specified

Parameters:
  • instance_ids (list) – A list of strings of the Instance IDs to terminate
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of the instances terminated

trim_snapshots(hourly_backups=8, daily_backups=7, weekly_backups=4, monthly_backups=True)

Trim excess snapshots, based on when they were taken. More current snapshots are retained, with the number retained decreasing as you move back in time.

If ebs volumes have a ‘Name’ tag with a value, their snapshots will be assigned the same tag when they are created. The values of the ‘Name’ tags for snapshots are used by this function to group snapshots taken from the same volume (or from a series of like-named volumes over time) for trimming.

For every group of like-named snapshots, this function retains the newest and oldest snapshots, as well as, by default, the first snapshots taken in each of the last eight hours, the first snapshots taken in each of the last seven days, the first snapshots taken in the last 4 weeks (counting Midnight Sunday morning as the start of the week), and the first snapshot from the first day of each month forever.

Parameters:
  • hourly_backups (int) – How many recent hourly backups should be saved.
  • daily_backups (int) – How many recent daily backups should be saved.
  • weekly_backups (int) – How many recent weekly backups should be saved.
  • monthly_backups (int) – How many monthly backups should be saved. Use True for no limit.
unassign_private_ip_addresses(network_interface_id=None, private_ip_addresses=None, dry_run=False)

Unassigns one or more secondary private IP addresses from a network interface in Amazon VPC.

Parameters:
  • network_interface_id (string) – The network interface from which the secondary private IP address will be unassigned.
  • private_ip_addresses (list) – Specifies the secondary private IP addresses that you want to unassign from the network interface.
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

bool

Returns:

True if successful

unmonitor_instance(instance_id, dry_run=False)

Deprecated Version, maintained for backward compatibility. Disable detailed CloudWatch monitoring for the supplied instance.

Parameters:
  • instance_id (string) – The instance id
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.instanceinfo.InstanceInfo

unmonitor_instances(instance_ids, dry_run=False)

Disable CloudWatch monitoring for the supplied instance.

Parameters:
  • instance_id (list of string) – The instance id
  • dry_run (bool) – Set to True if the operation should not actually run.
Return type:

list

Returns:

A list of boto.ec2.instanceinfo.InstanceInfo

boto.ec2.ec2object

Represents an EC2 Object

class boto.ec2.ec2object.EC2Object(connection=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.ec2object.TaggedEC2Object(connection=None)

Any EC2 resource that can be tagged should be represented by a Python object that subclasses this class. This class has the mechanism in place to handle the tagSet element in the Describe* responses. If tags are found, it will create a TagSet object and allow it to parse and collect the tags into a dict that is stored in the “tags” attribute of the object.

add_tag(key, value='', dry_run=False)

Add a tag to this object. Tags are stored by AWS and can be used to organize and filter resources. Adding a tag involves a round-trip to the EC2 service.

Parameters:
  • key (str) – The key or name of the tag being stored.
  • value (str) – An optional value that can be stored with the tag. If you want only the tag name and no value, the value should be the empty string.
add_tags(tags, dry_run=False)

Add tags to this object. Tags are stored by AWS and can be used to organize and filter resources. Adding tags involves a round-trip to the EC2 service.

Parameters:tags (dict) – A dictionary of key-value pairs for the tags being stored. If for some tags you want only the name and no value, the corresponding value for that tag name should be an empty string.
remove_tag(key, value=None, dry_run=False)

Remove a tag from this object. Removing a tag involves a round-trip to the EC2 service.

Parameters:
  • key (str) – The key or name of the tag being stored.
  • value (str) – An optional value that can be stored with the tag. If a value is provided, it must match the value currently stored in EC2. If not, the tag will not be removed. If a value of None is provided, the tag will be unconditionally deleted. NOTE: There is an important distinction between a value of ‘’ and a value of None.
remove_tags(tags, dry_run=False)

Removes tags from this object. Removing tags involves a round-trip to the EC2 service.

Parameters:tags (dict) – A dictionary of key-value pairs for the tags being removed. For each key, the provided value must match the value currently stored in EC2. If not, that particular tag will not be removed. However, if a value of None is provided, the tag will be unconditionally deleted. NOTE: There is an important distinction between a value of ‘’ and a value of None.
startElement(name, attrs, connection)

boto.ec2.elb

See the ELB Reference.

boto.ec2.group

class boto.ec2.group.Group(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.image

class boto.ec2.image.BillingProducts
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.image.CopyImage(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.image.Image(connection=None)

Represents an EC2 Image

deregister(delete_snapshot=False, dry_run=False)
endElement(name, value, connection)
get_kernel(dry_run=False)
get_launch_permissions(dry_run=False)
get_ramdisk(dry_run=False)
remove_launch_permissions(user_ids=None, group_names=None, dry_run=False)
reset_launch_attributes(dry_run=False)
run(min_count=1, max_count=1, key_name=None, security_groups=None, user_data=None, addressing_type=None, instance_type='m1.small', placement=None, kernel_id=None, ramdisk_id=None, monitoring_enabled=False, subnet_id=None, block_device_map=None, disable_api_termination=False, instance_initiated_shutdown_behavior=None, private_ip_address=None, placement_group=None, security_group_ids=None, additional_info=None, instance_profile_name=None, instance_profile_arn=None, tenancy=None, dry_run=False)

Runs this instance.

Parameters:
  • min_count (int) – The minimum number of instances to start
  • max_count (int) – The maximum number of instances to start
  • key_name (string) – The name of the key pair with which to launch instances.
  • security_groups (list of strings) – The names of the security groups with which to associate instances.
  • user_data (string) – The Base64-encoded MIME user data to be made available to the instance(s) in this reservation.
  • instance_type (string) –

    The type of instance to run:

    • t1.micro
    • m1.small
    • m1.medium
    • m1.large
    • m1.xlarge
    • m3.medium
    • m3.large
    • m3.xlarge
    • m3.2xlarge
    • c1.medium
    • c1.xlarge
    • m2.xlarge
    • m2.2xlarge
    • m2.4xlarge
    • cr1.8xlarge
    • hi1.4xlarge
    • hs1.8xlarge
    • cc1.4xlarge
    • cg1.4xlarge
    • cc2.8xlarge
    • g2.2xlarge
    • c3.large
    • c3.xlarge
    • c3.2xlarge
    • c3.4xlarge
    • c3.8xlarge
    • i2.xlarge
    • i2.2xlarge
    • i2.4xlarge
    • i2.8xlarge
    • t2.micro
    • t2.small
    • t2.medium
  • placement (string) – The Availability Zone to launch the instance into.
  • kernel_id (string) – The ID of the kernel with which to launch the instances.
  • ramdisk_id (string) – The ID of the RAM disk with which to launch the instances.
  • monitoring_enabled (bool) –
    Enable CloudWatch monitoring on
    the instance.
    type subnet_id:string
  • subnet_id – The subnet ID within which to launch the instances for VPC.
  • private_ip_address (string) – If you’re using VPC, you can optionally use this parameter to assign the instance a specific available IP address from the subnet (e.g., 10.0.0.25).
  • block_device_map (boto.ec2.blockdevicemapping.BlockDeviceMapping) – A BlockDeviceMapping data structure describing the EBS volumes associated with the Image.
  • disable_api_termination (bool) – If True, the instances will be locked and will not be able to be terminated via the API.
  • instance_initiated_shutdown_behavior (string) –

    Specifies whether the instance stops or terminates on instance-initiated shutdown. Valid values are:

    • stop
    • terminate
  • placement_group (string) – If specified, this is the name of the placement group in which the instance(s) will be launched.
  • additional_info (string) – Specifies additional information to make available to the instance(s).
  • security_group_ids (list of strings) – The ID of the VPC security groups with which to associate instances.
  • instance_profile_name (string) – The name of the IAM Instance Profile (IIP) to associate with the instances.
  • instance_profile_arn (string) – The Amazon resource name (ARN) of the IAM Instance Profile (IIP) to associate with the instances.
  • tenancy (string) – The tenancy of the instance you want to launch. An instance with a tenancy of ‘dedicated’ runs on single-tenant hardware and can only be launched into a VPC. Valid values are:”default” or “dedicated”. NOTE: To use dedicated tenancy you MUST specify a VPC subnet-ID as well.
Return type:

Reservation

Returns:

The boto.ec2.instance.Reservation associated with the request for machines

set_launch_permissions(user_ids=None, group_names=None, dry_run=False)
startElement(name, attrs, connection)
update(validate=False, dry_run=False)

Update the image’s state information by making a call to fetch the current image attributes from the service.

Parameters:validate (bool) – By default, if EC2 returns no data about the image the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
class boto.ec2.image.ImageAttribute(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.image.ProductCodes
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.instance

Represents an EC2 Instance

class boto.ec2.instance.ConsoleOutput(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instance.Instance(connection=None)

Represents an instance.

Variables:
  • id – The unique ID of the Instance.
  • groups – A list of Group objects representing the security groups associated with the instance.
  • public_dns_name – The public dns name of the instance.
  • private_dns_name – The private dns name of the instance.
  • state – The string representation of the instance’s current state.
  • state_code – An integer representation of the instance’s current state.
  • previous_state – The string representation of the instance’s previous state.
  • previous_state_code – An integer representation of the instance’s current state.
  • key_name – The name of the SSH key associated with the instance.
  • instance_type – The type of instance (e.g. m1.small).
  • launch_time – The time the instance was launched.
  • image_id – The ID of the AMI used to launch this instance.
  • placement – The availability zone in which the instance is running.
  • placement_group – The name of the placement group the instance is in (for cluster compute instances).
  • placement_tenancy – The tenancy of the instance, if the instance is running within a VPC. An instance with a tenancy of dedicated runs on a single-tenant hardware.
  • kernel – The kernel associated with the instance.
  • ramdisk – The ramdisk associated with the instance.
  • architecture – The architecture of the image (i386|x86_64).
  • hypervisor – The hypervisor used.
  • virtualization_type – The type of virtualization used.
  • product_codes – A list of product codes associated with this instance.
  • ami_launch_index – This instances position within it’s launch group.
  • monitored – A boolean indicating whether monitoring is enabled or not.
  • monitoring_state – A string value that contains the actual value of the monitoring element returned by EC2.
  • spot_instance_request_id – The ID of the spot instance request if this is a spot instance.
  • subnet_id – The VPC Subnet ID, if running in VPC.
  • vpc_id – The VPC ID, if running in VPC.
  • private_ip_address – The private IP address of the instance.
  • ip_address – The public IP address of the instance.
  • platform – Platform of the instance (e.g. Windows)
  • root_device_name – The name of the root device.
  • root_device_type – The root device type (ebs|instance-store).
  • block_device_mapping – The Block Device Mapping for the instance.
  • state_reason – The reason for the most recent state transition.
  • groups – List of security Groups associated with the instance.
  • interfaces – List of Elastic Network Interfaces associated with this instance.
  • ebs_optimized – Whether instance is using optimized EBS volumes or not.
  • instance_profile – A Python dict containing the instance profile id and arn associated with this instance.
confirm_product(product_code, dry_run=False)
create_image(name, description=None, no_reboot=False, dry_run=False)

Will create an AMI from the instance in the running or stopped state.

Parameters:
  • name (string) – The name of the new image
  • description (string) – An optional human-readable string describing the contents and purpose of the AMI.
  • no_reboot (bool) – An optional flag indicating that the bundling process should not attempt to shutdown the instance before bundling. If this flag is True, the responsibility of maintaining file system integrity is left to the owner of the instance.
Return type:

string

Returns:

The new image id

endElement(name, value, connection)
get_attribute(attribute, dry_run=False)

Gets an attribute from this instance.

Parameters:attribute (string) –

The attribute you need information about Valid choices are:

  • instanceType
  • kernel
  • ramdisk
  • userData
  • disableApiTermination
  • instanceInitiatedShutdownBehavior
  • rootDeviceName
  • blockDeviceMapping
  • productCodes
  • sourceDestCheck
  • groupSet
  • ebsOptimized
Return type:boto.ec2.image.InstanceAttribute
Returns:An InstanceAttribute object representing the value of the attribute requested
get_console_output(dry_run=False)

Retrieves the console output for the instance.

Return type:boto.ec2.instance.ConsoleOutput
Returns:The console output as a ConsoleOutput object
modify_attribute(attribute, value, dry_run=False)

Changes an attribute of this instance

Parameters:
  • attribute (string) –

    The attribute you wish to change.

    • instanceType - A valid instance type (m1.small)
    • kernel - Kernel ID (None)
    • ramdisk - Ramdisk ID (None)
    • userData - Base64 encoded String (None)
    • disableApiTermination - Boolean (true)
    • instanceInitiatedShutdownBehavior - stop|terminate
    • sourceDestCheck - Boolean (true)
    • groupSet - Set of Security Groups or IDs
    • ebsOptimized - Boolean (false)
  • value (string) – The new value for the attribute
Return type:

bool

Returns:

Whether the operation succeeded or not

monitor(dry_run=False)
placement
placement_group
placement_tenancy
previous_state
previous_state_code
reboot(dry_run=False)
reset_attribute(attribute, dry_run=False)

Resets an attribute of this instance to its default value.

Parameters:attribute (string) – The attribute to reset. Valid values are: kernel|ramdisk
Return type:bool
Returns:Whether the operation succeeded or not
start(dry_run=False)

Start the instance.

startElement(name, attrs, connection)
state
state_code
stop(force=False, dry_run=False)

Stop the instance

Parameters:force (bool) – Forces the instance to stop
Return type:list
Returns:A list of the instances stopped
terminate(dry_run=False)

Terminate the instance

unmonitor(dry_run=False)
update(validate=False, dry_run=False)

Update the instance’s state information by making a call to fetch the current instance attributes from the service.

Parameters:validate (bool) – By default, if EC2 returns no data about the instance the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
use_ip(ip_address, dry_run=False)

Associates an Elastic IP to the instance.

Parameters:ip_address (Either an instance of boto.ec2.address.Address or a string.) – The IP address to associate with the instance.
Return type:bool
Returns:True if successful
class boto.ec2.instance.InstanceAttribute(parent=None)
ValidValues = ['instanceType', 'kernel', 'ramdisk', 'userData', 'disableApiTermination', 'instanceInitiatedShutdownBehavior', 'rootDeviceName', 'blockDeviceMapping', 'sourceDestCheck', 'groupSet']
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instance.InstancePlacement(zone=None, group_name=None, tenancy=None)

The location where the instance launched.

Variables:
  • zone – The Availability Zone of the instance.
  • group_name – The name of the placement group the instance is in (for cluster compute instances).
  • tenancy – The tenancy of the instance (if the instance is running within a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instance.InstanceState(code=0, name=None)

The state of the instance.

Variables:
  • code

    The low byte represents the state. The high byte is an opaque internal value and should be ignored. Valid values:

    • 0 (pending)
    • 16 (running)
    • 32 (shutting-down)
    • 48 (terminated)
    • 64 (stopping)
    • 80 (stopped)
  • name

    The name of the state of the instance. Valid values:

    • “pending”
    • “running”
    • “shutting-down”
    • “terminated”
    • “stopping”
    • “stopped”
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instance.Reservation(connection=None)

Represents a Reservation response object.

Variables:
  • id – The unique ID of the Reservation.
  • owner_id – The unique ID of the owner of the Reservation.
  • groups – A list of Group objects representing the security groups associated with launched instances.
  • instances – A list of Instance objects launched in this Reservation.
endElement(name, value, connection)
startElement(name, attrs, connection)
stop_all(dry_run=False)
class boto.ec2.instance.SubParse(section, parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.instanceinfo

class boto.ec2.instanceinfo.InstanceInfo(connection=None, id=None, state=None)

Represents an EC2 Instance status response from CloudWatch

Variables:
  • id (str) – The instance’s EC2 ID.
  • state (str) – Specifies the current status of the instance.
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.instancestatus

class boto.ec2.instancestatus.Details

A dict object that contains name/value pairs which provide more detailed information about the status of the system or the instance.

endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instancestatus.Event(code=None, description=None, not_before=None, not_after=None)

A status event for an instance.

Variables:
  • code – A string indicating the event type.
  • description – A string describing the reason for the event.
  • not_before – A datestring describing the earliest time for the event.
  • not_after – A datestring describing the latest time for the event.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instancestatus.EventSet
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instancestatus.InstanceStatus(id=None, zone=None, events=None, state_code=None, state_name=None)

Represents an EC2 Instance status as reported by DescribeInstanceStatus request.

Variables:
  • id – The instance identifier.
  • zone – The availability zone of the instance.
  • events – A list of events relevant to the instance.
  • state_code – An integer representing the current state of the instance.
  • state_name – A string describing the current state of the instance.
  • system_status – A Status object that reports impaired functionality that stems from issues related to the systems that support an instance, such as such as hardware failures and network connectivity problems.
  • instance_status – A Status object that reports impaired functionality that arises from problems internal to the instance.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instancestatus.InstanceStatusSet(connection=None)

A list object that contains the results of a call to DescribeInstanceStatus request. Each element of the list will be an InstanceStatus object.

Variables:next_token – If the response was truncated by the EC2 service, the next_token attribute of the object will contain the string that needs to be passed in to the next request to retrieve the next set of results.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.instancestatus.Status(status=None, details=None)

A generic Status object used for system status and instance status.

Variables:
  • status – A string indicating overall status.
  • details – A dict containing name-value pairs which provide more details about the current status.
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.keypair

Represents an EC2 Keypair

class boto.ec2.keypair.KeyPair(connection=None)
copy_to_region(region, dry_run=False)

Create a new key pair of the same new in another region. Note that the new key pair will use a different ssh cert than the this key pair. After doing the copy, you will need to save the material associated with the new key pair (use the save method) to a local file.

Parameters:region (boto.ec2.regioninfo.RegionInfo) – The region to which this security group will be copied.
Return type:boto.ec2.keypair.KeyPair
Returns:The new key pair
delete(dry_run=False)

Delete the KeyPair.

Return type:bool
Returns:True if successful, otherwise False.
endElement(name, value, connection)
save(directory_path)

Save the material (the unencrypted PEM encoded RSA private key) of a newly created KeyPair to a local file.

Parameters:directory_path (string) – The fully qualified path to the directory in which the keypair will be saved. The keypair file will be named using the name of the keypair as the base name and .pem for the file extension. If a file of that name already exists in the directory, an exception will be raised and the old file will not be overwritten.
Return type:bool
Returns:True if successful.

boto.ec2.launchspecification

Represents a launch specification for Spot instances.

class boto.ec2.launchspecification.GroupList
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.launchspecification.LaunchSpecification(connection=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.networkinterface

Represents an EC2 Elastic Network Interface

class boto.ec2.networkinterface.Attachment
Variables:
  • id – The ID of the attachment.
  • instance_id – The ID of the instance.
  • device_index – The index of this device.
  • status – The status of the device.
  • attach_time – The time the device was attached.
  • delete_on_termination – Whether the device will be deleted when the instance is terminated.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.networkinterface.NetworkInterface(connection=None)

An Elastic Network Interface.

Variables:
  • id – The ID of the ENI.
  • subnet_id – The ID of the VPC subnet.
  • vpc_id – The ID of the VPC.
  • description – The description.
  • owner_id – The ID of the owner of the ENI.
  • requester_managed
  • status – The interface’s status (available|in-use).
  • mac_address – The MAC address of the interface.
  • private_ip_address – The IP address of the interface within the subnet.
  • source_dest_check – Flag to indicate whether to validate network traffic to or from this network interface.
  • groups – List of security groups associated with the interface.
  • attachment – The attachment object.
  • private_ip_addresses – A list of PrivateIPAddress objects.
attach(instance_id, device_index, dry_run=False)

Attach this ENI to an EC2 instance.

Parameters:
  • instance_id (str) – The ID of the EC2 instance to which it will be attached.
  • device_index (int) – The interface nunber, N, on the instance (eg. ethN)
Return type:

bool

Returns:

True if successful

delete(dry_run=False)
detach(force=False, dry_run=False)

Detach this ENI from an EC2 instance.

Parameters:force (bool) – Forces detachment if the previous detachment attempt did not occur cleanly.
Return type:bool
Returns:True if successful
endElement(name, value, connection)
startElement(name, attrs, connection)
update(validate=False, dry_run=False)

Update the data associated with this ENI by querying EC2.

Parameters:validate (bool) – By default, if EC2 returns no data about the ENI the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
class boto.ec2.networkinterface.NetworkInterfaceCollection(*interfaces)
build_list_params(params, prefix='')
class boto.ec2.networkinterface.NetworkInterfaceSpecification(network_interface_id=None, device_index=None, subnet_id=None, description=None, private_ip_address=None, groups=None, delete_on_termination=None, private_ip_addresses=None, secondary_private_ip_address_count=None, associate_public_ip_address=None)
class boto.ec2.networkinterface.PrivateIPAddress(connection=None, private_ip_address=None, primary=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.placementgroup

Represents an EC2 Placement Group

class boto.ec2.placementgroup.PlacementGroup(connection=None, name=None, strategy=None, state=None)
delete(dry_run=False)
endElement(name, value, connection)

boto.ec2.regioninfo

class boto.ec2.regioninfo.EC2RegionInfo(connection=None, name=None, endpoint=None, connection_cls=None)

Represents an EC2 Region

boto.ec2.reservedinstance

class boto.ec2.reservedinstance.InstanceCount(connection=None, state=None, instance_count=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ModificationResult(connection=None, modification_id=None, availability_zone=None, platform=None, instance_count=None, instance_type=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ModifyReservedInstancesResult(connection=None, modification_id=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.PriceSchedule(connection=None, term=None, price=None, currency_code=None, active=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.PricingDetail(connection=None, price=None, count=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.RecurringCharge(connection=None, frequency=None, amount=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ReservedInstance(connection=None, id=None, instance_type=None, availability_zone=None, duration=None, fixed_price=None, usage_price=None, description=None, instance_count=None, state=None)
endElement(name, value, connection)
class boto.ec2.reservedinstance.ReservedInstanceListing(connection=None, listing_id=None, id=None, create_date=None, update_date=None, status=None, status_message=None, client_token=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ReservedInstancesConfiguration(connection=None, availability_zone=None, platform=None, instance_count=None, instance_type=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ReservedInstancesModification(connection=None, modification_id=None, reserved_instances=None, modification_results=None, create_date=None, update_date=None, effective_date=None, status=None, status_message=None, client_token=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.reservedinstance.ReservedInstancesOffering(connection=None, id=None, instance_type=None, availability_zone=None, duration=None, fixed_price=None, usage_price=None, description=None, instance_tenancy=None, currency_code=None, offering_type=None, recurring_charges=None, pricing_details=None)
describe()
endElement(name, value, connection)
purchase(instance_count=1, dry_run=False)
startElement(name, attrs, connection)

boto.ec2.securitygroup

Represents an EC2 Security Group

class boto.ec2.securitygroup.GroupOrCIDR(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.securitygroup.IPPermissions(parent=None)
add_grant(name=None, owner_id=None, cidr_ip=None, group_id=None, dry_run=False)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.securitygroup.IPPermissionsList
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.securitygroup.SecurityGroup(connection=None, owner_id=None, name=None, description=None, id=None)
add_rule(ip_protocol, from_port, to_port, src_group_name, src_group_owner_id, cidr_ip, src_group_group_id, dry_run=False)

Add a rule to the SecurityGroup object. Note that this method only changes the local version of the object. No information is sent to EC2.

authorize(ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, src_group=None, dry_run=False)

Add a new rule to this security group. You need to pass in either src_group_name OR ip_protocol, from_port, to_port, and cidr_ip. In other words, either you are authorizing another group or you are authorizing some ip-based rule.

Parameters:
Return type:

bool

Returns:

True if successful.

copy_to_region(region, name=None, dry_run=False)

Create a copy of this security group in another region. Note that the new security group will be a separate entity and will not stay in sync automatically after the copy operation.

Parameters:
  • region (boto.ec2.regioninfo.RegionInfo) – The region to which this security group will be copied.
  • name (string) – The name of the copy. If not supplied, the copy will have the same name as this security group.
Return type:

boto.ec2.securitygroup.SecurityGroup

Returns:

The new security group.

delete(dry_run=False)
endElement(name, value, connection)
instances(dry_run=False)

Find all of the current instances that are running within this security group.

Return type:list of boto.ec2.instance.Instance
Returns:A list of Instance objects
remove_rule(ip_protocol, from_port, to_port, src_group_name, src_group_owner_id, cidr_ip, src_group_group_id, dry_run=False)

Remove a rule to the SecurityGroup object. Note that this method only changes the local version of the object. No information is sent to EC2.

revoke(ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, src_group=None, dry_run=False)
startElement(name, attrs, connection)

boto.ec2.snapshot

Represents an EC2 Elastic Block Store Snapshot

class boto.ec2.snapshot.Snapshot(connection=None)
AttrName = 'createVolumePermission'
create_volume(zone, size=None, volume_type=None, iops=None, dry_run=False)

Create a new EBS Volume from this Snapshot

Parameters:
  • zone (string or boto.ec2.zone.Zone) – The availability zone in which the Volume will be created.
  • size (int) – The size of the new volume, in GiB. (optional). Defaults to the size of the snapshot.
  • volume_type (string) – The type of the volume. (optional). Valid values are: standard | io1 | gp2.
  • iops (int) – The provisioned IOPs you want to associate with this volume. (optional)
delete(dry_run=False)
endElement(name, value, connection)
get_permissions(dry_run=False)
reset_permissions(dry_run=False)
share(user_ids=None, groups=None, dry_run=False)
unshare(user_ids=None, groups=None, dry_run=False)
update(validate=False, dry_run=False)

Update the data associated with this snapshot by querying EC2.

Parameters:validate (bool) – By default, if EC2 returns no data about the snapshot the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
class boto.ec2.snapshot.SnapshotAttribute(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.spotinstancerequest

Represents an EC2 Spot Instance Request

class boto.ec2.spotinstancerequest.SpotInstanceRequest(connection=None)
Variables:
  • id – The ID of the Spot Instance Request.
  • price – The maximum hourly price for any Spot Instance launched to fulfill the request.
  • type – The Spot Instance request type.
  • state – The state of the Spot Instance request.
  • fault – The fault codes for the Spot Instance request, if any.
  • valid_from – The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.
  • valid_until – The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date is reached.
  • launch_group – The instance launch group. Launch groups are Spot Instances that launch together and terminate together.
  • launched_availability_zone – foo
  • product_description – The Availability Zone in which the bid is launched.
  • availability_zone_group – The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.
  • create_time – The time stamp when the Spot Instance request was created.
  • launch_specification – Additional information for launching instances.
  • instance_id – The instance ID, if an instance has been launched to fulfill the Spot Instance request.
  • status – The status code and status message describing the Spot Instance request.
cancel(dry_run=False)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.spotinstancerequest.SpotInstanceStateFault(code=None, message=None)

The fault codes for the Spot Instance request, if any.

Variables:
  • code – The reason code for the Spot Instance state change.
  • message – The message for the Spot Instance state change.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.spotinstancerequest.SpotInstanceStatus(code=None, update_time=None, message=None)

Contains the status of a Spot Instance Request.

Variables:
  • code – Status code of the request.
  • message – The description for the status code for the Spot request.
  • update_time – Time the status was stated.
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.tag

class boto.ec2.tag.Tag(connection=None, res_id=None, res_type=None, name=None, value=None)

A Tag is used when creating or listing all tags related to an AWS account. It records not only the key and value but also the ID of the resource to which the tag is attached as well as the type of the resource.

endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.tag.TagSet(connection=None)

A TagSet is used to collect the tags associated with a particular EC2 resource. Not all resources can be tagged but for those that can, this dict object will be used to collect those values. See boto.ec2.ec2object.TaggedEC2Object for more details.

endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.vmtype

boto.ec2.volume

Represents an EC2 Elastic Block Storage Volume

class boto.ec2.volume.AttachmentSet

Represents an EBS attachmentset.

Variables:
  • id – The unique ID of the volume.
  • instance_id – The unique ID of the attached instance
  • status – The status of the attachment
  • attach_time – Attached since
  • device – The device the instance has mapped
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volume.Volume(connection=None)

Represents an EBS volume.

Variables:
  • id – The unique ID of the volume.
  • create_time – The timestamp of when the volume was created.
  • status – The status of the volume.
  • size – The size (in GB) of the volume.
  • snapshot_id – The ID of the snapshot this volume was created from, if applicable.
  • attach_data – An AttachmentSet object.
  • zone – The availability zone this volume is in.
  • type – The type of volume (standard or consistent-iops)
  • iops – If this volume is of type consistent-iops, this is the number of IOPS provisioned (10-300).
  • encrypted – True if this volume is encrypted.
attach(instance_id, device, dry_run=False)

Attach this EBS volume to an EC2 instance.

Parameters:
  • instance_id (str) – The ID of the EC2 instance to which it will be attached.
  • device (str) – The device on the instance through which the volume will be exposed (e.g. /dev/sdh)
Return type:

bool

Returns:

True if successful

attachment_state()

Get the attachment state.

create_snapshot(description=None, dry_run=False)

Create a snapshot of this EBS Volume.

Parameters:description (str) – A description of the snapshot. Limited to 256 characters.
Return type:boto.ec2.snapshot.Snapshot
Returns:The created Snapshot object
delete(dry_run=False)

Delete this EBS volume.

Return type:bool
Returns:True if successful
detach(force=False, dry_run=False)

Detach this EBS volume from an EC2 instance.

Parameters:force (bool) – Forces detachment if the previous detachment attempt did not occur cleanly. This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures.
Return type:bool
Returns:True if successful
endElement(name, value, connection)
snapshots(owner=None, restorable_by=None, dry_run=False)

Get all snapshots related to this volume. Note that this requires that all available snapshots for the account be retrieved from EC2 first and then the list is filtered client-side to contain only those for this volume.

Parameters:
  • owner (str) –

    If present, only the snapshots owned by the specified user will be returned. Valid values are:

    • self
    • amazon
    • AWS Account ID
  • restorable_by (str) – If present, only the snapshots that are restorable by the specified account id will be returned.
Return type:

list of L{boto.ec2.snapshot.Snapshot}

Returns:

The requested Snapshot objects

startElement(name, attrs, connection)
update(validate=False, dry_run=False)

Update the data associated with this volume by querying EC2.

Parameters:validate (bool) – By default, if EC2 returns no data about the volume the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
volume_state()

Returns the state of the volume. Same value as the status attribute.

class boto.ec2.volume.VolumeAttribute(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.volumestatus

class boto.ec2.volumestatus.Action(code=None, id=None, description=None, type=None)

An action for an instance.

Variables:
  • code – The code for the type of the action.
  • id – The ID of the event.
  • type – The type of the event.
  • description – A description of the action.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volumestatus.ActionSet
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volumestatus.Event(type=None, id=None, description=None, not_before=None, not_after=None)

A status event for an instance.

Variables:
  • type – The type of the event.
  • id – The ID of the event.
  • description – A string describing the reason for the event.
  • not_before – A datestring describing the earliest time for the event.
  • not_after – A datestring describing the latest time for the event.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volumestatus.EventSet
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volumestatus.VolumeStatus(id=None, zone=None)

Represents an EC2 Volume status as reported by DescribeVolumeStatus request.

Variables:
  • id – The volume identifier.
  • zone – The availability zone of the volume
  • volume_status – A Status object that reports impaired functionality that arises from problems internal to the instance.
  • events – A list of events relevant to the instance.
  • actions – A list of events relevant to the instance.
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.volumestatus.VolumeStatusSet(connection=None)

A list object that contains the results of a call to DescribeVolumeStatus request. Each element of the list will be an VolumeStatus object.

Variables:next_token – If the response was truncated by the EC2 service, the next_token attribute of the object will contain the string that needs to be passed in to the next request to retrieve the next set of results.
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.ec2.zone

Represents an EC2 Availability Zone

class boto.ec2.zone.MessageSet

A list object that contains messages associated with an availability zone.

endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.ec2.zone.Zone(connection=None)

Represents an Availability Zone.

Variables:
  • name – The name of the zone.
  • state – The current state of the zone.
  • region_name – The name of the region the zone is associated with.
  • messages – A list of messages related to the zone.
endElement(name, value, connection)
startElement(name, attrs, connection)