sku11
sku11

Reputation: 43

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.

Upvotes: 2

Views: 9142

Answers (1)

Marcin
Marcin

Reputation: 238957

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.

Upvotes: 4

Related Questions