Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aws Codedeploy + Elasticbeanstalk using Bitbucket

I have one repository in bitbucket, for deploying to elasticbeanstalk i am using codedeploy(i couldn't find any better solution). I have created elsticbeanServceRole in IAM and the policies, i have attached to that roles are

  1. AmazonEC2FullAccess
  2. AdministratorAccess
  3. AmazonAPIGatewayAdministrator
  4. codedeployServiceRolePolicy (Custom Policy)

This is the content of codedeployServiceRolePolicy

{
"Version": "2012-10-17",
"Statement": [
    {
        "Action": [
            "autoscaling:PutLifecycleHook",
            "autoscaling:DeleteLifecycleHook",
            "autoscaling:RecordLifecycleActionHeartbeat",
            "autoscaling:CompleteLifecycleAction",
            "autoscaling:DescribeAutoscalingGroups",
            "autoscaling:PutInstanceInStandby",
            "autoscaling:PutInstanceInService",
            "ec2:Describe*"
        ],
        "Effect": "Allow",
        "Resource": "*"
    }
]

}

Then i copied Role ARN and paste in codedeploy application settings

I have successfully configured the bitbucket codedeploy settings, for that i created one role called bitbucketRole with custom policy. Policy content is

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "autoscaling:*",
            "codedeploy:*",
            "ec2:*",
            "elasticloadbalancing:*",
            "iam:AddRoleToInstanceProfile",
            "iam:CreateInstanceProfile",
            "iam:CreateRole",
            "iam:DeleteInstanceProfile",
            "iam:DeleteRole",
            "iam:DeleteRolePolicy",
            "iam:GetInstanceProfile",
            "iam:GetRole",
            "iam:GetRolePolicy",
            "iam:ListInstanceProfilesForRole",
            "iam:ListRolePolicies",
            "iam:ListRoles",
            "iam:PassRole",
            "iam:PutRolePolicy",
            "iam:RemoveRoleFromInstanceProfile",
            "s3:*"
        ],
        "Resource": "*"
    }
]

}

Problem

Now when i click on "Deploy to AWS" in bitbucket, deployment from bitbucket to codedeploy is triggering but i am getting error at codedeploy console

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).

Please Help me

like image 572
Vijay Sebastian Avatar asked Aug 26 '26 13:08

Vijay Sebastian


1 Answers

Is CodeDeploy agent running on your instances? Also, can you paste the Error Info from one of the failed instances?

HEALTH_CONSTRAINTS usually means CodeDeploy was unable to continue the deployment due to the health constraints set in the deployment config. Too many instances already failed and CodeDeploy can't take down any more instances.

like image 54
Surya Bala Avatar answered Aug 29 '26 17:08

Surya Bala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!