如何设置在亚马逊EC2环境变量亚马逊、如何设置、环境变量

2023-09-11 09:14:22 作者:不了解我,就别说我变了

我创建了AWS控制台上的标签我的EC2实例之一。

I created a tag on the AWS console for one of my EC2 instances.

然而,当我看在服务器上,没有这样的环境变量设置。

However, when I look on the server, no such environment variable is set.

同样的事情适用于弹性青苗。 ENV 显示我的控制台上创建的标签。

The same thing works with elastic beanstalk. env shows the tags I created on the console.

$ env
 [...]
 DB_PORT=5432

我怎样才能在Amazon EC2上设置环境变量?

How can I set environment variables in Amazon EC2?

推荐答案

继盖伊,我写一个小的shell脚本。此脚本使用AWS CLI和 JQ 。它可以让你输入你AWS实例和AMI的标签,shell环境变量。

Following the instructions given by Guy, I wrote a small shell script. This script uses AWS CLI and jq. It lets you import your AWS instance and AMI tags as shell environment variables.

我希望这能帮助一些人。

I hope it can help a few people.

https://github.com/berpj/ec2-tags-env