How to Deploy Amazon WorkSpaces in AWS using Terraform

Guillermo Musumeci
8 min readJan 9, 2022

In this story, we will deploy Amazon WorkSpaces on AWS using Terraform.

There are several requirements to deploy Amazon WorkSpaces in our AWS account:

  • Network (VPC, Subnets, etc.)
  • AWS Directory Service or AWS Connector (for on-premise AD)
  • Update DHCP Options in the VPC to use AWS Directory Service
  • The workspaces_DefaultRole IAM role
  • Optional — KMS is required to encrypt WorkSpaces disk volumes

Deploying the Network (Optional)

First, we will use the VPC Module to create a simple VPC with two public and two private subnets in the EU-West region.

Note: We can skip this step if we have an existing network deployed.

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "kopicloud-dev"
cidr = "10.10.0.0/16"
azs = ["eu-west-1a", "eu-west-1b"]
private_subnets = ["10.10.1.0/24", "10.10.2.0/24"]
public_subnets = ["10.10.3.0/24", "10.10.4.0/24"]
enable_nat_gateway = true
single_nat_gateway = true
one_nat_gateway_per_az = false
enable_dns_hostnames = true
enable_dns_support = true

--

--

Guillermo Musumeci
Guillermo Musumeci

Written by Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌

Responses (1)