Why is AWS CodeDeploy failing? - amazon-web-services

I create a pipeline in aws using CodePipeline, CodeBuild and CodeDeploy. I am also using Auto Scaling group and Application Load Balancer. The pipeline runs successfully up to the Code Deploy stage that keeps failing. I get this error: "The deployment failed because no instances were found for your deployment group. Check your deployment group settings to make sure the tags for your Amazon EC2 instances or Auto Scaling groups correctly identify the instances you want to deploy to, and then try again."
I have spent days trying to solve this. Has anyone come across this problem? Can you please help?
Thanks

Related

Error trying to use codedeploy to load code onto a auto scalable group of EC2

When I try to run codedeploy, I get the following 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.
When I look at the ec2 instances created by the auto scalable group, they are both running, and status is passed 2/2 checks passed in green. I am wondering if this is just a catch all error, because its supposed to throw this error if one or both or all are not running.
It seems it wanted an appspec.yml. I am not sure why a appspec.yml is needed, If you create the autodeploy group, and create the codedeploy application, why is there a need for a appspec.yml. I am using jenkins to run the code deploy. I gave it a appspec.yml that is empty, and seems to work.

VPC creation failed using AWS CDK: AddressLimitExceeded

I am creating a VPC through aws cdk on vscode. While running the cdk bootstrap it is creating a stack successfully but after running cd deploy it is showing vpc creation failed and ROLLBACK is also not created.
Error Code: AddressLimitExceeded
I have tried creating vpc earlier with same approach and it was a success but now I am trying to create another vpc with same approach its showing several errors after deploying. Please help me understand and resolve this issue.
Base on your capture, you reached the maximum EIPs (5 EIPs), you need to delete the not in use EIPs or submit a ticket to increase your quota.

AWS - How to send S3 artifacts from codebuild to EC2 instance

I recently was able to successfully send my artifacts to an S3 bucket using Code Build, but now I want to send those exact artifacts to a specific place in my EC2 instance.
I've been reading the AWS docs non-stop, but I haven't been able to configure Code Deploy in a way that works. Can anyone guide me to a proper source that teaches how to use appspec files and how Code Deploy works?
Thanks,
CodeDeploy simply fetches your code from S3/GitHub to your EC2 Instances and deploy it using appspec.yml.
Place your appspec.yml file in the root of your code.
https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file.html
Create a Deployment group which will contain either your EC2 Instances (Use tags to find the EC2 Instances) or AutoScaling group.
Configure it to use the deployment strategy as per your requirement which is AllAtOnce,HalfAtOnce,OneAtATime and it's done.
( Make sure your EC2 Instances are running CodeDeploy agent )
https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html
Create a deployment which will get your code from S3 bucket and deploy on EC2 Instances.

Error code: HEALTH_CONSTRAINTS in Blue/Green Deployment

I am working with Blue/Green Deployment using AWS CodeDeploy. The sample deployment provided by AWS is working fine but when I am doing the same thing using custom Deployment, I am getting the following 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. (Error code: HEALTH_CONSTRAINTS)
Can anyone help me with this?
You get this error when 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. You can check which lifecycle event failed for the instance and what is the error, also it would be helpful to log in to the failed instance and check the host agent logs.

Codedeploy fails to run on freshly scaled VM

I have codedeploy setup to deploy to an autoscaling group. I also have a jenkins build setup to build and deploy to code deploy.
When I use the jenkins box to deploy to codedeploy, every instance within the autoscaling group gets deployed to and everything works great.
However, when I tell the autoscaling group to bump the desired number of instances up to +1, that new instance fails to pickup the deployment from codedeploy. It has the codedeploy-agent service installed and it is running.
Any ideas for help with debugging this would be greatly appreciated.
So, I wasn't being patient enough. Sometimes it just takes time--everything was setup right.