
Set Up AWS Managed Microsoft AD and Join an EC2 Instance to It: A Beginner’s Walkthrough
Learn how to create an AWS Managed Microsoft Active Directory, connect a Windows EC2 instance to your domain, create users, and configure Group Policies step by step. A beginner-friendly, hands-on AWS tutorial covering identity management, networking, security, and cost-effective resource cleanup.
Series: AWS (6 articles)
- …
- 6Set Up AWS Managed Microsoft AD and Join an EC2 Instance to It: A Beginner’s Walkthrough This article
If you have ever wondered how companies manage thousands of users, laptops, and servers from one place, the answer is usually Active Directory (AD). On AWS, you do not have to build and babysit your own domain controllers to get it. AWS Directory Service for Microsoft Active Directory, also called AWS Managed Microsoft AD, runs a real Windows Server Active Directory for you.
In this walkthrough, you will create a managed directory, join a Windows EC2 instance to it, create a user, and apply a simple Group Policy. I will also show you how to clean everything up so you do not get a surprise bill. Everything here is aimed at beginners and students who want to learn by doing.
Console screens and prices change. Treat the steps below as a guide, and check the current AWS documentation and pricing page for your Region before you start.
What is AWS Managed Microsoft AD?
Active Directory is Microsoft’s directory service. It stores users, groups, and computers, and it decides who can sign in to what. Machines that belong to a domain follow the rules (Group Policy) that administrators set centrally.
With AWS Managed Microsoft AD, AWS launches a pair of domain controllers for you in two Availability Zones inside your VPC. You get a genuine AD domain, and AWS handles the infrastructure work behind it.
Why choose it over running your own domain controller on EC2?
You could install the Active Directory Domain Services role on your own Windows Server EC2 instance. That works, and it is a great way to learn how AD is built. For most real workloads, though, the managed option has clear advantages:
- Less operational work. AWS patches and monitors the domain controllers, and it replaces a failed one automatically.
- High availability by default. The directory spans two Availability Zones from day one. A self-managed setup needs you to build and test that yourself.
- Built-in backups. Automatic snapshots are taken for you, and you can restore from them.
- AWS integrations. The directory works with services such as Amazon RDS for SQL Server, Amazon FSx for Windows File Server, and Amazon WorkSpaces.
- Hybrid support. You can set up a trust relationship with an on-premises AD.
There are trade-offs too:
- You are not a full domain admin. You get a delegated administrator account, and you cannot sign in to the domain controllers themselves. You can still extend the schema when an application needs it.
- It costs more than one small EC2 instance. You pay for the directory for every hour it exists.
- It is not a fit for every tiny lab. If you only want to explore AD internals, a self-built domain controller may suit you better.
Standard or Enterprise edition?
There are two editions. Standard is designed for small and mid-sized organizations (on the order of tens of thousands of objects), while Enterprise supports far larger directories. For learning, Standard is the sensible choice.
What you need before you start
- An AWS account, and a Region you will remember. Resources in the wrong Region are the most common cause of forgotten charges.
- A VPC with two subnets in different Availability Zones. The directory needs both.
- Permission to create directories, EC2 instances, and IAM roles. A sandbox account is ideal.
- A domain name you can invent, such as
corp.example.com. It does not have to be a real, registered domain, but avoid names you might need on the public internet later.
Step 1: Create the directory
- Open the Directory Service console and choose Set up directory.
- Pick AWS Managed Microsoft AD.
- Choose the Standard edition.
- Enter your directory DNS name (for example
corp.example.com) and a short NetBIOS name (for examplecorp).
- Set an Admin password. The administrator account is named
Admin. Store this password somewhere safe, because you will need it shortly.
- Select your VPC and the two subnets in different Availability Zones.
- Review and create the directory.
Creation takes a while, often around 20 to 40 minutes. When the status changes to Active, note the DNS addresses of the two domain controllers. Your instances will need them.
Step 2: Prepare IAM and networking
The easiest way to join an EC2 instance to the domain is the “seamless domain join” feature, which uses AWS Systems Manager.
- Create an IAM role for EC2 and attach two AWS managed policies:
AmazonSSMManagedInstanceCoreandAmazonSSMDirectoryServiceAccess.
- Make sure the instance can use the directory’s DNS servers. You can do this by creating a DHCP options set for your VPC that points to the two directory DNS addresses, or by configuring DNS on the instance yourself.
- Check that your security groups allow the instance and the directory to talk to each other. AWS creates a security group for the directory, and the instance must be able to reach it for DNS, Kerberos, and LDAP traffic.
Step 3: Launch and join a Windows EC2 instance
- In the EC2 console, launch a Windows Server instance in the same VPC as the directory.
- Attach the IAM role you created as the instance profile.
- Under advanced details, find the Domain join directory setting and select your directory.
- Launch the instance, wait for it to pass its status checks, then connect with RDP using the local administrator credentials.
Once the join succeeds, the computer account appears in your directory. If the join fails, the most common causes are a missing IAM policy, the wrong DNS settings, or blocked ports.
Step 4: Install the management tools and create a user
You manage the domain from a domain-joined Windows machine.
- Sign in to the instance as
corp\Admin(use your own NetBIOS name).
- In Server Manager, choose Add roles and features and install Active Directory Domain Services Tools and Group Policy Management from the Remote Server Administration Tools section.
- Open Active Directory Users and Computers.
- Expand your domain and find the OU named after your NetBIOS name. This is where your delegated Admin account has permissions.
- Inside it, open the Users OU, right-click, and choose New > User. Give the user a name and password.
A small catch: new domain users cannot sign in over RDP by default. Add the user to the instance’s local Remote Desktop Users group, or grant the right through policy, and then test signing in as that user.
Step 5: Apply a basic Group Policy
Group Policy is where AD becomes powerful. Let’s set up a simple rule that automatically locks idle screens.
- Open Group Policy Management.
- Find your OU, right-click it, and choose Create a GPO in this domain, and Link it here.
- Name it something clear, such as
Lock Idle Screens.
- Right-click the GPO and choose Edit. Under User Configuration > Policies > Administrative Templates > Control Panel > Personalization, enable a screen saver timeout and require a password on resume.
- Sign in as your test user and run
gpupdate /force. The setting should apply.
A useful rule of thumb: settings that affect users belong in a GPO linked to the OU holding user accounts, and settings that affect computers belong in a GPO linked to the OU holding computer accounts.
Cost and cleanup: avoid the surprise bill
This is the part many beginners skip, so do it properly. A directory is billed for every hour it exists, whether or not anyone is using it. The EC2 instance bills too.
Follow this checklist when you finish practicing:
- Terminate the EC2 instance(s) you joined to the domain.
- Delete the directory from the Directory Service console. This ends the directory charges. Deleting it also removes all users, groups, and policies inside it, so export anything you want to keep first.
- Delete the DHCP options set and any security groups you created for this lab.
- Remove the IAM role you made for the instance.
- Check Billing and Cost Management the next day to confirm charges have stopped.
Before you begin, set a billing alert or AWS Budget so you hear about unexpected spend early. Also check whether a free trial applies to your account, since AWS has offered one for new directories in the past, and the terms can change.
Common problems and quick fixes
- The domain join fails. Re-check the IAM policies, the DNS servers, and the security group rules, in that order.
- You cannot find the Admin OU. Look for the OU that matches your NetBIOS name, not the top-level domain object.
- A domain user cannot RDP in. Add them to the Remote Desktop Users group.
- A GPO does not seem to apply. Run
gpupdate /forceand confirm the GPO is linked to the OU where the user or computer object lives.
Wrapping up
You have now seen the full loop: create a managed directory, join a Windows machine to it, add a user, control behavior with Group Policy, and clean everything up. From here you can explore trust relationships with an on-premises AD, connect services like Amazon RDS for SQL Server or FSx, and learn how identity fits into a wider security design.
If you try this walkthrough, tell me where you got stuck in the comments, and I will add it to the troubleshooting list.
Suggested tags: active-directory, aws-directory-service, windows, ec2, student-builders, security
Series: AWS (6 articles)
- …
- 6Set Up AWS Managed Microsoft AD and Join an EC2 Instance to It: A Beginner’s Walkthrough This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article