Amazon WorkSpaces and Application Auto Scaling
You can scale a pool of WorkSpaces using target tracking scaling policies, step scaling policies, and scheduled scaling.
Use the following information to help you integrate WorkSpaces with Application Auto Scaling.
Service-linked role created for WorkSpaces
Application Auto Scaling automatically creates the service-linked role named AWSServiceRoleForApplicationAutoScaling_WorkSpacesPool in your AWS account when you register WorkSpaces resources as scalable targets with Application Auto Scaling. For more information, see Service-linked roles for Application Auto Scaling.
This service-linked role uses the managed policy AWSApplicationAutoscalingWorkSpacesPoolPolicy. This policy grants Application Auto Scaling permissions to call Amazon WorkSpaces on your behalf. For more information, see AWSApplicationAutoscalingWorkSpacesPoolPolicy in the AWS Managed Policy Reference.
Service principal used by the service-linked role
The service-linked role trusts the following service principal to assume the role:
-
workspaces.application-autoscaling.amazonaws.com
Registering WorkSpaces pools as scalable targets with Application Auto Scaling
Application Auto Scaling requires a scalable target before you can create scaling policies or scheduled actions for WorkSpaces. A scalable target is a resource that Application Auto Scaling can scale out and scale in. Scalable targets are uniquely identified by the combination of resource ID, scalable dimension, and namespace.
If you configure auto scaling using the WorkSpaces console, then WorkSpaces automatically registers a scalable target for you.
If you want to configure auto scaling using the AWS CLI or one of the AWS SDKs, you can use the following options:
-
AWS CLI:
Call the register-scalable-target command for a pool of WorkSpaces. The following example registers the target capacity of a pool of WorkSpaces using its request ID, with a minimum capacity of two virtual desktops and a maximum capacity of ten virtual desktops.
aws application-autoscaling register-scalable-target \ --service-namespace workspaces \ --resource-id workspacespool/
wspool-abcdef012
\ --scalable-dimension workspaces:workspacespool:DesiredUserSessions \ --min-capacity2
\ --max-capacity10
If successful, this command returns the ARN of the scalable target.
{ "ScalableTargetARN": "arn:aws:application-autoscaling:
region
:account-id
:scalable-target/1234abcd56ab78cd901ef1234567890ab123" } -
AWS SDK:
Call the RegisterScalableTarget operation and provide
ResourceId
,ScalableDimension
,ServiceNamespace
,MinCapacity
, andMaxCapacity
as parameters.