EC2 Start Instance

Objective

The goal of the tutorial is to start the AWS EC2 Instance(s). This automation includes:

  • Start the Virtual Machine using One or more Instance Id(s) using AWS CLI.

We will walk through each of the FlexDeploy features that will be created/configured to accomplish this goal and start the Instance in a very short amount of time.

Checklist

Checklist

Description

Checklist

Description

AWS Access Key

The access key found on the "Security Credentials" page of the AWS management console.

AWS Secret Key

The secret key found on the "Security Credentials" page of the AWS management console.

AWS Default Region

The default region found on the top right corner of the AWS management console.

Instance Id(s)

Provide either comma or space-separated IDs of the instances to start.

AWS CLI installation

AWS CLI needs to be installed where the plugin operation shall run (e.g. FlexDeploy server)

AWS CLI in class path

AWS CLI should be added to class path on the FlexDeploy Server. Else the path can also be set under FlexDeploy environment level property.

Configure cloud account

First, an AWS account needs to be configured under Integrations. FlexDeploy will connect to the AWS account with provided details and starts the Instance(s).

  1. Select Integrations from the Menu.

  2. Navigate to the Cloud tab from the left-hand pane.

  3. Create a new Cloud account of the provider type “AWS” with the “+ Create” button.

It should have a AWS Access Key, AWS Secret Key, and AWS Default Region to be configured in it. The AWS Access Key must have relevant access to Start/Stop the Instance(s).

  1. Secret Key is a password field and hence needs to be kept hidden. To update the same click on the pencil icon as shown below

  2. Update the Secret Key value under Secret Text. This is to make sure no one else can retrieve the password

After saving the credential, click on Save on the cloud instance. Test connection will not work for the AWS cloud.

Utility Workflow

Navigate to the Workflows tab and create a workflow using the “+”(Click to create new Workflow) button

Next, create one Utility workflow as shown below. The workflow Type field defines the type of workflow.

Utility Workflow

  1. Navigate to the Workflows tab

  2. Select the “+” button from the left-hand pane to create a new workflow with type as Utility.

The Workflow Group and Subgroup define the folder hierarchy. Once the workflow is created, it should look like the below. No constraint on workflow or folder naming convention.

Create a workflow property with Project scope as shown below:

  1. Go back to the Main tab of the Workflow.

  2. Under Workflow Properties, choose open the Add menu.

  3. From the Add menu, we can add an existing property, or create a new one. Select New Property.

  4. Properties must each have a unique code, give a meaningful code for the new property.

  5. A property display name does not have to be unique and can contain spaces. This is the name that will be displayed on the Project Properties screen

  6. Select the property scope, this defines where the property will be configured. We're using Project scope.

  7. Enter a good description for the property, this will make configuration easier in the future

Now, configure the code, display name, property scope and other details as follows and make sure to save the workflow after adding the properties.

The steps of the workflow execution can be configured through the Definition section.

The StartInstance operation returns three output variables. To capture them and use them for further processing/evaluation, one can create three variables and map them against the output parameters. Return As Output drop down option should be set as Yes in case we want to return them as Workflow output.

  1. First, navigate to the Workflow Definition tab and click on the Variables button

  2. Next use Create option to add three output variables.

Map the variables against the output of the StartInstance operation to capture the responses and also update the Workflow Input values.

We are also mapping the Project Property(AWS_EC2_INSTANCE_ID) against the Instance IDs section to dynamically pass the Instance ID from Project property.

Note: You can also hard code the Instance ID’s directly at plugin input. Also can use Target/Environment level property to pass the Instance ID's.

Now, click on save and activate the workflow.

Plugin Inputs

Property Name

Type

Description

Property Name

Type

Description

Instance Id(s)

Single instance

Provide comma or space separated Instance Id(s) to start.

(eg. i-073d5fbf3e5766cf4 )

Multiple instances space separated

 

eg. i-073d5fbf3e5766cf4 i-04ed696929f9074e2

Multiple instances comma separated

 

e.g. i-073d5fbf3e5766cf4,i-04ed696929f9074e2

Topology

For detailed steps on how to configure the topology and map the workflows manually, please refer to Configure the Topology

Target Properties

Selecting the DEV environment mapped to the Target Group will display the configurable properties/Endpoint and allows to the configure the Target properties.

Provide the value for AWSEndpoint(optional), AWSCloudAccount, AWSRegion (optional but can be used to override the region defined in the AWS cloud instance), AWSCLIPath(optional,not needed if set in classPath), Number of Iterations (optional, default value is 6), and Interval Duration (optional default value is 30sec) and map the localhost as Endpoint as shown below.

Target Properties Info

Property Name

Mandatory

Values for this Tutorial

Description

Property Name

Mandatory

Values for this Tutorial

Description

AWS Endpoint

Optional

 

The AWS Endpoint to use.

AWS Cloud Account

Yes

AWSFlexDev

The AWS Cloud Account Name configured.

Absolute path of AWS CLI

Optional

/usr/local/bin

The path to the directory where Azure CLI is installed. (Optional)
eg: /usr/local/bin

AWS Region

Optional

 

The default region found on the top right corner of the AWS Management console. e.g. us-west-2

Number of Iterations

Optional (default is 6)

6

The number of iterations to perform the status check.

Interval between status check

Optional (default is 30)

15

The interval between EC2 instance status check.

Create the AWS EC2 Start Instance Project

For details steps on how to configure the project and execution, please refer to Create the AWS EC2 Start/Stop Instance Project

Reports

With the successful execution of the Utility workflow, a text (.txt) file is created, stored in the reports tab. Every execution will generate a new report with execution Id appended to the text file in the Reports tab.

Click on the text file generated to see the details. This file captures the details of each instance i.e., Instance Id, Instance State, Instance Status, and System Status. In the workflow, there were two EC2 Instance Id’s provided as input. Hence, the report contains the details of both the EC2 Instances. Also, user can download the report file generated.

Congratulations! You have successfully completed the EC2 Start Instance tutorial.

Now that you have configured FlexDeploy for one EC2 Start Instance, it is extremely easy to replicate the same for other EC2 Start Instance. Simply use the Copy Project feature and a new project will be created with all of the configuration completed already. You just need to make the necessary configuration changes.

 

The following macros are not currently supported in the footer:
  • style