AWS User Data script for windows server to be able to automatically join domain.
- Create aws IAM policy with the detail on role.json
- Create aws role, attache the policy from the step 1
- add other aws default policy required by ec2 such as AmazonSSMManagedInstanceCore, CloudWatchAgentAdminPolicy, AmazonEC2RoleforSSM
- create secret manager named prod/AD
- add the following secret key: UserID, PAssword, Domain, oupath, localpwd and their secret value to the secret manager.
- on EC2 instance AMI, create new folder on c:\ named sorce (c:\source)
- add ssm agent installer to the folder c:\source (AmazonSSMAgentSetup.exe)