Pipe fails on the aws side during various events ? DownloadBundle, ApplicationStop, AfterBlockTraffi
Asked by Trip:

Pipe fails on the aws side during various events -- DownloadBundle, ApplicationStop, AfterBlockTraffic, BeforeBlockTraffic

This is my first pipeline. See below see below for my pipeline and appspec. The error I see in the console is "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."

I was able to verify there is a healthy instance in the ASG. The ASG min = 1, desired = 1, max =2. I'm not sure how to verify if too many instances failed. The deployment group is set to replace all at once. I also added the IGNORE_APPLICATION_STOP_FAILURES: 'true' which got it further in the process. But the rest of those events failed.

I brought down the healthy instance to see if the auto scale group would stand up a new one and executed as expected.

In troubleshooting saw this link --

<https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html#troubleshooting-deployments-lifecycle-event-failures>

In says - On Amazon Linux, Ubuntu Server, and RHEL instances, this file must exist in /opt/codedeploy-agent/deployment-root/deployment-instructions.

When I ssh, I don't see the deployment-root directory, but the agent is running. If it makes a difference the deployment has never been successful.

Any help/guidance is much appreciated.

Appspec -- this is a Drupal 9 site and was never able too find an example

version: 0.2

os: linux

files:

- source: /

destination: /var/www/html/web/

Pipeline --

image: atlassian/default-image:2

pipelines:

branches:

feature/infastructure:

- step:

name: Zip the code

script:

- zip -r myApp.zip . -x \*.git\*

- pipe: atlassian/aws-code-deploy:0.4.0

variables:

AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

AWS_DEFAULT_REGION: 'us-east-1'

LOCAL_PATH: $(pwd)

COMMAND: 'upload'

S3_BUCKET: 'ahrq-testing-s3/dev-builds'

APPLICATION_NAME: 'AHRQ-Testing'

DEPLOYMENT_GROUP: $DEPLOYMENT_GROUP

ZIP_FILE: 'myApp.zip'

- pipe: atlassian/aws-code-deploy:0.4.0

variables:

AAWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

AWS_DEFAULT_REGION: 'us-east-1'

LOCAL_PATH: $(pwd)

COMMAND: 'deploy'

S3_BUCKET: 'ahrq-testing-s3/dev-builds'

APPLICATION_NAME: 'AHRQ-Testing'

DEPLOYMENT_GROUP: $DEPLOYMENT_GROUP

IGNORE_APPLICATION_STOP_FAILURES: 'true'

WAIT: 'false'

FILE_EXISTS_BEHAVIOR: 'OVERWRITE'

artifacts:

- myApp.zip


Answers:
author: Monica Gordillo
body: For me, I had to restart the codedeploy agent (on the original EC2) for the BeforeBlockTraffic issue.


author: Halyna Berezovska
body: [@Trip](/t5/user/viewprofilepage/user-id/4345724) thanks for the question!

I think that the problem is not that deployment-instructions file do not exist, that note is put in another type error's subsection.

But what you initially referred to is right: you have the subsection in [Troubletshoot guide](https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html#troubleshooting-deployments-lifecycle-event-failures) called
> Troubleshooting all lifecycle events skipped errors

There you can see exactly your error: `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`

However, except of that code-deploy agent is running, other checks explained by this aws guide (linked by you) can be made:

- Your instance might not be able to reach the CodeDeploy or S3 public endpoint using port 443.

- check if service role has required permissions

and other actions that are described there.

Right now, we do not have a lot of information about your AWS Code deploy setup and your ec2 instance.

If you could share the pipeline log, it would be great, so we can ensure that nothing wrong happend inside our pipeline and this is AWS side and setup for AWS ec2-instance should be rechecked (I suspect if you finish following this troubleshooting guide, you can find the root cause).

However, if during communication we understand, that something is wrong in AWS code deploy pipe, we will fix it. But let's first communicate to understand your root cause.

Regards, Galyna


Tags: aws

bitbucket-pipelines

cloud