What is the Cloud-Init equivalent for Windows?
Asked Answered
P

6

15

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?

Paulettepauley answered 6/10, 2011 at 16:36 Comment(0)
T
22

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.

Tabbi answered 17/4, 2012 at 15:40 Comment(1)
If the OP is listening, I think at this moment in time this answer ought to marked as the accepted answer.Jerrome
O
3

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/

Outflow answered 13/9, 2013 at 8:1 Comment(0)
L
2

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.

Lorenza answered 10/11, 2011 at 20:52 Comment(0)
R
2

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

http://cloudinitnet.codeplex.com/

Receive answered 20/12, 2011 at 23:23 Comment(4)
I've been using this, reporting issues, etc -- this is a great tool.Warmonger
I would like to transition to this tool, especially for personal projects. Looks very interesting.Paulettepauley
If you have any questions you can contact me on this site (I think) or the codeplex site and i'd be more than willing to help you out if you've got any questions.Receive
Can anyone clarify the relationship between CloudInit.NET and EC2Config-with-UserData? Does the latter essentially make the former obsolete?Peg
L
0

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.

Linear answered 6/10, 2011 at 16:39 Comment(3)
What about just dropping Ec2Config and orchestrating the bootstrap process with a custom service? It's not like Ec2Config does all that much.Paulettepauley
Right. You don't need Ec2Config; we don't "use" it at all for our bootstrapping EXCEPT: the only way we believe that we can conclusively know the instance is truly ready is by looking for the "Windows is Ready to use" in the Ec2ConfigLog.txt file. It's a maddening problem if you really want to know when the instance is done setting up and rebooting.Linear
I've decided to go this route. Ec2Config does automate some startup tasks. No point in reinventing the wheel. For example formatting ephemeral volumes and renaming the machine, if needed. Hopefully a future version of Ec2Config adds a "ready" event hook to simplify this process.Paulettepauley
V
0

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.

Violate answered 16/5, 2013 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.