...
The goal of the tutorial is to stop the AWS (Elastic Compute Cloud) EC2 Instanceinstance(s) from FlexDeploy. This automation includes:
Stop the Virtual Machine using One or more Instance Id(s) using AWS CLI.a virtual machine using one or more instance ids using the AWS CLI
We will walk through each of the FlexDeploy features that will be created/configured to accomplish this goal and stop the Instance instance in a very short amount of time.
Checklist
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 stop. |
AWS CLI installation | AWS CLI needs to be installed where the plugin operation shall run (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 stops the Instance(s).
...
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
Navigate to the Workflows tab
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 button as highlighted below.
...
Workflow Properties
From the Properties tab, create a workflow property with Project scope as shown below:
Go back to the Main tab of the Workflow
Under Workflow Properties, choose open the Add menu
From the Add menu, we can add an existing property, or create a new one. Select New PropertyClick + Create
Properties must each have a unique code, give a meaningful code for the new property.
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
Select the property scope, this defines where the property will be configured. We're using Project scope.
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.
...
Below given is a sample Utility workflow to stop the Instance(s).
...
Save the new property
...
Workflow Definition
Going back to the Definition tab, here is a sample utility workflow.
...
The stopInstance 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 checked in case we want to return them as Workflow Outputoutput.
First, navigate click the X2 button to open the Workflow Definition tab and click on the Variables button Variables popup
Next use Create option to , click the Create button and add threeoutput variables.
...
We are also mapping the Project Property (AWS_EC2_INSTANCE_IDIDS) against the Instance IDs section to dynamically pass the Instance ID from Project property.
Note: You can also hard code the Instance ID’s IDs directly at as a plugin input. Also can , or use Target/Environment level property to pass the Instance ID's.
...
Now, click on save and activate the workflow.
...
IDs.
...
Plugin Inputs
Property Name | Type | Description |
---|---|---|
Instance Id(s) | Single instance | Provide comma or space separated Instance Id(s)to start. ( |
e.g. i-073d5fbf3e5766cf4 ) |
Multiple instances space separated |
e.g. 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
...
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 |
---|---|---|---|
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) |
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 Stop Instance Project
...