问题标签 [cloud-init]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2221 浏览

python - Python Boto 创建的 cloud-init #include 脚本未在 EC2 上运行

我的想法已经用完了,希望得到一些帮助。

我正在启动 EC2 Ubuntu 12.04 实例并将以下脚本添加到用户数据中:

实例启动后,我可以右键单击实例并查看系统日志。

我可以在底部附近看到以下内容:

我可以从提供的 url 上的实例运行 wget 并查看 txt 文件的内容。

为什么通过#include 添加的脚本不起作用?任何帮助,将不胜感激。

亲切的问候,C

0 投票
3 回答
8994 浏览

amazon-ec2 - 是否可以在 cloud-config 中使用变量

当使用cloud init 的#cloud-config 创建配置文件时,我将如何使用变量来填充值?

在我的具体情况下,我想将 EC2 实例作为预配置的 salt minions 自动启动。salt minion 云配置示例

假设我想获取特定的 EC2 实例 ID 并将其设置为 salt minion 的 ID。

我将如何为每个实例动态设置值?

0 投票
4 回答
20616 浏览

linux - 用户数据 (cloud-init) 脚本未在 EC2 上执行

我的用户数据脚本

这是从命令中输入的:

但是当我检查文件/var/log/cloud-init.log时,tail -n 5是:

我还验证了curl http://169.254.169.254/latest/user-data按预期返回我的文件。

并且没有其他错误或我的脚本输出发生。如何让用户数据脚本在启动时正确执行?

0 投票
3 回答
40527 浏览

cloud-init - 在哪里可以找到 cloud-init 用户数据脚本的日志?

我通过将 shell 脚本粘贴到用户数据字段来初始化运行标准 Ubuntu 13.04 AMI 的衍生产品的现场实例。

这行得通。脚本运行。但是调试起来很困难,因为我不知道脚本的输出记录在哪里,如果在任何地方的话。

我查看了 /var/log/cloud-init.log,它似乎包含一堆与调试 cloud-init 本身相关的内容,但与我的脚本无关。我在 /var/log 中搜索并没有发现任何东西。

我需要做一些特别的事情来打开登录吗?

0 投票
0 回答
835 浏览

ubuntu - x-shellscript file from inside MIME multipart not executing during cloud-init

I'm running an Ubuntu 12.04 machine in a very EC2-like environment (Open Stack euca2ools environment).

Basically I launch my instances and give it a GZIPed multipart file as documented here is possible. Here's code for how I convert to multipart file:

The problem is that the shell script never executes. I need the other files included before in the mime file before the shell script will work. According to this CloudInit posting, what I'm doing is sound (order-wise).

Anyone know how to get this shell script executing?


EDIT:

I have found this error in my /var/log/cloud-init.log:

which seems to indicate (of course) that a part of the multipart file was not executed...which isn't exactly helpful in debugging. The script client_script.sh in question runs fine in a terminal.

0 投票
1 回答
2413 浏览

openstack - 使用 Cloud-init 创建用户

我正在使用我的 vm 加载以下 cloud-init 脚本:

但似乎我做错了什么

由于我收到以下错误:

对我的问题有任何提示或解决方案吗?

0 投票
2 回答
1887 浏览

python - os.system('sudo shutdown now -P') 不适用于 cloud-init

我想以编程方式启动 Amazon EC2 实例,使用 cloud-init 执行 Python 脚本,然后让相同的脚本终止实例。一切正常,除了自我终止部分。我试过这个:

和这个:

还有这个:

不好。在所有情况下,/var/log/cloud-init.log文件都显示sudo: sorry, you must have a tty to run sudo.

显然,注释掉这Default requiretty行就/etc/sudoers可以了,但我想以编程方式做事,所以我想这不是一个选择(而且它可能也需要 root 权限,这让我们回到了原点)。

我想我可以使用一个多部分的 cloud-init 脚本——比如说,在 Python 脚本之后使用一个 bash 脚本来执行自终止。但是肯定有一种方法可以在 Python 中解决这个问题吗?

(亚马逊 Linux。Python 2.7.5。Boto 2.23)

0 投票
5 回答
48091 浏览

openstack - 如何在不重启的情况下重新运行 cloud-init

我正在使用 openstack 创建一个使用“nova boot”命令的虚拟机。我的图像已启用 cloud-init。我传递了一个 --user-data 脚本,它是一种 bash shell 格式,供 cloud-init 在 VM 启动期间运行。这一切都成功地发生了。现在我的用例是重新运行 cloud-init 以执行相同的用户数据脚本,而无需重新启动 VM。我看到了 /usr/bin/cloud-init 选项,他们确实谈到了运行特定的模块,但没有什么能让它执行相同的用户数据脚本。如何实现?任何帮助,将不胜感激。

0 投票
6 回答
54346 浏览

amazon-ec2 - 如何手动运行 cloud-init?

我正在编写一个 CloudFormation 模板,并尝试调试我在模板中提供的用户数据脚本。如何cloud-init手动运行并使其执行与启动新实例时相同的操作?

0 投票
1 回答
457 浏览

amazon-ec2 - 如何告诉 cloud-init 只运行 userdata 脚本?

我正在制作一个自定义 ami 以在 CloudFormation 模板中使用,因此我不需要任何 cloud-init 功能,除了运行我在 CFN 模板中提供的用户数据脚本。如何将 cloud-init 配置为仅在实例启动时运行该脚本?