Windows – How to create a new public AMI for windows with a random password

amazon ec2amazon-amiamazon-ebswindows

I am trying to make a windows 2008 AMI that is a nice clean 64bit starter pack (IIS, SQL express, ASP.NET MVC, etc…) I would like to make it a public AMI when its done. There in lies the problem.

I can make an AMI from my image no problem. But I can't seen to get new instances to generate their own passwords.. The results are that I have a new instance that works great with my password.

So what is the process of making my EBS backed Instances convert into an AMI that will auto-generate its password when a new instance starts up?

Thanks in advance.

Best Answer

You could go to the EC2ConfigService Settings (Start -> all programs) on your instance. Under "Set Password" put a check in "Set a random password ....".

The password will be generated on next boot and your ami created from the instance will have a random generated password.

Alternatively you can edit your C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml file by setting Ec2SetPassword to enabled:

<Plugin>
  <Name>Ec2SetPassword</Name>
  <State>Enabled</State>
</Plugin>

And restarting the Ec2ConfigService (running as a windows service on the instance.)

After doing this you can create your ami in the usual way (shut down the instance and rigth-click on the instance -> "Create Image (EBS AMI)".