【发布时间】:2020-11-13 04:41:41
【问题描述】:
我正在尝试将 RDS Aurora 凭据设置为 ECS 任务的环境变量。
最初我将它作为纯文本传递给environments。
我知道正确的做法是使用secrets,但ApplicationLoadBalancedTaskImageOptions 期望Secret 而rds.DatabaseCluster 返回另一种类型。
在这种情况下管理凭据的正确方法是什么?
- db 是一个 rds.DatabaseCluster 实例
task_image_options=ecs_patterns.ApplicationLoadBalancedTaskImageOptions(
image=ecs.ContainerImage.from_registry("sonarqube:8.2-community"),
container_port=9000,
# FIXME: by documentation this is the right way to pass creds, however this fail, the database secret is not the same type than the expected
# secrets={
# "sonar.jdbc.password": ecs.Secret.from_secrets_manager(self.db.secret)
# },
environment={
'sonar.jdbc.url': url,
"sonar.jdbc.username": username,
"sonar.jdbc.password": self.db.secret.secret_value_from_json("password").to_string() #plaintext, FIXME
}
)
【问题讨论】:
标签: python amazon-web-services amazon-ecs amazon-aurora aws-cdk