Use DescribeWorkspaces with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeWorkspaces with a CLI

The following code examples show how to use DescribeWorkspaces.

CLI
AWS CLI

To describe a WorkSpace

The following describe-workspaces example describes the specified WorkSpace.

aws workspaces describe-workspaces \ --workspace-ids ws-dk1xzr417

Output:

{ "Workspaces": [ { "WorkspaceId": "ws-dk1xzr417", "DirectoryId": "d-926722edaf", "UserName": "Mary", "IpAddress": "172.16.0.175", "State": "STOPPED", "BundleId": "wsb-0zsvgp8fc", "SubnetId": "subnet-500d5819", "ComputerName": "WSAMZN-RBSLTTD9", "WorkspaceProperties": { "RunningMode": "AUTO_STOP", "RunningModeAutoStopTimeoutInMinutes": 60, "RootVolumeSizeGib": 80, "UserVolumeSizeGib": 10, "ComputeTypeName": "VALUE" }, "ModificationStates": [] } ] }

For more information, see Administer your WorkSpaces in the Amazon WorkSpaces Administration Guide.

PowerShell
Tools for PowerShell

Example 1: Retrieves details of all your WorkSpaces to the pipeline.

Get-WKSWorkspace

Output:

BundleId : wsb-1a2b3c4d ComputerName : DirectoryId : d-1a2b3c4d ErrorCode : ErrorMessage : IpAddress : RootVolumeEncryptionEnabled : False State : PENDING SubnetId : UserName : myuser UserVolumeEncryptionEnabled : False VolumeEncryptionKey : WorkspaceId : ws-1a2b3c4d WorkspaceProperties : Amazon.WorkSpaces.Model.WorkspaceProperties

Example 2: This command shows the values of child properties of WorkSpaceProperties for a workspace in the us-west-2 region. For more information about the child properties of WorkSpaceProperties, see https://docs.aws.amazon.com/workspaces/latest/api/API_WorkspaceProperties.html.

(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties

Output:

ComputeTypeName : STANDARD RootVolumeSizeGib : 80 RunningMode : AUTO_STOP RunningModeAutoStopTimeoutInMinutes : 60 UserVolumeSizeGib : 50

Example 3: This command shows the value of the child property RootVolumeSizeGib of WorkSpaceProperties for a workspace in the us-west-2 region. The root volume size, in GiB, is 80.

(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties.RootVolumeSizeGib

Output:

80