【发布时间】:2021-10-24 19:15:16
【问题描述】:
当我尝试从 Visual Studio 部署 AWS lambda 时出现此错误
Fetching ECR authorization token to use to login with the docker CLI
Error logging on with the docker CLI: User: arn:aws:sts::123456789012:assumed-role/@Infra/aws-toolkit-visualstudio-637706142753914780 is not authorized to perform: ecr:GetAuthorizationToken on resource: * because no identity-based policy allows the ecr:GetAuthorizationToken action
我使用的 IAM 角色具有以下权限:
AmazonS3FullAccess
AmazonAPIGateway 管理员
AmazonElasticContainerRegistryPublicFullAccess
AWSLambda_FullAccess
如果我通过添加 AdministratorAccess 扩展此列表,则部署成功,但我想将权限限制为仅需要的权限。
知道如何扩展权限来解决这个问题吗? 我已经有了 AmazonElasticContainerRegistryPublicFullAccess,所以我希望它应该足够了。
出于安全考虑,我在错误消息中传递了假数字。
【问题讨论】:
-
你需要像
AmazonEC2ContainerRegistryPowerUser这样的东西。正如错误消息所说,AmazonElasticContainerRegistryPublicFullAccess不提供将私有图像推送到 ECR 的访问权限。 -
检查
AmazonElasticContainerRegistryPublicFullAccess的实际作用,可以在 IAM 控制台中轻松完成,然后检查ecr:GetAuthorizationToken是否在*上被授予 - 不要只是期待什么。 -
进展如何?仍然不清楚如何“将权限限制为仅需要的权限”?
-
添加 AmazonEC2ContainerRegistryPowerUser 解决了这个问题。
标签: amazon-web-services aws-lambda