Windows 上的 Cloud-Init 等效项是什么?

发布于 2024-12-08 06:41:42 字数 302 浏览 1 评论 0 原文

Windows 上的股票引导过程似乎有点缺乏。

Linux 具有 cloud-init,它将安装软件包、存储文件并根据用户数据运行 bash 脚本。

Windows 有 ec2config,但当前不支持在系统“就绪”时运行 cmd 或 powershell 脚本,这意味着所有初始重新启动均已完成。

似乎有第三方选项。例如,RightScale 具有执行此功能的 RightLink 代理。

有可用的开源选项吗? 是否有计划将此功能添加到 Ec2Config 中? 我必须自己构建这个吗?

我错过了什么吗?

It seems that the stock bootstrapping process is a bit lacking on Windows.

Linux has cloud-init which will install packages, store files, and run a bash script from user data.

Windows has ec2config but there is currently no support to run a cmd or powershell script when the system is "ready"--meaning that all the initial reboots are completed.

There seem to be third party options. For example RightScale has the RightLink agent which performs this function.

Are there open source options available?
Are there any plans to add this feature to Ec2Config?
Do I have to build this my self?

Am I missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

童话里做英雄 2024-12-15 06:41:42

2012 年 4 月 11 日更新

该文档尚未更新,因此很难判断它是否支持 PowerShell 还是仅支持 cmd.exe 脚本。我已在 AWS 论坛上发布了一个问题,尝试获取一些信息更多细节,当我了解更多信息时会在这里更新。

更新: 看起来支持 cmd.exe 批处理语法,从而可以调用 PowerShell。 AMI 中包含新版本的 EC2Config 文档。引用其中:

[EC2Config] 将读入为实例指定的用户数据,然后检查它是否包含标签 。如果找到两者,那么它将获取这两个标签之间的信息并将其保存到位于该应用程序的“设置”文件夹中的批处理文件中。然后它将在实例启动期间执行批处理文件。

批处理文件仅在 sysprep 后首次启动实例时创建并执行。如果您希望再次创建并执行批处理文件,请将 Ec2HandleUserdata 插件状态设置为启用。

更新2:我的解释已得到确认Shon 来自AWS 团队

更新 3: 从 2012 年 5 月的 AMI 开始,使用 标签支持 PowerShell。

It appears that EC2Config on the Amazon-provided AMIs now supports "User Data Scripts" as of the 11-April-2012 updates.

The documentation has not yet been updated, so it's hard to tell if it supports PowerShell or just cmd.exe scripts. I've posted a question on the AWS forums to try and get some more detail, and will update here when I learn more.

UPDATE: It looks like cmd.exe batch syntax is supported, which can in turn invoke PowerShell. There's a new version of the EC2Config documentation included on the AMI. Quoting from it:

[EC2Config] will read in the user data specified for the instance and then check if it contain the tags <script> and </script>. If it finds both then it will take the information between those two tags and save it to a batch file located in the Settings folder of this application. It will then execute the batch file during the start of an instance.

The batch file will only be created and executed on the first launch of an instance after a sysprep. If you want to have the batch file created and executed again set the Ec2HandleUserdata plugin state to Enabled.

UPDATE 2: My interpretation is confirmed by Shon from the AWS Team

UPDATE 3: And as of the May-2012 AMIs, PowerShell is supported using the <powershell/> tag.

征﹌骨岁月お 2024-12-15 06:41:42

Cloudbase.it 开源了一个名为 cloudbase-init 的 Python Windows 服务,该服务遵循 configdrive 和 HTTP 数据源。
http://www.cloudbase.it/cloud-init-for-windows-实例/

github 这里
https://github.com/stackforge/cloudbase-init/

Cloudbase.it have opensourced a python windows service they call cloudbase-init which follows the configdrive and HTTP datasources.
http://www.cloudbase.it/cloud-init-for-windows-instances/

github here
https://github.com/stackforge/cloudbase-init/

旧时模样 2024-12-15 06:41:42

我必须自己建造一个,但这很容易。刚刚创建了一个服务,该服务在启动时读取用户数据并将文件作为 powershell 脚本执行。

为了解决不知道何时启动服务的问题,我只是将服务启动类型设置为“延迟自动”,这似乎解决了问题。取决于您需要对系统执行的操作可能适合您,也可能不适合您,但就我而言,这就是我所要做的。

I had to build one myself however it was very easy. Just made a service that reads the user-data when starts up and executes the file as a powershell script.

To get around the issue of not knowing when to start the service I just made the service start type as "delayed-auto" and that seemed to fix the problem. Depending on what you need to do to the system that may or may not work for you however in my case that was all I had to do.

居里长安 2024-12-15 06:41:42

我添加了一个新的 codeplex 项目,该项目已经为 Windows 构建了此工具。期待一些反馈。

http://cloudinitnet.codeplex.com/

I added a new codeplex project that already has this tool built for windows. Looking forward to some feedback.

http://cloudinitnet.codeplex.com/

℉絮湮 2024-12-15 06:41:42

我们必须自己建造它;我们通过定制服务做到了这一点,并构建了我们自己的 AMI。目前 EC2Config 中没有任何规定可以执行此操作。

更好的是,没有简单的方法来确定实例何时“准备好”。我们必须通过跟踪 EC2Config 的日志文件来完成此操作。

We had to build it ourselves; we did it with a custom service and built our own AMIs. There's no provision currently within EC2Config to do it.

Even better, there is no easy way to determine when the instance is "ready". We had to do it by tailing the logfile of EC2Config.

停滞 2024-12-15 06:41:42

我最近发现 nssm(位于 nssm.cc),它可以轻松地将简单的批处理文件(或几乎任何其他文件)包装为服务。然后,您可以使用 sc config servic1 dependent= service0 强制批处理文件在服务初始化序列中的特定点运行。例如,我在 ex2config 和 sqlexpress 之间使用它在 d 上创建一个文件夹。您必须使用服务工具使其作为网络服务运行,并使用 regedit 将 AppExit 属性更改为“忽略”,但一旦您将其全部安装到位,它就可以工作。

I've recently found nssm (at nssm.cc) which easily wraps a simple batch file (or pretty much anything else) as a service. You can then us sc config servic1 depend= service0 to force the batch file to be run at a particular point in the service initialization sequence. I am using it in between ex2config and sql express to create a folder on d, for instance. You'll have to use the services tool to make it run as network services and change the AppExit property to Ignore using regedit, but it works once you get it all in place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文