+ All Categories
Home > Documents > Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s...

Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s...

Date post: 08-Mar-2021
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
23
WorkSpaces Cost Optimizer Implementation Guide
Transcript
Page 1: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost OptimizerImplementation Guide

Page 2: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

WorkSpaces Cost Optimizer: Implementation GuideCopyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service that is notAmazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages ordiscredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who mayor may not be affiliated with, connected to, or sponsored by Amazon.

Page 3: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Table of ContentsWelcome .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Cost ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Example 1 .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Example 2 .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Architecture overview .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Considerations .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Dry run mode .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Billing model conversion .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Hourly to monthly .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Monthly to hourly ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Opting out with tags .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Modifying workspace properties ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Deployment in an existing VPC .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Calculation of maintenance hours .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Regional deployment .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Security ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7IAM Roles .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Template .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Deployment .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Launch the Stack .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Update the stack .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Resources .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Troubleshooting failed workspaces .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Uninstall the solution .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Using the AWS Management Console .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Using AWS Command Line Interface .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Collection of operational metrics ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Source Code .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Contributors ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Revisions .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Notices .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

iii

Page 4: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Monitor Amazon WorkSpaces usageand optimize costs with the AmazonWorkspaces Cost Optimizer solution

AWS Implementation Guide

AWS Solutions Builder Team

January 2017 (last update (p. 19): June 2021)

The Amazon WorkSpaces Cost Optimizer solution analyzes all of your Amazon WorkSpaces usage dataand automatically converts the WorkSpace to the most cost-effective billing option (hourly or monthly),depending on your individual usage. This solution helps you monitor your WorkSpace usage andoptimize costs, and uses AWS CloudFormation to automatically provision and configure the necessaryAWS services to convert individual WorkSpaces.

Amazon WorkSpaces is a fully managed, secure Desktop-as-a-Service (DaaS) service and eliminates theneed for you to procure, deploy, and manage complex virtual desktop environments.

WorkSpaces offers the flexibility to pay hourly or monthly without any upfront commitment. Withhourly billing, you pay a small fixed monthly fee per WorkSpace and a low hourly rate for each hour theWorkSpace is used during the month. With monthly billing, you pay a fixed monthly fee for unlimitedusage during the month. This is initially set up when you launch the WorkSpace and can be changed atany time.

This implementation guide discusses architectural considerations and configuration steps for deployingthe Amazon WorkSpaces Cost Optimizer on the Amazon Web Services (AWS) Cloud. It includes links tothe AWS CloudFormation template that launches, configures, and runs the AWS compute, management,storage, and other services required to deploy this solution on AWS, using AWS best practices for securityand availability.

The guide is intended for IT infrastructure architects, administrators, and DevOps professionals who havea working knowledge of WorkSpaces and architecting in the AWS Cloud.

1

Page 5: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideExample 1

CostYou are responsible for the cost of the AWS services used while running this solution. The total cost forrunning this solution depends on the number of WorkSpaces this solution monitors. As of June 2021, thecost for running this solution with default settings in the US East (N. Virginia) Region is approximately$0.005 per day for a deployment with 25 WorkSpaces. This does not include the cost of the individualWorkSpaces. This reflects AWS Lambda, Amazon CloudWatch, and AWS Fargate charges. You will alsoincur variable charges from Amazon Simple Storage Service (Amazon S3). For a detailed cost breakdown,refer to the examples below.

Example 1Assumptions:

• Number of Workspaces: 1,000

• Number of Amazon ECS Task runs per month: 30

• Amazon ECS task run time in seconds: 600

AWS Service Dimensions Total cost (per month)

Amazon CloudWatch API calls to get metrics $2.00

Amazon ECS ECS Task $1.00

Amazon S3 Cost Optimizer Report Bucket $1.00

Total $4.00

Example 2Assumptions:

• Number of Workspaces: 5,000

• Number of Amazon ECS task runs per month: 30

• Amazon ECS task run time in seconds: 1,200

AWS Service Dimensions Total cost (per month)

Amazon CloudWatch API calls to get metrics $7.00

Amazon ECS ECS Task $2.00

Amazon S3 Cost Optimizer Bucket $1.00

Total $10.00

2

Page 6: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideExample 2

NoteThe default values provided in the Amazon WorkSpaces Cost Optimizer for each of theWorkSpaces bundle type should be considered a guidance value only. Review AmazonWorkSpaces pricing for the AWS Region where you deployed the solution to determine the valuefor your location. Pricing differences between AWS Regions can mean a different billing break-even point between AutoStop and AlwaysOn instances.

Prices are subject to change. For full details, see the pricing webpage for each AWS service you will beusing in this solution.

3

Page 7: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Architecture overviewDeploying this solution with the default parameters builds the following environment in the AWS Cloud.

Figure 1: WorkSpaces Cost Optimizer architecture

1. The AWS CloudFormation template creates an Amazon CloudWatch rule that invokes the AmazonWorkSpaces Cost Optimizer AWS Lambda function every 24 hours.

2. The Lambda function runs the Amazon Elastic Container Service (Amazon ECS) task, which gets thelist of AWS Directories and WorkSpaces from Regions where these services are available.

3. The task then checks the total usage for each WorkSpace that is on an hourly billing model. If themonthly usage threshold has been met, this solution will convert the individual WorkSpace tomonthly billing.

NoteIf a WorkSpace starts in monthly billing or the solution converts a WorkSpace from hourlyto monthly billing, the solution will not convert the WorkSpace to hourly billing until thebeginning of the next month, if usage was below the threshold. However, you can manuallychange the billing model at any time using the Amazon WorkSpaces console. Also, you canchange the threshold for when each WorkSpace converts from hourly to monthly billing. Formore information, refer to Billing Model Conversion. (p. 5)

The solution also features a dry run mode that enables you to gain insight into how the recommendedchanges will effect your costs. For more information, refer to Dry run mode (p. 5).

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

4. The AWS CloudFormation template also creates an Amazon S3 bucket to log the conversions at theend of each run.

NoteCheck your Amazon S3 bucket frequently to track the optimizer’s activity, and to view logswith error messages. Runtime information is logged in Amazon CloudWatch and WorkSpacemetadata is stored in Amazon S3.

4

Page 8: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideDry run mode

Implementation considerations

Dry run modeWe recommend that you run this solution in the dry run mode for a few months, review the daily andmonthly reports, and manually implement any desired changes. This provides insight into how therecommended changes may affect your WorkSpaces costs and allows you to evaluate and analyzesolution’s recommendations. When you are comfortable with the recommendations provided by thesolution and would like these recommendations to be automatically implemented, change the templateparameter Dry Run Mode to No. The solution will then begin to automatically implement future changesbased on the recommendations provided in its daily and monthly reports.

Billing model conversionHourly to monthlyThis solution will calculate the hourly WorkSpace usage for each WorkSpace once per day, just beforemidnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameteris set to No, the solution will automatically convert individual WorkSpaces from an hourly billing modelto a monthly billing model, if the WorkSpace exceeds an hourly usage threshold for that particularWorkSpace type.

By default, the threshold is set close to the hourly and monthly billing break-even point. But, you canuse the solution’s AWS CloudFormation template parameters to change the threshold for when eachWorkSpace converts from hourly to monthly billing.

Because the solution cannot convert WorkSpaces before the calculation at midnight, the defaultconfiguration may result in some WorkSpaces exceeding the threshold for up to 24 hours. For example,the default threshold for a Standard instance is set to 85. If, at midnight on Monday, your usage is 84,the WorkSpace will not be converted to monthly billing. If usage exceeds 85 after midnight on Monday,the WorkSpace will not be converted until the calculation at midnight on Tuesday.

We recommend carefully monitoring your usage using dry run mode and adjusting the threshold to meetyour needs. If several of your WorkSpaces consistently exceed the threshold before being converted,consider lowering the threshold. If several of your WorkSpaces are prematurely converted beforeexceeding the threshold, consider raising the threshold.

Once the solution converts a WorkSpace from hourly billing to monthly billing, the solution will notconvert the WorkSpace back to hourly billing until the beginning of the next month, if usage was belowthe monthly usage threshold. However, you can manually change the billing model at any time using theAWS Management Console.

Monthly to hourlyThe solution converts a WorkSpace to monthly or hourly billing model at the end of the month,depending on the WorkSpace utilization for the given month. If WorkSpace utilization exceeds the usagethreshold, the billing model changes to monthly. If WorkSpace utilization was lesser than or equal tousage threshold, the model changes to hourly. To prevent WorkSpaces from being converted multipletimes in a month, usage for monthly WorkSpaces is calculated at the end of the month. For customers

5

Page 9: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideOpting out with tags

who want to convert WorkSpaces from monthly billing to hourly billing immediately, the solution’s AWSCloudFormation template includes a parameter (Simulate End of Month) that will run these conversionsat the time of deployment.

Opting out with tagsTo prevent the solution from converting a WorkSpace between billing models, you can apply a resourcetag to the WorkSpace using the tag key Skip_Convert and any tag value. This solution will log taggedWorkSpaces, but it will not convert the tagged WorkSpaces. Remove the tag at any time to resumeautomatic conversion for that WorkSpace.

Modifying workspace propertiesThis solution uses the Describe_Workspaces API call to calculate the idle timeout for a Workspace.This value is a point in time and does not provide historical data for the idle time. If you change the idletimeout for a Workspace in the middle of a month, the billable hours will use the new idle timeout andapply it for the entire month. For this reason, the billable hours calculated by the solution will not matchthe billable hours charged by the Workspace service. This solution uses the new idle timeout value andcalculate correct billable hours from the following month. You can skip the Workspace processing for thecurrent month by adding a Skip_Convert tag to the Workspace.

Deployment in an existing VPCThis solutions creates a new VPC to run the ECS task. You can also deploy the solution in an existing VPCby providing the subnet IDs and security group ID as part of the input parameters to the CloudFormationtemplate. To run this solution in an existing VPC, the ECS task needs to run in a public subnet, or aprivate subnet with a route to the internet. This route is necessary because the ECS task pulls the Dockerimage hosted in a public Amazon ECR repository. The security group used to run the ECS task allows youto pull this image from ECR repository.

Calculation of maintenance hoursIf you run your patches or other maintenance scripts by changing the workspaces to ALWAYS_ONmode, you will need to account for the ALWAYS_ON hours and adjust the threshold values in theCloudFormation template accordingly. For example, if you change the mode from AUTO_STOP toALWAYS_ON for 10 hours to run the maintenance scripts, you should subtract 10 hours from the setthreshold value in the CloudFormation template.

Regional deploymentYou must launch the WorkSpaces Cost Optimizer solution in an AWS Region that supports AWSLambda, WorkSpaces, and AWS Fargate services. However, once deployed, this solution will monitor theWorkSpaces in any AWS Region. You must launch this solution in the same account as the WorkSpacesyou want to monitor.

For the most current availability by Region, refer to AWS service offerigns by Region.

6

Page 10: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideIAM Roles

SecurityWhen you build systems on AWS infrastructure, security responsibilities are shared between you andAWS. This shared model can reduce your operational burden as AWS operates, manages, and controlsthe components from the host operating system and virtualization layer down to the physical security ofthe facilities in which the services operate. For more information about security on AWS, visit the AWSSecurity Center.

IAM RolesThis solution creates AWS Identity and Access Management (IAM) roles to control and isolate permissionsfor the AWS Lambda function and AWS Fargate Container, following the best practice of least privilege.The services are granted the following permissions:

CostOptimizerCreateTask function:

• Create and run Amazon ECS tasks• Run permissions to AWS Lambda

ECS Container:

• Read-only permissions to AWS Directory Service• Write permissions to Amazon CloudWatch Logs• Write permissions to Amazon S3• Read/Write permissions to WorkSpaces

7

Page 11: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

AWS CloudFormation TemplateThis solution uses AWS CloudFormation to automate the deployment of WorkSpaces Cost Optmizer onthe AWS Cloud. It includes the following AWS CloudFormation template, which you can download beforedeployment:

workspaces-cost-optimizer.template: Use this template to launch the WorkSpacesCost Optimizer and all associated components. The default configuration deploys an AWS Lambdafunctions, an Amazon ECS task definition, an Amazon CloudWatch event, and an Amazon S3 bucket, butyou can also customize the template based on your specific needs.

8

Page 12: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideLaunch the Stack

Automated DeploymentBefore you launch the automated deployment, please review the architecture, configuration, and otherconsiderations discussed in this guide. Follow the step-by-step instructions in this section to configureand deploy WorkSpaces Cost Optimizer into your account.

Time to deploy: Approximately five minutes

Launch the StackThis automated AWS CloudFormation template deploys the WorkSpaces Cost Optimizer on the AWSCloud.

NoteYou are responsible for the cost of the AWS services used while running this solution. See theCost (p. 2) section for more details. For full details, see the pricing webpage for each AWSservice you will be using in this solution.

1. Sign in to the AWS Management Console and choose the button below to launch the workspaces-cost-optimizer AWS CloudFormation template.

You can also download the template as a starting point for your own implementation.2. The template is launched in the US East (N. Virginia) Region by default. To launch the WorkSpaces

Cost Optimizer in a different AWS Region, use the region selector in the console navigation bar.

NoteThis solution uses AWS Lambda, AWS Fargate, and WorkSpaces, which are currentlyavailable in specific AWS Regions only. However, once deployed, the solution will monitorthe Workspaces in any AWS Region. Also, you must launch this solution in the same accountas the WorkSpaces you want to monitor. For the most current availability by region, seeAWS service offerings by region.

3. On the Select Template page, verify that you selected the correct template and choose Next.4. Under Parameters, review the parameters for the template and modify them as necessary. This

solution uses the following default values.

Parameter Default Description

Launch in Dry Run Mode? Yes Generates a change log, butdoes not run any changes Formore information, refer to Dryrun mode (p. 5).

Simulate End of Month No Overrides date and forces thesolution to run as if it is theend of the month.

9

Page 13: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideLaunch the Stack

Parameter Default Description

Log Level INFO Sets the log level for theLambda function logs inCloudWatch.

Value Limit 81 The number of hours a Valueinstance can run in a monthbefore being converted toALWAYS_ON.

Standard Limit 85 The number of hours aStandard instance can run in amonth before being convertedto ALWAYS_ON.

Performance Limit 83 The number of hours aPerformance instance canrun in a month before beingconverted to ALWAYS_ON.

Power Limit 83 The number of hours a Powerinstance can run in a monthbefore being converted toALWAYS_ON.

Graphics Limit 217 The number of hours aGraphics instance can run in amonth before being convertedto ALWAYS_ON.

PowerPro Limit 80 The number of hours aPowerPro instance can run in amonth before being convertedto ALWAYS_ON.

GraphicsPro Limit 80 The number of hours aGraphicsPro instance canrun in a month before beingconverted to ALWAYS_ON.

VPC CIDR 10.215.0.0/16 The default VPC CIDR usedto deploy the AWS Fargatecontainer dynamically whenthe solution runs.

Subnet1 CIDR 10.215.10.0/24 One of two subnets in differentAZs where the AWS Fargatecontainer is deployed.

Subnet2 CIDR 10.215.20.0/24 The second of two subnets indifferent AZs where the AWSFargate container is deployed.

Create New VPC Yes Select Yes to deploy thesolution in a new VPC.

10

Page 14: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideUpdate the stack

Parameter Default Description

Subnet ID for first subnet Subnet ID to launch ECS task.Leave this blank if you selectedYes for Create New VPC orenter an existing subnet ID torun ECS task.

Subnet ID for second subnet Subnet ID to launch ECS task.Leave this blank if you selectedYes for Create New VPC orenter an existing subnet ID torun ECS task.

Security group ID to launchECS task

Security group ID to launchECS task. Leave this blank ifyou selected Yes for CreateNew VPC or enter an existingsecurity group ID to run ECStask.

5. Choose Next.6. On the Options page, choose Next.7. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that

the template will create AWS Identity and Access Management (IAM) resources.8. Choose Create to deploy the stack.

You can view the status of the stack in the AWS CloudFormation console in the Status column. Youshould receive a CREATE_COMPLETE status in approximately five minutes.

NoteIn addition to the CostOptimizerCreateTask AWS Lambda function, this solution includesthe solution-helper Lambda function, which runs only during initial configuration or whenresources are updated or deleted.When running this solution, you will see all AWS Lambda functions in the AWS Managementconsole, but only the CostOptimizerCreateTask function is regularly active. However, do notdelete the solution-helper function as it is necessary to manage associated resources.

Update the stackIf you have previously deployed an older version (v2.2.1 or lower) of this solution, follow this procedureto update the Amazon Workspaces Cost Optimizer CloudFormation stack to get the latest version of thesolution’s framework.

1. Sign in to the AWS CloudFormation console, select your existing workspaces-cost-optimizerCloudFormation stack, and select Update.

2. Select Replace current template.3. Under Specify template:

a. Select Amazon S3 URL.b. Copy the link of the latest template.c. Paste the link in the Amazon S3 URL box.d. Verify that the correct template URL shows in the Amazon S3 URL text box, and choose Next.

Choose Next again.

11

Page 15: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideUpdate the stack

4. Under Parameters, review the parameters for the template and keep the value for the parameterCreateNewVPC as Yes. Leave the Existing VPC Settings section blank. This upgrade will not create anew VPC. This upgrade will continue using the existing VPC resources created by the older version ofthe solution. Refer to Step 1. Launch the Stack (p. 9) for details about the parameters.

5. Choose Next.6. On the Configure stack options page, choose Next.7. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that

the template might create AWS Identity and Access Management (IAM) resources.8. Choose View change set and verify the changes.9. Choose Update stack to deploy the stack.

You can view the status of the stack in the AWS CloudFormation console in the Status column. Youshould receive a UPDATE_COMPLETE status in approximately five minutes.

12

Page 16: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Additional ResourcesAWS services

• WorkSpaces• AWS CloudFormation• AWS Lambda• Amazon CloudWatch• AWS Fargate• Amazon Simple Storage Service• AWS Directory Service

13

Page 17: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Troubleshooting failed workspacesThis solution attempts to modify workspace mode based on the threshold hours. When this solutioncannot change the workspace mode due to an exception, such as the workspace being in UNHEALTHYstate or booting up during the conversion, this solution skips this workspace and continues to processother Workspaces in the account. The skipped workspaces are added to the daily report with themessage Failed to change mode. More details about the exception can be found in the ECS logs.This solution attempts to change the mode again during the next run of the ECS task.

14

Page 18: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation GuideUsing the AWS Management Console

Uninstall the solutionYou can uninstall the Amazon Workspaces Cost Optmizer solution from the AWS Management Consoleor by using the AWS Command Line Interface.

Using the AWS Management Console1. Sign in to the AWS CloudFormation console.2. Select this solution’s main stack.3. Choose Delete.

Using AWS Command Line InterfaceDetermine whether the AWS Command Line Interface (AWS CLI) is available in your environment. Forinstallation instructions, refer to What Is the AWS Command Line Interface in the AWS CLI User Guide.After confirming that the AWS CLI is available, run the following command.

$ aws cloudformation delete-stack --stack-name <installation-stack-name>

15

Page 19: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Collection of operational metricsThis solution includes an option to send anonymous operational metrics to AWS. We use this data tobetter understand how customers use this solution and related services and products. When enabled, thefollowing information is collected and sent to AWS:

• Solution ID: The AWS solution identifier• Unique ID (UUID): Randomly generated, unique identifier for each WorkSpaces Cost Optimizer

deployment• Timestamp: Data-collection timestamp• WorkSpaces Data: The number and billing model of WorkSpaces that the WorkSpaces Cost Optimizer

manages in each AWS Region

Example data:

{ noChange: 103 error: 0 toHourly: 0 toMonthly: 17}

Note that AWS will own the data gathered via this survey. Data collection will be subject to the AWSPrivacy Policy. To opt out of this feature, modify the AWS CloudFormation template mapping section asfollows:

Mappings: Solution: Data: SendAnonymousUsageData: True

to

Mappings: Solution: Data: SendAnonymousUsageData: False

16

Page 20: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Source CodeVisit our GitHub repository to download the templates and scripts for this solution, and to share yourcustomizations with others. Refer to the README.md file for additional information.

17

Page 21: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

ContributorsThe following individuals contributed to this document:

• Matt Juaire• Joseph Seeley• Michael Ortwein

18

Page 22: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

Document RevisionsDate Change

January 2017 Initial release

March 2017 Added a function to the child AWS Lambdafunction and updated the parameters

February 2018 Added a Power instance parameter and updatedthe anonymous data collection configuration

May 2018 Updated for clarity on the Dry Run Mode providedby the solution

December 2018 Added clarification on billing conversion

February 2019 Converted parent and child AWS Lambdafunctions to AWS Fargate container solution

December 2019 Added information on support for Node.js update

April 2020 Bug fixes

June 2021 Release version 2.3: Bug fixes and support forexisting VPCs. For more information, refer to theCHANGELOG.md file in the GitHub repository

19

Page 23: Cost Optimizer Amazon WorkSpaces...midnight GMT. Note that the calculation includes that day’s usage. When the Dry Run Mode parameter is set to No, the solution will automatically

WorkSpaces Cost Optimizer Implementation Guide

NoticesThis document is provided for informational purposes only. It represents AWS's current product offeringsand practices as of the date of issue of this document, which are subject to change without notice.Customers are responsible for making their own independent assessment of the information in thisdocument and any use of AWS's products or services, each of which is provided "as is" without warrantyof any kind, whether express or implied. This document does not create any warranties, representations,contractual commitments, conditions or assurances from AWS, its affiliates, suppliers or licensors. Theresponsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and thisdocument is not part of, nor does it modify, any agreement between AWS and its customers.

The WorkSpaces Cost Optimizer solution is licensed under Apache License Version 2.0 available at TheApache Software Foundation

20


Recommended