7

I'm using AWS CodeDeploy to deploy my project (triggered by CodePipeline) to an autoscaling group (EC2 instances behind an ALB). This is my appSpec file:

version: 0.0 os: linux files: - source: / destination: /var/www/html/test-deploy overwrite: true permissions: - object: /var/www/html/test-deploy/codedeploy pattern: "*.sh" owner: root group: root mode: 755 type: - file hooks: BeforeInstall: - location: codedeploy/before_install.sh timeout: 180 AfterInstall: - location: codedeploy/after_install.sh runas: centos timeout: 180

The files get deployed successfully to the EC2 instance, but for some reason after the "BeforeAllowTraffic" nothing happens, like I waited 15 min and the next step was still at "pending".

The two .sh files do nothing fancy (and codedeploy passed those steps so I don't think that's the problem).

Can anyone point me to a direction? I don't get any error messages, so I don't even know how to debug it.

Thanks

3 Answers 3

10

I have got the same issue, after investigation, I found that my target group was "unhealthy". I just add the health check path/file i.e "/rorbots.txt" and rebooted the Ec2 Server and its fixed the problem.

Sign up to request clarification or add additional context in comments.

1 Comment

awesome thanks for the comment - we have a headless API with no base url, so it was getting stuck on allow traffic because hitting the ELB default "/" endpoint wasn't returning 200 :)
0

We also had an unhealthy target instance. The problem was hosting two applications on the same instance, where one (application A) was responsible for health checks and talking to the load balancer, and the other one (application B without any open network ports) was being deployed. One instance was always getting stuck in AllowTraffic during app B deployments. I found the root cause when I looked at the target group for app A and saw that same instance in the "unhealthy" status, so of course deploying app B wasn't going to fix that. After I re-deployed app A and restored the instance back to health, app B deployments were able to progress.

Comments

0

Check your logs on your target group instances. It may be caused by one of the following:

  • the application startup command did not finish successfully
  • the application is not running due to an error
  • your target group's health check is NOT configured with the endpoint you expect
  • your application is NOT responding at the endpoint you expect

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.