AWS WorkSpaces Directory

This page shows how to write Terraform and CloudFormation for WorkSpaces Directory and write them securely.

aws_workspaces_directory (Terraform)

The Directory in WorkSpaces can be configured in Terraform with the resource name aws_workspaces_directory. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "aws_workspaces_directory" "directory_abc" {
  directory_id = local.directory_id_abc
  subnet_ids = [
resource "aws_workspaces_directory" "main" {
  directory_id =

data "aws_workspaces_bundle" "value_windows_10" {
  bundle_id = "wsb-bh8rsxt14"
resource "aws_workspaces_directory" "main" {
  directory_id =

  self_service_permissions {
    increase_volume_size = true
    rebuild_workspace    = true
resource "aws_workspaces_directory" "test" {
  directory_id =
  subnet_ids = slice(module.vpc.public_subnets, 0, 2)

  // デフォルトのIAMロールに依存するので depends_on を書いておく
  depends_on = [

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


Explanation in Terraform Registry

Provides a WorkSpaces directory in AWS WorkSpaces Service.

NOTE: AWS WorkSpaces service requires workspaces_DefaultRole IAM role to operate normally.

AWS::WorkSpaces::Workspace (CloudFormation)

The Workspace in WorkSpaces can be configured in CloudFormation with the resource name AWS::WorkSpaces::Workspace. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.


Explanation in CloudFormation Registry

The AWS::WorkSpaces::Workspace resource specifies a WorkSpace.

Updates are not supported for the BundleId, RootVolumeEncryptionEnabled, UserVolumeEncryptionEnabled, or VolumeEncryptionKey properties. To update these properties, you must also update a property that triggers a replacement, such as the UserName property.

Frequently asked questions

What is AWS WorkSpaces Directory?

AWS WorkSpaces Directory is a resource for WorkSpaces of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS WorkSpaces Directory?

For Terraform, the Rubynahal/terraform-aws-workspace-automation, colinbut1/aws-workspaces-daas and JamesWoolfenden/terraform-aws-workspaces source code examples are useful. See the Terraform Example section for further details.