“There should be two tasks for a human being to perform to deploy software… to pick the version and environment and to press the “deploy” button.”
― David Farley, Continuous Delivery
Hundreds of tools exist to partially or fully automate a CI/CD deployment pipeline. Most large-scale web applications already have some degree of automation, enabling developers to push to development or production several times a week or even several times a day.
Amazon Web Services’ automated code delivery tool, CodeDeploy, is really just a glorified script with an agent, a web interface, and a code repository. It is not the most innovative or even the fastest tool on the market. But its very simplicity and flexibility are the reasons we recommend CodeDeploy to enterprises on AWS.
1. Easy in, Easy Out
For most enterprises, the best deployment tool is the one that does not require significant application refactoring. The great thing about AWS CodeDeploy is that it is extremely flexible; it is platform and language agnostic, works with any application, and the process that enterprises currently use to deploy software can be slotted into CodeDeploy’s framework.
This flexibility is due to CodeDeploy’s AppSpec configuration file, where you can specify commands to run at each phase of deployment such as code retrieval, code testing, etc. These commands can be written in any code, meaning that if you have an existing CI/CD pipeline, existing stages can be modified and sequenced in an AppSpec file will minimal effort. You can also integrate CodeDeploy into your existing software delivery toolchain using the CodeDeploy APIs.
If they ever want to leave AWS, this framework is relatively easy to transport to another cloud or service, since CodeDeploy is platform agnostic. Portability and customization are the main reasons most enterprises will choose CodeDeploy over an all-in-one application management tool like AWS Elastic Beanstalk or Opsworks.
Bottom line: CodeDeploy allows you to orchestrate code deployment without getting locked into an AWS or vendor-specific solution.
2. Greater Control Over Orchestration
You could technically orchestrate Auto Scaling and write a sequential deploy process with a Configuration Management tool like Puppet or Chef. So why do you need CodeDeploy at all?
The first reason is that in a modern development environment where you are doing code pushes multiple times a day or week, it is not that simple to make sure that the latest version of your code is deployed. Puppet runs on its own schedule and you usually stagger deploys to prevent overloading the Puppet master. It is therefore possible that multiple versions of your code are running, and you do not know what is running where (Puppet does its own thing, and does not provide version visibility to you instance by instance).
CodeDeploy gives you the ability to do a rolling update across a group of instances, so that an update can be deployed to a specific number of instances for testing purposes and not to other. Deployment Health Tracking monitors the success of each instance update so that in the case of failure, you can pinpoint the exact instance and script experiencing failure.
For systems engineers, this transparency into what developers are doing is crucial. When problems crop up, they have a reasonable ability to see what happened and why things went wrong.
Bottom line: Everyone wants a predictable, controllable, transparent deploy process. CodeDeploy gives you greater control over which version of your code is running where than a pure Configuration Management-run deploy.
3. One App, One Deployment Methodology
Most application teams will only need to create a single AppSpec file for all common deployment tasks, whether they are deploying to test or production. This centralizes and simplifies deployment pipeline maintenance, and the less manual rewriting your engineers have to do on a case-by-case basis, the safer your deployments will be be.
Bottom line: Deployment is one of the most vulnerable times in an application’s lifecycle. A single, integrated process reduces the opportunity for human error and failed deploys.
4. Native Auto Scaling Integration
Deployment in AWS can happen one of two ways: either an engineer pushes a code revision, or an Auto Scaling event happens and a new instance is created, which needs to receive the latest version of your code.
CodeDeploy integrates natively with Auto Scaling. This means that if your instances are part of a Deployment Group and a new instance is created, Auto Scaling will wait for CodeDeploy to “interject” with the application code before it puts the instance behind an Elastic Load Balancer.
Only a developer that has tried to integrate Auto Scaling with a custom toolchain will understand how difficult this is to do without CodeDeploy; you need to pause the scaling event, make sure the instance does not get added to the load balancing pool before it is ready, and then trigger this event after testing.
In fact, most non-AWS users assume that Auto Scaling is a “built-in” feature of AWS. It is actually one of the most complex systems to architect, and requires a sophisticated orchestration layer above multiple systems. Usually engineers will use a configuration management tool like Puppet to orchestrate these resources, and Puppet and CodeDeploy work well together to spin up and bootstrap and instance, then kick off CodeDeploy to add application code. Puppet can even do the work of installing the CodeDeploy agent on each instance.
Bottom line: Because CodeDeploy integrates with Auto Scaling, you do not have to create a custom process that ensures instances do not get launched without application code.
5. Roll Backs & Versioning
CodeDeploy tracks the recent history of your deployments and in the case of error, it allows you to stop application deployment and redeploy a previous revision. Most deployment tools have this feature; the advantage of CodeDeploy is that it is more intelligent about pinpointing the instance where failure is occurring without having to log into the individual instance.
Bottom line: CodeDeploy provides a simple way to access all recent versions of your code and redeploy an old version if necessary.
6. On-Premises Deployments
Building a hybrid cloud? Codedeploy allows you to coordinate an update across AWS EC2 instances or on-premises instances by creating Deployment Groups across both systems. It is equally intelligent about pinpointing failure with on-premises systems, and you can monitor the state of your on-premises instances directly from the CLI or interface.
Just one note of caution: AWS CodeDeploy is absolutely free for updating EC2 instances, but there is a $0.02 charge per on-premises instance updated using CodeDeploy.
Bottom line: CodeDeploy may be a good option for coordinating deployments across multiple clouds and/or on-premises systems.
Whether you have an existing code deployment pipeline and are migrating to AWS or are building a greenfield application on AWS, CodeDeploy is one of the best options available for coordinating and automating deployments. Its native integrations and its sheer flexibility mean it is easy to transfer to, easy to transfer out of, and can even be used for on-premises systems. Other deployment models (Docker, Bamboo, Snap) may have more features, but they also require more work. Ultimately, for most applications, enterprises want flexible over fancy.
Logicworks is an enterprise cloud automation and managed services provider with 23+ years of experience transforming enterprise IT. Contact us to learn more about our managed cloud solutions.