As businesses increasingly adopt cloud computing as part of their “cloud-first” strategies, many find themselves operating within a multicloud landscape. While companies often experience optimal performance and cost benefits by selecting a primary cloud provider, various circumstances can lead to a multicloud setup. For instance, mergers and acquisitions may result in an organization taking on a different cloud platform, or independent software vendors (ISVs) may need to support clients across multiple cloud providers. Additionally, compliance with data residency and sovereignty regulations can necessitate deploying workloads across various cloud services. Consequently, organizations may find themselves managing complex multicloud environments.
One major challenge in these scenarios is the management of the release process, which includes building, testing, and deploying applications at scale across different cloud platforms. If AWS serves as the primary cloud provider, companies might prefer to utilize AWS developer tools for deploying workloads to other cloud platforms. Instead of crafting a separate release pipeline for each platform — a task that can be daunting and unsustainable over time — organizations can leverage AWS services to develop a cohesive end-to-end CI/CD and release process.
In this article, we will illustrate how organizations can effectively use AWS developer tools within hybrid and multicloud environments. We will guide you through a scenario where an application is deployed to virtual machines (VMs) operating on-premises and in Azure, emphasizing AWS’s capabilities in multicloud and hybrid DevOps.
Overview of the Solution and Scenario
This article will cover the following key steps:
- Setting up a CI/CD pipeline utilizing AWS CodePipeline and demonstrating its execution upon application code updates in a GitHub repository.
- Checking out application code from the repository and making modifications using Visual Studio Code before checking it back into the repository.
- Automatically triggering the release process through AWS CodePipeline upon code check-in. This involves using AWS CodeBuild to fetch the latest code, compile it, create the deployment package, and test the application.
- Deploying the updated application to VMs in both on-premises and Azure environments using AWS CodeDeploy.
The outlined solution provides a high-level view of the process. Note that this post does not explore every possible integration for building the CI/CD pipeline; for instance, you can incorporate existing tools like Selenium, Jenkins, or SonarQube into your workflow. Our focus here is to demonstrate how AWS Developer Tools can support virtually any organizational use case in a multicloud setting. We will deploy a sample application from this AWS tutorial to an on-premises server and an Azure VM running Red Hat Enterprise Linux (RHEL). Future articles in this series will explore deploying various workloads, including containers and serverless applications, using AWS tools.
Setting Up the CI/CD Pipeline
This section provides instructions for establishing a multicloud CI/CD pipeline.
Note: The CI/CD pipeline setup, along with the subsequent subsections, is a one-time process; you will not need to repeat these steps each time you deploy or modify an application.
Install CodeDeploy Agent
The AWS CodeDeploy agent is essential for executing deployments on an instance. You can install it on both on-premises servers and Azure VMs using either command-line tools or AWS Systems Manager.
Configure GitHub Code Repository
To set up your GitHub repository, follow these steps:
- Create a new GitHub repository or utilize an existing one.
- Copy the Sample_App_Linux app (zip) from Amazon S3 as indicated in Step 3 of the tutorial on uploading a sample application to your GitHub repository.
- Commit the files to the repository using the following commands:
git add .
git commit -m 'Initial Commit'
git push
You will use this repository for deploying your code across multiple environments.
Configure AWS CodePipeline
To set up and configure CodePipeline for orchestrating your CI/CD pipeline, follow these steps:
- In the AWS console, navigate to CodePipeline and select ‘Create pipeline.’
- Name your pipeline (e.g., MyWebApp-CICD) and allow CodePipeline to create a service role for you.
- For the source stage, choose GitHub (v2) as your source provider, and click on the “Connect to GitHub” button to grant access to your Git repository.
- Create a new GitHub connection by clicking the “Install a new App” button to install the AWS Connector in your GitHub account.
- Return to the CodePipeline console and select the repository and branch you wish to build and deploy.
Next, create the build stage by selecting AWS CodeBuild as the build provider. Click on the ‘Create project’ button to initiate your build stage project and name it. Choose Ubuntu as the operating system for your managed image, select the standard runtime, and pick the ‘aws/codebuild/standard’ image with the latest version.
In the Buildspec section, select “Insert build commands” and switch to the editor. Input the following YAML code as your build commands:
version: 0.2
phases:
build:
commands:
- echo "This is a dummy build command"
artifacts:
files:
- "*/*"
Note: You may also integrate build commands directly into your Git repository using a buildspec YAML file. For further details, refer to the Build Specification Reference for CodeBuild.
Leave the other options as default and proceed to CodePipeline.
Back in the CodePipeline console, your project name will be auto-filled. Continue to the next step by clicking the “Skip deploy stage” button; we will establish this in a future section. Review your changes and click “Create pipeline.” Your newly established pipeline will build for the first time!
Configure AWS CodeDeploy on Azure and On-Premises VMs
Having built your application, the next step is to deploy it to both environments: Azure and on-premises. As mentioned in the “Install CodeDeploy agent” section, we have already installed the agent. As a one-time measure, we must grant the CodeDeploy agents access to the AWS environment. You can utilize AWS Identity and Access Management (IAM) Roles Anywhere alongside the code-deploy-session-helper to access necessary AWS resources. The IAM Role should at least include the AWSCodeDeployFullAccess managed policy and read-only access to the CodePipeline S3 bucket in your account (named codepipeline–).
For further insights on setting up IAM Roles Anywhere, see this authoritative source. This is another blog post that can keep you engaged with additional information on the topic as well. Also consider visiting this excellent resource for more information on AWS tools and services.
In conclusion, effectively deploying workloads in a multicloud environment is achievable by leveraging AWS Developer Tools, enabling organizations to streamline their CI/CD processes and maintain efficient operations across diverse cloud platforms.
Leave a Reply