Amazon Elastic Compute Cloud

8 minute readExtensibilityDeveloper productivity

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers. EC2 allows users to rent virtual computers on which to run their computer applications.

It provides you with complete control of your computing resources and lets you run on the proven Amazon computing environment. Amazon EC2 reduces the time required to obtain and boot new server instances to minutes, allowing you to quickly scale capacity, both up and down, as your computing requirements change. You can create, launch, and terminate server instances as needed, paying by the hour for active servers. EC2 provides developers the tools to build failure resilient applications and isolate them from common failure scenarios.

Amazon EC2 presents a true virtual computing environment, allowing you to use web service interfaces to launch instances with a variety of operating systems, load them with your custom application environment, manage your network access permissions, and run your image using as many or few systems as you want.

  • For more information about Amazon EC2, go to the http://aws.amazon.com/ec2/.

  • You can view the documentation at http://aws.amazon.com/documentation/ec2/.

CloudBees CD/RO integration to EC2 implementations

This plugin uses the Amazon EC2 application programming interface (API) that lets developers choose where their applications physically run and that provides access to infrastructure resources. Using this secure API, your application is automatically scaled up and down as needed. This integration allows CloudBees CD/RO to manage EC2 resources.

The plugin interacts with EC2 data by using PERL to perform the following tasks:

  • Create configurations with connection information.

  • Query for virtual machine and configuration information.

  • Perform actions on instances.

  • Make API Requests.

  • Create CloudBees CD/RO resources.

The integration has two types of procedures to accomplish a specific task:

  • API procedures named API_xxx that directly wrap an EC2 API call

  • Higher-level procedures named EC2_xxx that combine many API calls

The procedure that you select determines which fields are available.

Plugin version 1.0.5.2021101327

Revised on August 20, 2021

Plugin configurations

Plugin configurations are sets of parameters that apply across some or all of the plugin procedures. They reduce repetition of common values, create predefined parameter sets for end users, and securely store credentials where needed. Each configuration is given a unique name that is entered in designated parameters on procedures that use them.

Creating plugin configurations

To create plugin configurations in CloudBees CD, do these steps:

  • Go to Administration Plugins to open the Plugin Manager.

  • Find the EC-AWS-EC2-1.0.5.2021101327 row.

  • Click Configure to open the Configurations page.

  • Click Create Configuration as per the description of parameters below.

Configuration procedure parameters

ParameterDescription

Configuration Name

The name for the created configuration

Description

Description for the configuration

Region

AWS Region to work with. See the list of available regions here .

Authorization Type

Choose the authorization type.

basic - requires Access Key ID and Key Secret

sts - requires Access Key ID, Secret and the Role ARN.

Role ARN

The Amazon Resource Name (ARN) of the role to assume.

AWS Credentials

Basic AWS credentials: Access Key ID and Secret.

Session Token

Session token to use with Access Key ID and the Secret.

Check Connection?

If checked, the connection endpoint and credentials entered as part of the configuration will be tested. If this option is checked, configuration will not be saved if the test fails.

Debug Level

This option sets debug level for logs. If info is selected, only summary information will be shown, for debug, there will be some debug information and for trace the whole requests and responses will be shown.

Plugin procedures

API_AllocateIP

Allocate an Elastic IP

API_AllocateIP parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Results Location

Where to put the result. If not specified, the result is only printed.

API_AssociateIP

Associate an Elastic IP to an instance

API_AssociateIP parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instance ID

The instance to be associated with an IP

IP

The Elastic IP (public IP address, e.g. 52.71.234.249) to associate to an instance

API_AttachVolumes

Attach a list of volumes to a list of instances

API_AttachVolumes parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Device

How the device is exposed to the instance.

List of Instances

The instances to which the volumes will be attached.

List of Volumes

The volumes that will be attached to the instances.

API_CreateImage

Make a copy of an EBS instance

API_CreateImage parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instance

The instance to duplicate.

New Image Name

The new name for the created image.

New Image Description

The description for the new image.

No Reboot

By default, this parameter is set to false, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When the parameter is set to true, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.

Results Location

Where to put the result. If not specified, the result is only printed.

Wait for Image?

If checked, will wait for the image to become available.

API_CreateTags

Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources

API_CreateTags parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Resources

The space separated list of resource IDs.

Tags

The comma separated list of key-value (key ⇒ value, key2 ⇒ value2)

API_DescribeInstances

Describe one or more instances

API_DescribeInstances parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instances

A list of instances or reservations to list.

Results Location

Where to put the result. If not specified, the result is only printed and saved to the output parameter.

Output parameters

ParameterDescription

instances

JSON representation of instances.

API_ReleaseIP

Release an Elastic IP address

API_ReleaseIP parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

IP

The Elastic IP (public IP address, e.g. 52.71.234.249) to release.

API_RunInstances

This procedure provisions one or several EC2 instances and creates resources for them.

API_RunInstances parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

AMI

The Amazon Image ID (AMI) of the image to deploy.

Availability Zone

The Availability Zone you want to launch the instance into.

Name

Name for the instance.

Instance Type

The instance type. For more information, see Instance Types .

Subnet ID

The ID of the subnet to launch the instance(s) into (for use with VPCs)

Security Group

Key Name

The name of the keypair to use for the instance.

Initiated Shutdown Behaviour

Specify the instance behaviour when an OS-level shutdown is performed.Instance can be either terminated or shut down.

IAM Profile Name

If specified, new instance will be associated with given IAM profile.

Private IP

The primary IP address. You must specify a value from the IP address range of the subnet.If no value is supplied then IP address from the IP address range of the subnet is selected.(for use with VPCs)

Tenancy

Each instance that you launch into a VPC has a tenancy attribute. This attribute has the following values: default - Your instance runs on shared hardware. dedicated - Your instance runs on single-tenant hardware. host - Your instance runs on a Dedicated Host, which is an isolated server with configurations that you can control.

User Data

Extra user data to pass into runInstance.

Number of Instances

The number of instances to start.

Resource Pool

If you would like to add CloudBees CD resources for each instance created, enter the CloudBees CD pool name for the new resource. If left blank no resource will be created.

Use Private IP?

If checked, private IP will be used for the resource creation.

Resource Port

If you specify a resource pool name in 'Resource Pool' field, this is the port that will be used when creating the resource. If no value is specified, port 7800 will be used by default when creating the resource.

Resource Workspace

If you specify a resource pool name in 'Resource Pool' field, this is the workspace that will be used when creating the resource.

Resource Zone Name

Created resource will belong to the specified zone. Zone 'default' is used by default.

Ping Resource?

If checked, the resource will be pinged after the creation.

Result Property Sheet

Property path to store results

API_StartInstance

Start instance

API_StartInstance parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instances IDs

Instances IDs, newline-separated.

Wait for Instances?

If checked, the procedure will check the instances statuses and will finish when the instances are stopped.

Results Location

Where to put the result. If not specified, the result is only printed and saved to the output parameter.

Output parameters

ParameterDescription

instances

JSON representation of the instances details.

API_StopInstance

Stops a single or multiple instances.

API_StopInstance parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instances IDs

Instances IDs, newline-separated.

Wait for Instances?

If checked, the procedure will check the instances statuses and will finish when the instances are stopped.

API_TearDownResource

Terminates resources created with this plugin.

API_TearDownResource parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Resource Name

Resource or Resource Pool name to delete.

API_Terminate

Terminate an instances

API_Terminate parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instance IDs

If this is an instance id, terminate that one instance. If this is a reservation id, terminate all instances in the reservation. Multiple instance IDs are separated by a semicolon.

Resources

List of resources to be deleted.

Wait for Instances?

If checked, the procedure will wait until the instances are terminated.

Execute API Request

This procedure executes custom Query API request to the specified service that supports Query API (except S3)

Execute API Request parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Host

Host of the AWS Service to use, e.g. ec2.amazonaws.com. If host is not provided, it will be derived from the service name.

Service Name

Service name to use, e.g. ec2.

API Version

API Version to use, e.g. 2016-11-15.

Action

Action to perform, e.g. DescribeInstances. See list of actions in Operation List .

Headers

A set of headers, in key=value pairs or in JSON map.

Query

Query parameters, key=value pairs or JSON map.

Path

Path to use. Default is "/".

Output parameters

ParameterDescription

result

The returned response from the service (in XML format).

Snap Attached Volume

This procedure creates a new snapshot from a volume attached to an instance. It only creates a snapshot from the first volume found.

Snap Attached Volume parameters

ParameterDescription

Configuration Name

Previously defined configuration for the plugin

Instance

Instance ID of a running EC2 instance

Results Location

Where to put the result. If not specified, the result is only printed.

Volume Id

The volume ID to be snapped. Separate list of volume id’s with semi-colons.

The plugin requires 10.1 version of CloudBees CD/RO agent in order to work. The agent contains the upgraded libraries versions.

The previous version of this plugin, EC-EC2, is deprecated. This new plugin backward compatible, interface-wise. In order to switch an existing automation to use this plugin, you can change the plugin name in the DSL of the existing declaration, for example:

resourceTemplate 'amazonEC2-ResourceTemplate', {
    cloudProviderParameter = [
        'config': 'ec2config',
        'count': '1',
        'group': 'PROVIDE SECURITY GROUP',
        'image': 'PROVIDE IMAGE NAME',
        'instanceInitiatedShutdownBehavior': '',
        'instanceType': 'PROVIDE INSTANCE TYPE',
        'keyname': 'PROVIDE KEY NAME',
        'privateIp': '',
        'propResult': '',
        'res_poolName': '',
        'res_port': '',
        'res_workspace': '',
        'resource_zone': 'default',
        'subnet_id': 'PROVIDE SUBNET ID',
        'use_private_ip': '0',
        'userData': '',
        'zone': 'PROVIDE AVAILABILITY ZONE',
    ]
    cloudProviderPluginKey = 'EC-EC2' // replace with 'EC-AWS-EC2'
    cloudProviderProcedure = 'API_RunInstances'
  // Custom properties

  property 'ec_cloud_plugin_parameter', {

    // Custom properties
    config = 'ec2config'
    count = '1'
    group = 'PROVIDE SECURITY GROUP'
    image = 'PROVIDE IMAGE NAME'
    instanceInitiatedShutdownBehavior = ''
    instanceType = 'PROVIDE INSTANCE TYPE'
    keyname = 'PROVIDE KEY NAME'
    privateIp = ''
    propResult = ''
    res_poolName = ''
    res_port = ''
    res_workspace = ''
    resource_zone = 'default'
    subnet_id = 'PROVIDE SUBNET ID'
    use_private_ip = '0'
    userData = ''

    property 'zone', value: 'PROVIDE AVAILABILITY ZONE', {
      expandable = '1'
      suppressValueTracking = '0'
    }
  }
}

Third-party dependencies

ModuleLicense

com.typesafe.netty:netty-reactive-streams:2.0.5

Apache License, Version 2.0

com.typesafe.netty:netty-reactive-streams-http:2.0.5

Apache License, Version 2.0

io.netty:netty-buffer:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-codec:4.1.68.Final

Apache License, Version 2.0

io.netty:netty-codec-http:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-codec-http2:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-common:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-handler:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-resolver:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-transport:4.1.68.Final

Apache License, Version 2.0

io.netty:netty-transport-native-epoll:4.1.69.Final

Apache License, Version 2.0

io.netty:netty-transport-native-unix-common:4.1.69.Final

Apache License, Version 2.0

org.reactivestreams:reactive-streams:1.0.3

CC0

org.slf4j:slf4j-api:1.8.0-beta4

MIT License

software.amazon.awssdk:annotations:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:apache-client:2.13.58

Apache License, Version 2.0

software.amazon.awssdk:auth:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:aws-core:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:aws-query-protocol:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:ec2:2.13.58

Apache License, Version 2.0

software.amazon.awssdk:http-client-spi:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:json-utils:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:metrics-spi:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:netty-nio-client:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:profiles:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:protocol-core:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:regions:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:sdk-core:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:sts:2.13.58

Apache License, Version 2.0

software.amazon.awssdk:third-party-jackson-core:2.17.58

Apache License, Version 2.0

software.amazon.awssdk:utils:2.17.58

Apache License, Version 2.0

software.amazon.eventstream:eventstream:1.0.1

Apache License, Version 2.0

Release notes

EC-AWS-EC2 1.0.3

  • Upgraded third-party dependencies.

EC-AWS-EC2 1.0.2

  • Upgraded third-party dependencies.

EC-AWS-EC2 1.0.1

  • Added known issues section to the documentation.

EC-AWS-EC2 1.0.0

  • First release.