如何在Amazon EC2中设置环境变量 [英] How to set an environment variable in Amazon EC2
问题描述
我在我的EC2实例的AWS控制台上创建了一个标签。
$ b
同样的东西与弹性豆串起作用。 env
显示我在控制台上创建的标签。
$ env
[...]
DB_PORT = 5432
如何设置环境变量在Amazon EC2中
按照 Guy ,我写了一个小shell脚本。该脚本使用AWS CLI和 jq
。它允许您将AWS实例和AMI标签导入shell环境变量。
希望可以帮助几个人。
https://github.com/12moons/ec2-tags-env
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.
The same thing works with elastic beanstalk. env
shows the tags I created on the console.
$ env
[...]
DB_PORT=5432
How can I set environment variables in Amazon EC2?
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/12moons/ec2-tags-env
这篇关于如何在Amazon EC2中设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!