It is a service offered by Amazon that is used for the purpose of deployment. It helps in the automation of the application deployment of Amazon EC2 instances, on premise instances, server less Lambda functions, and ECS services.
Content mentioned below, and much more can be deployed with the help of AWS CodeDeploy:
- Server less Lambda functions
- Web and configuration files
- Multimedia files
CodeDeployhas the ability to deploy content within the application that is present in many locations. Some of them have been mentioned below:
- Application that runs on servers
- Application that be stored in Amazon S3 buckets
- Application that is stored in Github repositories
- Application that is stored in BitBucket repositories
Before deploying code, there is no need to make any explicit changes to the existing code so as to deploy it using CodeDeploy.
- It can be used to update AWS Lambda function’s versions.
- It can be used to release new features of the application in a very short period of time.
- It helps handle the complexity of updating the user-developed application without associating any risks that could occur when updates are done manually. This is because manual updates could be error-prone.
CodeDeploy has been designed in such a manner that it can work with multiple systems to manage configurations, perform source control, continuous integration, continuous deployment (CI-CD), and continuous delivery.
In addition to this, it provisions a way of quickly searching for the user resources (which includes repositories, project builds, deployment applications, pipelines).
CodeDeploy can deploy applications to the below mentioned compute platforms:
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 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 the way in which traffic is routed to that instance, with the help of an in-place or blue-green deployment type.
It is used to deploy applications which have an updated version of the Lambda function. Lambda helps in the management of Lambda function which is present in a server less 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.
It is used to deploy Amazon ECS applications which 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.
CodeDeploy comes with two methods of deployment:
In this method, the application present on every instance of the deployment group is stopped, and the latest application (which would have been revised) 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 on-premise compute platform.
AWS Lambda and Amazon ECS can’t deploy their applications using an in-place deployment.
In this method, the deployment’s characteristics depends on which compute platform is used to deploy the application.
- 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 application (which is revised) gets installed as the replacement instance. There is an optional wait time so as 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.
An important point to remember is that blue/green deployments work only with Amazon EC2 instances.
- Blue/green deployment on AWS Lambda compute platform: The traffic that comes to the current server less environment is rerouted to the updated Lambda function version. Lambda functions can be specified to perform validation tests, and specific way can be chosen to handle the shift in traffic. Any deployment which is performed on the AWS Lambda compute platform is considered as a blue/green deployment. This is the reason 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 which 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.
Features of CodeDeploy
- It can be used to deploy applications which require servers (traditional applications), applications which are server less, and applications such as Amazon ECS (container applications).
- CodeDeploy is a fully managed, automated service which automatically deploys the user application in development, test and production environments.
- It is highly scalable with the user infrastructure and can be used to deploy one or thousand instances.
- An application can be made to be highly available with the help of CodeDeploy in case the application uses an EC2 or on premise compute platform. When an in-place deployment happens, CodeDeploy does a rolling update across Amazon EC2 instances. The number of instances which need to be taken offline must be specified during the time of update.
- When a blue/green deployment is used, the most recent updated application is installed on the replacement instances. As soon as this happens, traffic is rerouted to these instances which are chosen by the user at that point in time or right after the new environment has been tested.
- In case of both these deployment types, CodeDeploy service keeps a track on the health of the application based on the rules used to configure the service.
- A deployment could be automatically or manually stopped. Just after this stoppage, it can be rolled back to the previous state in case of any errors.
- The status of every deployment done by the user can be tracked with the help of CodeDeploy console or the AWS CLI. The user will receive a report that lists information on when every application was revised, and when it was deployed, and to which Amazon EC2 instance it was deployed.
- If multiple applications use the EC2 or on premise compute platform, CodeDeploy helps in deploying all of these application concurrently to the same set of instances.
- CodeDeploy is an easy to use, and easy-to-adopt platform that works with any application. The setup code can be conveniently reused.
- CodeDeploy can be integrated with the process of software release or the continuous delivery toolchain to make the process of deployment efficient and easy.
In this post, we understood how CodeDeploy can be used to automate the process of application deployment.