You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何查找未指定区域创建的SageMaker端点并解决配额超限问题

问题

使用SageMaker JumpStart部署Llama 2模型后未删除端点,再次运行部署代码时遇到资源配额超限错误:

botocore.errorfactory.ResourceLimitExceeded: An error occurred (ResourceLimitExceeded) when calling the CreateEndpoint operation: The account-level service limit 'ml.g5.2xlarge for endpoint usage' is 2 Instances, with current utilization of 2 Instances and a request delta of 1 Instances. Please use AWS Service Quotas to request an increase for this quota. If AWS Service Quotas is not available, contact AWS support to request an increase for this quota.

但部署时未指定区域,也未设置AWS默认区域(aws configure get region无返回),各区域控制台和SageMaker Studio均找不到端点,需解决以下问题:

  • 确定模型创建的区域
  • 了解如何在Python中重用现有模型
  • 明确JumpStartModel是否有全局默认区域

1. 查找现有端点所在区域

通过AWS CLI遍历所有AWS区域,列出每个区域的SageMaker端点:

for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do
  echo "Checking region: $region"
  aws sagemaker list-endpoints --region $region
done

该命令会逐个检查所有区域,返回存在端点的区域及对应端点列表。

2. 在Python中重用现有模型/端点

直接重用已存在的端点

找到端点名称和所在区域后,直接创建Predictor实例:

from sagemaker.predictor import Predictor

# 替换为实际的端点名称和区域
predictor = Predictor(endpoint_name="your-endpoint-name", region_name="your-region")

列出目标区域的所有端点

若不确定端点名称,可先通过Python列出目标区域的所有端点:

import boto3

# 替换为找到的区域
sagemaker_client = boto3.client("sagemaker", region_name="your-region")
endpoints = sagemaker_client.list_endpoints()
print(endpoints["Endpoints"])

删除多余端点释放配额

若不需要保留现有端点,可删除以释放资源:

# 通过Predictor删除端点
predictor.delete_endpoint()

# 或者通过SageMaker客户端删除
sagemaker_client.delete_endpoint(EndpointName="your-endpoint-name")

3. JumpStartModel的默认区域说明

JumpStartModel没有全局默认区域,未指定region_name且无AWS默认区域配置时,会遵循boto3的区域解析逻辑:

  • 优先读取环境变量AWS_REGION或AWS_DEFAULT_REGION
  • 若无环境变量,检查AWS配置文件(通常为~/.aws/config)中的默认区域
  • 若以上都没有,仅在EC2、SageMaker Studio等AWS托管环境中,会从实例元数据获取区域
  • 若所有途径都无区域配置,代码运行时会直接抛出区域未指定的错误——你之前能成功部署,说明当时运行环境存在隐含的区域配置(比如SageMaker Studio所在区域、临时环境变量等)

内容的提问来源于stack exchange,提问作者hubatish

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 23:22:06