Given the current situation, it’s fair to say that most IT departments have experienced a jump in demand for remote workstations, and many are turning to cloud providers. AWS Workspaces is a convenient way to provide digital workspaces to your employees, but how can you be sure that you’re getting the most out of it?
Enter the AWS Workspace Cost Optimizer. This premade CloudFormation stack provided by AWS sets up a lambda function that checks the usage of each workspace on your account, then updates the billing method for that workstation to the most cost-effective plan. The function runs every 24 hours and generates a report detailing the changes made to your billing structure and the monthly usage of your workstations. With this running, you’ll be able to limit overspending on both underused and overused workspaces.
To deploy it, download the template, then create a new stack using that template. CloudFormation will prompt you with a set of parameters, allowing you to customize billing thresholds and deployment VPCs, however, the solution works well as-is. Once you deploy this stack, it will create a Lambda function and s3 buckets for logging and reporting.
The template is customizable and there are many parameters to play around with, but that base install does a lot of work. Note that some types of workspaces have different optimal cost thresholds - for example Windows performance instances should be converted to monthly billing after 74 hours at time of writing. It’s always worthwhile to check the break-even point of your workstations.
If you’re nervous about automatically making changes to your billing settings, there is a dry-run option that can be enabled in the parameters section. In dry-run mode this solution will continue to generate reports and recommendations, but will refrain from modifying your billing settings. If you enjoy the test drive, you can always disable dry-run mode later by updating the stack and changing that parameter.
This solution is perfectly serviceable for keeping track of and managing your workstation spending, but it would be nice to have some more detailed reporting. Thankfully it isn’t that difficult to implement a monitoring solution for this use case.
The plan is to create a lambda function set to trigger on object creation events in the cost optimizer bucket, scraping relevant data from the report csv file into a DynamoDB table. Once we have that data tabulated we can use additional Lambda functions to run reports. Let’s take a look at the scraper function.
This function does three things:
The three API calls used in this solution are:
In this solution we’re enriching the original data with potentially relevant information, such as user names, tag data, and the date. Once the information is in a table, it becomes much easier to visualize usage patterns and run additional reports.
We’ve used a similar solution to send reports directly to Slack for one of our customers, allowing them to keep a close eye on their workspaces usage.
The Workspaces Cost Optimizer is a handy free tool to have in your belt that can really make a difference in your workspaces spending. Throw in customizability and detailed reporting and you almost can’t afford not to install it.
Like what you read? Why not subscribe to the weekly Orbit newsletter and get content before everyone else?