chapter fifteen

15 Automating deployment: CodeDeploy, CloudFormation, and Packer

 

About 20 years ago, we rented our first virtual machine. Our goal was to deploy WordPress, a Content Management System. To do so, we logged into the machine using SSH, downloaded WordPress, installed the scripting language PHP and the web server Apache, edited configuration files, and started the web server.

To this day, the steps for deploying software - whether open source, proprietary, or homegrown - have remained the same.

  1. Fetch source code or binaries
  2. Install dependencies
  3. Edit configuration files
  4. Start services

These activities are also summarized under the term configuration management.

There are two main reasons why automating deployments is a must-have in the cloud.

  1. To ensure high availability and scalability you need to configure an auto-scaling group to launch EC2 instances automatically. Anytime, a new machine could spin up, so deploying changes manually is not an option.
  2. Manual changes are error-prone and expensive to reproduce. Automating increases reliability and reduces the costs per deployment.

From what we have learned from our consulting clients, organisations that implement automated deployments have a higher chance to suceed in the cloud.

15.1 In-place deployment with AWS CodeDeploy

15.2 Rolling update with AWS CloudFormation and user data

15.3 Deploying customized AMIs created by Packer

15.3.1 Tips and Tricks for Packer and CloudFormation

15.4 Summary