简体   繁体   中英

How Can I set environment variables on AWS EC2?

I am working on a Django application to be hosted on AWS EC2. Some of my variables are sensitive and have to be excluded from version control. Some are not sensitive but the values vary from environment to environment. To achieve this, I am saving the values in the environment and accessing via the code. CircleCI provides a way of achieving this by Environment Variables of the project. Heroku also provides similar functionality.

Please how can I set these variables in AWS Ec2?

Make a file.env where setting.py file exists.After That set the enviroment variables in that file

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
AWS_DEFAULT_REGION
AWS_MEDIA_STORAGE_BUCKET_NAME
AWS_S3_CUSTOM_DOMAIN
AWS_CLOUDFRONT_KEY
AWS_CLOUDFRONT_KEY_ID

and set other necessary variables related to the AWS

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