AWS::SageMaker::EndpointConfig - AWS CloudFormation
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

AWS::SageMaker::EndpointConfig

AWS::SageMaker::EndpointConfig 资源为 Amazon SageMaker 终端节点创建配置。有关更多信息,请参阅 SageMaker 开发人员指南 中的 CreateEndpointConfig

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

{ "Type" : "AWS::SageMaker::EndpointConfig", "Properties" : { "DataCaptureConfig" : DataCaptureConfig, "EndpointConfigName" : String, "KmsKeyId" : String, "ProductionVariants" : [ ProductionVariant, ... ], "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::SageMaker::EndpointConfig Properties: DataCaptureConfig: DataCaptureConfig EndpointConfigName: String KmsKeyId: String ProductionVariants: - ProductionVariant Tags: - Tag

属性

DataCaptureConfig

指定如何为模型监控器捕获终端节点数据。数据捕获配置适用于终端节点上托管的所有生产变体。

必需:否

类型DataCaptureConfig

Update requires: Replacement

EndpointConfigName

终端节点配置的名称。

必需:否

类型:字符串

最高63

模式^[a-zA-Z0-9](-*[a-zA-Z0-9])*

Update requires: Replacement

KmsKeyId

Amazon SageMaker 用于加密附加到托管终端节点的 ML 计算实例的存储卷上的数据的 AWS Key Management Service 密钥的 Amazon 资源名称 (ARN)。

  • 密钥 ID:1234abcd-12ab-34cd-56ef-1234567890ab

  • 密钥 ARN:arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

  • 别名:alias/ExampleAlias

  • 别名 ARN:arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias

KMS 密钥策略必须为您在 CreateEndpointUpdateEndpoint 请求中指定的 IAM 角色授予权限。有关更多信息,请参阅 AWS Key Management Service 在 AWS KMS 中使用密钥策略部分。

注意

某些基于 Nitro 的实例包括本地存储,具体取决于实例类型。使用实例上的硬件模块对本地存储卷进行加密。在将实例类型用于本地存储时,无法请求 KmsKeyId。如果您在 ProductionVariants 参数中指定的任何模块将基于 nitro 的实例用于本地存储,请不要指定 KmsKeyId 参数的值。如果您在将任何基于 nitro 的实例用于本地存储时指定 KmsKeyId 的值,则对 CreateEndpointConfig 的调用将失败。

有关支持本地实例存储的实例类型的列表,请参阅实例存储卷

有关本地实例存储加密的更多信息,请参阅 SSD 实例存储卷

必需:否

类型:字符串

最高2048

模式.*

Update requires: Replacement

ProductionVariants

ProductionVariant 对象列表,每个要在此终端节点上托管的模型对应一个对象。

必需:是

类型ProductionVariant 的列表

最高10

Update requires: Replacement

Tags

要应用于此资源的键/值对的列表。

有关更多信息,请参阅资源标签使用成本分配标签

必需:否

类型Tag 的列表

最高50

Update requires: No interruption

返回值

Ref

在将此资源的逻辑 ID 传递给内部 Ref 函数时,Ref 返回终端节点配置的 Amazon 资源名称 (ARN),例如 arn:aws:sagemaker:us-west-2:01234567>8901:endpoint-config/myendpointconfig

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt 内部函数返回此类型的一个指定属性的值。以下为可用属性和示例返回值。

有关使用 Fn::GetAtt 内部函数的更多信息,请参阅 Fn::GetAtt

Fn::GetAtt 返回一个此类型指定属性的值。以下为可用属性和示例返回值。

EndpointConfigName

终端节点配置的名称,例如 MyEndpointConfiguration

示例

SageMaker EndpointConfig 示例

以下示例从训练后的模型创建终端节点配置,然后创建一个终端节点。

JSON

{ "Description": "Basic Hosting entities test. We need models to create endpoint configs.", "Mappings": { "RegionMap": { "us-west-2": { "NullTransformer": "12345678901.dkr.ecr.us-west-2.amazonaws.com/mymodel:latest" }, "us-east-2": { "NullTransformer": "12345678901.dkr.ecr.us-east-2.amazonaws.com/mymodel:latest" }, "us-east-1": { "NullTransformer": "12345678901.dkr.ecr.us-east-1.amazonaws.com/mymodel:latest" }, "eu-west-1": { "NullTransformer": "12345678901.dkr.ecr.eu-west-1.amazonaws.com/mymodel:latest" }, "ap-northeast-1": { "NullTransformer": "12345678901.dkr.ecr.ap-northeast-1.amazonaws.com/mymodel:latest" }, "ap-northeast-2": { "NullTransformer": "12345678901.dkr.ecr.ap-northeast-2.amazonaws.com/mymodel:latest" }, "ap-southeast-2": { "NullTransformer": "12345678901.dkr.ecr.ap-southeast-2.amazonaws.com/mymodel:latest" }, "eu-central-1": { "NullTransformer": "12345678901.dkr.ecr.eu-central-1.amazonaws.com/mymodel:latest" } } }, "Resources": { "Endpoint": { "Type": "AWS::SageMaker::Endpoint", "Properties": { "EndpointConfigName": { "Fn::GetAtt" : ["EndpointConfig", "EndpointConfigName" ] } } }, "EndpointConfig": { "Type": "AWS::SageMaker::EndpointConfig", "Properties": { "ProductionVariants": [ { "InitialInstanceCount": 1, "InitialVariantWeight": 1, "InstanceType": "ml.t2.large", "ModelName": { "Fn::GetAtt" : ["Model", "ModelName" ] }, "VariantName": { "Fn::GetAtt" : ["Model", "ModelName" ] } } ] } }, "Model": { "Type": "AWS::SageMaker::Model", "Properties": { "PrimaryContainer": { "Image": { "Fn::FindInMap" : [ "AWS::Region", "NullTransformer"] } }, "ExecutionRoleArn": { "Fn::GetAtt" : [ "ExecutionRole", "Arn" ] } } }, "ExecutionRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "sagemaker.amazonaws.com" ] }, "Action": [ "sts:AssumeRole" ] } ] }, "Path": "/", "Policies": [ { "PolicyName": "root", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "*", "Resource": "*" } ] } } ] } } }, "Outputs": { "EndpointId": { "Value": { "Ref" : "Endpoint" } }, "EndpointName": { "Value": { "Fn::GetAtt" : [ "Endpoint", "EndpointName" ] } } } }

YAML

Description: "Basic Hosting entities test. We need models to create endpoint configs." Mappings: RegionMap: "us-west-2": "NullTransformer": "123456789012.dkr.ecr.us-west-2.amazonaws.com/mymodel:latest" "us-east-2": "NullTransformer": "123456789012.dkr.ecr.us-east-2.amazonaws.com/mymodel:latest" "us-east-1": "NullTransformer": "123456789012.dkr.ecr.us-east-1.amazonaws.com/mymodel:latest" "eu-west-1": "NullTransformer": "123456789012.dkr.ecr.eu-west-1.amazonaws.com/mymodel:latest" "ap-northeast-1": "NullTransformer": "123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/mymodel:latest" "ap-northeast-2": "NullTransformer": "123456789012.dkr.ecr.ap-northeast-2.amazonaws.com/mymodel:latest" "ap-southeast-2": "NullTransformer": "123456789012.dkr.ecr.ap-southeast-2.amazonaws.com/mymodel:latest" "eu-central-1": "NullTransformer": "123456789012.dkr.ecr.eu-central-1.amazonaws.com/mymodel:latest" Resources: Endpoint: Type: "AWS::SageMaker::Endpoint" Properties: EndpointConfigName: !GetAtt EndpointConfig.EndpointConfigName EndpointConfig: Type: "AWS::SageMaker::EndpointConfig" Properties: ProductionVariants: - InitialInstanceCount: 1 InitialVariantWeight: 1.0 InstanceType: ml.t2.large ModelName: !GetAtt Model.ModelName VariantName: !GetAtt Model.ModelName Model: Type: "AWS::SageMaker::Model" Properties: PrimaryContainer: Image: !FindInMap [RegionMap, !Ref "AWS::Region", "NullTransformer"] ExecutionRoleArn: !GetAtt ExecutionRole.Arn ExecutionRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: - "sagemaker.amazonaws.com" Action: - "sts:AssumeRole" Path: "/" Policies: - PolicyName: "root" PolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Action: "*" Resource: "*" Outputs: EndpointId: Value: !Ref Endpoint EndpointName: Value: !GetAtt Endpoint.EndpointName