I am trying to host my express server. I am cloning the repo into my ec2 instance also it will need env keys for database.
How to store the env keys. Will it be correct if I just create .env keys into my project inside of ec2 and launch my server.
The application will be exposed on the public ip on port 8000
It is best practice to keep only normal configuraiton properties in env file. but for confidential properties like user name and password, you should configure it using a shell script.
Sample Script
#!/bin/bash
export DB_USER="value"
export DB_PASSWORD="value"
npm run start
Solution 1:
Solution 2:
Further you can explore, these are AWS service to get secured key=value pairs