Search code examples
amazon-web-servicesaws-code-deployaws-auto-scaling

How to auto deploy latest code from CodeDeploy to an auto scaling group?


When the Auto Scaling Group creates a new instances, the code from CodeDeploy is not downloaded and installed on a newly created EC2 instance.

I've followed the documentation here: https://docs.amazonaws.cn/en_us/codedeploy/latest/userguide/tutorials-auto-scaling-group-create-auto-scaling-group.html

And the last steps says

Install the CodeDeploy agent by following the steps in Install the CodeDeploy agent and using the Name=CodeDeployDemo instance tags.

My "user" script run on the new instance from the ASG (Auto Scaling Group) correctly installs and run the CodeDeploy agent (connecting to SSh to the machine and running a service codedeploy-agent status shows it's running), but from there, I don't know how to tell CodeDeploy to deploy the code to that instance. (Or to run CodePipeline for that instance?)

What should I do here?


Solution

  • Based on the comments.

    The issue of being stuck at:

    Install the CodeDeploy agent by following the steps in Install the CodeDeploy agent and using the Name=CodeDeployDemo instance tags.

    was simply resolved by skipping this step. It is not needed, as OP uses UserData to setup CodeDeploy Agent.