- 최신
- 최다 투표
- 가장 많은 댓글
Please review the following link. To access the secrets stored in AWS Secrets Manager from your application running on EC2 instances, you can use AWS SDKs or CLI commands.
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/secrets-manager.html
Update your docker-compose.yml file to use the .env file:
services:
your-service:
image: your-image
env_file:
- .env
python fetch_secrets.py and produce .env file then run docker-compose
docker-compose up
For applications running on Elastic Beanstalk Create a .ebextensions directory in your application's root directory Create a config file, for example, 01_fetch_secrets.config, inside the .ebextensions directory with the following content
container_commands:
01_fetch_secrets:
command: "python fetch_secrets.py"
Include the fetch_secrets.py script in your application's source code Deploy your application to Elastic Beanstalk. During deployment, Elastic Beanstalk will execute the fetch_secrets.py script and create the .env file. Your application should now be able to access the secrets stored in the .env file.
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 9달 전
- AWS 공식업데이트됨 일 년 전
Thanks for this. I will implement this and give feedback of the outcome.
Thanks, a lot this worked for me. Though what I did differently was use the AWS SDK for Node JS, and wrote a function that gets secret from Parameter store and append it as env for the application. I believe the same implementation should work for secret manager. I went the parameter store option. I saved the secret as Json on parameter store and retrieve via the function.