Creating a CodeDeploy application and deployment group

With our AppSpec file and scripts in place and the EC2 instance set up with the CodeDeploy agent as well, the final thing left is to configure AWS CodeDeploy and tie these things together:

  1. Start off by logging into the AWS CodeDeploy service by selecting URL https://console.aws.amazon.com/codedeploy/home.
  2. Since this is the first time we are using CodeDeploy, select the Get Started Now option. Here, you will be prompted to select either a Sample deployment that deploys a sample application on the EC2 instances or, alternatively, go for a Custom deployment if you have your code and EC2 instances up and running. In this case, we will select the Custom deployment option itself.
  3. In the Create application page, start off by providing a suitable Application name, Compute Platform, and a Deployment group name. Remember to select the EC2/On-premises option from the Compute Platform, as shown in the following screenshot:
  1. Next, in the Deployment type section, choose the In-place deployment option for now. This will enable CodeDeploy to update the existing instances with the revised set of application code with some amount of downtime.
  1. In the Environment configuration section, you can specify any combination of Auto Scaling groups, Amazon EC2 instances, and On-premises instances to add instances to this deployment group. Since we have created an EC2 instance in our earlier steps with the CodeDeploy agent installed in it, select the Amazon EC2 instances tab. From the Tag group drop-down, select the instance's Key and Value, as shown.

Note that these are the same tags that you would have configured to your instance before its launch in our earlier sections:

  1. Moving on, in the Deployment configuration section, you can choose from a list of default and custom deployment configurations. As discussed earlier, a deployment configuration is a set of rules that determines how fast an application will be deployed along with the definition of success or failure conditions for a particular deployment.

There are three default configurations provided by AWS CodeDeploy itself:

  • OneAtATime: Routes traffic to one instance in the replacement environment at a time
  • HalfAtATime: Routes traffic to up to half the instances in the replacement environment at a time
  • AllAtOnce: Routes traffic to all instances in the replacement environment all at once

Since we are working with just a single EC2 instance as of now, go ahead and select the OneAtATime deployment configuration option.

  1. Finally, select the IAM Role that we created and assigned our EC2 instance to at the time of launching, using the Service Role drop-down list. Once done, select the Create application option to complete the process!

There you have it! If you made it this far then you have successfully configured both AWS CodeCommit and AWS CodeDeploy for our WordPress application's deployment! But we are still missing the glue that ties all these services together, and that precisely is what we will be talking about in the next section with the introduction of AWS CodePipeline!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset