Author: Dean Suzuki (Last Updated: 4/1/20)
Many customers already have Microsoft Active Directory running in their on-premises data centers. Earlier, you setup AWS Managed Microsoft Active Directory (AD) that creates an AD forest running inside of AWS. In this lab, you will learn how to integrate the two AD forests, on-premises AD forest and AWS Managed Microsoft AD forest. This integration will be done by creating an AD trust between the AWS Managed Microsoft AD running in AWS and your on-premises AD.
In this lab, you will simulate your on-premises AD by setting up AD on EC2.
For more information on AWS Directory service, please visit our developers guide.
For more information on trust relationship, please visit When to Create a Trust Relationship.
To do this lab, you will need to have completed the following prior labs (on http://aws-labs.net):
Step 1: Building the network
Step 2: Deploying Active Directory
Step 3: Administering AD
In this section, you will setup Active Directory domain controllers running on EC2 to simulate your on-premises AD forest. To perform this step, you will leverage a CloudFormation template that has been created.
Note: This CloudFormation template may have already been run in your lab environment so please check with your lab proctor.
Login to the AWS Console and navigate to the CloudFormation (CFN) console.
Make sure you to select the “N.Virginia” region.
Click on Create stack with new resources (standard)
In the Create stack screen, enter the values as shown below and click on Next.
Prepare Template: Template is ready
Template Source: Amazon S3 URL
For stack name, enter AD-Onprem
Provide the below inputs for the CloudFormation stack then click Next to continue.
For the tags, enter “Name” for key and “AD Lab” for value and click Next.
In this last page, check “I acknowledge that CloudFormation might create IAM resources”, then click on Create Stack.
It will take a about 40 minutes to deploy the stack which will deploy the EC2 Instances and promote them as Domain Controllers for the onprem.local domain.
In the Filter/Search bar type Controller and hit enter. This will show you the AD/AWS Directory Service Security groups as shown:
Note: Look at the descriptions, you will see a “Domain Controller” Security group. These correspond to the on-prem domain controllers built. You will also see the Security group that was created for your AWS Directory Service “AWS created security group with name d-xxxx_controllers”. Take note of these security group ID’s.
Copy the Group ID for the “AD-Onprem-DomainControllersSG-###” group and save it in a notepad file.
Copy the Group ID for the “d-xxxxxxx_controllers” group and save it in a notepad file.
Select the Security Group named “d-xxxxxxx_controllers” and click on Outbound Rules tab and click on Edit.
You will need to create an Allow All Outbound rules, for Domain Controller Security group set as the destination. Press Add Rule. For Type, select All Traffic. For Destination, paste the Group Id for the “AD-Onprem-DomainControllersSG-###” group. Press Save.
Select the Security Group “AD-Onprem-DomainControllerSG-xxxx” and click on Inbound Rules tab and click Edit.
Press Add Rule. For Type, select All traffic. For source, paste in the Group ID for “d-xxxxxxx_controllers” group. Press Save.
Next, you are going to login to the Remote Desktop Gateway (RDGW) server.
Log in to the AWS Console and go to Elastic Compute Cloud (EC2) console.
On the left hand menu, select Instances.
Select the checkbox near to the RDGW server.
Click the Connect button. Click the “Download Remote Desktop File” to download the RDP file.
Click the Get Password button.
Click the Choose File button and browse to the location of the key pair file that you downloaded earlier.
Click Decrypt Password
Once the password is decrypted, copy it to the clipboard.
Double click the RDP connection file and paste the password from the clipboard into the password field.
You should be logged into the RDGW server
Once you are logged in to the RDGW server, open Microsoft Remote Desktop again and connect to the IP address “10.0.3.10”. This is one of the Domain Controllers that is setup for the on-prem domain.
When logging in to the DC1 (10.0.3.10), on the login screen, select More choices. Then select Use a different account. Then enter ONPREM\admin as the username and the password you created when you launched ONPREM domain in Section 1.
On DC1 (10.0.3.10), go to the Start Menu and look for Windows Administrative Tools and under there, open DNS.
In the DNS Manager Console, expand the DNS server for DC1.
Right click on “Conditional Forwarders” and click on “New Conditional Forwarder”
In DNS domain, type the fully qualified domain name (FQDN) of your AWS Managed Microsoft AD which should be corp.example.com.
Under IP addresses of the master servers, add the IP’s of your AWS Managed Microsoft AD directory, which you noted earlier in step 3. Check the option to “Store this conditional forwarder in AD” and select the option “All DNS servers in this domain”.
Note: Note: After entering the DNS addresses, you may get a “timeout” or “unable to resolve” error. You can ignore these errors.
Click OK to close the conditional forwarder. You can also close the DNS server.
Keep the Remote Desktop connection open and continue with part 3 below.
Open Server Manager on the DC1 (10.0.3.10) and on the Tools menu, click on Active Directory Domains and Trusts.
Right click on the domain which should be “onprem.local” and click on Properties.
Click on the Trusts tab and click on New trust. Type the name of your AWS Managed AD which should be “corp.example.com” and click Next.
Choose Forest trust. Click Next.
Choose Two-way. Click Next.
Choose This domain only. Click Next.
Choose Forest-wide authentication. Click Next.
Type a Trust password. Make sure to remember this password as you will need it when setting up the trust for your AWS Managed Microsoft AD.
In the next dialog box, confirm your settings and choose Next. Confirm that the trust was created successfully and again choose Next.
Choose No, do not confirm the outgoing trust. Click Next.
Choose No, do not confirm the incoming trust. Click Next. Click Finish to close this wizard.
Press Ok to close the dialog box.
On the Directory details page, select the Networking & security tab.
In the Trust relationships section, click on Add trust relationship.
On the Add a trust relationship page, use the following values as shown:
Trust Type: Forest Trust
Trust Password: Same trust password that you used when creating the trust on your on-premises domain.
Trust Direction: Two-Way
Conditional Forwarder: Enter 10.0.3.10; Click on Add additional IP and enter 10.0.35.10.
Click Add to continue.
It will take a few minutes to configure the trust. Once it’s completed you should see the status change to Verified as shown below. Your trust relationship is now setup and ready to be used.
You have successfully deployed a simulated On-premises Active Directory on EC2 Instances and performed necessary steps to setup a two-way Forest trust between the AWS Managed AD and the simulated “on-premises” AD.
You can leverage this architecture to enable single sign-on to AWS resources. For example, a common architecture is to join EC2 instances to the AWS Managed Microsoft AD forest in AWS. By establishing the AD trust, you can leverage the AD groups and AD users in your on-premises AD forest to secure resources in AWS Managed Microsoft AD forest.
If you are done with all the labs, you can clean up the resources in the following order to stop accumulating AWS charges.