Configuration files for EC2 to use node.js (e.g. NODE_ENV = production)
On the elastic bean stem, you can 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 variables in node / express for example
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)
- How / where to set these environment variables
- How can I access them
+3
source to share
No one has answered this question yet
Check out similar questions: