CreateContext - Amazon SageMaker Service
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

CreateContext

Creates a context. A context is a lineage tracking entity that represents a logical grouping of other tracking or experiment entities. Some examples are an endpoint and a model package. For more information, see Amazon SageMaker ML Lineage Tracking.

Note

CreateContext can only be invoked from within an SageMaker managed environment. This includes SageMaker training jobs, processing jobs, transform jobs, and SageMaker notebooks. A call to CreateContext from outside one of these environments results in an error.

Request Syntax

{ "ContextName": "string", "ContextType": "string", "Description": "string", "Properties": { "string" : "string" }, "Source": { "SourceId": "string", "SourceType": "string", "SourceUri": "string" }, "Tags": [ { "Key": "string", "Value": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ContextName

The name of the context. Must be unique to your account in an AWS Region.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 120.

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

Required: Yes

ContextType

The context type.

Type: String

Length Constraints: Maximum length of 256.

Required: Yes

Description

The description of the context.

Type: String

Length Constraints: Maximum length of 3072.

Pattern: .*

Required: No

Properties

A list of properties to add to the context.

Type: String to string map

Map Entries: Maximum number of 30 items.

Key Length Constraints: Maximum length of 256.

Key Pattern: .*

Value Length Constraints: Maximum length of 256.

Value Pattern: .*

Required: No

Source

The source type, ID, and URI.

Type: ContextSource object

Required: Yes

Tags

A list of tags to apply to the context.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

Response Syntax

{ "ContextArn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

ContextArn

The Amazon Resource Name (ARN) of the context.

Type: String

Length Constraints: Maximum length of 256.

Pattern: arn:aws[a-z\-]*:sagemaker:[a-z0-9\-]*:[0-9]{12}:context/.*

Errors

For information about the errors that are common to all actions, see Common Errors.

ResourceLimitExceeded

You have exceeded an Amazon SageMaker resource limit. For example, you might have too many training jobs created.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: