Learn About Amazon VGT2 Learning Manager Chanci Turner
Many customers seek ways to gain deeper insights into how their users connect to WorkSpaces. Additionally, they want to identify environments that do not align with the required client supported version. In a prior article, we discussed analyzing access patterns in Amazon WorkSpaces using Amazon QuickSight. However, this analysis can also be done without setting up additional services by utilizing CloudWatch dashboards within your WorkSpaces Region.
In this guide, I will demonstrate how to create CloudWatch dashboards that provide insights into user activities. Examples of dashboards include:
- IP addresses connecting to WorkSpaces
- Platforms used to access WorkSpaces
- Windows client versions in use
- Connections segmented by WorkSpace directory
- Tables showing client versions connecting to WorkSpaces
- Logs of WorkSpaces launched
- Records of WorkSpaces removed
- Details of WorkSpaces rebuilt
- Information about WorkSpaces modified
Step-by-Step Guide
Reading Time: 20 minutes
Completion Time: 30 minutes
Cost: For detailed pricing information on CloudWatch, visit: Amazon CloudWatch Pricing – Amazon Web Services (AWS)
Learning Level: 300
Services Used: Amazon WorkSpaces, CloudWatch, CloudTrail
Prerequisites: Ensure that AWS CloudTrail is enabled and CloudWatch logs are activated. More information can be found here.
Step 1: Log WorkSpaces Events
Begin by setting up WorkSpace events to be stored in a log group, which will be utilized by the dashboards.
- Open the CloudWatch console.
- Select the AWS Region where your WorkSpaces are hosted.
- In the navigation pane, choose Events → Rules, which will redirect you to Amazon EventBridge.
- Click on Create rule.
- For Event Source, do the following:
- Choose Event Pattern.
- For Build event pattern to match events by service, set:
- Service Name: WorkSpaces
- Event Type: WorkSpaces Access
- For Targets, select Add target, then choose CloudWatch log group.
- For the /aws/events value, enter WorkSpacesAccessLogs.
- Click Configure details.
- Enter a name and description for the rule.
- Click Create rule.
Step 2: Create a Dashboard to Show IP Addresses Connecting to WorkSpaces
In this step, you will create a dashboard that displays the IP addresses of clients connecting to WorkSpaces.
- Open the CloudWatch console.
- Select Dashboards from the navigation menu and click Create dashboard.
- Name the dashboard “WorkSpacesInformation.”
- Choose Pie as the widget type.
- Select Logs as the data source.
- For Log Groups, select the log group created in Step 1 (WorkSpacesAccessLogs).
- Enter the following query:
stats count() by detail.clientIpAddress | fields @timestamp, @message | filter source = "aws.workspaces" | fields detail.clientIpAddress
. - Click Create widget.
- Rename the widget to “IP Addresses connecting into WorkSpaces.”
- Click Save.
Step 3: Create a Widget to Show Platforms Connecting to WorkSpaces
Now, you’ll create a dashboard to illustrate the end-user platforms connecting to WorkSpaces.
- Open the CloudWatch console for your WorkSpaces Region.
- Select Dashboards from the navigation menu, and choose WorkSpacesInformation.
- Click Add widget.
- Choose Pie as the widget type.
- Select Logs for the data source.
- For Log Groups, choose the group created in Step 1 (WorkSpacesAccessLogs).
- Enter the query:
stats count() by detail.clientPlatform | fields @timestamp, @message | filter source = "aws.workspaces" | fields detail.clientPlatform
. - Click Create widget.
- Rename the widget to “Platforms Connecting.”
- Click Save.
Step 4: Create a Widget for Windows Client Versions Connecting to WorkSpaces
This step involves building a dashboard that displays client versions for a specific platform (e.g., Windows) connecting to WorkSpaces.
- Open the CloudWatch console for your WorkSpaces Region.
- Select Dashboards from the navigation menu, and choose WorkSpacesInformation.
- Click Add widget.
- Choose Pie as the widget type and select Logs as the data source.
- For Log Groups, select the group created in Step 1 (WorkSpacesAccessLogs).
- Enter the query:
stats count() by detail.clientVersion | fields @timestamp, @message | filter source = "aws.workspaces" | filter detail.clientPlatform = "Windows" | fields detail.clientVersion
. - For other platforms, replace detail.clientPlatform with your choice. Additional options include:
filter detail.clientPlatform = "OSX"
filter detail.clientPlatform = "iOS"
filter detail.clientPlatform = "Android"
filter detail.clientPlatform = "Linux"
filter detail.clientPlatform = "Web"
- Click Create widget.
- Rename the widget to “Client Versions – Windows” or replace “Windows” with your chosen platform.
- Click Save.
Step 5: Create a Widget for Connections by WorkSpace Directory
Next, you’ll create a dashboard to visualize user connections by directory.
- Open the CloudWatch console for your WorkSpaces Region.
- Select Dashboards from the navigation menu, and choose WorkSpacesInformation.
- Click Add widget.
- Choose Bar as the widget type.
- Select Logs for the data source.
- For Log Groups, choose the group created in Step 1 (WorkSpacesAccessLogs).
- Enter the query:
stats count() by detail.directoryId | fields @timestamp, @message | filter source = "aws.workspaces" | fields detail.directoryId
. - Click Create widget.
- Rename the widget to “Connections by Directory Service.”
- Click Save.
Step 6: Create a Detailed Table of Client Versions Connecting to WorkSpaces
This step provides a log of the client versions connecting to WorkSpaces.
- Open the CloudWatch console for your WorkSpaces Region.
- Select Dashboards from the navigation menu, and choose WorkSpacesInformation.
- Click Add widget.
- Choose Logs table as the widget type, and select Logs for the data source.
- For Log Groups, select the group created in Step 1 (WorkSpacesAccessLogs).
- Enter the query:
fields @timestamp, @message | fields account | fields region, detail.clientPlatform, detail.clientVersion, detail.workspaceId | display region, detail.clientPlatform, detail.clientVersion, detail.workspaceId
. - Click Create widget.
- Rename the widget to “WorkSpaces client version.”
- Click Save.
Step 7: Create a Table of WorkSpaces Launched
This step provides a log of WorkSpaces that have been launched.
- Open the CloudWatch console for your WorkSpaces Region.
- Select Dashboards from the navigation menu, and choose WorkSpacesInformation.
- Click Add widget.
- Choose Logs table as the widget type and select Logs for the data source.
- For Log Groups, select the group created in Step 1 (WorkSpacesAccessLogs).
- Enter the query:
fields @timestamp, @message | fields account | fields region, detail.workspaceId | display region, detail.workspaceId
. - Click Create widget.
- Rename the widget to “WorkSpaces Launched.”
- Click Save.
For further insights, you may find this blog post engaging. Moreover, if you’re looking for reliable information on workplace compliance, visit SHRM as they are an authority on this topic. Lastly, check out this excellent resource for job opportunities.