Elastic Beanstalk定制AMI无法看到环境变量

编程入门 行业动态 更新时间:2024-10-27 08:38:12
本文介绍了Elastic Beanstalk定制AMI无法看到环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

由于某些大包装要求,我将自定义AMI用于Elastic Beanstalk。

I'm using a custom AMI for Elastic Beanstalk because of some large package requirements.

当我通过SSH进入EC2实例时,我的应用程序都无法使用我的环境变量(在Elastic Beanstalk Web控制台设置中指定)。

When I SSH into the EC2 instance none of my environment variables (specified in the Elastic Beanstalk web console settings) are available to my app.

我的生产环境中的应用程序可以很好地访问变量,但是我不能在控制台中访问变量,这确实使调试非常困难。

My app in production can access the variables just fine, but I cannot do so in the console, which is really making debugging anything very difficult.

在使用SSH控制台时,如何使所有环境变量可用?

How do I make all of the environment variables available when I'm using the SSH console?

推荐答案

找到了一种简单的方法在阅读Elastic Beanstalk支持论坛时加载所有环境变量:

Found an easy way to load all the environment variables while perusing the Elastic Beanstalk support forums:

. /opt/python/current/env

要查看变量: echo $ {VAR_NAME} 或 printenv VAR_NAME ,在使用上述命令之前不起作用。 ( UNIX,获取环境变量)

To view a variable: echo ${VAR_NAME} or printenv VAR_NAME, which doesn't work before using the above command. (UNIX, get environment variable)

奖金:

仅查看变量列表: printenv

要列出导出变量: cat / opt / python / current / env

要将导出添加到配置文件的末尾: cat / opt / python / current / env>> / path / to / my / file

To add the exports to the end of a config file: cat /opt/python/current/env >> /path/to/my/file

更多推荐

Elastic Beanstalk定制AMI无法看到环境变量

本文发布于:2023-10-22 23:20:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519026.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:环境变量   Elastic   Beanstalk   AMI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!