AWS CodeDeploy: What It Is and Why You Should Use It to Automate Deployments

AWS CodeDeploy

What is AWS CodeDeploy?

AWS CodeDeploy is a service that automates software deployments. One can deliver new features more quickly, avoid application deployment downtime, and handle the complexity of application updates with AWS CodeDeploy. Software deployments can be automated with the help of CodeDeploy, eliminating the necessity for laborious manual tasks. CodeDeploy can customize services that will favor the deployment of your application.

Learn more about AWS CodeDeploy in this informative course on Cloud Academy: Working with AWS CodeDeploy

What is AWS CodeDeploy used for?

Application deployments to serverless AWS Lambda functions, on-premises instances operating in your facility, Amazon EC2 instance, or applications in an Amazon ECS services are all examples of use cases for automation via AWS CodeDeploy.

Deploying updated Lambda functions, updated applications in an Amazon ECS service, code, web and configuration files, executables, packages, scripts, multimedia files, and other application material are possible. Application content kept in GitHub, Bitbucket, or Amazon S3 repositories can be deployed using AWS CodeDeploy, though of course before using CodeDeploy your current code must not be modified.

With CodeDeploy, you can easily roll out new features, prevent downtime when deploying your apps, and handle the complexity of updating your programs without many of the hazards involved with risky manual deployments.

Overview of CodeDeploy compute platform

Applications can be deployed to three computing platforms using CodeDeploy:

EC2/On-Premises

EC2/On-Premises describes instances of physical servers, which may be on-premises servers, Amazon EC2 cloud instances, or both. Executable files, configuration files, pictures, and other types of files are all possible components of applications built utilizing the EC2/On-Premises compute platform.

Utilizing an in-place or blue/green deployment type, EC2/On-Premises compute platform deployments control how traffic is routed to instances.

AWS Lambda

AWS Lambda is used to distribute apps that contain newer iterations of Lambda functions. AWS Lambda controls the Lambda function in a serverless computing system with a high-availability compute structure. AWS Lambda handles all management of the compute resources. Selecting a canary, linear, or all-at-once configuration can control how traffic is switched to the updated Lambda function versions during a deployment.

Amazon ECS

Amazon ECS used to release a task set of an Amazon ECS containerized application. By deploying an updated version of the application as a new replacement task set, CodeDeploy carries out a blue/green deployment. Production traffic is switched from the original application job assigned to the substitute task created by CodeDeploy. After a successful deployment, the initial job set is ended.

Benefits of Amazon CodeDeploy

Automation of Deployments

Your software deployments are entirely automated by AWS CodeDeploy, enabling you to deploy quickly and reliably. Whether you deploy to Amazon EC2, AWS Fargate, AWS Lambda, or your on-premises servers, applications can be deployed to any configured environments, i.e., development, test and production simultaneously. Your infrastructure scales with the service.

Minimizes Downtime

When deploying software, AWS CodeDeploy maximizes the availability of your applications. It makes updates gradually and monitors the application’s health using settable rules. Mistakes done on deployment can be reverted and previous versions restored.

Centralized Control

You can simply launch and monitor the progress of your application deployments using AWS CodeDeploy using the AWS Management Console or the AWS CLI. You can see the dates and locations of each program revision’s deployment with the help of the comprehensive report that CodeDeploy provides. Additionally, you can design push notifications to get real-time information on your deployments.

Easy Adaptation

When deploying to Amazon EC2, AWS Fargate, or AWS Lambda, AWS CodeDeploy offers the same experience regardless of the platform or language used. Your setup code from before can be easily reused. CodeDeploy can also be integrated with the continuous delivery toolchain or your current software release process (e.g., AWS CodePipeline, GitHub, Jenkins).

AWS CodeDeploy pricing

As explained in the AWS CodeDeploy documentation, the price varies according to different cases:

  • For CodeDeploy on Amazon EC2, AWS Lambda, and Amazon ECS there is no additional charge for code deployments.
  • For CodeDeploy On-Premises you pay $0.02 per on-premises instance update using AWS CodeDeploy. There are no minimum fees and no upfront commitments.
  • You pay for any other AWS resources (e.g. S3 buckets) you may use in conjunction with CodeDeploy to store and run your application. You only pay for what you use, as you use it; there are no minimum fees and no upfront commitments.

AWS CodeDeploy vs Elastic Beanstalk

While Beanstalk is categorized under “Code Collaboration & Version Control,” AWS CodeDeploy is under the “Deployment as a Service” umbrella.

The following are the distinctive characteristics between AWS CodeDeploy and Elastic Beanstalk:

AWS CodeDeploy:

  • Your code deployments are entirely automated by CodeDeploy, enabling you to deploy quickly and reliably.
  • By running rolling updates across all of your Amazon EC2 instances and monitoring application health following set policies, AWS CodeDeploy aids in maximizing your application availability.
  • Through the AWS Management Console or the AWS CLI, AWS CodeDeploy enables you to launch and monitor the status of your deployments quickly.

Elastic Beanstalk:

  • One can create or import Subversion and Git repositories immediately accessible to your team. Manage repositories.
  • Users can invite their staff, partners, and clients. Provide read-only, or full read/write rights and restrict access to specific repositories.
  • Browse files and changes—With just a click, you may access every version of any file you’ve uploaded to Beanstalk. View the differences between revisions and get a chronology of who made modifications. highlighting syntax in more than 70 languages.

Uploading Source Code To An AWS S3 Storage Bucket

You need an AWS Account to be able to upload source code to AWS S3 Storage Bucket.

After logging in to your account, navigate to the Amazon S3 console: https://console.aws.amazon.com/s3/.

AWS CodeDeploy Overview in Console

Click on The Orange Create Bucket Button.

S3 Create Bucket

Give your bucket a distinctive name on the Create a Bucket – Select a Bucket Name and Region page’s Bucket Name field. All AWS accounts, not just your own, need that bucket names be distinct.

After selecting a region, all other settings have their default options selected. Scroll down and click on Create Bucket.

NOTE: The bucket will be created only if the name written is unique.

Once the process is successful, you will be redirected to the Amazon S3 buckets console page, and all the buckets created will be listed:

Successful S3 Bucket Creation

Choose the S3 bucket you created from the All Buckets list. On the bucket page, choose Upload.

AWS CodeDeploy Upload item to S3 bucket

On the Upload – Select Files and Folders page, choose Add files. Browse for the source codes from your computer, choose Open, and then choose Start Upload.

AWS CodeDeploy S3 bucket successful upload

Which type of deployments are supported by AWS CodeDeploy?

CodeDeploy supports two deployment type options, in-place and blue/green deployments.

In-place deployment:

In this type of deployment, the most recent application revision is installed, the program is paused on each instance in the deployment group, and the new version is launched and tested. By using a load balancer, you can ensure that each instance is deregistered during deployment and then restored to service after it is finished. Utilizing in-place deployments is only possible for deployments that use the EC2/On-Premises compute platform.

Blue/green deployment

The blue/green deployment type makes use of the CodeDeploy-managed blue/green deployment model. You can use the blue/green deployment type to test a new service deployment before sending production traffic to it.

For this type of deployment, there are three ways in which traffic might change:

  1. Canary — Traffic is shifted in two increments.
  2. Linear — Equal intervals of time, with an equal number of minutes between each interval, are used to move the traffic.
  3. All-at-once — Traffic is instantly switched from the outdated job set to the original work set.

References

Cloud Academy