AWS Plugin - Execute Command/Script

Objective

You have a shell script in a Git repository. The goal of the tutorial is to execute the shell script.

This process will include:

  • Copy the shell script from a Git repository

  • Execute the shell script

We will walk through each of the FlexDeploy features that will be created/configured to accomplish this goal and Execute the shell script

Checklist

Checklist

Description

Checklist

Description

AWS Access Key

AWS Access Key ID of IAM user

AWS Secret Key

Password for the Access Key

AWS CLI installation

AWS CLI needs to be installed on the Target m/c where the plugin operation shall run

AWS CLI in class path

AWS CLI should be added to the classpath in target m/c. Else the path can also be set under FlexDeploy environment level property

AWS PowerShell

AWS PowerShell needs to be installed on Windows OS and path should be added to the classpath in target m/c.

Please refer to https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-windows.html

Configure cloud account

First, AWS account needs to be configured under Topology. FlexDeploy will connect to the AWS cloud and execute the script

  1. Navigate to the Integrations from the left-hand pane

  2. Navigate to the Cloud tab under Topology

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

It should have a AWS Access Key and AWS Secret Key.

  1. AWS Access 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. next update the AWS Access Key value under Secret Text. This is to make sure no one else can retrieve the password

Git repository structure

The Git repository should contain shell script to execute.

The Sample Git repository structure is given below:

Build Workflow

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

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

Build Workflow

  1. Navigate to the Workflows Tab

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

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

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

Below given is a sample build workflow to copy and execute the script.

Step-i: Clone Git Repository

This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.

Step-ii: Copy the script file

The below step will copy the script file.

Step-iii : execute the script file

Code Snippet field is mandatory, we can select the type of CLI from the drop-down. Available options are shell, PowerShell, and WindowsShell. The default CLI type is the shell.

Project configuration

Navigate to the Project tab and create a Project with a logical name(AWS-Command in this case)

Configure the Build workflow that has been created in previous steps as shown below.

Source Control

Configure the Source SCM repository under Source Control as shown below.

 

  1. To configure Project specific Source Control one first need to navigate to the Project Configuration tab.

  2. Next, expand the SOURCE CONTROL option from the left-hand pane.

  3. Select the appropriate Source Control Type

  4. Configure Source Repository. For detailed steps of Source Control configuration please refer to https://flexagon.atlassian.net/wiki/spaces/FD60/pages/10107093010

Project Properties

To configure Project specific settings one can navigate to Configuration Properties as shown below.

 

  1. To configure Project specific settings one can navigate to the Project Configuration tab as shown above.

  2. Next, select the PROPERTIES option from the left-hand pane.

  3. Select the target AWS Cloud Account.

Target Properties

Topology

Navigate to the Topology from the Menu. The Page with the Target Groups, Environments and Endpoints sections will be displayed. Choose a Target Group on the left. You will see a list of Environments on the right with colored circles representing each Target

 

Properties

Mandatory field

Description

AWS ACCOUNT

Optional

AWS cloud account name

AWS CLI

Optional

Directory Where AWS CLI is installed

GIT Path

Optional

Path to the Git executable. Required only if git is not on PATH.

Build Execution

For detailed steps on how to initiate Build please refer to https://flexagon.atlassian.net/wiki/spaces/FD65/pages/10273849473

Congratulations! You have successfully completed the tutorial.

Now that you have configured FlexDeploy to execute the script, it is extremely easy to replicate the same for other cloud provider as well. 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