当我尝试将带有 Copilot 的负载平衡 Web 服务 部署到新环境中时,出现以下错误。我在 test
中运行了所有内容,创建了一个新的 prod
环境并尝试将服务部署到其中,但任务详细信息显示停止原因:
ResourceInitializationError:无法提取机密或注册表身份验证: 执行资源检索失败:无法从中检索秘密 ssm:服务调用已重试 1 次:AccessDeniedException: 用户:arn:aws:sts::xxx:assumed-role...
答案 0 :(得分:1)
SSM 参数是专门为 test
环境添加的,我认为默认情况下它会应用于所有环境,但显然不是。必须为 prod
环境再次添加,标签为 copilot-environment
。
aws ssm put-parameter \
--name /copilot/applications/core/environments/test/port \
--value '8000' \
--type SecureString \
--tags Key=copilot-environment,Value=test Key=copilot-application,Value=core
aws ssm put-parameter \
--name /copilot/applications/core/environments/prod/port \
--value '8000' \
--type SecureString \
--tags Key=copilot-environment,Value=prod Key=copilot-application,Value=core
并更新了我的 manifest.yml:
secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
PORT: /copilot/applications/core/environments/test/port
# You can override any of the values defined above by environment.
environments:
prod:
secrets:
PORT: /copilot/applications/core/environments/prod/port