Amazon EC2 creates custom AMI and amazonec2
Test System: Windows server 2008
Functions: 1. Create a custom AMI. When an instance is generated, the password is random and the Dynamic Desktop Wallpaper is used.
2. The powershell script is automatically run when the instance is generated to automatically set the DNS address and add the Domain
1. Create an AMI
In server2008, find EC2configservice from "start"-"program"
Right-click the target and choose Properties> find its directory.
Modify the following script in the Settings directory:
Modify BundleConfig. xml as follows:
AutoSysprep is set to Yes // enable sysprep
SetPasswordAfterSysprep is set to Yes // set a random password on the newly started instance
Modify Config. xml as follows:
Ec2SetPassword is set to Enabled // a random password is generated each time the instance is started. It is disabled after the instance is started for the first time.
Ec2SetComputerName is set to Enabled // set a unique host name based on the instance's IP address
Ec2HandleUserData is set to Enabled // you can run the user data script after the instance is started for the first time.
WallpaperSettings. xml is used to control the information displayed on the desktop background. It is set by default and does not need to be modified. You can add the corresponding system variables as needed.
Now the AMI template has been set, but the key step is as follows:
Bytes -----------------------------------------------------------------------------------
Important: when using this template to create a new AMI, you must enable the No reboot option in the create option. After restart, the settings in the above xml will No longer exist.
----------------------------------------------------------------------------------
2. Add the powershell script to the Advanced Details of the configure instance option of the launch instance.