简体   繁体   中英

How to create variables in AWS and use them in an .env file for ECS deploy task

One of my former workplaces used this kind of functionality. They had a production.env file in config folder and the docker image copied that production.env file into the container when deploying through Github tasks.

DATABASE_HOST=$DATABASE_HOST
DATABASE_PORT=$DATABASE_PORT
DATABASE_USERNAME=$DATABASE_USERNAME
DATABASE_PASSWORD=$DATABASE_PASSWORD
DATABASE_NAME=$DATABASE_NAME

It seems like they created these variables on AWS somehow, and used them directly in the production.env file. I can't find any references to this on google, as I'm not sure what to search.

You can inject individual name/value pairs or entire files via your ECS task definitions. See the documentation here - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html

Alternatively if you need more detailed configuration management, you can inject environment variables from SSM Parameter Store and Secrets Manager in similar ways.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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