The course is part of these learning pathsSee 1 more
In this course we’ll provide you with an introduction to AWS CodeDeploy and how it can be used to automate deployments of applications to servers either running in the cloud or on prem and/or into the Lambda service. We’ll show you where AWS CodeDeploy sits in a CI/CD setup. This course will familiarize yourself with the AWS CodeDeploy service and ensure you know when and where to use it within your own software projects. We'll then provide a demonstration where we use AWS CodeDeploy to deploy our web portal project onto EC2 infrastructure.
About the Author
Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.
Jeremy holds professional certifications for both the AWS and GCP cloud platforms.
- [Instructor] Welcome back. In this lecture, we'll provide a brief introduction to AWS CodeDeploy and how it can be used to automate deployments of applications to servers either running in the cloud or on-prem or into the lambda servers. We'll show you where AWS CodeDeploy sits in our CICD setup. This lecture will familiarize yourself with the AWS CodeDeploy service and ensure you know when and where to use it within your own software project. Okay, let's begin. AWS CodeDeploy is a fully managed deployment service. AWS CodeDeploy can be used to deploy your build artifacts into various environments. For example, CodeDeploy can be used to take your Java or .NET libraries and/or executables and deploy them onto your web servers or take your updated lambda function and deploy it into the lambda servers. CodeDeploy makes it effortless to roll out application changes quickly and in automated fashion ensuring that new features are available to your end users as early as possible while avoiding downtime of the current system. As we'll see later on in this lecture, AWS CodeDeploy can be triggered to deploy automatically as part of the code pipeline release process. CodeDeploy uses an agent-based method for performing deployments on servers. Whether they are EC2 instances or on-prem servers, the CodeDeploy agent is not required for deployments that target the serverless lambda servers. AWS provides an agent installable software package for both Linux and Windows operating systems. Once installed, the agent communicates back with the CodeDeploy service using outbound connections over the HTTPS protocol in port 443, polling for code deployment updates. The behavior of the agent can be controlled via a local configuration file. AWS CodeDeploy acts as the deployment system for your software projects. It is the service that is used to deploy your build artifacts stored in S3 onto our servers or into the lambda servers. As we've already seen, AWS CodeBuild can be used to build the artifacts which can then be given to AWS CodeDeploy for deployment. Installing the CodeDeploy agent is very simple. AWS provides install scripts that can be used to bootstrap the agent during launch. Scripts or install commands exist for common operating systems such as Windows, Amazon Linux, Red Hat Enterprise Linux, and/or Ubuntu. The following example can be used to install the CodeDeploy agent on a Linux operating system that uses yum as its package manager such as the Amazon Linux OS. The next example as shown here shows PowerShell commands used to install the CodeDeploy agent on a Windows-based server. Either set of commands can be integrated into the user data section of an EC2 instance launch to have the CodeDeploy agent automatically installed during launch. CodeDeploy uses either a JSON or YAML-based AppSpec file to drive the deployment depending on deployment endpoint. If you are deploying a lambda function to the lambda servers, then you can use either JSON or YAML within your AppSpec file. However, if you are deploying to an EC2 instance or on-prem server, then you must use YAML only. Within this file, you specify the install sequence of steps which may include specific commands and/or scripts that you want to run. The following example as shown here demonstrates a potential WordPress installation and deployment consisting of scripts to perform installation, create database, and start and stop the web server. In this next example, the AppSpec file is used to install and set up an NGINX-based website. Again, the AppSpec configuration consists of scripts to perform the installation, deploy the website files, and start and stop the NGINX servers. AWS CodeDeploy has the concept of deployment groups. A deployment group represents a group of servers that have the CodeDeploy agent installed on and for which you will deploy a version or revision of your software application to. Deployment groups can be configured either by specifying an auto scaling group, EC2 instances identified by tags, or on-prem servers identified by tags. A deployment group can consist of any combination of the previously three mentioned options. The steps to provision a new deployment bridge within AWS CodeDeploy are simple. The key configuration attributes are deployment group, represents the set of instances or servers to which the deployment will be rolled out to. Revision, represents the version of the software package that will be deployed and installed onto the deployment group. When performing a deployment, you can control the speed of your deployment in terms of how many of your instances or servers are updated at once. Or in the case of a lambda function, how traffic is rerouted incrementally from the old lambda function to the new lambda function. To facilitate and control how the deployments take place, you have the option of choosing from a number of deployment configuration presets. Or if required, you can create your own custom deployment configuration. AWS CodeDeploy provides several integration options. CodeDeploy CloudWatch Events. CodeDeploy publishes events to CloudWatch such that you can detect and react to changes in the state of an instance or a deployment. CodeDeploy Deployment Group Triggers. With the deployment group triggers, you can register an SNS topic to receive deployment event messages. You can subsequently subscribe to the topic and perform any necessary downstream actions, et cetera. AppSpec file. As we've already seen, the AppSpec file gives you the capability to hook in commands or custom scripts to react before or after particular deployment events. Okay, that completes this introduction lecture on the AWS CodeDeploy service. Go ahead and close this lecture and we'll see you shortly in the next one.