CI/CD Deployment Flow From Azure to AWS

March 30, 2022

CI/CD Deployment Flow From Azure to AWS

What is CICD?

  • CICD stands for Continuous Integration and continuous deployment acts as a bridge between the development and operational environments.
  • It helps in facilitating the process, the application release, basically, build and deployment of
    latest features to the market with many checks without any manual intervention or avoiding long human hours to validate the code and proceed for final deployments.

What is Azure DevOps?

  • Azure DevOps Server is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, testing, and release management capabilities. It covers the entire application lifecycle and enables DevOps capabilities.

What is AWS CodeDeploy?

  • CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances, on-premises instances, serverless Lambda functions, or Amazon ECS services.

What is our use-case?

  • The current setup involves Continuous integration with Azure DevOps and Continuous Deployment with AWS Code Deploy.
  • As the development team is working and committing their code to AZURE Repos and the Application infrastructure is setup and running AWS.
  • The idea is to Setup a pipeline for all the Micro-services on Azure linked up with eh Azure-Repos, and final build artifacts will be pushed to S3 on successful build and code deploy to absorb the artifacts from S3 using AWS lambda and deploy on to production EC2 workloads.

Configuring Azure pipeline with Azure Repo on Microsoft Azure DevOps.

  • Deployment Process.
    • The developer pushes the code into the Azure repository service, which triggers the Azure pipeline as how the azurepipline.yml file is structured.
    • Once successfully the Azure pipeline gets triggered, it will build the entire dotnet application code and artifact the entire application into zip files and drop them to S3.
    • An IAM user has been created and been used on the Azure pipeline to push the artifact from the Azure pipeline to AWS S3, and based on date of deployment, folder structure gets created on S3, and artifact gets
    • An AWS toolkit is installed on the Azure pipeline, which offers the option to dump the artifact to S3.
  • AWS Credential Setup.
    • Specifies the AWS credentials to be used by the task in the build agent environment.
    • You can specify credentials using a service endpoint (of type AWS) in the task configuration.
    • Once the Access key and Secret access keys are added to AzureDevops configuration. The pipeline will have access to the AWS resources with permissions provided to
      keys of the user.
  • AWS code deploys agent installation on the Servers
    • When an autoscaling group is being used to achieve high availability of the application for end user for automating deployment on ASG servers, we need to
      install the code deploy agent.
    • To install the agent on every new server that is launched by the AWS autoscaling group, we need to make use of the user data in the Launch template/Launch configuration.
    • So, the user data helps in installing the AWS code deploy agent during the server boot time and keeps the machine ready for any future deployments.
  • Click on the new pipeline setup on the azure pipelines page, which helps showing the version control configuration details. In this case it is, Azure Repos.
  • Once the Azure Repos Git YAML is selected, click on the classic editor, which leads to a YAML- based pipeline setup webpage.
  • Now select the template based on the type of application that needs to be built. In our case the application is developed on dotnet core. We can choose ASP.Net Core
  • Where it helps in fetching the ASP.net core details as YAML to build the dotnet core application.
  • Once the details were automatically added to YAML by Azure Relevant build changes and configurations can be made to build the application.
  • Next, we need to add the details of the AWS S3 bucket to store the artifacts to trigger an AWS CodeDeploy to deploy the latest changes.
  • Fill the relevant AWS S3 bucket details to store the artifacts with source folders in case they present on any existing bucket.
  • if the given AWS S3 bucket name and source folder details were not found. Azure pipeline will automatically create the S3 bucket and mentioned source folders on the fly during pipeline run.

Create an AWS CodeDeploy Service with added details of the EC2 instance. By creating an application with compute platform set to Ec2/On-premise.

  • Once the application is created, start creating a deployment group for microservice with deployment group name and service role containing permissions for code deploy service to deploy the resources on EC2.
  • Choose the deployment type as In-place with Environment configuration set to Autoscaling groups as we run the application with scalability across all Availability zones.
  • Set the deployment settings to where deployment configurations need to be set to HalfAtATime. Because we don’t want to lose all the instances at a time for the deployment and become a cause for
    downtime.
  • Set the load balancer details by checking the box and provide the load balancer name, which serves traffic for the micro-service in the deployment group.
  • Add a deployment trigger with the SNS topic as a trigger point to let the teams know the status of the deployment.
  • Enable the Deployment Rollback by checking the Roll back when a deployment fails So, any failure deployments will be reported to the teams with the above SNS trigger, and deployment will be rollbacked
  • previous successful revision with the artifacts that are store in the S3 bucket by the Azure pipelines after a successful build.
  • The final task is to add an AWS code-deploy task on to the Azure-pipeline mentioning the above created AWS code deploy service details of the relevant microservices for final deployment on to the AWS Autoscaling group EC2 workload for deployments.
  • Once the YAML file with the relevant task are in place. A Pipeline can be saved and used for Continuous integration and continuous deployment purpose
  • Any direct commit made to the AzureRepo branch linked to the Azure pipeline will auto start the pipeline by starting code pull, code build, and deploy the code to AWS infrstructure.
  • After a successful application build, an artifact will be constructed, which is then pushed to the S3 bucket, and the AWS CodeDeploy service gets triggered with the S3 artifact URL for final deployment on the AWS Autoscaling group, where Ec2 workloads will be serving the end user requests through a load balancer.

The Azure pipeline will start monitoring the AWS CodeDEploy service in each step of the deployment and provide the relevant deployment log data on AzureDevops Console.

Summary

  • AWS Toolkit on AzureDevops helps to build the tasks which are required to carry out necessary operations across AWS and Azure.
  • It helps both the development and operations teams not worry about version control and deployments that are being run from two different
    cloud providers.

Written By – Karanam Sreenivas

Cloud Computing Insights and Resources

What is a Hybrid Cloud Strategy? What are its Advantages?

A hybrid cloud strategy is a method that companies use to decide which portions of hybrid cloud infrastructure are most …

What is a Hybrid Cloud Strategy? What are its Advantages? Read More »

AWS Launches the Second Infrastructure Region in India – Hyderabad

On November 22, 2022, AWS launched its new AWS region in Hyderabad. The AWS Asia-Pacific Hyderabad region is the second …

AWS Launches the Second Infrastructure Region in India – Hyderabad Read More »

Three Ways Cloud is Improving Customer Experience

Three Ways Cloud is Improving Customer Experience 

Ever since the cloud rose to popularity in the 2000s owing to its various advantages over traditional computing, businesses have …

Three Ways Cloud is Improving Customer Experience  Read More »