Orchestration Amazon EC2 Activities

From ServiceNow Wiki
Home > Deliver > IT Operations Management > Orchestration > Orchestration Activities > Orchestration Amazon EC2 Activities
Jump to: navigation, search
Discovery
Orchestration
Related Topics
Get the Book
Knowledge.gif Discovery
Knowledge.gif Data Collected by Discovery
Knowledge.gif Orchestration for VMWare

1 Overview

Orchestration - Amazon EC2 adds these activities for use in workflows. For the list of all Orchestration activities, see Orchestration Activities.

2 Determining EC2 Activity Result Values

EC2 activities use a REST message to communicate with Amazon. All EC2 activities set their activity.result value based on the response code returned by this REST message. If the response code indicates an error, or if there is a REST fault, the activity result value is failure. If the REST message does not return an error code or a REST fault, the activity result value is success. For more information about activity.result, see Using the Activity Result Value.

EC2 activities used SOAP messages instead of REST messages prior to the Eureka release. For more information about upgrading from SOAP to REST, see Upgrading with Cloud Provisioning.

3 Change State

The Change State activity sends commands to an EC2 instance to start, stop, or reboot the instance. If the virtual machine is already in the specified state, the activity does not alter the instance. This activity is available starting with the Calgary release.

Note
Note: The Change State activity can reboot all EC2 instances, but can only start and stop Amazon Elastic Block Store (EBS) volumes.


3.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
instances An array of instance objects. Each object contains:
  • instance_id: the EC2 instance ID.
  • instance_state: an EC2 status code:
    • 0: Pending
    • 16: Running
    • 32: Shutting down
    • 48: Terminated
    • 64: Stopping
    • 80: Stopped
  • instance_xml: the raw XML returned by Amazon.

3.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Select the name of the Amazon EC2 account from which this instance was created.
Action One of the following state changes:
Instances Amazon EC2 instances whose state you want to change. Define multiple instances with a comma-delimited list of instance IDs. If one instance in a list of instances fails, the entire request fails. For example, if you attempt to stop 5 instances, and one instance is not an EBS volume, none of the instances will stop.
Region Amazon EC2 region that is hosting the instance. Access a scratchpad pad variable for the region by adding ${workflow.scratchpad.region} to the field.
Sensor script The script to execute after the request is made and a response is received. You can access the full XML response body from the activity.output object. The script also populates the instances variable.

4 Create Tag

The Create Tag activity adds private tags to an EC2 instance to simplify the administration of your EC2 environment. This metadata consists of case-sensitive key/value pairs that you can use to create user-friendly names. For example, you can define a tag with key = Name and value = Webserver. You can add up to 10 unique keys to each instance with an optional value for each key. For more information, see Tagging Your Amazon EC2 Resources

4.1 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the Amazon EC2 account from which this instance was created.
Region Amazon EC2 region that is hosting the instance. Access a scratchpad pad variable for the region by entering ${workflow.scratchpad.region} in the field.
Instances List of Amazon EC2 instances to tag. Define multiple instances with a comma-delimited list of instance IDs. If one instance in the list fails, the entire request fails.
Tag Key Key for the EC2 instance tag, which allows up to 128 characters and can be any string. Do not use the aws: prefix in your tag names. This prefix is reserved for Amazon Web Services use. Remember that all tag keys are case sensitive.
Tag Value Value of EC2 instance tag, which allows up to 256 characters and can be any string value. Do not use the aws: prefix in your tag values. This prefix is reserved for Amazon Web Services use. Remember that all tag values are case sensitive.

5 Describe Images

The Describe Images activity retrieves information about one or more Amazon machine images (AMI) visible to the specified account. This activity also retrives information about all public Amazon images, account-owned images, and images from specified shared accounts.

5.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
images An array of image objects. Each object in the array contains:
  • image_id: the image's AMI ID.
  • name: image name.
  • image_state: image availability.
  • architecture: the processor architecture of the image, typically i386 or x86_64.
  • platform: the operating system of the image, Windows or Linux. Available starting with the Calgary release.
  • ramdisk_id: the disk ID of the RAM.
  • kernel_id: the image kernel ID.
  • root_device_type: root device type, typically EBS or instance store.
  • virtualization: virtualization type, typically paravirtual or HVM (hardware virtual machine). Available starting with the Calgary release.
  • image_xml: raw XML returned by the API call for the image.

5.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account from which to retrieve image information.
Region Endpoint of the Amazon-defined region from which to retrieve the image information.
Image The retrieved image's ID that starts with ami-. If this field is blank, information about all images visible to the account is retrieved.
Sensor script The script to execute after the request is made and a response is received. The activity stores image information in an the images scratchpad variable.

6 Describe Instances

The Describe Instances activity retrieves information about a single instance or all instances associated with the given EC2 account and region.

6.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
instances An array of instance objects. Each object in the array contains:
  • instance_id: ID of the running instance.
  • private_dns: private DNS, accessible only from within the EC2 region in which the instance is running.
  • dns: public DNS, accessible from any computer on the Internet.
  • ip_address: public IP address for the instance.
  • instance_state: state of the instance:
    • 0: Pending
    • 16: Running
    • 32: Shutting down
    • 48: Terminated
    • 64: Stopping
    • 80: Stopped
  • instance_xml: the raw XML returned by Amazon.

6.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account from which to retrieve instance information.
Region Endpoint of the Amazon-defined region from which to retrieve the instance information.
Instance The ID of a single instance from which to retrieve information. This variable is deprecated in the Calgary release, use the Instances variable instead.
Instances The comma separated IDs of the instances to describe. If this variable is blank, ServiceNow returns information about all instances on this account.
Sensor script The script to execute after the request is made and a response is received. The activity stores instance information in the instances scratchpad variable.

7 Describe KeyPairs

The Describe KeyPairs activity retrieves information about the key pairs defined in the specified EC2 account. These key pairs can later be used with Run Instances to start instances.

7.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
keyPairs An array of key pairs. Each object in the array contains:
  • name: name given to the key pair when it was created in the account.
  • fingerprint: public key fingerprint of the key pair.

7.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account from which to retrieve key pair information.
Region Endpoint of the Amazon-defined region from which to retrieve the key pairs.
Sensor script The script to execute after the request is made and a response is received. The information about the key pairs is stored in the keyPairs scratchpad variable.

8 Describe Regions

The Describe Regions activity retrieves all the region endpoints defined by Amazon.

8.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
regions An array of regions. Each object in the array contains:
  • name: region's name.
  • endpoint: region's endpoint.

8.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account from which to retrieve region information.
Sensor script The script to execute after the request is made and a response is received. The activity store region information in the regions scratchpad variable.

9 Run Instances

The Run Instances activity launches a specified number of instances of an image.

9.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
instances An array of instance objects. Each object in the array contains:
  • instance_id: ID of the running instance.
  • private_dns: private DNS, accessible only from within the EC2 region where the instance is running.
  • dns: public DNS, accessible from any computer on the Internet.
  • ip_address: public IP address for the instance.
  • instance_state: state of the instance:
    • 0: Pending
    • 16: Running
    • 32: Shutting down
    • 48: Terminated
    • 64: Stopping
    • 80: Stopped
  • instance_xml: the raw XML returned by Amazon.

9.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account in which the instances are launched. This account is charged for the length of time the instances are running.
User data [Optional] Metadata that defines bootstrap behavior when launching EC2 virtual machines. For information about using this parameter, see the Amazon EC2 Instance Metadata and User Data documentation. This variable is available starting with the Eureka release.
Image AMI ID of the image used to launch the instance.
Minimum Count The minimum number of instances Amazon must launch for this request to be successful. If Amazon cannot launch this number of instances, no instances are launched.
Maximum Count The maximum number of instances Amazon should launch for this request, up to the maximum number allowed for the specified account.
Instance type The instance type. The valid values are:
  • t1.micro
  • m1.small
  • m1.medium
  • m1.large
  • m1.xlarge
  • c1.medium
  • c1.xlarge
  • m2.xlarge
  • m2.2xlarge
  • m2.4xlarge
  • m3.xlarge
  • m3.2xlarge
  • hi1.4xlarge
  • cc1.4xlarge
  • cg1.4xlarge
  • cc2.8xlarge
Sensor script The script to execute after the request is made and a response is received. The activity stores instance information in the instances scratchpad variable.

10 Terminate Instances

The Terminate Instances activity terminates one or more instances in the specified region of the given EC2 account.

10.1 Scratchpad Entries

The activity writes this data to the workflow scratchpad.

Variable Description
instances An array of instance objects. Each object in the array contains:
  • instance_id: ID of the running instance.
  • private_dns: wmpty string, because a terminated instance does not have a private DNS.
  • dns: empty string, because a terminated instance does not have a public DNS.
  • ip_address: empty string because a terminated instance does not have an IP address.
  • instance_state: state of the instance:
    • 0: Pending
    • 16: Running
    • 32: Shutting down
    • 48: Terminated
    • 64: Stopping
    • 80: Stopped
  • instance_xml: the raw XML returned by Amazon.

10.2 Input Variables

These variables determine the behavior of the activity.

Field Description
Account Name of the account in which the instance will be terminated
Region Endpoint of the Amazon-defined region in which the instance will be terminated.
Instance The ID of a single instance to terminate. This variable is deprecated in the Calgary release, and this ID must be put in the Instances variable.
Instances The comma separated IDs of the instances to terminate. If this variable is blank, there are no instances to terminate and the activity returns an error.
Sensor script The script to execute after the request is made and a response is received. The activity stores instance information in the instances scratchpad variable.
Was this article helpful?
Yes, I found what I needed
No, I need more assistance