- 新しい順
- 投票が多い順
- コメントが多い順
Thank you for that reply, but didn't answer the OP. In a simplified way to ask it;
If I have an autoscale group, I increase that count, what the best way for that instance to start, AND pull down the latest code from code-deploy?
The basic issue is I have 5 servers running version 1.0 from the launch template. I update code commit to version 1.1, it looks and says oh, here are 5 servers in that deployment group, it updates, all those are now version 1.1
Something triggers and the group says we need another server, it starts, using the launch template (which was on version 1.0). Before it goes into production, is that a way at the autoscale group to say check code-deploy and pull down the latest version.
If you read the documentation the ALB is optional.
You can also coordinate deployments in CodeDeploy with Amazon EC2 Auto Scaling instances registered with Elastic Load Balancing load balancers.
The link provided is correct and doesn’t require an ALB
You can follow the tutorial https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-auto-scaling-group.html
As per documentation you have linked in the question, it uses a lifecycle hook to deploy the revisions of your code automaticlly to the new EC2's that launch. Its all part of the ASG and CodeDeploy lifecycle event.
How Amazon EC2 Auto Scaling works with CodeDeploy In order for CodeDeploy to deploy your application revision to new EC2 instances during an Auto Scaling scale-out event, CodeDeploy uses an Auto Scaling lifecycle hook. The lifecycle hook notifies CodeDeploy that an Auto Scaling scale-out event is in progress and that CodeDeploy must deploy a revision to the scaled-out instances.
After the lifecycle hook is installed, it is used during scale-out events. A scale-out event unfolds as follows:
- The Auto Scaling service (or simply, Auto Scaling) determines that a scale-out event needs to occur, and contacts the EC2 service to launch a new EC2 instance.
- The EC2 service launches a new EC2 instance. The instance moves into the Pending state, and then into the Pending:Wait state.
- During Pending:Wait, Auto Scaling runs all the lifecycle hooks attached to the Auto Scaling group, including the lifecycle hook created by CodeDeploy.
- The lifecycle hook sends a notification to the Amazon SQS queue that is polled by CodeDeploy.
- Upon receiving the notification, CodeDeploy parses the message, performs some validation, and starts to deploy your application to the new EC2 instance using the last successful revision.
- While the deployment is running, CodeDeploy sends heartbeats every five minutes to Auto Scaling to let it know that the instance is still being worked on.
- So far, the EC2 instance is still in the Pending:Wait state.
- When the deployment completes, CodeDeploy indicates to Auto Scaling to either CONTINUE or ABANDON the EC2 launch process, depending on whether the deployment succeeded or failed.
-
If CodeDeploy indicates CONTINUE, Auto Scaling continues the launch process, either waiting for other hooks to complete, or putting the instance into the Pending:Proceed and then the InService state.
-
If CodeDeploy indicates ABANDON, Auto Scaling terminates the EC2 instance, and restarts the launch procedure if needed to meet the desired number of instances, as defined in the Auto Scaling Desired Capacity setting.
関連するコンテンツ
- AWS公式更新しました 8ヶ月前
Added a new answer with the text from the documentation which is the exact process that occurs when the ASG scales out an achieves what you are looking to do. This is not tied to the launch template. Its part of the codedeploy process. The launch template has the EC2 configuration etc and not the codedeployed versions