DEV Community

Cover image for App streaming  cost optimization
selvakumar palanisamy
selvakumar palanisamy

Posted on

App streaming cost optimization

App streaming cost optimisation

App-streaming stack can have always-on / on- demand fleets .

Choose the fleet type based on your business requirements .

For Non prod and services which do not require 24/7 availability, you can go with on -demand fleets and also include autoscaling in your fleets to optimise the cost .Below the details about app streaming fleet types

  1. Always-On fleets, users get instant-on access to their applications, but you are charged streaming fees for all instances in the fleet, even if no users are connected.
  2. On-Demand fleets, users experience a small delay accessing their first application. However, users are only charged streaming fees for instances when they  are connected, and a small, fixed hourly fee for instances in their  fleet that are not being used.    "No streaming resources are available for your session," means that at the time user  tried to sign in, all available AppStream sessions were currently in use by other users. Apps on Demand will be aware of user  attempt to sign in, and will begin preparing another session, a process that may take up to ten minutes. suggestion is to wait about ten minutes, then click retry.

Savings of on-demand over always-on is ~30% +

image

Auto scaling config

Below the sample auto scaling config to optimize the app stream fleet usage and the run cost

image

 
 

$>aws application-autoscaling register-scalable-target --service-namespace appstream --resource-id fleet/fleet-name --scalable-dimension appstream:fleet:DesiredCapacity  

aws application-autoscaling put-scheduled-action --service-namespace appstream --resource-id fleet/fleet-name --scheduled-action-name weekdaystart --schedule="cron(0 0 21 ? * SUN-THU *)" --scalable-target-action MinCapacity=3,MaxCapacity=15 --scalable-dimension appstream:fleet:DesiredCapacity 

aws application-autoscaling put-scheduled-action --service-namespace appstream --resource-id fleet/fleet-name --scheduled-action-name weekdayend --schedule="cron(0 0 7 ? * MON-FRI *)" --scalable-target-action MinCapacity=1,MaxCapacity=1 --scalable-dimension appstream:fleet:DesiredCapacity 

aws application-autoscaling put-scheduled-action --service-namespace appstream --resource-id fleet/fleet-name --scheduled-action-name weekend --schedule="cron(0 0 13 ? * FRI-SAT *)" --scalable-target-action MinCapacity=1,MaxCapacity=1 --scalable-dimension appstream:fleet:DesiredCapacity 

Enter fullscreen mode Exit fullscreen mode

Note : cron triggers in AWS are set up on UTC time, you need to adjust the time as per your time zone

To know the scheduled actions associated with a fleet

$>aws application-autoscaling describe-scheduled-actions --service-namespace appstream --resource-id fleet/fleet-name

 

{
    "ScheduledActions": [
        {
            "ScheduledActionName": "weekdaystart",
            "ScheduledActionARN": "arn:aws:autoscaling:ap-southeast-2:account-id:scheduledAction:xxxxxxxx-ba8d-xxx-85be-xxxxxxxxx:resource/appstream/fleet/fleet-name:scheduledActionName/weekdaystart",
            "ServiceNamespace": "appstream",
            "Schedule": "cron(0 0 21 ? * SUN-THU *)",
            "ResourceId": "fleet/fleet-name",
            "ScalableDimension": "appstream:fleet:DesiredCapacity",
            "ScalableTargetAction": {
                "MinCapacity": 3,
                "MaxCapacity": 15
            },
            "CreationTime": "2021-07-16T09:59:50.125000+00:00"
        },
        {
            "ScheduledActionName": "weekdayend",
            "ScheduledActionARN": "arn:aws:autoscaling:ap-southeast-2:account-id:scheduledAction:xxxxxxxx-ba8d-xxx-85be-xxxxxxxxx:resource/appstream/fleet/fleet-name:scheduledActionName/weekdayend",
            "ServiceNamespace": "appstream",
            "Schedule": "cron(0 0 7 ? * MON-FRI *)",
            "ResourceId": "fleet/fleet-name",
            "ScalableDimension": "appstream:fleet:DesiredCapacity",
            "ScalableTargetAction": {
                "MinCapacity": 1,
                "MaxCapacity": 1
            },
            "CreationTime": "2021-07-16T10:00:05.234000+00:00"
        },
        {
            "ScheduledActionName": "weekend",
            "ScheduledActionARN": "arn:aws:autoscaling:ap-southeast-2:account-id:scheduledAction:xxxxxxxx-ba8d-xxx-85be-xxxxxxxxx:resource/appstream/fleet/fleet-name:scheduledActionName/weekend",
            "ServiceNamespace": "appstream",
            "Schedule": "cron(0 0 13 ? * FRI-SAT *)",
            "ResourceId": "fleet/fleet-name",
            "ScalableDimension": "appstream:fleet:DesiredCapacity",
            "ScalableTargetAction": {
                "MinCapacity": 1,
                "MaxCapacity": 1
            },
            "CreationTime": "2021-07-16T10:00:17.031000+00:00"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)