Deploy Mini Active Directory on GCP with Terraform - Fast & Low-Cost for Dev/Test

Опубликовано: 01 Май 2026
на канале: Mike's Cloud Solutions
16,040
161

#ActiveDirectory #GCP #Terraform #InfrastructureAsCode #MiniAD #Samba4

Deploy Mini Active Directory on GCP with Terraform - Fast & Low-Cost for Dev/Test

In this project, we build a cost-effective, lightweight Active Directory environment in Google Cloud Platform (GCP) — what I call mini-AD*. Instead of using the fully managed *Google Cloud Managed Microsoft AD*, we deploy *Samba 4 on Ubuntu as a self-managed domain controller and DNS server, all inside a custom VPC network*. You’ll also see how Windows and Linux VMs can automatically join the domain at boot time using *cloud-init and *startup scripts*.

This setup is perfect for labs, demos, and development, where you need AD integration without the cost and overhead of a managed service. Just keep in mind — this is not a production-ready solution, but it delivers a functional AD environment for under ~$40/month (depending on your GCP region and VM sizing).

*What You’ll Learn*
How to provision a Samba 4 Domain Controller in GCP using Terraform
Designing a custom VPC with subnets and firewall rules for AD workloads
Automating domain join for Windows and Linux VMs with metadata startup scripts
Using Samba 4 as both an AD Domain Controller and DNS server
Cost considerations and trade-offs between Google Managed AD and mini-AD
Automating the entire build with Infrastructure as Code

*Resources Deployed*
Custom VPC with private subnet
Ubuntu VM running Samba 4 as Domain Controller + DNS
Windows Server VM joined to the domain
Linux VM joined to the domain
Terraform modules for networking, firewall rules, and domain services

GitHub https://github.com/mamonaco1973/gcp-m...
README https://github.com/mamonaco1973/gcp-m...

---

*Timestamps*

00:00 Introduction
01:32 GCP Diagram
02:22 Limitations
04:15 Prerequisites
04:45 Build the Code
06:17 Build Results
09:35 Demo