On Elastic Beanstalk, it is possible to set the environment
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs:staticfiles
option_name: /public
value: /public
- option_name: NODE_ENV
value: production
and also access the variables in the node/express, for e.g.
console.log('Using production settings.');
app.set('connection', mysql.createConnection({
host: process.env.RDS_HOSTNAME,
user: process.env.RDS_USERNAME,
password: process.env.RDS_PASSWORD,
port: process.env.RDS_PORT}));
Now, if I have to do the same on EC2 (without using Elastic Beanstalk)