GameLift AutoScaling in CloudFormation CDK while using Fully Managed GameLift/FleetIQ

0

How can Target-tracking Fleet Auto-Scaling be managed in CloudFormation/CDK without going the semi-self-managed route of GameServerGroup/FleetIQ?

CloudFormation has an AutoScalingPolicy but it's part of GameLift::GameServerGroup which appears to be the more manual version of FleetIQ.

An option would be after updating the stack to call the GameLift PutScalingPolicy/DeleteScalingPolicy API calls but this is hacky and anti-IaC. Another option would be to develop a Custom Resource that calls those APIs on Create/Update/Delete.

I'd like to avoid either of those if possible. If not possible, I'd like confirmation that those options would work without side effects.

Thanks, Mike

mjans71
已提问 1 年前344 查看次数
1 回答
0

Hello,

Thank you for sharing your query with us. I would like to share the functionality that you are looking to implement is currently marked as an active feature request with and the team is actively working on the same. However being a support engineer I do not have visibility over the development team's timeline , hence I would not be able to share any ETA for the same.

Moving ahead, I would recommend o develop this using a Custom Lambda resource[1] with CloudFormation to fill in the gap of functionality here. For example, the document you outlined[2] shows two ways to achieve this using the console or the CLI, if we can leverage a custom Lambda resource, and then use Python or NodeJS(below example if Python bases), we can make these same calls with this same functionality from the console and the CLI. For example, the CLI example given,

$aws gamelift put-scaling-policy
--fleet-id "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa"
--name "My_Target_Policy_1"
--policy-type "TargetBased" 
--metric-name "PercentAvailableGameSessions"
--target-configuration "TargetValue=5"   

Can be translated into Python code using the AWS Boto3 library put_scaling_policy call[3]

response = client.put_scaling_policy(
    Name='string',
    FleetId='string',
    ScalingAdjustment=123,
    ScalingAdjustmentType='ChangeInCapacity'|'ExactCapacity'|'PercentChangeInCapacity',
    Threshold=123.0,
    ComparisonOperator='GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold',
    EvaluationPeriods=123,
    MetricName='ActivatingGameSessions'|'ActiveGameSessions'|'ActiveInstances'|'AvailableGameSessions'|'AvailablePlayerSessions'|'CurrentPlayerSessions'|'IdleInstances'|'PercentAvailableGameSessions'|'PercentIdleInstances'|'QueueDepth'|'WaitTime',
    PolicyType='RuleBased'|'TargetBased',
    TargetConfiguration={
        'TargetValue': 123.0
    }
)

This way we can add a depends on to this resource, and update it as part of the CloudFormation template. I understand this is just adding more complexity to what is I'm sure an already complex design, however I believe this would be the recommended approach.

As for side effects, I believe if we can ensure that there is no accidental lambda calls , then it would avoid any sort of our of band changes. Furthermore, I can see that you have created support case, regarding the same. The assigned engineer is working with the service team for more updates regarding your query, hence I would also recommend you to kindly keep an eye on the case for more customised updates pertaining to your use case.

References:

CFN Custom Resources [1]. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html
Autoscaling GameLift document [2]. https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-autoscaling-target.html
Put_Scaling_Policy [3]. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/gamelift.html#GameLift.Client.put_scaling_policy

AWS
支持工程师
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则