

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 暂时关闭扩展策略
<a name="endpoint-auto-scaling-suspend-scaling-activities"></a>

配置自动扩缩后，如果您需要在不受扩展策略干扰的情况下调查问题（动态扩展），可以使用以下选项：
+ 通过调用 [register-scalable-target](https://docs.amazonaws.cn/cli/latest/reference/application-autoscaling/register-scalable-target.html)CLI 命令或 [RegisterScalableTarget](https://docs.amazonaws.cn/autoscaling/application/APIReference/API_RegisterScalableTarget.html)API 操作，为和`DynamicScalingInSuspended`指定布尔值，暂时暂停然后恢复扩展活动`DynamicScalingOutSuspended`。  
**Example**  

  下面的示例显示了如何暂停在 `my-endpoint` 端点上运行的名为 `my-variant` 的变体的扩展策略。

  ```
  aws application-autoscaling register-scalable-target \
    --service-namespace sagemaker \
    --resource-id endpoint/my-endpoint/variant/my-variant \
    --scalable-dimension sagemaker:variant:DesiredInstanceCount \
    --suspended-state '{"DynamicScalingInSuspended":true,"DynamicScalingOutSuspended":true}'
  ```
+ 通过禁用策略的横向缩减部分，防止特定目标跟踪扩展策略在变量中横向缩减。这种方法可以防止扩展策略删除实例，但仍允许它根据需要创建实例。

  使用 CLI 命令或 [PutScalingPolicy](https://docs.amazonaws.cn/autoscaling/application/APIReference/API_PutScalingPolicy.html)AP [put-scaling-policy](https://docs.amazonaws.cn/cli/latest/reference/application-autoscaling/put-scaling-policy.html)I 操作编辑策略，为指定布尔值，从而暂时禁用并启用缩减活动。`DisableScaleIn`  
**Example**  

  下面是扩展策略目标跟踪配置的示例，该策略将横向扩展，但不会横向缩减。

  ```
  {
      "TargetValue": 70.0,
      "PredefinedMetricSpecification":
      {
          "PredefinedMetricType": "SageMakerVariantInvocationsPerInstance"
      },
      "DisableScaleIn": true
  }
  ```