There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeWorkspaces with a CLI
The following code examples show how to use DescribeWorkspaces.
- CLI
 - 
            
- AWS CLI
 - 
             
                    
To describe a WorkSpace
The following
describe-workspacesexample describes the specified WorkSpace.aws workspaces describe-workspaces \ --workspace-idsws-dk1xzr417Output:
{ "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.
- 
                    
For API details, see DescribeWorkspaces
in AWS CLI Command Reference.  
 - 
                    
 
 - PowerShell
 - 
            
- Tools for PowerShell V4
 - 
             
                    
Example 1: Retrieves details of all your WorkSpaces to the pipeline.
Get-WKSWorkspaceOutput:
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.WorkspacePropertiesExample 2: This command shows the values of child properties of
WorkSpacePropertiesfor a workspace in theus-west-2region. For more information about the child properties ofWorkSpaceProperties, see https://docs.aws.amazon.com/workspaces/latest/api/API_WorkspaceProperties.html.(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspacePropertiesOutput:
ComputeTypeName : STANDARD RootVolumeSizeGib : 80 RunningMode : AUTO_STOP RunningModeAutoStopTimeoutInMinutes : 60 UserVolumeSizeGib : 50Example 3: This command shows the value of the child property
RootVolumeSizeGibofWorkSpacePropertiesfor a workspace in theus-west-2region. The root volume size, in GiB, is 80.(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties.RootVolumeSizeGibOutput:
80- 
                    
For API details, see DescribeWorkspaces in AWS Tools for PowerShell Cmdlet Reference (V4).
 
 - 
                    
 - Tools for PowerShell V5
 - 
             
                    
Example 1: Retrieves details of all your WorkSpaces to the pipeline.
Get-WKSWorkspaceOutput:
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.WorkspacePropertiesExample 2: This command shows the values of child properties of
WorkSpacePropertiesfor a workspace in theus-west-2region. For more information about the child properties ofWorkSpaceProperties, see https://docs.aws.amazon.com/workspaces/latest/api/API_WorkspaceProperties.html.(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspacePropertiesOutput:
ComputeTypeName : STANDARD RootVolumeSizeGib : 80 RunningMode : AUTO_STOP RunningModeAutoStopTimeoutInMinutes : 60 UserVolumeSizeGib : 50Example 3: This command shows the value of the child property
RootVolumeSizeGibofWorkSpacePropertiesfor a workspace in theus-west-2region. The root volume size, in GiB, is 80.(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties.RootVolumeSizeGibOutput:
80- 
                    
For API details, see DescribeWorkspaces in AWS Tools for PowerShell Cmdlet Reference (V5).
 
 -