我想使用存储在机密管理器中的凭据填充环境变量,但实例化任务中的 ENV 变量没有预期值,而是分配有完整的SecretString
.
定义看起来与文档中指定的一样:
...
Parameters:
...
SecretARN:
Type: String
Description: ARN of the secrets manager
MyTask:
Type: AWS::ECS::TaskDefinition
Properties:
...
ContainerDefinitions:
- Name: 'my-task'
...
Secrets:
- Name: PASSWORD
ValueFrom: !Ref SecretARN
- Name: USERNAME
ValueFrom: !Ref SecretARN
...
秘密SecretString
看起来像这样:
{
"PASSWORD": "v3r1s3cr3t",
"USERNAME": "johndoe"
}
在应用程序或任务中,当我执行时env
,输出打印如下:
PASSWORD='{ "PASSWORD": "v3r1s3cr3t", "USERNAME": "johndoe" }'
USERNAME='{ "PASSWORD": "v3r1s3cr3t", "USERNAME": "johndoe" }'