大网数据广告活动
服务器运维问答

Proxy settings at/prior to cloud-init runtime

· 52CE 我爱测

Instances launched into our VPC in EC2 require HTTP_PROXY and partners to be set to access anything located outside the VPC. Now I've run into a problem (using data pipeline) where I have no control over the user data passed in f…

问题原文

原帖链接 · kadrach · CC BY-SA 3.0

Instances launched into our VPC in EC2 require HTTP_PROXY and partners to be set to access anything located outside the VPC.

Now I've run into a problem (using data pipeline) where I have no control over the user data passed in for cloud-config. Given the proxies are not set, I can see wget hanging (trying to connect) during the cloud-init user scripts.

Having set environment variables in /etc/environment it seems this is not read at runlevel 3 (this uses a positively ancient Amazon Linux 2013.03, and ps axf suggests it's called from runlevel 3, but I have to admit I'm not familiar with the various init daemons and their interaction with cloud-init):

 1354 ?        S      0:00  \_ /bin/bash /etc/rc3.d/S99cloud-init-user-scripts start
 1355 ?        S      0:00      \_ /usr/bin/python2.6 /usr/bin/cloud-init-run-module once-per-instance user-scripts execute run-parts /var/lib/cloud/data/scripts
 1356 ?        S      0:00          \_ /bin/bash /usr/bin/run-parts /var/lib/cloud/data/scripts
 1360 ?        S      0:00              \_ /bin/bash /var/lib/cloud/data/scripts/part-000
 1362 ?        S      0:00                  \_ wget -O remote-runner-install -N http://datapipeline-ap-southeast-2.s3.amazonaws.com/ap-southeast-2/bootstrap-actions/latest/TaskRu...
                                                \
                                                 \ This works in a login shell as I've set 
                                                   the variables in /etc/environment

Setting these variables here does not seem to work:

  • /etc/environment
  • /etc/sysconfig/cloudinit

How can I set the proxy used during cloud-init runtime?

已采纳解答

原帖链接 · ffledgling · CC BY-SA 3.0

At the moment there's no good way to add a proxy to cloud init at run time. There's an open bug about it on launchpad/cloud-init.

There are work arounds mentioned in the comments, but they are all inherently application specific (for example for yum or apt), setting the proxy variables in their configs.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。