Deployment automation is a key concept for teams that plan to release new code or update applications on a regular...
basis. Some of the biggest businesses in the world rely on tools and processes to completely automate code deployment to servers multiple times a day. Until a couple of years ago, AWS DevOps tools were only available to teams inside of Amazon. But now these deployment automation tools are available to anyone -- and developers can use AWS CodeDeploy to reliably and repeatedly deploy code to servers running in the cloud or on premises.
Developers can use AWS CodeDeploy in AWS deployment automation. CodeDeploy works with other services, such as AWS CodePipeline, to orchestrate deployments across different environments, including dev, staging and production. CodeDeploy also works as a standalone tool to continuously deploy application code to servers after each change.
IT teams define and bundle deployable assets, such as code and configuration files, within CodeDeploy, along with an application specification (AppSpec) file that tells the service which files to deploy and how to configure servers to host an application. All of this content goes into a single archive file hosted in Amazon Simple Storage Service (S3) or in a GitHub repository.
From there, developers inform CodeDeploy of the location of the archive and tell the service to which Elastic Compute Cloud (EC2) instances or on-premises servers it should deploy. They can logically define a group of servers in CodeDeploy, associating them with a Deployment Group. Teams often define Deployment Groups by keying on a common EC2 tag or specifying servers that spin up by an AWS Auto Scaling group. Developers must install the CodeDeploy agent on their servers to make this work -- regardless of whether they are running in the cloud or on premises.
Each bundle of code is called a target revision; new deployments use a target package to deploy code. Servers running the CodeDeploy agent regularly poll the service for new revisions. The agent then pulls the latest target revision from S3 or GitHub and deploys the application based on the specifications in the AppSpec file.
Benefits of AWS deployment automation
Automated deployments are always the same, even when dealing with multiple environments such as development, staging and production. Switching to AWS deployment automation eliminates mistakes that manual code releases cause, ensuring deployments are always consistent. This allows an IT team to iterate quickly and focus on improving its application instead of having to troubleshooting deployments.
AWS CodeDeploy also supports rolling updates, allowing teams to release changes in small batches. This reduces downtime and ensures that new code works on a subset of servers before deploying to the entire fleet. If issues arise, developers can also easily roll back to a previous application revision.
Centralized administration allows administrators to manage the deployment from the CodeDeploy web-based console or through the AWS Command Line Interface. Admins have access to detailed reports about the success or failure of deployments, and they can integrate with other services, such as Amazon Simple Notification Service, to receive notifications about deployments.
Integrating CodeDeploy with other services
CodeDeploy also seamlessly integrates with other AWS tools in a DevOps workflow, including the following:
- CodePipeline: This service orchestrates a release pipeline that tests and deploys code to development, staging or production environments. CodeDeploy and CodePipeline help automate the application deployment process.
- CloudWatch and CloudTrail: The CodeDeploy agent logs the health of app deployments and the output from deployment scripts used within the application source bundle. Admins can send these logs to Amazon CloudWatch to centrally monitor all deployments. When enabled, AWS CloudTrail provides details about API calls made to CodeDeploy. This allows IT teams to audit who or what initiated a deployment and the origin of an API call.
- AWS Auto Scaling groups: As enterprises scale out to handle additional demand for applications, CodeDeploy can target servers in AWS Auto Scaling groups to ensure that new servers coming online have the latest and best versions of an application installed before going into service.
Amazon Simple Storage Quiz
Think you know everything about Amazon Simple Storage Service? Prove it with this 10 question quiz about Amazon S3.
In addition to reliable, repeatable deployments and integration with native services, AWS CodeDeploy also integrates well with several third-party development and configuration management tools. For example, if an IT team uses products from Atlassian, it can use Bitbucket Connect with CodeDeploy in AWS deployment automation. Other vendors, such as CircleCI, CloudBees and Codeship, offer products that integrate with AWS CodeDeploy.
From a configuration management perspective, admins can integrate CodeDeploy with popular platforms like Ansible, Chef, Puppet or SaltStack. These configuration management tools help get the CodeDeploy agent up and running on all servers, in the cloud or on premises.
DevOps tools help in deployment automation
Configuration management tools to consider
Successful DevOps means embracing a new approach