StopWorkspacesCommand

Stops the specified WorkSpaces.

You cannot stop a WorkSpace unless it has a running mode of AutoStop or Manual and a state of AVAILABLE, IMPAIRED, UNHEALTHY, or ERROR.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WorkSpacesClient, StopWorkspacesCommand } from "@aws-sdk/client-workspaces"; // ES Modules import
// const { WorkSpacesClient, StopWorkspacesCommand } = require("@aws-sdk/client-workspaces"); // CommonJS import
const client = new WorkSpacesClient(config);
const input = { // StopWorkspacesRequest
  StopWorkspaceRequests: [ // StopWorkspaceRequests // required
    { // StopRequest
      WorkspaceId: "STRING_VALUE",
    },
  ],
};
const command = new StopWorkspacesCommand(input);
const response = await client.send(command);
// { // StopWorkspacesResult
//   FailedRequests: [ // FailedStopWorkspaceRequests
//     { // FailedWorkspaceChangeRequest
//       WorkspaceId: "STRING_VALUE",
//       ErrorCode: "STRING_VALUE",
//       ErrorMessage: "STRING_VALUE",
//     },
//   ],
// };

StopWorkspacesCommand Input

See StopWorkspacesCommandInput for more details

Parameter
Type
Description
StopWorkspaceRequests
Required
StopRequest[] | undefined

The WorkSpaces to stop. You can specify up to 25 WorkSpaces.

StopWorkspacesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
FailedRequests
FailedWorkspaceChangeRequest[] | undefined

Information about the WorkSpaces that could not be stopped.

Throws

Name
Fault
Details
WorkSpacesServiceException
Base exception class for all service exceptions from WorkSpaces service.