AWS News Blog

Now Available – Amazon WorkSpaces API & CLI

I’m a big fan of Amazon WorkSpaces and currently spend most of my day using a single WorkSpace that I can access from multiple locations, devices, and device types (I can’t wait to share even more details about this use case with you).

Up until now, all actions on a WorkSpace had to be initiated through the AWS Management Console. This access method offered point-and-click convenience, but did not lend itself to integration with existing business processes and workflows. There was, for example, no way to automatically create a WorkSpace for a new employee.

Today we are making WorkSpaces even more useful by adding API and CLI (Command-Line Interface) support. You can now describe available directories and bundles, create and describe WorkSpaces, and perform maintenance operations (rebuild, reboot, and terminate WorkSpaces) from your own code. For example, you could build an internal administrative tool or a self-service “give me a desktop” portal. The actions that are performed on a WorkSpace via the AWS SDK and the CLI can be recorded via AWS CloudTrail. Also, permissions for these actions and the WorkSpaces resources can be controlled via an IAM policy.

Let’s walk through the provisioning process using the CLI, taking on the role of the WorkSpaces Administrator  (the same steps apply to the AWS Tools for Windows PowerShell or to code that calls the WorkSpaces API):

The first step is to list (describe) the directories:

As you can see from the output, there’s one directory ( The next step is to describe the WorkSpace bundles that can be used to create a WorkSpace:

And now we have all of the information needed to create a WorkSpace for a new user (in this example the user is named olivia in the directory listed above):

Then we can describe the WorkSpace to check on its creation status:

We can also describe all of the WorkSpaces associated with the AWS account in the current Region:

We can reboot a single WorkSpace by referencing the user’s name:

And we can check on the status of the reboot:

As usual, this new functionality is available now. You can start using it today in all of the regions where you can use WorkSpaces (currently US East (Northern Virginia), US West (Oregon), EU (Ireland), Asia Pacific (Singapore), Asia Pacific (Tokyo), and Asia Pacific (Sydney)).


PS – If you are in the process of evaluating WorkSpaces to see how it could work for you, be sure to check out our new WorkSpaces Application Manager.