Updating CodeDeploy

In Chapter 4, Adding Continuous Integration and Continuous Deployment, we saw CodeDeploy used while associated with an EC2 instance. In addition to being able to use it with EC2 instances, CodeDeploy can be used with Auto Scaling groups. We can easily make the change using the web interface as follows:

  1. Open CodeDeploy in your browser at https://console.aws.amazon.com/codedeploy.
  2. Select the Hello World application.
  3. In the Application details, select the deployment group called production and click on Action and then Edit.
  4. In the Tag Type menu, switch from Amazon EC2 to Auto Scaling Group and select the new Auto Scaling group. Its name starts with helloword-production. Once selected, the instance count should reflect your new selection and have an instance count of 2 or 3.
  5. Click Save at the bottom of the page to validate your change.

 

  1. We now need to run the actual deployment. The easiest way to do it is to run it again on our pipeline. Head to the code pipeline interface at https://console.aws.amazon.com/codepipeline/.
  2. Select the helloworld pipeline.
  3. Click on Release change and confirm it in the next popup by clicking on Release. The pipeline will now run again and in the end, deploy our service to the Auto Scaling group.

We can validate the change with curl:

$ curl -I http://helloWorl-LoadBala-1ABKQHK92ZOJO-1157159557.us-east-1.elb.amazonaws.com:3000
hello world 
Here too, we made simple yet powerful changes. CodeDeploy, Auto Scaling groups, and ELB synergize very well. When the traffic spikes up, new instances will be created thanks to the Auto Scaling group. As Ansible does the initial run on our hosts, it will install the CodeDeploy daemon, which will then reach out to the backend services to know what to deploy and perform the deployment. This will make sure that all instances are running the same version of our application. Once the code is deployed, then finally the health check will start passing and the ELB will put the new host in service. If something was to happen to our instances as they get created and within a certain time window the service wasn't up and running, the system would be aware of the issue and it would automatically terminate the bad instance and create a new one.
..................Content has been hidden....................

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