One of the key principles of embracing a DevOps approach is to apply software development practices to infrastructure....
But for operations teams new to DevOps, this is one of the hardest adjustments to make. If you plan to run applications on AWS, these tools and services can ease the transition and automate the software release process.
Continuous delivery (CD) is a software development practice that allows developers to build applications that are ready for production at any given time. The idea is to continuously and automatically validate changes made to application source code. Developers create an automated continuous delivery pipeline to build or compile source code. They can make changes, run automated tests against an application and deploy the latest version to a production-like environment more quickly than with traditional development methods.
There are a number of CD tools available from AWS to help build, test and deploy applications using a fully automated continuous delivery pipeline:
- AWS CodeCommit is a fully managed private source control service. IT teams can use CodeCommit to track changes and securely store application source code.
- AWS CodeDeploy is an automated deployment service that works with both on-premises servers and Amazon Elastic Compute Cloud (EC2) instances. CodeDeploy makes it easy to automate the deployment and updates to application source code running on servers.
- AWS CodePipeline is a continuous delivery service that orchestrates software releases. CodePipeline triggers builds based on commits to version control repositories, such as CodeCommit or GitHub. IT teams can create multiple stages to run tests against application code using a continuous integration server. After all of the stages complete successfully, the application can deploy to servers in a CodeDeploy deployment group.
These tools are key components for building a continuous delivery pipeline on AWS, but there's one more piece to the puzzle: automating infrastructure deployment.
How Infrastructure as Code fits into CD
In a CD pipeline, changes to source code kick off a series of stages -- building or compiling application source code, running unit tests and deploying the new version of an app, and setting up testing and staging environments. These environments shouldn't be built manually. When embracing DevOps practices, one of the key principles is to automate everything, including the infrastructure.
The idea with Infrastructure as Code (IAC) is to apply the same practices that developers use for application source code to the infrastructure. DevOps teams can use a tool like AWS CloudFormation to define the infrastructure for an application environment as code in a declarative JSON-based template. These templates are checked into a version-control repository, just like application source code, and IT teams can have stages in the CD pipeline that run tests on the templates.
Plug CloudFormation into the CD pipeline
CloudFormation is a logical choice for automating the creation of application infrastructure from a stage in a continuous delivery pipeline, allowing IT teams to track the success or failure of its stacks.
CloudFormation can provision most AWS resources, such as EC2 instances, an Amazon Virtual Private Cloud, Elastic Load Balancing and Auto Scaling groups. Resources are defined in an easy-to-read JSON-based template that can be checked into version control. This gives IT teams a self-documented blueprint of a cloud environment; any team member can understand the configurations.
In addition, storing templates in version control gives administrators the ability to audit and report on every configuration change made to the infrastructure, which can ease the troubleshooting process if something goes wrong.
CloudFormation templates that have been launched are referred to as stacks, because they generally consist of a stack of resources powering an application. Developers launch templates manually from the web-based CloudFormation console; the templates are launched programmatically using the AWS Command Line Interface or through an API call using one of the AWS SDKs.
While CloudFormation is a good fit for automating AWS infrastructure, which operating system configuration to use for instances is a key consideration. CloudFormation has some capabilities for node configuration, but most IT teams will invoke traditional configuration management tools like Chef, Puppet or Ansible to configure the OS and application settings on servers. IT teams should also version and store node configurations used with configuration management in source control.
It's a good idea to get an operations team familiar with using version control. This will make the transition to defining IAC much smoother. There is a bit of a learning curve when it comes to writing CloudFormation templates, and AWS provides a number of starter templates that teams can use to hit the ground running.
Implementing DevOps can be a challenge in the cloud
AWS computing power helps enable DevOps
Don't forget security in the DevOps equation