Aws Codedeploy + Elasticbeanstalk使用Bitbucket

时间:2016-05-23 09:50:36

标签: bitbucket elastic-beanstalk aws-code-deploy

我在bitbucket中有一个存储库,用于部署到elasticbeanstalk我正在使用codedeploy(我找不到更好的解决方案)。我在IAM中创建了elsticbeanServceRole,我已经附加了那些角色

  1. AmazonEC2FullAccess
  2. AdministratorAccess
  3. AmazonAPIGatewayAdministrator
  4. codedeployServiceRolePolicy(自定义政策)
  5. 这是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": "*"
        }
    ]
    

    }

    然后我复制了角色ARN并粘贴了codedeploy应用程序设置

    我已经成功配置了bitbucket codedeploy设置,为此我创建了一个名为bitbucketRole的角色,其中包含自定义策略。政策内容是

    {
    "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": "*"
        }
    ]
    

    }

    问题

    现在,当我点击bitbucket中的“部署到AWS”时,从bitbucket到codedeploy的部署正在触发,但我在codedeploy控制台上遇到错误

      

    整体部署失败,因为部署失败的个别实例太多,可用于部署的健康实例太少,或者部署组中的某些实例遇到问题。 (错误代码:HEALTH_CONSTRAINTS)。

    请帮帮我

1 个答案:

答案 0 :(得分:1)

CodeDeploy代理是否在您的实例上运行?此外,您可以从其中一个失败的实例中粘贴错误信息吗?

HEALTH_CONSTRAINTS通常意味着由于部署配置中设置的运行状况限制,CodeDeploy无法继续部署。太多的实例已经失败,CodeDeploy不能再删除任何实例。