stevec
stevec

Reputation: 52658

Windows Amazon Machine Image (AMI) doesn't remember password for new instances?

If I start a windows EC2 and run net user Administrator "new_password" I can thereafter RDP in with that new password.

However, when I create an AMI from that box, and fire up a new EC2 from that AMI, the password I set doesn't work for the new instance, which is surprising.

How can I get the password to stick? Currently I have to login the first time with the .pem file and then set the password manually using the original line of code above). I would like to simply be able to use the password I set on the original box from which the AMI was created

What I've tried

I tried selecting a non-default 'Proceed without a key pair' option when launching the AMI, but the password I had previously set did not work

enter image description here

Upvotes: 2

Views: 1189

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270011

From Configuring a Windows Instance Using EC2Launch - Amazon Elastic Compute Cloud:

Update the following settings as needed and save your changes. Provide a password in adminPassword only if adminPasswordtype is Specify.

{
  "setComputerName": false,
  "setWallpaper": true,
  "addDnsSuffixList": true,
  "extendBootVolumeSize": true,
  "handleUserData": true,                      
  "adminPasswordType": "Random | Specify | DoNothing",
  "adminPassword":  "password that adheres to your security policy (optional)"
}

The password types are defined as follows:

Random: EC2Launch generates a password and encrypts it using the user's key. The system disables this setting after the instance is launched so that this password persists if the instance is rebooted or stopped and started.

Specify: EC2Launch uses the password you specify in adminPassword. If the password does not meet the system requirements, EC2Launch generates a random password instead. The password is stored in LaunchConfig.json as clear text and is deleted after Sysprep sets the administrator password. EC2Launch encrypts the password using the user's key.

DoNothing: EC2Launch uses the password you specify in the unattend.xml file. If you don't specify a password in unattend.xml, the administrator account is disabled.

Upvotes: 2

Related Questions