本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
刪除端點和資源
刪除端點,停止產生費用。
刪除端點
使用 AWS SDK for Python (Boto3)、 搭配 以程式設計方式刪除端點 AWS CLI,或使用 SageMaker AI 主控台以互動方式刪除端點。
SageMaker AI 會釋放建立端點時部署的所有資源。刪除端點不會刪除端點組態或 SageMaker AI 模型。如需如何刪除端點組態和 SageMaker AI 模型的相關資訊刪除端點組態刪除模型,請參閱 和 。
- AWS SDK for Python (Boto3)
-
使用
DeleteEndpoint
API 刪除端點。為EndpointName
欄位指定端點名稱。import boto3 # Specify your AWS Region aws_region=
'<aws_region>'
# Specify the name of your endpoint endpoint_name='<endpoint_name>'
# Create a low-level SageMaker service client. sagemaker_client = boto3.client('sagemaker', region_name=aws_region) # Delete endpoint sagemaker_client.delete_endpoint(EndpointName=endpoint_name) - AWS CLI
-
若要刪除端點,請使用
delete-endpoint
命令。為endpoint-name
旗標指定端點名稱。aws sagemaker delete-endpoint --endpoint-name
<endpoint-name>
- SageMaker AI Console
-
使用 SageMaker AI 主控台以互動方式刪除端點。
-
在 https://https://console.aws.amazon.com/sagemaker/
導覽選單的 SageMaker AI 主控台中,選擇推論。 -
從下拉式功能表選擇端點。在您的 AWS 帳戶中建立的端點清單將依名稱、Amazon Resource Name (ARN)、建立時間、狀態和上次更新端點時的時間戳記顯示。
-
選取您要刪除的端點。
-
選取右上角的動作下拉式按鈕。
-
選擇刪除。
-
刪除端點組態
以程式設計方式使用 AWS SDK for Python (Boto3)、 搭配 AWS CLI,或使用 SageMaker AI 主控台以互動方式刪除端點組態。刪除端點組態並不會刪除使用這個組態建立的端點。如需如何刪除端點的資訊,請參閱刪除端點。
請勿刪除作用中端點正在使用的端點組態,也不要在端點更新或建立時刪除端點組態。如果刪除作用中或正在建立或更新之端點的端點組態,可能會失去對端點使用中執行個體類型的可見度。
- AWS SDK for Python (Boto3)
-
使用
DeleteEndpointConfig
API 刪除端點。為EndpointConfigName
欄位指定端點組態名稱。import boto3 # Specify your AWS Region aws_region=
'<aws_region>'
# Specify the name of your endpoint configuration endpoint_config_name='<endpoint_name>'
# Create a low-level SageMaker service client. sagemaker_client = boto3.client('sagemaker', region_name=aws_region) # Delete endpoint configuration sagemaker_client.delete_endpoint_config(EndpointConfigName=endpoint_config_name)您可以選擇使用
DescribeEndpointConfig
API 傳回已部署模型 (生產變體) 名稱的相關資訊,例如模型名稱,以及與該部署模型相關的端點組態名稱。為EndpointConfigName
欄位提供端點名稱。# Specify the name of your endpoint endpoint_name=
'<endpoint_name>'
# Create a low-level SageMaker service client. sagemaker_client = boto3.client('sagemaker', region_name=aws_region) # Store DescribeEndpointConfig response into a variable that we can index in the next step. response = sagemaker_client.describe_endpoint_config(EndpointConfigName=endpoint_name) # Delete endpoint endpoint_config_name = response['ProductionVariants'][0]['EndpointConfigName'] # Delete endpoint configuration sagemaker_client.delete_endpoint_config(EndpointConfigName=endpoint_config_name)如需
DescribeEndpointConfig
傳回之其他回應元素的詳細資訊,請參閱 SageMaker API 參考指南的DescribeEndpointConfig
。 - AWS CLI
-
若要刪除端點組態,請使用
delete-endpoint-config
命令。為endpoint-config-name
旗幟指定端點組態名稱。aws sagemaker delete-endpoint-config \ --endpoint-config-name
<endpoint-config-name>
您可以選擇使用
describe-endpoint-config
API 命令傳回已部署模型 (生產變體) 名稱的相關資訊,例如模型名稱,以及與該部署模型相關的端點組態名稱。為endpoint-config-name
旗標提供端點名稱。aws sagemaker describe-endpoint-config --endpoint-config-name
<endpoint-config-name>
隨即會傳回 JSON 回應。您可以複製貼上、使用 JSON 剖析器,或使用專為 JSON 剖析而建置的工具,取得與該端點相關的端點組態名稱。
- SageMaker AI Console
-
使用 SageMaker AI 主控台以互動方式刪除端點組態。
-
在 https://https://console.aws.amazon.com/sagemaker/
導覽選單的 SageMaker AI 主控台中,選擇推論。 -
從下拉式功能表選擇端點組態。 AWS 帳戶建立的端點組態清單會依名稱、Amazon Resource Name (ARN) 和建立時間顯示。
-
選取您要刪除的端點組態。
-
選取右上角的動作下拉式按鈕。
-
選擇 刪除 。
-
刪除模型
以程式設計方式使用、搭配 AWS SDK for Python (Boto3)刪除 SageMaker AI 模型 AWS CLI,或使用 SageMaker AI 主控台以互動方式刪除 SageMaker AI 模型。刪除 SageMaker AI 模型只會刪除在 SageMaker AI 中建立的模型項目。刪除模型不會刪除模型成品、推論程式碼,或您在建立模型時指定的 IAM 角色。
- AWS SDK for Python (Boto3)
-
使用
DeleteModel
API 刪除 SageMaker AI 模型。為ModelName
欄位指定模型名稱。import boto3 # Specify your AWS Region aws_region=
'<aws_region>'
# Specify the name of your endpoint configuration model_name='<model_name>'
# Create a low-level SageMaker service client. sagemaker_client = boto3.client('sagemaker', region_name=aws_region) # Delete model sagemaker_client.delete_model(ModelName=model_name)您可以選擇使用
DescribeEndpointConfig
API 傳回已部署模型 (生產變體) 名稱的相關資訊,例如模型名稱,以及與該部署模型相關的端點組態名稱。為EndpointConfigName
欄位提供端點名稱。# Specify the name of your endpoint endpoint_name=
'<endpoint_name>'
# Create a low-level SageMaker service client. sagemaker_client = boto3.client('sagemaker', region_name=aws_region) # Store DescribeEndpointConfig response into a variable that we can index in the next step. response = sagemaker_client.describe_endpoint_config(EndpointConfigName=endpoint_name) # Delete endpoint model_name = response['ProductionVariants'][0]['ModelName'] sagemaker_client.delete_model(ModelName=model_name)如需
DescribeEndpointConfig
傳回之其他回應元素的詳細資訊,請參閱 SageMaker API 參考指南的DescribeEndpointConfig
。 - AWS CLI
-
使用
delete-model
命令來刪除 SageMaker AI 模型。為model-name
旗標指定模型名稱。aws sagemaker delete-model \ --model-name
<model-name>
您可以選擇使用
describe-endpoint-config
API 命令傳回已部署模型 (生產變體) 名稱的相關資訊,例如模型名稱,以及與該部署模型相關的端點組態名稱。為endpoint-config-name
旗標提供端點名稱。aws sagemaker describe-endpoint-config --endpoint-config-name
<endpoint-config-name>
隨即會傳回 JSON 回應。您可以複製貼上、使用 JSON 剖析器,或使用專為 JSON 剖析而建置的工具,取得與該端點相關的模型名稱。
- SageMaker AI Console
-
使用 SageMaker AI 主控台以互動方式刪除 SageMaker AI 模型。
-
在 https://https://console.aws.amazon.com/sagemaker/
導覽選單的 SageMaker AI 主控台中,選擇推論。 -
從下拉式功能表選擇模型。在您的 AWS 帳戶中建立的模型清單會依名稱、Amazon Resource Name (ARN) 和建立時間顯示。
-
選取您要刪除的模型。
-
選取右上角的動作下拉式按鈕。
-
選擇 Delete (刪除)。
-