使用Boto3在SageMaker中创建模型时,如何指定证书授权

发布于 2025-02-09 13:34:01 字数 1461 浏览 1 评论 0原文

我们尝试根据私人文物保存的图像在SageMaker中使用BOTO3创建模型。我们找到了一种设置基本凭证词的方式“ nofollow noreferrer”> https://docs.amazonaws.cn/en_us/sagemaker/sagemaker/latest/dg/your-algorithms-containers-containers-inference-inference-private.html ,但我无法找到通过证书授权的解决方案。

我们用来创建模型的代码是

import boto3

client = boto3.client('sagemaker')

response = client.create_model(
    ModelName='model-name',
    PrimaryContainer={
        'Image': 'local-repo.my_artifactory_endpoint/train:latest',
        'ImageConfig': {
            'RepositoryAccessMode': 'Vpc',
            
        },
        'Environment': {
            'SAGEMAKER_PROGRAM': 'train.py',
            "SAGEMAKER_SUBMIT_DIRECTORY": "/opt/ml/model/code",
            "SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
            "SAGEMAKER_REGION": <my-region>,
            "MMS_DEFAULT_RESPONSE_TIMEOUT": "500"
        }
    },
    ExecutionRoleArn=<my-role>,
    VpcConfig={
        'SecurityGroupIds': [
            ...
        ],
        'Subnets': [
            ...
        ]
    },
    EnableNetworkIsolation=False
)

在此之后的,当我们尝试基于该模型创建端点时,我们以错误的方式结束了:

Attempt to pull model image local-repo.my_artifactory_endpoint/train:latest failed due to error constructing client to call registry: constructing authentication challenge manager: Get "https://local-repo.my_artifactory_endpoint/v2/": x509: certificate signed by unknown authority.

我们找不到传递此证书或忽略SSL选项的方法。

We try to create a model in Sagemaker with boto3 based on an image we saved in a private artifactory. We found a way to setup the basic credentials acording to the doc https://docs.amazonaws.cn/en_us/sagemaker/latest/dg/your-algorithms-containers-inference-private.html but I cant find a solution to pass the certificate authority.

The code we use to create the model is

import boto3

client = boto3.client('sagemaker')

response = client.create_model(
    ModelName='model-name',
    PrimaryContainer={
        'Image': 'local-repo.my_artifactory_endpoint/train:latest',
        'ImageConfig': {
            'RepositoryAccessMode': 'Vpc',
            
        },
        'Environment': {
            'SAGEMAKER_PROGRAM': 'train.py',
            "SAGEMAKER_SUBMIT_DIRECTORY": "/opt/ml/model/code",
            "SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
            "SAGEMAKER_REGION": <my-region>,
            "MMS_DEFAULT_RESPONSE_TIMEOUT": "500"
        }
    },
    ExecutionRoleArn=<my-role>,
    VpcConfig={
        'SecurityGroupIds': [
            ...
        ],
        'Subnets': [
            ...
        ]
    },
    EnableNetworkIsolation=False
)

After, when we try to create an endpoint based on that model we endup with ther error:

Attempt to pull model image local-repo.my_artifactory_endpoint/train:latest failed due to error constructing client to call registry: constructing authentication challenge manager: Get "https://local-repo.my_artifactory_endpoint/v2/": x509: certificate signed by unknown authority.

We don't find a way to pass this certificate or to ignore ssl option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文