AWS CodeDeploy

What Is AWS CodeDeploy?

Amazon offers CodeDeploy as a service that is used for deployment. It helps in the automation of the application deployment of Amazon EC2 instances, on-premises instances, serverless Lambda functions, and ECS services. Apart from this, AWS CodeDeploy can deploy code, serverless Lambda functions, web and configuration files, packages, scripts, executables, multimedia files. 

With CodeDeploy, you can deploy content within the application that is present in many locations. For instance, it lets you deploy:

  • Applications that run on servers.
  • Applications that are stored in Amazon S3 buckets.
  • Applications that are stored in Github repositories.
  • Applications that are stored in BitBucket repositories.

CodeDeploy makes it easy to deploy the code, that too, without making any explicit changes to the existing code. For example, it can be used to:

  • Update AWS Lambda function’s versions. 
  • Release new features of the application in a very short period of time.  
  • Handle the complexity of updating the user-developed application, without associating any risks that could occur when updates are done manually. 

Features and Benefits of AWS CodeDeploy:

  • Server, Serverless, and Container Applications: You can deploy both traditional applications on servers and applications that deploy a serverless AWS Lambda function version or an Amazon ECS application.
  • Automated Deployments: It automates your application deployments across various environments like development, test, and production. Plus, it scales with your infrastructure so that you can deploy to as many instances as you want.
  • Minimize Downtime: If your application uses the EC2/On-Premises compute platform, it maximizes your application’s availability. During an in-place deployment, it performs a rolling update across Amazon EC2 instances. You can specify the number of instances to be taken offline at a time for updates. During a blue/green deployment, the latest application revision is installed on replacement instances. Traffic is rerouted to these instances when you choose, either immediately or as soon as you are done testing the new environment. For both deployment types, CodeDeploy tracks application health according to the configuration rule.
  • Stop and Rollback: If errors are found then you can automatically or manually stop and roll back deployments.
  • Centralized Control: You can launch and track the status of your deployments through the CodeDeploy console or the AWS CLI. You receive a report that lists when each application revision was deployed and to which Amazon EC2 instances.
  • Easy to Adopt: CodeDeploy is platform-agnostic and works with any application. You can easily reuse your setup code. CodeDeploy can also integrate with your software release process or continuous delivery toolchain.
  • Concurrent Deployments: If you have more than one application that uses the EC2/On-Premises compute platform, CodeDeploy can deploy them concurrently to the same set of instances.

Platforms Where Codedeploy Can Deploy Applications:

  • EC2 or On-Premise:
  • This platform talks about the physical servers, which could be Amazon EC2 cloud instances, on-premise servers, or both. When an application is created with the help of an EC2 or on-premise compute platform, it can contain executable files, configuration files, images, and other types of data. When an application is deployed using the EC2 or on-premise compute platform, it helps manage how traffic is routed to that instance, with the help of an in-place or blue-green deployment type.  

  • AWS Lambda:
  • It is used to deploy applications that have an updated version of the Lambda function. Lambda helps in the management of Lambda functions, which are present in a serverless compute environment. This environment contains high-available resources. The monitoring of these compute resources is taken care of by AWS Lambda itself. When an application is created with the help of the Lambda compute platform, it manages the method in which traffic is routed to the updated Lambda function’s versions. It also manages the deployment by choosing one of the methods from a canary, linear, or all-at-once configuration.  

  • Amazon ECS:
  • It is used to deploy Amazon ECS applications that have been containerized as a part of the task set. CodeDeploy deploys such applications using the blue/green deployment, wherein it installs an updated version of the containerized application as the new replacement task set. Once this is done, CodeDeploy reroutes the traffic from the original containerized application to the replaced task set. Once this is completed successfully, the original task gets terminated.  

Modes of Deployment

CodeBuild offers two methods to deploy the application:

  1. In-Place Deployment:
  2. In this method, the application present on every instance of the deployment group is stopped, and the latest application is installed. After this, the new version of this application starts and gets validation. A load balancer can be used so that every instance gets deregistered when it is being deployed and is restored when the deployment is complete. In-place deployments can be used only when the applications use EC2 or an on-premise compute platform. AWS Lambda and Amazon ECS can’t deploy their applications using an in-place deployment.  

  3. Blue/Green Deployment:
  4. With this method, the deployment’s characteristics depend on the compute platform used to deploy the application. Below are some examples:

  • Blue/Green Deployment on EC2 or On-Premise Compute Platform: The original environment’s instances are replaced by a different environment’s instances. The replacement environment is provisioned. The latest (revised) application gets installed as the replacement instance. There is an optional wait time to perform application testing and system verification. This newly replaced instance is registered with an Elastic Load Balancing load balancer, due to which the traffic gets rerouted to these instances. The instances present in the original environment are deregistered, and can be terminated as well, or could be run to perform other operations.  
  • Blue/Green Deployment on AWS Lambda Compute Platform: The traffic that comes to the current serverless environment is rerouted to the updated Lambda function version. Lambda functions can be specified to perform validation tests, and a specific way can be chosen to handle the shift in traffic. Any deployment that is performed on the AWS Lambda compute platform is considered a blue/green deployment. That’s why a deployment type need not be specified while using Lambda compute platform.  
  • Blue/Green Deployment on Amazon ECS Compute Platform: This is used with containerized applications. The traffic is rerouted from the original version of a containerized application that is present in Amazon ECS to a replacement task set that is present in the same ECS service. This production traffic is rerouted by specifying the protocol and port of the load balancer. When a deployment takes place, a test listener is used to handle traffic of the replacement task set while the validation tests are being executed.


AWS CodeDeploy helps you deploy various types of applications to many compute platforms. It does not just help you deploy a new application but also allows you to push updates regularly. It is so easy to use that you can integrate it with your current release process or toolchain.