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
orNone
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¶
Represents an EC2 Elastic IP Address
boto.ec2.autoscale¶
See the Auto Scaling Reference.
boto.ec2.buyreservation¶
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)¶ Init method to create a new connection to EC2.
-
APIVersion
= '2012-06-01'¶
-
DefaultRegionEndpoint
= 'ec2.us-east-1.amazonaws.com'¶
-
DefaultRegionName
= 'us-east-1'¶
-
ResponseError
¶ alias of
EC2ResponseError
-
allocate_address
(domain=None)¶ Allocate a new Elastic IP address and associate it with your account.
Return type: boto.ec2.address.Address
Returns: The newly allocated Address
-
associate_address
(instance_id=None, public_ip=None, allocation_id=None, network_interface_id=None)¶ Associate an Elastic IP address with a currently running instance. This requires one of
public_ip
orallocation_id
depending on if you’re associating a VPC address or a plain EC2 address.Parameters: - : param network_interface_id: The network interface ID to which
- elastic IP is to be assigned to
Return type: bool Returns: True if successful
-
attach_network_interface
(network_interface_id, instance_id, device_index)¶ Attaches a network interface to an instance.
Parameters:
-
attach_volume
(volume_id, instance_id, device)¶ Attach an EBS volume to an EC2 instance.
Parameters: Return type: Returns: True if successful
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
Return type: Returns: True if successful.
- 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
Return type: Returns: True if successful.
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.
-
build_filter_params
(params, filters)¶
-
build_tag_param_list
(params, tags)¶
-
bundle_instance
(instance_id, s3_bucket, s3_prefix, s3_upload_policy)¶ 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.
-
cancel_bundle_task
(bundle_id)¶ Cancel a previously submitted bundle task
Parameters: bundle_id (string) – The identifier of the bundle task to cancel.
-
cancel_spot_instance_requests
(request_ids)¶ Cancel the specified Spot Instance Requests.
Parameters: request_ids (list) – A list of strings of the Request IDs to terminate Return type: list Returns: A list of the instances terminated
-
confirm_product_instance
(product_code, instance_id)¶
-
create_image
(instance_id, name, description=None, no_reboot=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.
Return type: Returns: The new image id
-
create_key_pair
(key_name)¶ 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 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)¶ 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.
Return type: boto.ec2.networkinterface.NetworkInterface
Returns: The newly created network interface.
-
create_placement_group
(name, strategy='cluster')¶ Create a new placement group for your account. This will create the placement group within the region you are currently connected to.
Parameters: Return type: Returns: True if successful
-
create_security_group
(name, description, vpc_id=None)¶ Create a new security group for your account. This will create the security group within the region you are currently connected to.
Parameters: Return type: Returns: The newly created
boto.ec2.keypair.KeyPair
.
-
create_snapshot
(volume_id, description=None)¶ Create a snapshot of an existing EBS Volume.
Parameters: Return type: Returns: True if successful
-
create_spot_datafeed_subscription
(bucket, prefix)¶ 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.
Return type: boto.ec2.spotdatafeedsubscription.SpotDatafeedSubscription
Returns: The datafeed subscription object or None
Create new metadata tags for the specified resource ids.
Parameters:
-
create_volume
(size, zone, snapshot=None)¶ 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.
-
delete_key_pair
(key_name)¶ Delete a key pair from your account.
Parameters: key_name (string) – The name of the keypair to delete
-
delete_network_interface
(network_interface_id)¶ Delete the specified network interface.
Parameters: network_interface_id (str) – The ID of the network interface to delete.
-
delete_placement_group
(name)¶ Delete a placement group from your account.
Parameters: key_name (string) – The name of the keypair to delete
-
delete_security_group
(name=None, group_id=None)¶ Delete a security group from your account.
Parameters: Return type: Returns: True if successful.
-
delete_snapshot
(snapshot_id)¶
-
delete_spot_datafeed_subscription
()¶ Delete the current spot instance data feed subscription associated with this account
Return type: bool Returns: True if successful
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.
-
delete_volume
(volume_id)¶ Delete an EBS volume.
Parameters: volume_id (str) – The ID of the volume to be delete. Return type: bool Returns: True if successful
-
deregister_image
(image_id, delete_snapshot=False)¶ Unregister an AMI.
Parameters: Return type: Returns: True if successful
-
detach_network_interface
(network_interface_id, force=False)¶ Detaches a network interface from an instance.
Parameters:
-
detach_volume
(volume_id, instance_id=None, device=None, force=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.
Return type: Returns: True if successful
-
disassociate_address
(public_ip=None, association_id=None)¶ Disassociate an Elastic IP address from a currently running instance.
Parameters: Return type: Returns: True if successful
-
enable_volume_io
(volume_id)¶ 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. Return type: bool Returns: True if successful
-
get_all_addresses
(addresses=None, filters=None, allocation_ids=None)¶ 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.
Return type: list of
boto.ec2.address.Address
Returns: The requested Address objects
-
get_all_bundle_tasks
(bundle_ids=None, filters=None)¶ 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.
-
get_all_images
(image_ids=None, owners=None, executable_by=None, filters=None)¶ 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
- 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.
Return type: Returns: A list of
boto.ec2.image.Image
-
get_all_instance_status
(instance_ids=None, max_results=None, next_token=None, filters=None)¶ 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.
Return type: Returns: A list of instances that have maintenance scheduled.
-
get_all_instances
(instance_ids=None, filters=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.
Return type: Returns: A list of
boto.ec2.instance.Reservation
-
get_all_kernels
(kernel_ids=None, owners=None)¶ Retrieve all the EC2 kernels available on your account. Constructs a filter to allow the processing to happen server side.
Parameters: Return type: Returns: A list of
boto.ec2.image.Image
-
get_all_key_pairs
(keynames=None, filters=None)¶ 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.
Return type: Returns: A list of
boto.ec2.keypair.KeyPair
-
get_all_network_interfaces
(filters=None)¶ Retrieve all of the Elastic Network Interfaces (ENI’s) 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. Return type: list Returns: A list of boto.ec2.networkinterface.NetworkInterface
-
get_all_placement_groups
(groupnames=None, filters=None)¶ 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.
Return type: Returns: A list of
boto.ec2.placementgroup.PlacementGroup
-
get_all_ramdisks
(ramdisk_ids=None, owners=None)¶ Retrieve all the EC2 ramdisks available on your account. Constructs a filter to allow the processing to happen server side.
Parameters: Return type: Returns: A list of
boto.ec2.image.Image
-
get_all_regions
(region_names=None, filters=None)¶ 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.
Return type: Returns: A list of
boto.ec2.regioninfo.RegionInfo
-
get_all_reserved_instances
(reserved_instances_id=None, filters=None)¶ Describes Reserved Instance offerings that are available for purchase.
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.
Return type: Returns:
-
get_all_reserved_instances_offerings
(reserved_instances_id=None, instance_type=None, availability_zone=None, product_description=None, filters=None)¶ Describes Reserved Instance offerings that are available for purchase.
Parameters: - reserved_instances_id (str) – Displays Reserved Instances with the specified 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.
Return type: Returns: A list of
boto.ec2.reservedinstance.ReservedInstancesOffering
-
get_all_security_groups
(groupnames=None, group_ids=None, filters=None)¶ 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.
Return type: Returns: A list of
boto.ec2.securitygroup.SecurityGroup
-
get_all_snapshots
(snapshot_ids=None, owner=None, restorable_by=None, filters=None)¶ 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) –
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.
- 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 of
boto.ec2.snapshot.Snapshot
Returns: The requested Snapshot objects
-
get_all_spot_instance_requests
(request_ids=None, filters=None)¶ 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.
Return type: Returns: A list of
boto.ec2.spotinstancerequest.SpotInstanceRequest
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. Return type: dict Returns: A dictionary containing metadata tags
-
get_all_volume_status
(volume_ids=None, max_results=None, next_token=None, filters=None)¶ 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.
Return type: Returns: A list of volume status.
-
get_all_volumes
(volume_ids=None, filters=None)¶ 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.
Return type: list of
boto.ec2.volume.Volume
Returns: The requested Volume objects
-
get_all_zones
(zones=None, filters=None)¶ 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.
Return type: list of
boto.ec2.zone.Zone
Returns: The requested Zone objects
-
get_console_output
(instance_id)¶ Retrieves the console output for the specified instance.
Parameters: instance_id (string) – The instance ID of a running instance on the cloud. Return type: boto.ec2.instance.ConsoleOutput
Returns: The console output as a ConsoleOutput object
-
get_image
(image_id)¶ Shortcut method to retrieve a specific image (AMI).
Parameters: image_id (string) – the ID of the Image to retrieve 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')¶ Gets an attribute from an image.
Parameters: Return type: Returns: An ImageAttribute object representing the value of the attribute requested
-
get_instance_attribute
(instance_id, attribute)¶ Gets an attribute from an instance.
Parameters: Return type: boto.ec2.image.InstanceAttribute
Returns: An InstanceAttribute object representing the value of the attribute requested
-
get_key_pair
(keyname)¶ Convenience method to retrieve a specific keypair (KeyPair).
Parameters: image_id (string) – the ID of the Image to retrieve Return type: boto.ec2.keypair.KeyPair
Returns: The KeyPair specified or None if it is not found
-
get_params
()¶ Returns a dictionary containing the value of of all of the keyword arguments passed when constructing this connection.
-
get_password_data
(instance_id)¶ Get encrypted administrator password for a Windows instance.
Parameters: instance_id (string) – The identifier of the instance to retrieve the password for.
-
get_snapshot_attribute
(snapshot_id, attribute='createVolumePermission')¶ Get information about an attribute of a snapshot. Only one attribute can be specified per call.
Parameters: Return type: list of
boto.ec2.snapshotattribute.SnapshotAttribute
Returns: The requested Snapshot attribute
-
get_spot_datafeed_subscription
()¶ Return the current spot instance data feed subscription associated with this account, if any.
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)¶ 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”, and “Windows”
- availability_zone (str) – The availability zone for which prices should be returned
Return type: Returns: A list tuples containing price and timestamp.
-
get_volume_attribute
(volume_id, attribute='autoEnableIO')¶ Describes attribute of the volume.
Parameters: Return type: list of
boto.ec2.volume.VolumeAttribute
Returns: The requested Volume attribute
-
import_key_pair
(key_name, public_key_material)¶ mports 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: Return type: 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.
-
modify_image_attribute
(image_id, attribute='launchPermission', operation='add', user_ids=None, groups=None, product_codes=None)¶ 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.
-
modify_instance_attribute
(instance_id, attribute, value)¶ 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.
- AttributeName - Expected value (default)
- 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
- RootDeviceName - device name (None)
- SourceDestCheck - Boolean (true)
- GroupSet - Set of Security Groups or IDs
- value (string) – The new value for the attribute
Return type: Returns: Whether the operation succeeded or not
-
modify_snapshot_attribute
(snapshot_id, attribute='createVolumePermission', operation='add', user_ids=None, groups=None)¶ 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’.
-
modify_volume_attribute
(volume_id, attribute, new_value)¶ Changes an attribute of an Volume.
Parameters:
-
monitor_instance
(instance_id)¶ Deprecated Version, maintained for backward compatibility. Enable CloudWatch monitoring for the supplied instance.
Parameters: instance_id (string) – The instance id Return type: list Returns: A list of boto.ec2.instanceinfo.InstanceInfo
-
monitor_instances
(instance_ids)¶ Enable CloudWatch monitoring for the supplied instances.
Parameters: instance_id (list of strings) – The instance ids Return type: list Returns: A list of boto.ec2.instanceinfo.InstanceInfo
-
purchase_reserved_instance_offering
(reserved_instances_offering_id, instance_count=1)¶ 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: Return type: Returns: The newly created Reserved Instance
-
reboot_instances
(instance_ids=None)¶ Reboot the specified instances.
Parameters: instance_ids (list) – The instances to terminate and reboot
-
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)¶ 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.
Return type: Returns: The new image id
-
release_address
(public_ip=None, allocation_id=None)¶ Free up an Elastic IP address.
Parameters: Return type: 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)¶ 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:
- m1.small
- m1.large
- m1.xlarge
- c1.medium
- c1.xlarge
- m2.xlarge
- m2.2xlarge
- m2.4xlarge
- cc1.4xlarge
- t1.micro
- 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 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.
Return type: Returns: The
boto.ec2.spotinstancerequest.SpotInstanceRequest
associated with the request for machines
-
reset_image_attribute
(image_id, attribute='launchPermission')¶ Resets an attribute of an AMI to its default value.
Parameters: Return type: Returns: Whether the operation succeeded or not
-
reset_instance_attribute
(instance_id, attribute)¶ Resets an attribute of an instance to its default value.
Parameters: Return type: Returns: Whether the operation succeeded or not
-
reset_snapshot_attribute
(snapshot_id, attribute='createVolumePermission')¶ Resets an attribute of a snapshot to its default value.
Parameters: Return type: 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)¶ 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
Return type: 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)¶ - 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
Return type: 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)¶ 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
Return type: 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)¶ 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 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
- c1.medium
- c1.xlarge
- m2.xlarge
- m2.2xlarge
- m2.4xlarge
- cc1.4xlarge
- cg1.4xlarge
- cc2.8xlarge
- 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 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.
Return type: Returns: The
boto.ec2.instance.Reservation
associated with the request for machines
-
start_instances
(instance_ids=None)¶ Start the instances specified
Parameters: instance_ids (list) – A list of strings of the Instance IDs to start Return type: list Returns: A list of the instances started
-
stop_instances
(instance_ids=None, force=False)¶ Stop the instances specified
Parameters: Return type: Returns: A list of the instances stopped
-
terminate_instances
(instance_ids=None)¶ Terminate the instances specified
Parameters: instance_ids (list) – A list of strings of the Instance IDs to terminate Return type: list Returns: A list of the instances terminated
-
trim_snapshots
(hourly_backups=8, daily_backups=7, weekly_backups=4)¶ 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 Sunday of each month forever.
Parameters:
-
unmonitor_instance
(instance_id)¶ Deprecated Version, maintained for backward compatibility. Disable CloudWatch monitoring for the supplied instance.
Parameters: instance_id (string) – The instance id Return type: list Returns: A list of boto.ec2.instanceinfo.InstanceInfo
-
unmonitor_instances
(instance_ids)¶ Disable CloudWatch monitoring for the supplied instance.
Parameters: instance_id (list of string) – The instance id 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='')¶ Add a tag to this object. Tag’s 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:
-
remove_tag
(key, value=None)¶ 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, all tags with the specified name will be 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.image¶
-
class
boto.ec2.image.
Image
(connection=None)¶ Represents an EC2 Image
-
deregister
(delete_snapshot=False)¶
-
endElement
(name, value, connection)¶
-
get_kernel
()¶
-
get_launch_permissions
()¶
-
get_ramdisk
()¶
-
remove_launch_permissions
(user_ids=None, group_names=None)¶
-
reset_launch_attributes
()¶
-
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)¶ 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 keypair to run this instance with.
- security_groups –
- user_data –
- daddressing_type –
- instance_type (string) – The type of instance to run. Current choices are: m1.small | m1.large | m1.xlarge | c1.medium | c1.xlarge | m2.xlarge | m2.2xlarge | m2.4xlarge | cc1.4xlarge
- 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 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.
- additional_info (string) – Specifies additional information to make available to the instance(s)
- security_group_ids –
Return type: Returns: The
boto.ec2.instance.Reservation
associated with the request for machines
-
set_launch_permissions
(user_ids=None, group_names=None)¶
-
startElement
(name, attrs, connection)¶
-
update
(validate=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.
-
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 instances current state.
- state_code – An integer representation of the instances 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.
- 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.
- 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.
-
confirm_product
(product_code)¶
-
endElement
(name, value, connection)¶
-
get_attribute
(attribute)¶ 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 sourceDestCheck|groupSet Return type: boto.ec2.image.InstanceAttribute
Returns: An InstanceAttribute object representing the value of the attribute requested
-
get_console_output
()¶ 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)¶ Changes an attribute of this instance
Parameters: - attribute (string) –
The attribute you wish to change.
- AttributeName - Expected value (default)
- 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
- RootDeviceName - device name (None)
- SourceDestCheck - Boolean (true)
- GroupSet - Set of Security Groups or IDs
- value (string) – The new value for the attribute
Return type: Returns: Whether the operation succeeded or not
- attribute (string) –
-
monitor
()¶
-
reboot
()¶
-
reset_attribute
(attribute)¶ 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
()¶ Start the instance.
-
startElement
(name, attrs, connection)¶
-
stop
(force=False)¶ Stop the instance
Parameters: force (bool) – Forces the instance to stop Return type: list Returns: A list of the instances stopped
-
terminate
()¶ Terminate the instance
-
unmonitor
()¶
-
update
(validate=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)¶
-
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)¶
-
boto.ec2.instanceinfo¶
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)¶ 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
-
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.regioninfo¶
-
class
boto.ec2.regioninfo.
EC2RegionInfo
(connection=None, name=None, endpoint=None)¶ Represents an EC2 Region
boto.ec2.reservedinstance¶
-
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.
ReservedInstancesOffering
(connection=None, id=None, instance_type=None, availability_zone=None, duration=None, fixed_price=None, usage_price=None, description=None)¶ -
describe
()¶
-
endElement
(name, value, connection)¶
-
purchase
(instance_count=1)¶
-
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)¶
-
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)¶ 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.
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: - 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://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
- src_group (
boto.ec2.securitygroup.SecurityGroup
orboto.ec2.securitygroup.GroupOrCIDR
) – The Security Group you are granting access to.
Return type: Returns: True if successful.
-
copy_to_region
(region, name=None)¶ 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: Returns: The new security group.
- region (
-
delete
()¶
-
endElement
(name, value, connection)¶
-
instances
()¶ 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)¶ 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)¶
-
startElement
(name, attrs, connection)¶
-
boto.ec2.snapshot¶
Represents an EC2 Elastic Block Store Snapshot
-
class
boto.ec2.snapshot.
Snapshot
(connection=None)¶ -
AttrName
= 'createVolumePermission'¶
-
delete
()¶
-
endElement
(name, value, connection)¶
-
get_permissions
()¶
-
reset_permissions
()¶
-
update
(validate=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.
-
boto.ec2.volume¶
Represents an EC2 Elastic Block Storage Volume
-
class
boto.ec2.volume.
AttachmentSet
¶ -
endElement
(name, value, connection)¶
-
startElement
(name, attrs, connection)¶
-
-
class
boto.ec2.volume.
Volume
(connection=None)¶ -
attach
(instance_id, device)¶ Attach this EBS volume to an EC2 instance.
Parameters: Return type: Returns: True if successful
-
attachment_state
()¶ Get the attachment state.
-
create_snapshot
(description=None)¶ 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
-
detach
(force=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)¶ 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: Return type: list of L{boto.ec2.snapshot.Snapshot}
Returns: The requested Snapshot objects
-
startElement
(name, attrs, connection)¶
-
update
(validate=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.
-
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)¶