我创建了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