laniakea.core.providers.ec2 package¶
Submodules¶
Amazon Elastic Cloud Computing API
-
class
laniakea.core.providers.ec2.manager.
EC2Manager
(images)¶ Bases:
object
Amazon Elastic Cloud Computing manager class.
-
cancel_spot_requests
(requests)¶ Cancel one or more EC2 spot instance requests.
Parameters: requests (list) – List of EC2 spot instance request IDs.
-
check_spot_requests
(requests, tags=None)¶ Check status of one or more EC2 spot instance requests.
Parameters: - requests (list) – List of EC2 spot instance request IDs.
- tags (dict) –
Returns: List of boto.ec2.instance.Instance’s created, order corresponding to requests param (None if request still open, boto.ec2.instance.Reservation if request is no longer open)
Return type: list
-
connect
(region, **kw_params)¶ Connect to a EC2.
Parameters: - region (str) – The name of the region to connect to.
- kw_params (dict) –
-
create_on_demand
(instance_type='default', tags=None, root_device_type='ebs', size='default', vol_type='gp2', delete_on_termination=False)¶ Create one or more EC2 on-demand instances.
Parameters: - size (int) – Size of root device
- delete_on_termination (boolean) –
- vol_type (str) –
- root_device_type (str) – The type of the root device.
- instance_type (str) – A section name in amazon.json
- tags (dict) –
Returns: List of instances created
Return type: list
-
create_spot
(price, instance_type='default', tags=None, root_device_type='ebs', size='default', vol_type='gp2', delete_on_termination=False, timeout=None)¶ Create one or more EC2 spot instances.
Parameters: - root_device_type –
- size –
- vol_type –
- delete_on_termination –
- timeout –
- price (float) – Max price to pay for spot instance per hour.
- instance_type (str) – A section name in amazon.json
- tags (dict) –
Returns: List of instances created
Return type: list
-
create_spot_requests
(price, instance_type='default', root_device_type='ebs', size='default', vol_type='gp2', delete_on_termination=False, timeout=None)¶ Request creation of one or more EC2 spot instances.
Parameters: - size –
- vol_type –
- delete_on_termination –
- root_device_type (str) – The type of the root device.
- price (float) – Max price to pay for spot instance per hour.
- instance_type (str) – A section name in amazon.json
- timeout (int) – Seconds to keep the request open (cancelled if not fulfilled).
Returns: List of requests created
Return type: list
-
find
(instance_ids=None, filters=None)¶ Flatten list of reservations to a list of instances.
Parameters: - instance_ids (list) – A list of instance ids to filter by
- filters (dict) – A dict of Filter.N values defined in http://goo.gl/jYNej9
Returns: A flattened list of filtered instances.
Return type: list
-
resolve_image_name
(image_name)¶ Look up an AMI for the connected region based on an image name.
Parameters: image_name (str) – The name of the image to resolve. Returns: The AMI for the given image. Return type: str
-
retry_on_ec2_error
(func, *args, **kwargs)¶ Call the given method with the given arguments, retrying if the call failed due to an EC2ResponseError. This method will wait at most 30 seconds and perform up to 6 retries. If the method still fails, it will propagate the error.
Parameters: func (function) – Function to call
-
stop
(instances, count=0)¶ Stop each provided running instance.
Parameters: - count –
- instances (list) – A list of instances.
-
terminate
(instances, count=0)¶ Terminate each provided running or stopped instance.
Parameters: - count –
- instances (list) – A list of instances.
-
-
exception
laniakea.core.providers.ec2.manager.
EC2ManagerException
¶ Bases:
Exception
Exception class for Azure Manager.
Module contents¶
Amazon Elastic Cloud Computing CLI
-
class
laniakea.core.providers.ec2.
Ec2CommandLine
¶ Bases:
object
Sub command-line interface for the Amazon EC2 provider.
-
HOME
= '/home/travis/build/MozillaSecurity/laniakea/laniakea/core/providers/ec2'¶
-
VERSION
= 0.8¶
-
classmethod
add_arguments
(subparsers, dirs)¶ Argument parser of this module.
-
classmethod
main
(args, settings=None, userdata=None)¶
-