Orchestrating SageMaker AI endpoint auto scaling with AWS CDK
AWS•How-to••by Lauren Eterno•AWS Artificial Intelligence Blog
Updating a SageMaker AI endpoint that has Application Auto Scaling registered makes AWS CloudFormation and AWS CDK deployments fail. This post shows how to build a reusable AWS CDK construct with CloudFormation custom resources that deregisters and re-registers auto scaling automatically, so you can update the endpoint and its scaling in a single deployment.
Deploy a reusable CDK construct that deregisters and re-registers SageMaker AI endpoint auto scaling around endpoint updates, so one deployment updates both.
Who it is for
Teams deploying SageMaker AI real-time endpoints with CloudFormation or AWS CDK that need to change instance type or scaling settings without stack failures.
Key points
Without this, updating an endpoint with auto scaling registered fails; manual deregistration can leave scaling unregistered or roll back into UPDATE_ROLLBACK_FAILED.
The construct uses three CloudFormation custom resources; the stack also deploys twelve Lambda functions and two Step Functions state machines.
Source code is in the aws-samples sample-sagemaker-endpoint-autoscaling GitHub repository.
AI:SageMaker AI real-time endpoints now route each request to the instance holding the longest cached match for its prompt, using cache state the model container reports.