2

We have auto-scaling group behind an Application load balancer which launches instances if the avg. CPU Utilization goes beyond 70%.

We have created a base AMI for the auto-scaling group.

But the problem is that our website updates almost on a regular or weekly basis so what we can configure to allow AWS code-deploy to automatically deploy our latest revision from github on those instances created via auto-scaling group?

If any more information is required please let me know.

11
  • Are you able to elaborate which aspect specifically you are struggling with? Have you read this for example: docs.aws.amazon.com/codedeploy/latest/userguide/…
    – Alex Moore
    May 18, 2019 at 8:33
  • According to docs, what I understood is that I just have to point the deployment group to Auto-scaling group. Is that it? How will the code-deploy know which revision or commit to deploy on the auto-scaling instances?
    – Axel
    May 18, 2019 at 9:08
  • For that you should use CodePipeline to trigger the CodeDeploy if you want it automated.
    – Alex Moore
    May 18, 2019 at 9:15
  • Check out this article: medium.com/@ariklevliber/…
    – Alex Moore
    May 18, 2019 at 9:17
  • Nice! I didn't indulge in Codepipeline because I didn't want to complicate things too much and I was manually deploying the latest commit by going to code-deploy in the console or via aws CLI and using the latest githun commit ID for deployment. Codepipeline looks better.
    – Axel
    May 18, 2019 at 9:24

2 Answers 2

0

Code Deploy fully supports Auto Scaling.

Here are the steps to integrate these two services: Integrating CodeDeploy with Amazon EC2 Auto Scaling

Hope that helps :)

0

You just have to point the deployment group to Auto-scaling group.

It is a horrifying implicit magic.

However, to make it work you need to set Deployment type In-place, or you will get a new auto scaling group instead. And it mean that you still need 2 instances at least.

Initiating event on each 'Deployment' can tell you more. If your autoScaling group would start a new instance, you will have a new deployment in your CodeDeploy and the Initiating event would say autoScaling, when normally it would say user.

Also look into Auto Scaling Group Lifecycle Hook. The Code deploy creates the hook and name it like so

CodeDeploy-managed-automatic-launch-deployment-hook-Your-Deployment-Group-name-some_numbers

and it somehow knows the Revision. Documentetion.

I could not trace of how SQS Notification from Auto Scaling Group Lifecycle Hook connected to exact CodeDeploy Deployment group and that is why I call it magic.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .