简体   繁体   English

AWS EC2 实例上的 Node.js 环境变量

[英]Node.js environment variables on AWS EC2 instance

How can I set the environment variables that I'm using in my Node.js application on AWS EC2?如何设置我在 AWS EC2 上的 Node.js 应用程序中使用的环境变量? I tried to export them inside the instance console but it didn't work.我试图将它们导出到实例控制台中,但没有奏效。 It's running on an ubuntu server 20.04 btw.(ps my application is coming from a git repository, so there isn't a.env file there).它在 ubuntu 服务器 20.04 btw 上运行。(ps 我的应用程序来自 git 存储库,因此那里没有 a.env 文件)。

Manual Start:手动启动:

Variable=ThisIsTheValue node index

System D:系统 D:

Environment=Variable=ThisisTheValue
ExecStart=/usr/bin/node /path/to/index.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 https 在 aws ec2 实例上运行 node.js 应用程序 - Running node.js app on aws ec2 instance with https JS WebSocket无法连接到运行Node.js'ws'包的AWS EC2实例 - JS WebSocket won't connect to my AWS EC2 instance running Node.js 'ws' package 如何在 AWS EC2 实例中设置环境变量 - How to setup environment variables in AWS EC2 instance 使用Node.js从EC2实例下载AWS S3文件 - Download AWS S3 file from EC2 instance using Node.js 无法通过在 EC2 实例上运行的 Node.js 应用程序使用 AWS SES 发送 email - Cannot send email using AWS SES via Node.js app running on EC2 instance 如何使用 Node.js 和 Knex 连接到 AWS EC2 实例内的 postgresql 数据库 - How to connect to postgresql database inside AWS EC2 instance using Node.js and Knex 使用适用于Node.js的AWS开发工具包,如何等待EC2实例添加到ECS集群中? - Using AWS SDK for Node.js, how to wait for EC2 instance being added to ECS cluster? 如何使用 node.js AWS 开发工具包从启动模板创建 EC2 实例 - How can you create an EC2 Instance from a launch template with the node.js AWS SDK 如何使用 Amazon EC2 实例为生产设置 node.js process.env 变量? - How to set up node.js process.env variables for production with an Amazon EC2 instance? 在Amazon EC2实例上负载测试node.js应用 - Load testing node.js app on Amazon EC2 instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM