Monday, 25 May 2020

Deploying Infrastructure to AWS Lightsail Using Azure DevOps – Part 3 – Creating a Release Pipeline to Deploy AWS Lightsail Infrastructure

In the previous two post, we have discussed how to write a bash script with AWS CLI to create AWS Lightsail instance and, how to setup a service connection in Azure DevOps for AWS. IN this post, lets explore the steps required to get the bash script executed in a release pipeline to create AWS Lightsail infrastructure.
As the first step we need to create a build pipeline to publish the script as an artifact. Instead of creating a build you can directly use the Azure Git repo in the release as an artifact as well. However, let’s create a build and release pipeline both to implement a clear solution.
In the build pipeline we can add a copy file step to copy the bash script to build artifact staging directory. Then using a publish step we can publish the content of the build artifact staging directory as build output.

The build produces an output drop with the file. Using the build as a trigger we can setup a release pipeline. In the release pipeline you can add AWS Shell script step. In the step select the AWS service connection, we have created in the previous post. Then select the script that is in the build artifact as the script to execute. You need to supply the four arguments, name of the AWS Lightsail instance, the region (availability zone), the type of machine (blueprint) and the size (bundle) as parameters.

You can setup them as variables in the release pipeline. You can define same step in multiple stages in release pipeline to enable creation of multiple environments in the release workflow.

Once the pipeline is executed, AWS Lightsail instance would be created if it is not already exist.

No comments:

Popular Posts