cloudmesh.aws.compute.Provider
¶
Module Contents¶
Classes¶
-
class
cloudmesh.aws.compute.Provider.
Provider
(name=None)¶ Bases:
cloudmesh.abstract.ComputeNodeABC.ComputeNodeABC
,cloudmesh.provider.ComputeProviderPlugin
-
kind
= aws¶
-
sample
= cloudmesh: cloud: {name}: cm: active: true heading: AWS host: TBD label: {name} kind: aws version: TBD service: compute default: image: ami-0c929bde1796e1484 size: t2.medium username: ec2-user credentials: region: {region} EC2_SECURITY_GROUP: cloudmesh EC2_ACCESS_ID: {EC2_ACCESS_ID} EC2_SECRET_KEY: {EC2_SECRET_KEY} EC2_PRIVATE_KEY_FILE_PATH: ~/.cloudmesh/aws_cert.pem EC2_PRIVATE_KEY_FILE_NAME: aws_cert¶
-
output
¶
-
Print
(self, data, output, kind)¶
-
find
(self, elements, name=None)¶
-
list_secgroups
(self, name=None)¶ List the named security groups
- Parameters
name – Name of the security group. If not provided, returns all security group
- Returns
List of dict
-
list_secgroup_rules
(self, name=None)¶ List the named security group
- Parameters
name – The name of the group, if None all will be returned
- Returns
returns list of dict
-
static
_is_group_name_valid
(name=None)¶
-
add_secgroup
(self, name=None, description=None)¶ Adds named security group
- Parameters
name – Adds security group
description – name = name of the security group to be added/created description: Description of the security group. If its none then default description is added with user name and time of creation
- Returns
None
-
add_secgroup_rule
(self, name=None, port=None, protocol=None, ip_range=None)¶ Add rule to named security group
- Parameters
name – Name of the security group to which rfule needs to be added
port – The start and end port range for the TCP and UDP protocols
protocol –
ip_range –
- Returns
-
remove_secgroup
(self, name=None)¶
-
upload_secgroup
(self, name=None)¶
-
add_rules_to_secgroup
(self, name=None, rules=None)¶
-
remove_rules_from_secgroup
(self, name=None, rules=None)¶
-
set_server_metadata
(self, name, **metadata)¶ sets the metadata for the server
- Parameters
name – virtual machine name
metadata – cm dict
- Returns
Describes the metadata tag of EC2 resource :param name: Virtual machine name
- Returns
Dictionary with Metadata information
-
get_server_metadata
(self, name)¶ Describes the metadata tag of EC2 resource :param name: Virtual machine name
- Returns
Dictionary with Metadata information
-
list_public_ips
(self, ip=None, available=False)¶ Lists the public ip addresses.
- Parameters
available – if True only those that are not allocated will be returned.
- Returns
-
delete_public_ip
(self, ip=None)¶ Deletes the ip address
- Parameters
ip – the ip address, if None than all will be deleted
- Returns
-
create_public_ip
(self)¶ Creates a new public IP address to use
- Returns
The ip address information
-
find_available_public_ip
(self)¶ Returns a single public available ip address.
- Returns
The ip
-
static
_get_allocation_ids
(client, ip)¶
-
attach_public_ip
(self, node=None, ip=None)¶ adds a public ip to the named vm
- Parameters
name – Name of the vm
ip – The ip address
- Returns
-
detach_public_ip
(self, node=None, ip=None)¶ adds a public ip to the named vm
- Parameters
name – Name of the vm
ip – The ip address
- Returns
-
wait
(self, vm=None, interval=None, timeout=None)¶ wais till the given VM can be logged into
- Parameters
vm – name of the vm
interval – interval for checking
timeout – timeout
- Returns
-
ssh
(self, vm=None, command=None)¶
-
static
_get_instance_id
(ec2_resource, name)¶
-
start
(self, name=None)¶ start a node
- Parameters
name – the unique instance name
- Returns
The dict representing the node
-
stop
(self, name=None, hibernate=False)¶ stops the node with the given name
- Parameters
name – the instance name
hibernate – stop or hibernate
- Returns
The dict representing the node including updated status
-
info
(self, name=None)¶ gets the information of a node with a given name
- Parameters
name – the node name
- Returns
The dict representing the node including updated status
-
_instance_is_reachable
(self, instance_id=None)¶ gets the information of a statuso of a VM with a given name, useful for when you want to check if the vm is ready for ssh Note: describe_instance_status doesn’t filter by tag , so we should use instance ID
previously name was used. Figure out what shoudl be documented an if it is in compliance
- Parameters
instance_id –
- Returns
-
list
(self)¶ list all nodes id
- Returns
an array of dicts representing the nodes
-
suspend
(self, name=None)¶ suspends the node with the given name
- Parameters
name – the name of the node
- Returns
The dict representing the node
-
resume
(self, name=None)¶ resume the named node
- Parameters
name – the name of the node
- Returns
the dict of the node
-
destroy
(self, name=None)¶ Destroys the node :param name: the name of the node
- Returns
the dict of the node
-
create
(self, name=None, image=None, size=None, location=None, timeout=360, key=None, secgroup=None, ip=None, user=None, public=None, group=None, metadata=None, **kwargs)¶ creates a named node
- Parameters
name – the name of the node
image – the image used
size – the size of the image
ip – The ip to attach to the vm
key – the name of the key
timeout – a timeout in seconds that is invoked in case the image does not boot. The default is set to 3 minutes.
user – user name
public – public IP
group – group name
metadata – cm metadata
secgroup – security group
location – location
kwargs – additional arguments passed along at time of boot
- Returns
the list with the modified dicts
-
rename
(self, name=None, destination=None)¶ rename a node
- Parameters
destination – the destination name
name – the current name
- Returns
the dict with the new name
-
keys
(self)¶ Lists the keys on the cloud
- Returns
dict
-
key_upload
(self, key=None)¶ uploads the key specified in the yaml configuration to the cloud :param key :return: the dict of the key
-
key_delete
(self, name=None)¶ deletes the key with the given name
- Parameters
name – The name of the key
- Returns
the dict of the key
-
add_server_metadata
(self, name, tags)¶ Add or Update tag to metadata
- Parameters
name – name of the fm
tags – tags to be added to vm metadata
- Returns
the dict of the metadata
-
delete_server_metadata
(self, name, tags=None)¶ gets the metadata for the server
- Parameters
name – name of the vm
tags – tags to be deleted from vm metadata
- Returns
the dict of the metadata
-
_get_account_id
(self)¶ retrieves the acount id which is used to find the images of the current account
- Returns
-
images
(self, **kwargs)¶ Lists the images on the cloud
- Returns
the dict of the images
-
get_images_and_import
(self, data)¶ this is a helper function for images() to allow the images to be passed and saved to the database with databaseimportasjson() decorator instead of the regular databaseupdate() decorator.
- Parameters
data –
- Returns
-
image
(self, name=None)¶ Gets the image with a given nmae
- Parameters
name – The name of the image
- Returns
the dict of the image
-
flavors
(self, **kwargs)¶ Lists the flavors on the cloud
- Returns
dict of flavors
-
flavor
(self, name=None)¶ Gets the flavor with a given name :param name: The name of the flavor :return: The dict of the flavor
-
update_dict
(self, elements, kind=None)¶ This function adds a cloudmesh cm dict to each dict in the list elements. Libcloud returns an object or list of objects With the dict method this object is converted to a dict. Typically this method is used internally.
- Parameters
elements – the list of original dicts. If elements is a single dict a list with a single element is returned.
kind – for some kinds special attributes are added. This includes key, vm, image, flavor.
- Returns
The list with the modified dicts
-
-
cloudmesh.aws.compute.Provider.
provider
¶