简体   繁体   中英

How to setup environment variables in AWS EC2 instance

I have been using a.env file to run my app in my local machine. However when deploying my app using aws ec2 instance, I am at a complete loss on how to set up the ENV vars as I am a complete beginner at using AWS. Please help me to set up the environment variables.

Based on the comments.

Since .env is used on local workstation successfully, it can also be used on ec2 instance.

Just have to be careful with not string any sensitive information in .env and using public repositories, as you may leak your passwords or access keys.

For storing secrets at AWS , the recommended way would be through secret manager or ssm parameter store . Also any permissions that your app may require to access these or other AWS services should be provided through instance role , not by hard codding AWS credentials into app or instance.

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