How to make multiple AMIs of a system that is already a member of a Windows domain

I have a golden image server configured, all packages installed and updated, and its connection to a windows domain. We must first join the system on the domain because some of the packages depend on the domain resource.

I took the AMI of this golden imaging system, but if I propagate an instance from this AMI, I just put a copy of the same server (same hostname, etc.) on our VPC. I want to use this AMI as a golden image to expand to 40 or more instances, all the same except the hostname and still on the domain.

Please tell me how can I make an AMI of an instance that is in an AD domain, but try it with a different hostname (still a member of the domain). It can be done?

+3


source to share


1 answer


I can represent the variant as user data. When you start an instance, you have the option to put User Data scripts (Powershell \ Batch on Windows) (Bash on linux), In these scripts, you can try to change the instance name, in User Data just type

<powershell>
Rename-computer –computername "Current_Computer_Name" –newname "New_Computer_Name_X" –domaincredential domain\user –force –restart
</powershell>

      



Where are you calling RunInstance (AWS SDK for .NET \ Java \ Python \ etc) Just increment X by "New_Computer_Name_X" by 1 each time a new instance is started.

Amazon Elastic Compute Cloud → User Data

0


source







All Articles