本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
排程擴展
透過排程擴展,您可以根據指定的排程調整端點佈建,以符合您的容量需求。排程縮放會自動調整推論單元的數量,以適應特定時間的使用突波。您可以針對文件分類端點和實體辨識器端點使用排程縮放。如需排程調整的其他資訊,請參閱應用程式自動調整規模的排程調整。
注意
下列範例會針對 Unix、Linux 和 macOS 進行格式化。用於 Windows 時,請以插入號 (^) 取代每一行結尾處的 Unix 接續字元斜線 (\)。
設定排程擴展
若要為端點設定排程擴展,您可以使用 AWS CLI 命令註冊可擴展的目標,然後建立排程動作。可擴充的目標會將推論單元定義為用於調整端點佈建的資源,排程的動作則控制已佈建容量在特定時間的 auto 動調整規模。
若要設定排定的調整比例
-
登錄可擴展的目標。下列範例會註冊一個可擴充的目標,以調整端點佈建,其容量下限為 1 個推論單元,最大容量為 2 個推論單元。
對於文件分類端點,請使用下列 AWS CLI 指令:
aws application-autoscaling register-scalable-target \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:document-classifier-endpoint/name
\ --scalable-dimension comprehend:document-classifier-endpoint:DesiredInferenceUnits \ --min-capacity 1 \ --max-capacity 2對於實體識別器端點,請使用以下 AWS CLI 命令:
aws application-autoscaling register-scalable-target \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:entity-recognizer-endpoint/name
\ --scalable-dimension comprehend:entity-recognizer-endpoint:DesiredInferenceUnits \ --min-capacity 1 \ --max-capacity 2 -
建立排程動作。下列範例會建立排程動作,以在 UTC 每天 12:00 自動調整佈建的容量,最少有 2 個推論單元和最多 5 個推論單元。如需有關按時間順序的運算式和排程縮放的詳細資訊,請參閱排程運算
對於文件分類端點,請使用下列 AWS CLI 指令:
aws application-autoscaling put-scheduled-action \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:document-classifier-endpoint/name
\ --scalable-dimension comprehend:document-classifier-endpoint:DesiredInferenceUnits \ --scheduled-action-nameTestScheduledAction
\ --schedule "cron(0 12 * * ? *)" \ --scalable-target-action MinCapacity=2,MaxCapacity=5對於實體識別器端點,請使用以下 AWS CLI 命令:
aws application-autoscaling put-scheduled-action \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:entity-recognizer-endpoint/name
\ --scalable-dimension comprehend:entity-recognizer-endpoint:DesiredInferenceUnits \ --scheduled-action-nameTestScheduledAction
\ --schedule "cron(0 12 * * ? *)" \ --scalable-target-action MinCapacity=2,MaxCapacity=5
移除排程的縮放
若要移除端點的排程擴展,您可以使用 AWS CLI 命令刪除排程的動作,然後取消註冊可擴展目標。
移除排定的縮放比例
-
刪除排程的處理行動。下列範例會刪除指定的排程動作。
對於文件分類端點,請使用下列 AWS CLI 指令:
aws application-autoscaling delete-scheduled-action \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:document-classifier-endpoint/name
\ --scalable-dimension comprehend:document-classifier-endpoint:DesiredInferenceUnits \ --scheduled-action-nameTestScheduledAction
對於實體識別器端點,請使用以下 AWS CLI 命令:
aws application-autoscaling delete-scheduled-action \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:entity-recognizer-endpoint/name
\ --scalable-dimension comprehend:entity-recognizer-endpoint:DesiredInferenceUnits \ --scheduled-action-nameTestScheduledAction
-
取消註冊可擴展的目標。下列範例會取消註冊指定的可縮放目標。
對於文件分類端點,請使用下列 AWS CLI 指令:
aws application-autoscaling deregister-scalable-target \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:document-classifier-endpoint/name
\ --scalable-dimension comprehend:document-classifier-endpoint:DesiredInferenceUnits對於實體識別器端點,請使用以下 AWS CLI 命令:
aws application-autoscaling deregister-scalable-target \ --service-namespace comprehend \ --resource-id arn:aws:comprehend:
region
:account-id
:entity-recognizer-endpoint/name
\ --scalable-dimension comprehend:entity-recognizer-endpoint:DesiredInferenceUnits