3
votes

I am trying to set up auto-deployment from GitHub to AWS, using EC2 behind an ELB.

After following the Tutorial: Use AWS CodeDeploy to Deploy an Application from GitHub, my deployment fails at the BlockTraffic event, after trying for an hour (1h 2min last time) with error code ScriptFailed. I'm not sure how to troubleshoot the issue/where to look.

The ELB target group target health status: healthy

Health Check configuration:

Healthy threshold: 2 Unhealthy threshold: 2 Timeout: 5 Interval: 10 Success codes: 200

2
Did you find the solution for this issue? I am having the same problem. - DynamicScope
@DynamicScope Yes. I can't remember what it was exactly, but I think I was missing an AppSpec file, or an ApplicationStart.sh. I had to learn about systemd and daemons - nth-chile

2 Answers

0
votes

Make sure your Code Deploy role has sufficient access to register and de-register instance if it is behind ELB.

Below permissions may required.

"elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeInstanceHealth",
"elasticloadbalancing:RegisterInstancesWithLoadBalancer",
"elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:DeregisterTargets"
0
votes

There is an AWSCodeDeployRole policy, makes it very easy to cover the permissions you need to use codedeploy