AWS has published a walkthrough for orchestrating Amazon SageMaker AI real-time endpoint updates when Application Auto Scaling is enabled. According to the post, changing an endpoint’s instance type, instance count, or environment variables can fail when the scalable target remains registered. SageMaker AI requires the scalable target to be deregistered before certain endpoint changes can be made.
The proposed solution replaces native AWS CloudFormation Application Auto Scaling resources with three custom resources. The first deregisters the scalable target before the endpoint update. After the endpoint reaches InService status, a second resource registers the scalable target, and a third applies the target-tracking scaling policy. AWS CDK dependency ordering controls the sequence.
The custom resources use asynchronous completion checks for registration and policy attachment. The walkthrough says these checks can wait up to one hour for scalable-target registration and 15 minutes for policy attachment. A ConfigHash value causes the orchestration to run again when endpoint or auto scaling configuration changes.
AWS also notes that the construct creates additional supporting resources. The deployed stack described in the post contains three custom resources, two Step Functions state machines, and twelve Lambda functions, including framework-generated functions.
The example requires an AWS account with permissions for SageMaker AI, Lambda, IAM, Application Auto Scaling, and CloudWatch, along with AWS CDK v2, Python 3.12 or later, and model and container assets. The post includes an example repository and instructions for deploying or integrating the construct into an existing CDK stack.