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
node.js amazon-web-services amazon-ec2 production-environment config


source to share


No one has answered this question yet

Check out similar questions:

1500
Writing Files in Node.js
1045
Check synchronously if file / directory exists in Node.js
868
In Node.js, how do I include features from other files?
523
How to save settings \ w630> .js for deployment / config files?
515
node.js delete file
43
Can you run a rail console or rail command in an elastic beanstalk environment?
22
How to set environment variable in Amazon EC2
ten
Elastic bean ribbon cable connects to RDS from SSH enclosure
6
Custom AMI with elastic bean cannot see environment variables
-1
SSH from EC2 to EC2, security group works with public IP, not security group



All Articles
Loading...
X
Show
Funny
Dev
Pics