【发布时间】:2016-09-20 03:29:02
【问题描述】:
我在 bitbucket 中有一个存储库,用于部署到 elasticbeanstalk,我正在使用 codedeploy(我找不到更好的解决方案)。我在 IAM 中创建了 elsticbeanServceRole,我附加到该角色的策略是
- AmazonEC2FullAccess
- 管理员访问权限
- AmazonAPIGateway 管理员
- codedeployServiceRolePolicy(自定义策略)
这是 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": "*"
}
]
}
然后我复制 Role 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)。
请帮帮我
【问题讨论】:
-
我在同样的情况下遇到同样的错误,结果发现我的 Elasticbeanstalk 的 EC2 实例中没有安装 CodeDeploy 代理。
标签: bitbucket amazon-elastic-beanstalk aws-code-deploy