Architecture overview - Cost Optimizer for Amazon WorkSpaces

Architecture overview

This section provides a reference implementation architecture diagram for the components deployed with this solution.

Architecture diagram

Deploying this solution with the default parameters deploys the following components in your AWS account.

Note

This solution includes both a hub account template (deployed first) for a central account to manage the WorkSpaces and provide a centralized report, and a spoke account template (deployed second) for each WorkSpace account that you want to monitor. The solution generates a report per directory and an aggregated report with information about WorkSpaces from all the directories combined.

Cost Optimizer for Amazon WorkSpaces architecture

Cost Optimizer for Amazon WorkSpaces architecture

  1. The spoke template creates a custom resource that invokes an AWS Lambda function to register the account as a spoke account in an Amazon DynamoDB table in the hub account.

  2. The hub template creates an Amazon EventBridge rule that invokes an Amazon ECS task every 24 hours.

  3. The Amazon ECS task assumes an AWS Identity and Access Management (IAM) role in each spoke account to manage WorkSpaces.

  4. The Amazon ECS task polls AWS Directory Service to gather a list of all directories registered for Amazon WorkSpaces in a specific AWS Region. The task then checks the total usage for each WorkSpace that is on an hourly billing model. If a WorkSpace has met the monthly usage threshold, the solution will convert the individual WorkSpace to monthly billing.

    Note

    If a WorkSpace starts in monthly billing or the solution converts a WorkSpace from hourly to monthly billing, the solution will not convert the WorkSpace to hourly billing until the beginning of the next month if usage was below the threshold. However, you can manually change the billing model at any time using the Amazon WorkSpaces console. Also, you can change the threshold for when each WorkSpace converts from hourly to monthly billing. For more information, refer to Automatic billing conversion

    The solution also features a dry run mode (activated by default) that allows you to gain insight into how the recommended changes will affect your costs. For more information, refer to Dry run mode.

    At the end of the month, the Amazon ECS task checks the total usage for each Workspace that is on a monthly billing model. If a WorkSpace has not met the monthly usage threshold, the solution will convert the individual WorkSpace from monthly to hourly billing at the start of the next month.

  5. The Amazon ECS task writes the results of the execution to the DynamoDB usage table, session tables, and uploads them to an Amazon Simple Cloud Storage (Amazon S3) bucket.

Note

Check your Amazon S3 bucket frequently to track the optimizer’s activity, and to view logs with error messages.