I need to stop a WorkSpace now and I don’t want to login to AWS WorkSpace console.
The following is the steps I’m literally taking to achieve this goal.
- Find out the WorkSpace ID, assuming that my AWS CLI has been setup correctly.
❯ aws workspaces describe-workspaces
{
"Workspaces": [
{
"WorkspaceId": "ws-9xm222222",
"DirectoryId": "d-9767555555",
"UserName": "kenno",
"IpAddress": "172.xx.x.xx",
"State": "AVAILABLE",
"BundleId": "wsb-clj855555",
"SubnetId": "subnet-0a4ae4b324a799999",
"ComputerName": "A-2B99WV33TITAN",
"WorkspaceProperties": {
"RunningMode": "AUTO_STOP",
"RunningModeAutoStopTimeoutInMinutes": 60,
"RootVolumeSizeGib": 80,
"UserVolumeSizeGib": 50,
"ComputeTypeName": "STANDARD",
"Protocols": [
"PCOIP"
]
},
"ModificationStates": []
}
]
}
- We can see that the WorkSpace ‘ws-9xm222222’ is in AVAILABLE state. To stop this workspace now, run the following command:
❯ aws workspaces stop-workspaces --stop-workspace-requests WorkSpaceId=ws-9xm222222
Parameter validation failed:
Unknown parameter in StopWorkspaceRequests[0]: "WorkSpaceId", must be one of: WorkspaceId
❯ aws workspaces stop-workspaces --stop-workspace-requests WorkspaceId=ws-9xm222222
{
"FailedRequests": []
}
Notice that the CLI option is case sensitive, and I “deliberately” made a mistake with WorkSpaceId
to demonstrate this. Hahaha.
- We can check the state of the same WorkSpace with:
❯ aws workspaces describe-workspaces --region ap-southeast-2 \
--query 'Workspaces[].{WorkspaceId:WorkspaceId,State:State}'
[
{
"WorkspaceId": "ws-9xm222222",
"State": "STOPPING"
}
]
- The output above shown that the Workspace “ws-9xm222222” is in a “STOPPING” state. Eventually, the state of the WorkSpace reported as stopped:
❯ aws workspaces describe-workspaces --region ap-southeast-2 \
--query 'Workspaces[].{WorkspaceId:WorkspaceId,State:State}'
[
{
"WorkspaceId": "ws-9xm222222",
"State": "STOPPED"
}
]
That’s it. It looks like I was able to stop my WorkSpace instance as wished.
References: