我目前正在尝试通过 CodeBuildAction 设置 SSM 参数存储值。我的第一次尝试导致254
返回代码,我猜这是因为请求未授权。然后,我尝试将托管策略附加到与 CodeBuildAction 关联的角色,但cdk deploy
失败了:
Policy arn:aws:iam::aws:policy/AWSServiceRoleForAmazonSSM does not exist or is not attachable. (Service: AmazonIdentityManagement; Status Code: 404; Error Code: NoSuchEntity; Request ID: 2f65f8db-64a5-4173-ac45-de4c56bffa44; Proxy: nu
ll)
这是角色设置:
this.codeBuildRole = new Role(this, "application-build-project-role", {
assumedBy: new ServicePrincipal("codebuild.amazonaws.com"),
managedPolicies: [
ManagedPolicy.fromAwsManagedPolicyName(
"AmazonEC2ContainerRegistryPowerUser"
),
ManagedPolicy.fromAwsManagedPolicyName("AWSServiceRoleForAmazonSSM"), // THIS IS THE NEW PART
],
});
我知道这意味着我使用了错误的政策,但我正在努力寻找替代方案。
是否有适用于此处的托管策略?如果没有,我将如何设置内联策略来实现我想要做的事情?