AWS Code Deploy - Script at specified location: scripts/validate_service.sh failed with exit code 1

Viewed 54

My deployments fail on last step Validate Service with error message:

The overall deployment failed because too many individual instances failed deployment, too few healthy instances are available for deployment, or some instances in your deployment group are experiencing problems.

Events log

No lines are selected.

My validate_service.sh contain

    #!/bin/bash
    # verify we can access our webpage successfully

curl -v --silent localhost:80 2>&1 | grep Welcome

Can someone advice what should I change ?

1 Answers

Script return value matters. Yours looks good to me. I just added couple of seconds to wait until application starts up.

In case you use bash -x together with pipeline of commands, you better add shopt -s pipefail so all pipeline fails when one of the commands fails.

Checkout my script:

#!/bin/bash

sleep 5
curl http://localhost:3009 | grep Welcome
Related