数据源与状态仍在导航菜单中
aws.amazon.com·2026/10/24·Lauren Eterno
更新 SageMaker AI 实时端点配置会因 Application Auto Scaling 目标未先注销导致 CloudFormation 或 AWS CDK 部署失败;手动注销又会造成失去自动扩缩、找不到资源或回滚失败。AWS 博客用可复用 CDK construct 以 custom resources 替代原生 ScalableTarget 与 ScalingPolicy,按先注销、端点更新、等待 InService 后注册目标、等待可查询后应用 target tracking 策略的顺序自动编排,并用 ConfigHash 将端点与扩缩参数绑定,任何变化都触发重配;首次部署时注销步骤会忽略目标不存在的错误。异步等待由 provider waiter 驱动,注册目标总超时 1 小时,应用策略总超时 15 分钟。用户可克隆 sample-sagemaker-endpoint-autoscaling,在 config.yaml 配置模型镜像、S3 权重、实例类型与容量后部署 InferenceStack,也可把 construct 加入现有栈;更新实例类型后用 CLI 验证,销毁栈会清理端点、Lambda、IAM 和告警。官方称可在单次部署中完成配置与扩缩更新,但栈内会额外生成 provider 框架的 Lambda 与 Step Functions 资源。
为什么重要 解决 CloudFormation/CDK 更新 SageMaker 端点时 Application Auto Scaling 资源冲突导致的部署失败与回滚卡死问题适合 用 CDK/CloudFormation 管理 SageMaker 推理端点的 MLOps 工程师

Custom Resourc
Deregister / Register / Attach
Step Functions
驱动异步 waiter
轮询间隔
is_complete 重调用频率
注释 · provider 框架自动生成 7 个辅助 Lambda,无需维护但需纳入审查出自 Solution overview
$ git clone https://github.com/aws-samples/sample-sagemaker-endpoint-autoscaling.gitcd sample-sagemaker-endpoint-autoscalinguv sync
$ uv run cdk bootstrapuv run cdk deploy InferenceStack
$ aws application-autoscaling describe-scalable-targets--service-namespace sagemaker--resource-ids endpoint/my-model-endpoint/variant/AllTraffic
$ aws application-autoscaling describe-scaling-policies--service-namespace sagemaker--resource-id endpoint/my-model-endpoint/variant/AllTraffic
$ uv run cdk deploy InferenceStack
$ uv run cdk destroy InferenceStack
更新已注册 Application Auto Scaling 的 SageMaker AI 端点会导致 AWS CloudFormation 和 AWS CDK 部署失败。本文展示如何构建一个可复用的 AWS CDK construct,配合 CloudFormation 自定义资源自动解除并重新注册自动扩展,以便在单次部署中更新端点及其扩展配置。
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.
EVIDENCE / METHODS
表格
未处理时端点更新触发 3 种不同故障,最严重导致栈回滚卡死
| 场景 | 表现 | 后果 |
|---|---|---|
| 带 Auto Scaling 直接更新端点 | SageMaker 拒绝:variant 必须先 deregister | 部署失败 |
| 手动 deregister 后仅改端点配置 | 部署成功但 Auto Scaling 未重新注册 | 静默丢失伸缩能力 |
| 手动 deregister 后改伸缩参数 | 找不到已删除的 术语解释Application Auto Scaling 中注册的可伸缩目标,对 SageMaker 而言是某端点某 variant 的期望实例数 资源 | 术语解释CloudFormation 栈状态:更新失败后回滚也失败,需手动介入修复资源一致性,栈损坏 |
注释 · 第二种静默丢失自动伸缩且无报错,最容易被忽略出自 Why this problem occurs