Automate Application Deployment using AWS EKS (Kubernetes)

Written By Hitesh Kumar

Objective:

The objective is to demonstrate the procedure to automate the application deployment using DevOps tools like AWS EKS (Elastic Kubernetes Services), AWS CodeCommit, AWS CodeBuild and AWS CodePipeline. The process includes but not limited to implementation, configuration of various tools. The outcome of this process is to automate the deployment process using CI/CD (Continuous Integration and Continuous Deployment).

Components:

  • AWS EKS (Elastic Kubernetes Service)
  • AWS ECR (Elastic Container Registry)
  • AWS CodeCommit
  • AWS CodeBuild
  • AWS CodePipeline
  • AWS SES (Simple Email Service)
  • Git (Local)
  • Microsoft Visual Studio Code IDE (Local)

Process:

Step 1: Creating an EKS cluster with 2 worker nodes

We need to setup an EKS cluster with 2 worker nodes. EKS is a managed service so the master node will be automatically managed by WNS. We will deploy EKS cluster by following guidelines provided by AWS:

https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html

EKS Cluster Architecture:

After setting up EKS Cluster, we need to setup the other components like AWS ECR & Code management tools.

Step 2: AWS ECR (Elastic Container Registry)


We need to setup a managed container registry ECR. Amazon Elastic Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. Amazon ECR is integrated with Amazon Elastic Container Service (ECS), simplifying your development to production workflow. Amazon ECR eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure.

Step 3: Setup CodeCommit, CodeBuild & CodePipeline AWS CodeCommit:

AWS CodeCommit is a fully-managed source control service that hosts secure Git-based repositories. It makes it easy for teams to collaborate on code in a secure and highly scalable ecosystem.

CodeCommit eliminates the need to operate your own source control system or worry about scaling its infrastructure. You can use CodeCommit to securely store anything from source code to binaries, and it works seamlessly with your existing Git tools.

AWS CodeBuild:

AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy. With CodeBuild, you don’t need to provision, manage, and scale your own build servers. CodeBuild scales continuously and processes multiple builds concurrently, so your builds are not left waiting in a queue. You can get started quickly by using pre-packaged build environments, or you can create custom build environments that use your own build tools. With CodeBuild, you are charged by the minute for the compute resources you use.

AWS CodePipeline:

AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates. CodePipeline automates the build, test, and deploy phases of your release process every time there is a code change, based on the release model you define. This enables you to rapidly and reliably deliver features and updates. You can easily integrate AWS CodePipeline with third-party services such as GitHub or with your own custom plugin. With AWS CodePipeline, you only pay for what you use. There are no upfront fees or long-term commitments.

Process Flow:

  • Developer develops the application
  • Developer commits the code to CodeCommit
  • Reviewer reviews the code and merges to respective branch
  • CodePipeline continuous monitors the respective branch and initiates the code build
  • CodeBuild builds the container image, tags and pushes the images to ECR
  • CodeBuild triggers the image roll-out to EKS cluster
  • EKS roll-out the updated image using rolling update

For deployment related assistance, contact the Sterling Cloud Team.

Share the Post: