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 you 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.
- [Instructor] And now, next demonstration, we'll use the CodeDeploy service to deploy our build artifacts that we created in our previous demonstration. Before we create our CodeDeploy application, we'll first spin up an EC2 instance, which will be the endpoint to which we deploy to. We'll use the Amazon Linux AMI, and we'll use a t2.micro instance. We'll deploy it into a Network that has access to the Internet. This will be required to be able to download the CodeDeploy Agent. We'll create an IAM role for it. This will be required to give the EC2 instance access to the build artifacts stored in s3. Clicking the next button takes us to the permissions screen. Here, we'll create a custom policy. We'll click on the JSON tab, and we'll customize the policy by hand. We've got a pre-crafted one already, so we'll just paste this in. This policy gives us access to our catestbuild s3 bucket, as we can see here. So this is the bucket that holds our WebApp.zip artifact which was built using codebuild. So back within IAM, we'll edit the action just to give permissions to GetObject. This is sufficient to give the EC2 access rights to get the build artifact. So we'll give the policy a name, BuildBucketAccess, S3BuildBucketAccess. We'll click the Create policy button, and then finally, we'll attach the policy to our IAM role that we're creating for our EC2 instance. So clicking Refresh, we should be able to see the new policy, indeed we do, we select it, we attach it, and finally, we need to give our new role a name. In our case, we'll call it WepAppServerRole, and finally, we click the Create role button. Okay the role has been created. We go back into our EC2 console launch interface, refresh, select it. Under the Advanced Details section, we'll paste in our bootstrapping script to install the CodeDeploy Agent. Here you can see we're using bash to actually run the script. The first thing we do, is we change into the EC2 user home directory. We then use wget to a download of the CodeDeploy Agent, install rpm, and then we use yum to actually run the install. Okay, in the Storage section, we'll increase the volume size for the root directory. Next, for Tags, we're gonna give it a name tag with the value WebInstance. Clicking on Security Group, we'll configure a new security group with SSH and HTTP access. We'll give it a name. We'll call it WebInstanceSG. We then click on Review and Launch. Review the settings, and then click Launch, and we'll select an EC2 key pair. Okay, so that's launching the EC2 instance, and this will be the instance that we will use CodeDeploy to deploy to. So the first thing we'll do, is we'll grab the Public IP address, and we'll SSH into this instance. So jumping over to our terminal, we do ssh -v for verbose,
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.