I run my packer build
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored after 6 minutes 23 seconds: Timeout waiting for SSH.
and
==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Timeout waiting for SSH.
I checked my VPC(for user in packer build example)
How to solve this issue?
I removed the default VPC and created the new one with subnet. Added two lines into json
"vpc_id": "vpc-0bb5a477b899e995d",
"subnet_id": "subnet-00934a52461387401",
I got again
Build 'amazon-ebs' errored after 6 minutes 26 seconds: Timeout waiting for SSH.
I checked the route table again
I have set up a pipeline, but i get the following error during deployment:
before install CodeDeploy agent was not able to receive the lifecycle event. Check the CodeDeploy agent logs on your host and make sure the agent is running and can connect to the CodeDeploy server.
Code Agent is running, but i do not know, what the problem is. I checked the logs of codedeploy:
[ec2-user#ip-172-31-255-11 ~]$ sudo cat /var/log/aws/codedeploy-agent/codedeploy-agent.log
2022-09-27 00:00:02 INFO [codedeploy-agent(3694)]: [Aws::CodeDeployCommand::Client 200 45.14352 0 retries] poll_host_command(host_identifier:"arn:aws:ec2:us-east-1:632547665100:instance/i-01d3b4303d7c9c948")
2022-09-27 00:00:03 INFO [codedeploy-agent(3694)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.4.0-2218_rpm.
2022-09-27 00:00:03 INFO [codedeploy-agent(3694)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.4.0-2218_rpm.
Also was unlucky enough to meet this problem today.
Please use this guide and look at the CodeDeploy agent logs of your compute platform instance (EC2, probably).
in my case, it turned out that I did not have an AppSpec file added to the project.
I am trying to execute a AWS CLI command from SQL Server Agent Job to sync backups to S3 bucket. I created a profile xxxxxxx and I am able to execute the following command successfully from cmd.exe
"C:\Program Files\Amazon\AWSCLI\bin\aws.exe" s3 --profile xxxxxx sync "C:\AutomatedBackups\Sequential\xxxxxxxxx\msdb" "s3://xxxxxxx/AutomatedBackups/Sequential/xxxxxxxxxx/msdb"
I am getting the following error when I try to execute from SQL Server Agent Job:
Executed as user: xxxx\xxxxx. The config profile (xxxxxxx) could not be found. Process Exit Code 255. The step failed.
Please advise.
I have angular application and the back end was on node.js. Now I want to deploy the application to AWS EC2 instance from bitbucket repository using bit bucket pipeline and AWS Code Deploy.
When I am trying to install AWS code deploy agent in EC2 instance I am getting forbidden error.(403 error code)
It is a permission issue and I am missing some configure related permission.
I am trying to deploy it with the help of AWS Code Deploy by following the below article.
https://levelup.gitconnected.com/set-up-a-continuous-delivery-pipeline-from-bitbucket-to-aws-ec2-using-aws-code-deploy-a9777a3cbcad
I am getting an error when I am trying to install AWS code deploy agent in EC2 instance.
ubuntu#ip-10-245-1-43:~$ wget https://aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com/latest/install
--2019-07-03 13:14:17-- https://aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com/latest/install
Resolving aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com (aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com)... 52.216.130.237
Connecting to aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com (aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com)|52.216.130.237|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-07-03 13:14:17 ERROR 403: Forbidden.
I tried to run the bitbucket-pipeline.yml file and getting the below error:
--env=COMMAND="upload" \
--env=S3_BUCKET="$S3_BUCKET" \
--env=VERSION_LABEL="my-app-1.0.0" \
--env=ZIP_FILE="application.zip" \
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
bitbucketpipelines/aws-code-deploy:0.2.5
Unable to find image 'bitbucketpipelines/aws-code-deploy:0.2.5' locally
0.2.5: Pulling from bitbucketpipelines/aws-code-deploy
c67f3896b22c: Pulling fs layer
410e0473b28d: Pulling fs layer
935eaadc5887: Pulling fs layer
7e21295cc8c2: Pulling fs layer
3073cb4153c5: Pulling fs layer
7e21295cc8c2: Waiting
3073cb4153c5: Waiting
c67f3896b22c: Verifying Checksum
c67f3896b22c: Download complete
935eaadc5887: Download complete
7e21295cc8c2: Verifying Checksum
7e21295cc8c2: Download complete
3073cb4153c5: Verifying Checksum
3073cb4153c5: Download complete
c67f3896b22c: Pull complete
410e0473b28d: Verifying Checksum
410e0473b28d: Download complete
410e0473b28d: Pull complete
935eaadc5887: Pull complete
7e21295cc8c2: Pull complete
3073cb4153c5: Pull complete
Digest: sha256:afc573f273389097401321945c6d2f7c0436a8807917ebcc20b53bdff64be9d0
Status: Downloaded newer image for bitbucketpipelines/aws-code-deploy:0.2.5
INFO: Uploading application.zip to S3.
aws s3 cp application.zip s3://CodeDeployApplication-codedeploy-deployment/my-app-1.0.0
✖ Failed to upload application.zip to S3.
Appreciate your help.
Finally I found some solution for the error I am getting in bit-bucket pipeline.
I did some mistake to set up the environment variables in bit-bucket.
Previously I kept application name and s3 bucket name different.
After some finding I put the same name for both and application was successfully uploaded to AWS s3 storage.
Thank you all.
i've set up everything according to this article
https://aws.amazon.com/tw/blogs/apn/announcing-atlassian-bitbucket-support-for-aws-codedeploy/
Here is my env:
Instance (free tier with amazon linux)
- apache 2.4 installed
Security group
- only 22 (only my ip can access) and 80 port are opened
Iptables stopped
2 roles are set
- one for linking S3 <-> bitbucket
(attached custom policy)
- one role is for deployment group
(attached AWSCodeDeployRole policy)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "codedeploy.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
The script tried to deploy is
https://s3.amazonaws.com/aws-codedeploy-us-east-1/samples/latest/SampleApp_Linux.zip
Permission
/var/www/* is owned by ec2-user with 755 permission
Agent
service codedeploy-agent status =
The AWS CodeDeploy agent is running as PID 7200
Clues:
There are some zip file in my s3 bucket is uploaded for every deploy.
Error code: HEALTH_CONSTRAINTS
Anyone have an idea what the causes of deployment fail?
update1 After i re-launch the instance with iam profile, the application can be deployed. But it is still failed, when i click view events, there is log as follow:
Error CodeScriptFailed
Script Namescripts/install_dependencies
MessageScript at specified location: scripts/install_dependencies run as user root failed with exit code 1
Log TailLifecycleEvent - BeforeInstall
Script - scripts/install_dependencies
[stdout]Loaded plugins: priorities, update-motd, upgrade-helper
[stdout]Resolving Dependencies
[stdout]--> Running transaction check
[stdout]---> Package httpd.x86_64 0:2.2.31-1.8.amzn1 will be installed
[stdout]--> Processing Dependency: httpd-tools = 2.2.31-1.8.amzn1 for package: httpd-2.2.31-1.8.amzn1.x86_64
[stdout]--> Processing Dependency: apr-util-ldap for package: httpd-2.2.31-1.8.amzn1.x86_64
[stdout]--> Running transaction check
[stdout]---> Package apr-util-ldap.x86_64 0:1.4.1-4.17.amzn1 will be installed
[stdout]---> Package httpd-tools.x86_64 0:2.2.31-1.8.amzn1 will be installed
[stdout]--> Processing Conflict: httpd24-2.4.23-1.66.amzn1.x86_64 conflicts httpd < 2.4.23
[stdout]--> Processing Conflict: httpd24-tools-2.4.23-1.66.amzn1.x86_64 conflicts httpd-tools < 2.4.23
[stdout]--> Finished Dependency Resolution
[stderr]Error: httpd24-tools conflicts with httpd-tools-2.2.31-1.8.amzn1.x86_64
[stderr]Error: httpd24 conflicts with httpd-2.2.31-1.8.amzn1.x86_64
[stdout] You could try using --skip-broken to work around the problem
[stdout] You could try running: rpm -Va --nofiles --nodigest
Anyone what is the problem?
The error code HEALTH_CONSTRAINTS means more instances failed than expected, which is defined by the deployment configuration.
For more information about why the deployment failed, on the deployment console https://region.console.aws.amazon.com/codedeploy/home?region=region#/deployments, you can click on the failed deploymentID, then it will redirect to the deployment details page, which contains all of the instances included in the specified deployment, and each line contains the instance's lifecycle event. Then click on the ViewEvents, then if there is View Logs link, you can see the reason why this instance deployment failed.
If the console doesn't have enough information for what you need, then the log on the instance can be found at less /var/log/aws/codedeploy-agent/codedeploy-agent.log. It contains the logs for most recent deployments.
This happens because the codeDeploy checks health of the ec2 instances by hitting instances. Before deployment, you need to run below bash script on the instances and check if the script worked. httpd service must be started. Reboot the instance.
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
yum install ruby
yum install aws-cli
cd ~
aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1
chmod +x ./install
./install auto
echo 'hello world' > /var/www/html/index.html
hostname >> /var/www/html/index.html
chkconfig httpd on
service httpd start
It depends on your deployment configuration, but basically 1 or more deployments failed.
HEALTH_CONSTRAINTS: The deployment failed on too many instances to be
successfully deployed within the instance health constraints specified
http://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ErrorInformation.html
Check your deployment configuration settings. The overall failure/success of the deployment is based on these settings. Try the CodeDeployDefault.AllAtOnce, and dial in as needed.
Also, double check AWS CodeDeploy Instance Health settings, especially minimum-healthy-hosts
It seems there is a conflict between one of the dependencies you asked to install in your appspec.yaml file and your httpd24-tools service.
[stderr]Error: httpd24-tools conflicts with httpd-tools-2.2.31-1.8.amzn1.x86_64
[stderr]Error: httpd24 conflicts with httpd-2.2.31-1.8.amzn1.x86_64
[stdout] You could try using --skip-broken to work around the problem
So try to solve the dependency installation problem. You can try to install dependencies manually on your ec2 and find a solution for this conflict and when you solved it bring the solution to your appspec.yaml file and install the dependencies via code deploy.