AWS::SageMaker::Endpoint - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWS::SageMaker::Endpoint

Use the AWS::SageMaker::Endpoint resource to create an endpoint using the specified configuration in the request. Amazon SageMaker uses the endpoint to provision resources and deploy models. You create the endpoint configuration with the AWS::SageMaker::EndpointConfig resource. For more information, see Deploy a Model on Amazon SageMaker Hosting Services in the Amazon SageMaker Developer Guide.

Syntax

To declare this entity in your Amazon CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::SageMaker::Endpoint", "Properties" : { "DeploymentConfig" : DeploymentConfig, "EndpointConfigName" : String, "EndpointName" : String, "ExcludeRetainedVariantProperties" : [ VariantProperty, ... ], "RetainAllVariantProperties" : Boolean, "RetainDeploymentConfig" : Boolean, "Tags" : [ Tag, ... ] } }

Properties

DeploymentConfig

The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.

Required: No

Type: DeploymentConfig

Update requires: No interruption

EndpointConfigName

The name of the AWS::SageMaker::EndpointConfig resource that specifies the configuration for the endpoint. For more information, see CreateEndpointConfig.

Required: Yes

Type: String

Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}

Maximum: 63

Update requires: No interruption

EndpointName

The name of the endpoint.The name must be unique within an Amazon Region in your Amazon account. The name is case-insensitive in CreateEndpoint, but the case is preserved and must be matched in https://docs.amazonaws.cn/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html.

Required: No

Type: String

Pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}

Maximum: 63

Update requires: Replacement

ExcludeRetainedVariantProperties

When you are updating endpoint resources with RetainAllVariantProperties whose value is set to true, ExcludeRetainedVariantProperties specifies the list of type VariantProperty to override with the values provided by EndpointConfig. If you don't specify a value for ExcludeAllVariantProperties, no variant properties are overridden. Don't use this property when creating new endpoint resources or when RetainAllVariantProperties is set to false.

Required: No

Type: Array of VariantProperty

Minimum: 0

Maximum: 3

Update requires: No interruption

RetainAllVariantProperties

When updating endpoint resources, enables or disables the retention of variant properties, such as the instance count or the variant weight. To retain the variant properties of an endpoint when updating it, set RetainAllVariantProperties to true. To use the variant properties specified in a new EndpointConfig call when updating an endpoint, set RetainAllVariantProperties to false. Use this property only when updating endpoint resources, not when creating new endpoint resources.

Required: No

Type: Boolean

Update requires: No interruption

RetainDeploymentConfig

Specifies whether to reuse the last deployment configuration. The default value is false (the configuration is not reused).

Required: No

Type: Boolean

Update requires: No interruption

Tags

A list of key-value pairs to apply to this resource.

For more information, see Resource Tag and Using Cost Allocation Tags in the Amazon Billing and Cost Management User Guide.

Required: No

Type: Array of Tag

Minimum: 0

Maximum: 50

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Amazon Resource Name (ARN) of the endpoint, such as arn:aws:sagemaker:us-west-2:012345678901:endpoint/myendpoint.

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

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

EndpointArn

The Amazon Resource Name (ARN) of the endpoint.

EndpointName

The name of the endpoint, such as MyEndpoint.

Examples

SageMaker Endpoint Example

The following example creates an endpoint configuration from a trained model, and then creates an endpoint.

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