简体   繁体   English

使用 AWS SSM Parameter Store 的 SSL 证书

[英]SSL certs with AWS SSM Parameter Store

I am trying to pass in SSL certificate to AWS SSM parameter store the SSL certificate is password protected as well我正在尝试将 SSL 证书传递给 AWS SSM 参数存储 SSL 证书也受密码保护

my question is how do i retrieve this as a certificate file inside the containers in ECS?我的问题是如何将其作为 ECS 容器内的证书文件检索? I do know how to use SSM parameter store to store secret environment variables BUT how do i use it to create a secret file to a location on containers?我知道如何使用 SSM 参数存储来存储秘密环境变量,但我如何使用它来创建一个秘密文件到容器上的某个位置? We have a string and a file here, how does SSM manage files?我们这里有一个字符串和一个文件,SSM是如何管理文件的?

Thanks谢谢

I'm not aware of a way to create a file from SSM, but I expect your ENTRYPOINT in the Docker container could handle this logic我不知道从 SSM 创建文件的方法,但我希望 Docker 容器中的 ENTRYPOINT 可以处理此逻辑

Task Definition Snippet任务定义片段

{
  "containerDefinitions": [{
    "secrets": [{
      "name": "MY_SSM_CERT_FILE",
      "valueFrom": "arn:aws:secretsmanager:region:aws_account_id:secret:MY_SSM_CERT_FILE"
    },
    {
      "name": "MY_SSM_CERT_FILE_LOCATION",
      "valueFrom": "arn:aws:secretsmanager:region:aws_account_id:secret:MY_SSM_CERT_FILE_LOCATION"
    }]
  }]
}

entrypoint.sh入口点.sh

echo "$MY_SSM_CERT_FILE" >> $MY_SSM_CERT_FILE_LOCATION
// Run rest of the logic for application

Dockerfile文件

FROM ubuntu:16.04

COPY ./entrypoint.sh .entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]

Why don't you use AWS Secret Manager which can complement AWS SSM?为什么不使用可以补充 AWS SSM 的 AWS Secret Manager? I think secrets manager supports secrets file:我认为机密管理器支持机密文件:

$ aws secretsmanager create-secret --name TestSecret --secret-string file://secret.txt       # The Secrets Manager command takes the --secret-string parameter from the contents of the file

see this link for further information: https://docs.aws.amazon.com/secretsmanager/latest/userguide/best-practices.html请参阅此链接以获取更多信息: https : //docs.aws.amazon.com/secretsmanager/latest/userguide/best-practices.html

The link below shows how you can integrate Secrets manager with SSM https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html下面的链接显示了如何将 Secrets manager 与 SSM 集成https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html

Hope this helps希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM