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?
发布评论
评论(6)
自 2012 年 4 月 11 日更新。
该文档尚未更新,因此很难判断它是否支持 PowerShell 还是仅支持 cmd.exe 脚本。我已在 AWS 论坛上发布了一个问题,尝试获取一些信息更多细节,当我了解更多信息时会在这里更新。
更新: 看起来支持 cmd.exe 批处理语法,从而可以调用 PowerShell。 AMI 中包含新版本的 EC2Config 文档。引用其中:
更新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:
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.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/
我必须自己建造一个,但这很容易。刚刚创建了一个服务,该服务在启动时读取用户数据并将文件作为 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.
我添加了一个新的 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/
我们必须自己建造它;我们通过定制服务做到了这一点,并构建了我们自己的 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.
我最近发现 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.