AWS Elastic Beanstalk: Command Hooks Failed - amazon-web-services

Trying to deploy an IIS application to AWS Elastic Beanstalk via Visual Studio 2015. Every time we try to deploy it we get the following errors:
Error occurred during build: Command hooks failed
[Instance: i-XXXXXXXX ConfigSet: Infra-WriteRuntimeConfig, Infra-WriteApplication1,
Infra-WriteApplication2, Infra-EmbeddedPreBuild, Hook-PreAppDeploy,
Infra-EmbeddedPostBuild, Hook-EnactAppDeploy, Hook-PostAppDeploy]
Command failed on instance. Return code: 1 Output: null.
Unsuccessful command execution on instance id(s) 'i-XXXXXXXX'. Aborting the operation.
We've tried restarting the Application. We've tried deleting and recreating the Environment and Application. All to no success. Always the same error. I cannot find anything online anywhere that tells how to fix this. Has anyone else run into this problem and found a solution?

The Beanstalk deployment errors are usually quite generic.
To get the root cause, the troubleshooting steps are the ones in AWS Elastic Beanstalk Troubleshooting doc:
Retrieve and investigate EB Logs.
If retrieved logs are not helpful, then SSH to the EC2 instance can be used to get more details or check that the instance config is really what is expected for example.

Before deploying login to the ec2 instance via SSH and do a realtime log fetching
tail -f /var/log/eb-engine.log
and you will get proper error log why the hooks get failed.

Related

GCP Cloud Composer Update Failed - Questionable Permissions

I am trying to update my GCP Cloud Composer environment from composer-1.18.0-airflow-2.2.3 -> composer-1.19.4-airflow-2.2.5 .
It fails with the error that I don't have the permissions to describe the tenant Cloud SQL instance (verbose error below). I know that the command is executed on a running pod in the Composer's kubernetes cluster.
I tested the failing command, outlined below, with the environment's service account credentials activated and it works. Why does the command fail when executed inside the pod? Is the kubernetes cluster using different credentials than the Composer's service account?
Verbose error message:
Failed to update image version.
Exporting sql database failed with error [Failed to run command ['gcloud', 'sql', 'instances', 'describe', 'my-tentant-sql-instance-...-sql', '--project', 'myTenantProject-tp', '--format', 'get(serviceAccountEmailAddress)'], details: b'ERROR: (gcloud.sql.instances.describe) There was no instance found at projects/myTenantProject-tp/instances/my-tentant-sql-instance-...-sql or you are not authorized to access it.\n'].

Unable to deploy code on ec2 instance using codedeploy

I have single ec2 instance running on ubuntu server and I am trying to implement CI/CD flow using codedeploy and source is bit-bucket.I jave also installed codedeploy-agent on ec2 instance and it is installed and running successfully but whenever I am deploying code on ec2 deployment is failing with an error shown below:
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.
In the CodeDeploy agent log file that I am accessing using less /var/log/aws/codedeploy-agent/codedeploy-agent.log showing below error:
ERROR [codedeploy-agent(31598)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller:
Missing credentials - please check if this instance was started with an IAM instance profile
I am unable to understand how can I overcome this error someone let me know.
CodeDeploy agent requires IAM permissions provided by IAM role/profile of your instance. The exact permissions needed are given in AWS docs:
Step 4: Create an IAM instance profile for your Amazon EC2 instances

Jenkins pipeline is throwing Could not connect to the endpoint URL: "https://ecs.ap-south-1.amazonaws.com/"

We have AWS ECS Fargate running taskdefinitions and tasks. I wanted to perform deployment to AWS ECS by updating task definition with new Docker image using Jenkins. I have create a script for this on my Jenkins machine. I can run this and update the task definition. But using Jenkins the script is giving error. I have ECR configurations in Jenkins and I can push images to AWS ECR. But scripts for describing task definitions gives error "Could not connect to the endpoint URL" error".
Initially I was getting credentials error. I resolved this by running aws config for jenkins.
I used withAWS in jenkins pipeline. Still getting the same error.
I tried the solutions provided in the sites, but did not resolve the issue.
Any help is appreciated.

AWS CodeDeploy + Codeship Deployment Failed

Aws CodeDeploy issue: .zip file is going to s3 images, deployments starts and get failed and the error Status is just failed earlier it was showing error in hooks ApplicationStart but i went to instance and setup the node enviroment manually, now this error is not coming but deployment fails" with statusfailedno further details of logs, and it is not able to fetch.zipfile froms3to myinstanceand i don't know why it is not taking the files directly from github even i have set up codeDeploy in such a manner toconnect my github`.

Can't login to docker with aws

This is an extension of my last question considering I've decided to deploy a Docker container onto a ton of EC2's. I've set up a repository and a user with full rights, and I added the correct keys to my aws cli configuration. When I try to run the docker login command that comes up after running the "aws ecr get-login" command, it gives me a failed with status: 403 forbidden error. I have absolutely no clue what's going on, and I've spent the past 2 days trying to fix this error... Any ideas?
I would suggest to check the security group of the EC2 Instance
To allow access via SSH you have to apply the following settings for the Security Group of the EC2 Instance:
Security Groups