Amazon Workspaces can quickly add up and if your users aren't using them you may be paying for services that you don't need. So how can you tell if your workspaces are being used. The manual way is to log into the Workspaces console and check the last activity date. That may work for a few workspaces, but once you get over 5 or 10 that becomes pretty tedious.
Here's a python script that will run a quick report on your workspace. A -1 will mean the user has never logged in after that number represents the number of days since the last login, so a zero would mean today. I have a constant called THRESHOLD_DAYS set to 15, which basically says if you haven't logged in in the last 15 days you should be added to a list to check on.
The output is the a comma separated list of days since use, the workspace_id, and the user. The end of the report will include a summary or the total number of workspaces, the thresh hold count (those who haven't logged-in in X days) and number of users who have never logged in.
The program is written in python and uses boto3. It also uses the boto3 session, which looks for a either default AWS profile or an environment variable of AWS_PROFILE which is configured to the connect your account. The profile will of course need the necessary security credentials in aws to access workspaces.