AWS Plugin
Get the latest docs
You are looking at documentation for an older release. Not what you want? Go to the current release documentation.
The AWS plugin allows users to use Cloudify to manage cloud resources on AWS. See below for currently supported resource types.
Be aware that some services and resources vary in availability between regions and accounts.
For more information about the library, please refer here.
Plugin Requirements
- Python versions:
- 2.7.x
- AWS account
Compatibility
This version of Cloudify is only compatible with AWS Plugin version 1.3 or later
If you need to use an older AWS Plugin, you can work around this issue in two ways:
- connect to your manager machine and move the file
/etc/cloudify/aws_plugin/bototo/root/boto
or
- In the AWS manager, change this line
aws_config_path: /etc/cloudify/aws_plugin/bototoaws_config_path: /root/boto
The AWS plugin uses the Boto 2.38 client.
Note
This version of Boto EC2 Connection supports (AWS) APIVersion = ‘2014-10-01’. This version of Boto ELB Connecton supports (AWS) APIVersion = ‘2012-06-01’.
Terminology
- VPC is a virtual private cloud, for more info about VPCs refer to AWS Documentation.
- EC2-Classic is the original release of Amazon EC2. With this platform, instances run in a single, flat network that is shared with other customers.
- Region refers to a general geographical area, such as “Central Europe” or “East US”.
availability_zonerefers to one of many isolated locations within a region, such asus-west-1b. When specifying anavailability_zone, you must specify one that is in the region you are connecting to.
Types
The following are node type definitions. Nodes describe resources in your cloud infrastructure. For more information, see node type.
Common Properties
All cloud resource nodes have common properties:
Properties
use_external_resourcea boolean for setting whether to create the resource or use an existing one. See the using existing resources section. Defaults tofalse.resource_idThe ID of an existing resource when theuse_external_resourceproperty is set totrue(see the using existing resources section). Defaults to''(empty string).aws_configa dictionary that contains values you would like to pass to the connection client. For information on values that are accepted, please see boto documentation
Every time you manage a resource with Cloudify, we create one or more clients with AWS API. You specify the configuration for these clients using the aws_config property. It should be a dictionary, with the following values:
Your AWS API access credentials Read more.
aws_access_key_id(required)aws_secret_access_key(required)
Region information:
ec2_region_name(required, except with thecloudify.aws.nodes.ElasticLoadBalancernode type.) This is the EC2 region name, such as ‘us-east-1’. You may also use the word ‘region’ to refer to the same thing.ec2_region_endpoint, the endpoint of the EC2 service, such as ec2.us-east-1.amazonaws.com.elb_region_name(required in thecloudify.aws.nodes.ElasticLoadBalancernode type.) Refers to the ELB region name, and is usually has the same value as yourec2_region_name, ‘us-east-1’, though not interchangeable.elb_region_endpoint, the endpoint of the ELB service, such as elasticloadbalancing.eu-central-1.amazonaws.com.
See the cloudify.datatypes.aws.Config data type definition in the plugin’s plugin.yaml. Note that availability_zone and region are not synonymous, and that availability_zone is not part of the AWS configuration.
cloudify.aws.nodes.Instance
Derived From: cloudify.nodes.Compute
Properties:
parameterskey-value server configuration as described in AWS EC2 Classic.- The public key which is set for the server needs to match the private key name in your AWS account. The public key may be set in a number of ways:
- By connecting the instance node to a keypair node using the
cloudify.aws.relationships.instance_connected_to_keypairrelationship. - By setting it explicitly in the
key_namekey under theparametersproperty. - If the agent’s keypair information is set in the provider context, the agents’ keypair will serve as the default public key to be used if it was not specified otherwise.
- By connecting the instance node to a keypair node using the
- If the server is to have an agent installed on it, it should use the agents security group. If you are using a manager bootstrapped with the standard aws-manager-blueprint, there is a provider context dictionary on the manager that provides this value to the plugin. You can also use other security groups by:
security_groups: list of security group names.security_group_ids: a list of security group IDs.
- If you want to specify the
availability_zonefor your instance, you must use theplacementkey.
- The public key which is set for the server needs to match the private key name in your AWS account. The public key may be set in a number of ways:
image_idThe AMI image id for the instance. For more information, please refer here.instance_typeThe instance type for the instance. For more information, please refer here.nameAllows you to provide a name to your instance. It will be tagged with this name and will show up in your AWS console.
Example
This example shows adding additional parameters, tagging an instance name, and explicitly defining the aws_config.
my_ec2_instance:
type: cloudify.aws.nodes.Instance
properties:
image_id: ami-abcd1234
instance_type: t1.micro
parameters:
placement: us-east-1
name: my_ec2_instance
aws_config:
aws_access_key_id: ...
aws_secret_access_key: ...
ec2_region_name: us-east-1
...
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates the instance.cloudify.interfaces.lifecycle.startstarts the instance, if it’s not already started.cloudify.interfaces.lifecycle.stopstops the instance, if it’s not already stopped.cloudify.interfaces.lifecycle.deletedeletes the instance and waits for termination.cloudify.interfaces.validation.creationsee common validations section. Additionally, the plugin checks to see if the image_id is available to your account.
Attributes:
See the common Runtime Properties section.
The create function also sets reservation_id attribute. For information, see here
Four additional runtime_properties are available on node instances of this type once the cloudify.interfaces.lifecycle.start operation succeeds:
ipthe instance’s private IP.private_dns_namethe instance’s private FQDN in Amazon.public_dns_namethe instances’s public FQDN in Amazon.public_ip_addressthe instance’s public IP address.
Additional
If you want to use the instance in VPC, then you need to connect this to a Subnet using the cloudify.aws.relationships.instance_contained_in_subnet relationship or the cloudify.aws.relationships.instance_connected_to_subnet relationship.
cloudify.aws.nodes.WindowsInstance
Derived From: cloudify.aws.nodes.Instance
Use this type when working with a Windows server. It has the same properties and operations-mapping as cloudify.aws.nodes.Instance, yet it overrides some of the agent and plugin
installations operations-mapping derived from the built-in cloudify.nodes.Compute type.
Additionally, the default value for the use_password property is overridden for this type, and is set to true.
In this case, the password of the windows server will be retrieved, decrypted and put under the password runtime property of this node instance.
cloudify.aws.nodes.KeyPair
Derived From: cloudify.nodes.Root
Properties:
resource_idSpecial behavior: when using a new (not external) security group or key pair, this will become the resource name. See using existing resources section.private_key_pathRequired. The path (on the machine the plugin is running on) where the private key should be stored. Ifuse_external_resourceis set totrue, the existing private key is expected to be at this path.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates the keypair.cloudify.interfaces.lifecycle.deletedeletes the keypair.cloudify.interfaces.validation.creationsee common validations section. Additional validations which take place:- validation for the private key path supplied not to exist if it’s a new keypair resource.
- validation for the private key path supplied to exist and have the correct permissions and/or owner if it’s an existing keypair resource.
Attributes:
See the common Runtime Properties section.
cloudify.aws.nodes.SecurityGroup
Derived From: cloudify.nodes.SecurityGroup
Properties:
resource_idif this is a new resource (use_external_resourceis false), then this will be the name property of the new security group.descriptiona description of the security group.ruleskey-value security group rule configuration as described here. Defaults to[].ip_protocolfrom_portto_portcidr_ipORsrc_group_id.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates the security group, along with its defined rules.cloudify.interfaces.lifecycle.deletedeletes the security group.cloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Additional
Note that if you want to create a security group in a VPC, you need to connect it to a VPC using the cloudify.aws.relationships.security_group_contained_in_vpc relationship.
cloudify.aws.nodes.ElasticIP
Derived From: cloudify.nodes.Root
Properties:
domainnot required, but if you want the Elastic IP allocated in VPC, you need make ‘vpc’ the value of this property.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates the elastic IPcloudify.interfaces.lifecycle.deletedeletes the elastic IPcloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the actual IP is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.Volume
Derived From: cloudify.nodes.Volume
Properties:
sizeThis is the size in GB.zoneAn AWS availability zone, for exampleus-east-1b.deviceA device on the attached instance, for example/dev/xvdf. Note that this must be a valid device name on the OS.
Example
This example shows adding additional parameters, tagging an instance name, and explicitly defining the aws_config.
...
my_instance:
type: cloudify.aws.nodes.Instance
properties:
...
parameters:
placement: us-east-1
...
my_volume:
type: cloudify.aws.nodes.Volume
properties:
size: 2
zone: { get_property: [ my_instance, parameters, placement ] }
device: /dev/xvdf
relationships:
- type: cloudify.aws.relationships.volume_connected_to_instance
target: my_instance
...
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates the volume.cloudify.interfaces.lifecycle.deletedeletes the volume.cloudify.interfaces.validation.creationsee common validations section. Additionally, the plugin checks to see if the image_id is available to your account.cloudify.interfaces.aws.snapshot.createcreates a snapshot of an instance and saves as a volume.
Attributes:
See the common Runtime Properties section.
Additional
This node type requires a relationship to an instance, cloudify.aws.relationships.volume_connected_to_instance. Note that you must provide the instance::properties::parameters::placement, and the value must match the value of the zone property.
cloudify.aws.nodes.VPC
Derived From: cloudify.nodes.Network
For more info on VPC, see here.
Properties:
cidr_blockSet the base CIDR block for your VPC.instance_tenancySet this to “dedicated” if you want your VPC on dedicated hardware - note that Cloudify is not resposible for charges on your account for this.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a VPCcloudify.interfaces.lifecycle.deletedeletes a VPCcloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the VPC’s id in AWS is available via the aws_resource_id runtime-property.
When a VPC is created, it receives several default attachments. We assign a runtime property for original dhcp options set, called default_dhcp_options_id. Note that this is not necessarily the current dhcp options set.
cloudify.aws.nodes.Subnet
Derived From: cloudify.nodes.Subnet
Properties:
cidr_blockSplit your VPC’s CIDR block among many subnets or just one.availability_zonenot required but it is recommended so that you do not rely on AWS to make sure to put all of your resources in the desired availability zone.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a subnetcloudify.interfaces.lifecycle.deletedeletes a subnetcloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the subnet’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.InternetGateway
Derived From: cloudify.aws.nodes.Gateway
Properties:
cidr_blockRoute 0.0.0.0/0 for all internet traffic.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates an internet gatewaycloudify.interfaces.lifecycle.deletedeletes an internet gatewaycloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the internet gateway’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.VPNGateway
Derived From: cloudify.aws.nodes.Gateway
Properties:
availability_zonenot required but it is recommended so that you do not rely on AWS to make sure to put all of your resources in the desired availability zone.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a vpn gatewaycloudify.interfaces.lifecycle.deletedeletes a vpn gatewaycloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the vpn gateway’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.CustomerGateway
Derived From: cloudify.aws.nodes.Gateway
Properties:
typeThe type of tunnel. Default is ‘ipsec.1’.ip_addressYour VPN endpoint’s IP.bgp_asnYour ISP’s autonomous system number.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a customer gatewaycloudify.interfaces.lifecycle.deletedeletes a customer gatewaycloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the customer gateway’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.ACL
Derived From: cloudify.nodes.Root
Properties:
acl_network_entriesA list of of network acl entries. See thecloudify.datatypes.aws.NetworkAclEntryin the plugin.yaml data definitions section for its structure.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a network ACLcloudify.interfaces.lifecycle.deletedeletes a network ACLcloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the network_acl’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.DHCPOptions
Derived From: cloudify.nodes.Root
Properties:
domain_nameThe domain name that you associate with your DCHP.domain_name_serversA list of existing Domain Name Servers’ IP addresses.ntp_serversA list of existing NTP Servers’ IP addresses.netbios_name_serversA list of existing NetBIOS Servers’ IP addresses.netbios_node_typeThe type of Net BIOS.
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a DHCP Options Setcloudify.interfaces.lifecycle.deletedeletes a DHCP Options Setcloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the DHCP Option Set’s id in AWS is available via the aws_resource_id runtime-property.
cloudify.aws.nodes.RouteTable
Derived From: cloudify.nodes.Root
Mapped Operations:
cloudify.interfaces.lifecycle.createcreates a Route Tablecloudify.interfaces.lifecycle.deletedeletes a Route Tablecloudify.interfaces.validation.creationsee common validations section.
Attributes:
See the common Runtime Properties section.
Note that the route_table’s id in AWS is available via the aws_resource_id runtime-property.
Relationships
See relationships.
The following plugin relationship operations are defined in the AWS plugin:
cloudify.aws.relationships.instance_connected_to_elastic_ipThis connects an Instance to an Elastic IP. The source is the instance and the target is the Elastic IP.cloudify.aws.relationships.instance_connected_to_keypairTherun_instancesoperation looks to see if there are any relationships that define a relationship between the instance and a keypair. If so, that keypair will be the keypair for that instance. It inserts the key’s name property in the ‘key_name’ parameter in therun_instancesfunction.cloudify.aws.relationships.instance_connected_to_security_groupTherun_instancesoperation looks to see if there are any relationships that define a relationship between the instance and a security group. If so, that security group’s ID will be the included in the list of security groups in the ‘security_group_ids’ parameter in therun_instancesfunction.cloudify.aws.relationships.instance_contained_in_subnetTherun_instancesoperation looks for any relationships to a Subnet and creates the Instance in that Subnet. Otherwise, the instance is in the EC2 Classic VPC.cloudify.aws.relationships.instance_connected_to_subnetTherun_instancesoperation looks for any relationships to a Subnet and connects the Instance to that Subnet. Otherwise, the instance is connected to the EC2 Classic VPC.cloudify.aws.relationships.instance_connected_to_load_balancerThis registers and EC2 instance with an Elastic Load Balancer.cloudify.aws.relationships.security_group_contained_in_vpcA Security Group is created in EC2 classic unless it has this relationship. Then it will be created in the target VPC.cloudify.aws.relationships.volume_connected_to_instanceThis attaches an EBS volume to an Instance.cloudify.aws.relationships.subnet_contained_in_vpcThis is required, so that when a Subnet is created, the plugin knows which VPC to create the Subnet in.cloudify.aws.relationships.routetable_contained_in_vpcThis is required, so that when a Route Table is created, the plugin knows which VPC to create the Route Table in. A Route Table can be created in only one VPC for its entire lifecycle.cloudify.aws.relationships.routetable_associated_with_subnetA route table can be associated with no more than one subnet at a time.cloudify.aws.relationships.route_table_to_gatewayYou can add multiple routes to route tables. You can add them as arguments to the create operation of the route table. For gateways, this is abstracted into a relationship. This adds a route to the source route table to the destination gateway. The gateway must have acidr_blocknode property.cloudify.aws.relationships.gateway_connected_to_vpcAttach either a VPN gateway or an Internet Gateway to a VPC.cloudify.aws.relationships.network_acl_contained_in_vpcThis is required for Network ACLs. A Network ACL must be contained in a VPC, otherwise the plugin does not know where to put it.cloudify.aws.relationships.network_acl_associated_with_subnetThis associates a Network ACL with a particular Subnet.cloudify.aws.relationships.route_table_of_source_vpc_connected_to_target_peer_vpcThis creates a VPC Peering Connection. A VPC Peering Connection is a connection between two VPCs. However, it requires a Route Table to associate the routes with. This will add routes to the source Route Table and to the Target VPC route table. You should also have acloudify.relationships.depends_onrelationship to the target VPC’s route table, if you have anode_templateto create one.cloudify.aws.relationships.dhcp_options_associated_with_vpcIndicates with VPC to associate a DHCP options set with.cloudify.aws.relationships.customer_gateway_connected_to_vpn_gatewayRepresents a VPC connection between a customer gateway and a VPN Gateway.
Types Common Behaviors
Validations
All types offer the same base functionality for the cloudify.interfaces.validation.creation interface operation:
If it’s a new resource (
use_external_resourceis set tofalse), the basic validation is to verify that the resource doesn’t actually exist.When using an existing resource, the validation ensures that the resource does exist.
Runtime Properties
See section on runtime properties
Node instances of any of the types defined in this plugin get set with the following runtime properties during the cloudify.interfaces.lifecycle.create operation:
aws_resource_idthe AWS ID of the resource
Default Resource Naming Convention
If use_external_resource is set to true in the blueprint, the resource_id must be that resource’s ID in AWS, unless the resource type is a keypair, in which case the value is the key’s name.
Using Existing Resources
It is possible to use existing resources on AWS - whether these have been created by a different Cloudify deployment or not via Cloudify at all.
All Cloudify AWS types have a property named use_external_resource, whose default value is false. When set to true, the plugin will apply different semantics for each of the operations executed on the relevant node’s instances:
This behavior is common to all resource types:
createIfuse_external_resourceis true, the AWS plugin will check if the resource is available in your account. If no such resource is available, the operation will fail, if it is available, it will assign theaws_resource_idto the instanceruntime_properties.deleteIfuse_external_resourceis true, the AWS plugin will check if the resource is available in your account. If no such resource is available, the operation will fail, if it is available, it will unassign the instanceruntime_properties.
The following behaviors are unique:
aws.ec2.instance.startIfuse_external_resourceis true, theruntime_propertiesforpublic_ip_address, etc, are set, and the function exits.aws.ec2.instance.stopIfuse_external_resourceis true, theruntime_propertiesforpublic_ip_address, etc, are unset, and the function exits.cloudify.aws.relationships.instance_connected_to_elastic_ipHere, both the instance’s and theelasticip’suse_external_resourcevalue are relevant. If both are external the function sets the relationship properties. If either are not external the function fails.cloudify.aws.relationships.instance_connected_to_security_groupHere, both the instance’s and the security groups’suse_external_resourcevalue are relevant. If both are external the function sets the relationship properties. If either are not external the function fails.cloudify.aws.relationships.route_table_of_source_vpc_connected_to_target_peer_vpcwill run regardless of whether the source or target node is external.
Account Information
The plugin needs access to your aws_access_key_id and aws_secret_access_key in order to operate. Please read about your AWS Boto configuration here.
Tips
- It is highly recommended to ensure that AWS names are unique. Many operations will fail if you have existing resources with identical names..
- When packaging blueprints for use with a manager the manager will add the following configurations (you can still override them in your blueprint):
aws_configagent_keypairagent_security_group