Use RebuildWorkspaces with a CLI - AWS SDK Code Examples

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

Use RebuildWorkspaces with a CLI

The following code examples show how to use RebuildWorkspaces.

CLI
AWS CLI

To rebuild a WorkSpace

The following rebuild-workspaces example rebuilds the specified WorkSpace.

aws workspaces rebuild-workspaces \ --rebuild-workspace-requests ws-dk1xzr417

Output:

{ "FailedRequests": [] }

For more information, see Rebuild a WorkSpace in the Amazon WorkSpaces Administration Guide.

PowerShell
Tools for PowerShell

Example 1: Rebuilds the specified WorkSpace.

Reset-WKSWorkspace -WorkspaceId "ws-1a2b3c4d"

Example 2: Retrieves the collection of all your WorkSpaces and pipes the IDs to the -WorkSpaceId parameter of Reset-WKSWorkspace, causing the WorkSpaces to be rebuilt.

Get-WKSWorkspaces | Reset-WKSWorkspace
  • For API details, see RebuildWorkspaces in AWS Tools for PowerShell Cmdlet Reference.