awscdksagemakeralpha

package module
v2.159.1-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

Amazon SageMaker Construct Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


Amazon SageMaker provides every developer and data scientist with the ability to build, train, and deploy machine learning models quickly. Amazon SageMaker is a fully-managed service that covers the entire machine learning workflow to label and prepare your data, choose an algorithm, train the model, tune and optimize it for deployment, make predictions, and take action. Your models get to production faster with much less effort and lower cost.

Model

To create a machine learning model with Amazon Sagemaker, use the Model construct. This construct includes properties that can be configured to define model components, including the model inference code as a Docker image and an optional set of separate model data artifacts. See the AWS documentation to learn more about SageMaker models.

Single Container Model

In the event that a single container is sufficient for your inference use-case, you can define a single-container model:

import "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
import "github.com/aws-samples/dummy/path"


image := sagemaker.ContainerImage_FromAsset(path.join(jsii.String("path"), jsii.String("to"), jsii.String("Dockerfile"), jsii.String("directory")))
modelData := sagemaker.ModelData_FromAsset(path.join(jsii.String("path"), jsii.String("to"), jsii.String("artifact"), jsii.String("file.tar.gz")))

model := sagemaker.NewModel(this, jsii.String("PrimaryContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: image,
			ModelData: modelData,
		},
	},
})
Inference Pipeline Model

An inference pipeline is an Amazon SageMaker model that is composed of a linear sequence of multiple containers that process requests for inferences on data. See the AWS documentation to learn more about SageMaker inference pipelines. To define an inference pipeline, you can provide additional containers for your model:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image1 containerImage
var modelData1 modelData
var image2 containerImage
var modelData2 modelData
var image3 containerImage
var modelData3 modelData


model := sagemaker.NewModel(this, jsii.String("InferencePipelineModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: image1,
			ModelData: modelData1,
		},
		&containerDefinition{
			Image: image2,
			ModelData: modelData2,
		},
		&containerDefinition{
			Image: image3,
			ModelData: modelData3,
		},
	},
})
Model Properties
Network Isolation

If you enable network isolation, the containers can't make any outbound network calls, even to other AWS services such as Amazon S3. Additionally, no AWS credentials are made available to the container runtime environment.

To enable network isolation, set the networkIsolation property to true:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image containerImage
var modelData modelData


model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})
Container Images

Inference code can be stored in the Amazon EC2 Container Registry (Amazon ECR), which is specified via ContainerDefinition's image property which accepts a class that extends the ContainerImage abstract base class.

Asset Image

Reference a local directory containing a Dockerfile:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
import path "github.com/aws-samples/dummy/path"


image := sagemaker.ContainerImage_FromAsset(path.join(jsii.String("path"), jsii.String("to"), jsii.String("Dockerfile"), jsii.String("directory")))
ECR Image

Reference an image available within ECR:

import ecr "github.com/aws/aws-cdk-go/awscdk"
import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"


repository := ecr.Repository_FromRepositoryName(this, jsii.String("Repository"), jsii.String("repo"))
image := sagemaker.ContainerImage_FromEcrRepository(repository, jsii.String("tag"))
DLC Image

Reference a deep learning container image:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"


repositoryName := "huggingface-pytorch-training"
tag := "1.13.1-transformers4.26.0-gpu-py39-cu117-ubuntu20.04"

image := sagemaker.ContainerImage_FromDlc(repositoryName, tag)
Model Artifacts

If you choose to decouple your model artifacts from your inference code (as is natural given different rates of change between inference code and model artifacts), the artifacts can be specified via the modelData property which accepts a class that extends the ModelData abstract base class. The default is to have no model artifacts associated with a model.

Asset Model Data

Reference local model data:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
import path "github.com/aws-samples/dummy/path"


modelData := sagemaker.ModelData_FromAsset(path.join(jsii.String("path"), jsii.String("to"), jsii.String("artifact"), jsii.String("file.tar.gz")))
S3 Model Data

Reference an S3 bucket and object key as the artifacts for a model:

import s3 "github.com/aws/aws-cdk-go/awscdk"
import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"


bucket := s3.NewBucket(this, jsii.String("MyBucket"))
modelData := sagemaker.ModelData_FromBucket(bucket, jsii.String("path/to/artifact/file.tar.gz"))

Model Hosting

Amazon SageMaker provides model hosting services for model deployment. Amazon SageMaker provides an HTTPS endpoint where your machine learning model is available to provide inferences.

Endpoint Configuration

By using the EndpointConfig construct, you can define a set of endpoint configuration which can be used to provision one or more endpoints. In this configuration, you identify one or more models to deploy and the resources that you want Amazon SageMaker to provision. You define one or more production variants, each of which identifies a model. Each production variant also describes the resources that you want Amazon SageMaker to provision. If you are hosting multiple models, you also assign a variant weight to specify how much traffic you want to allocate to each model. For example, suppose that you want to host two models, A and B, and you assign traffic weight 2 for model A and 1 for model B. Amazon SageMaker distributes two-thirds of the traffic to Model A, and one-third to model B:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var modelA model
var modelB model


endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: modelA,
			VariantName: jsii.String("modelA"),
			InitialVariantWeight: jsii.Number(2),
		},
		&instanceProductionVariantProps{
			Model: modelB,
			VariantName: jsii.String("variantB"),
			InitialVariantWeight: jsii.Number(1),
		},
	},
})
Endpoint

When you create an endpoint from an EndpointConfig, Amazon SageMaker launches the ML compute instances and deploys the model or models as specified in the configuration. To get inferences from the model, client applications send requests to the Amazon SageMaker Runtime HTTPS endpoint. For more information about the API, see the InvokeEndpoint API. Defining an endpoint requires at minimum the associated endpoint configuration:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var endpointConfig endpointConfig


endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
AutoScaling

To enable autoscaling on the production variant, use the autoScaleInstanceCount method:

import "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var model model


variantName := "my-variant"
endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: model,
			VariantName: variantName,
		},
	},
})

endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(variantName)
instanceCount := productionVariant.AutoScaleInstanceCount(&EnableScalingProps{
	MaxCapacity: jsii.Number(3),
})
instanceCount.ScaleOnInvocations(jsii.String("LimitRPS"), &InvocationsScalingProps{
	MaxRequestsPerSecond: jsii.Number(30),
})

For load testing guidance on determining the maximum requests per second per instance, please see this documentation.

Metrics

To monitor CloudWatch metrics for a production variant, use one or more of the metric convenience methods:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var endpointConfig endpointConfig


endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(jsii.String("my-variant"))
productionVariant.MetricModelLatency().CreateAlarm(this, jsii.String("ModelLatencyAlarm"), &CreateAlarmOptions{
	Threshold: jsii.Number(100000),
	EvaluationPeriods: jsii.Number(3),
})

Documentation

Overview

The CDK Construct Library for AWS::SageMaker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointConfig_IsConstruct

func EndpointConfig_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func EndpointConfig_IsOwnedResource

func EndpointConfig_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func EndpointConfig_IsResource

func EndpointConfig_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func Endpoint_IsConstruct

func Endpoint_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Endpoint_IsOwnedResource

func Endpoint_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func Endpoint_IsResource

func Endpoint_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func Model_IsConstruct

func Model_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Model_IsOwnedResource

func Model_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func Model_IsResource

func Model_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func NewAcceleratorType_Override

func NewAcceleratorType_Override(a AcceleratorType, acceleratorType *string)

Experimental.

func NewContainerImage_Override

func NewContainerImage_Override(c ContainerImage)

Experimental.

func NewEndpointConfig_Override

func NewEndpointConfig_Override(e EndpointConfig, scope constructs.Construct, id *string, props *EndpointConfigProps)

Experimental.

func NewEndpoint_Override

func NewEndpoint_Override(e Endpoint, scope constructs.Construct, id *string, props *EndpointProps)

Experimental.

func NewInstanceType_Override

func NewInstanceType_Override(i InstanceType, instanceType *string)

Experimental.

func NewModelData_Override

func NewModelData_Override(m ModelData)

Experimental.

func NewModel_Override

func NewModel_Override(m Model, scope constructs.Construct, id *string, props *ModelProps)

Experimental.

func NewScalableInstanceCount_Override

func NewScalableInstanceCount_Override(s ScalableInstanceCount, scope constructs.Construct, id *string, props *ScalableInstanceCountProps)

Constructs a new instance of the ScalableInstanceCount class. Experimental.

func ScalableInstanceCount_IsConstruct

func ScalableInstanceCount_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

Types

type AcceleratorType

type AcceleratorType interface {
	// Return the accelerator type as a string.
	//
	// Returns: The accelerator type as a string.
	// Experimental.
	ToString() *string
}

Supported Elastic Inference (EI) instance types for SageMaker instance-based production variants.

EI instances provide on-demand GPU computing for inference.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

acceleratorType := sagemaker_alpha.AcceleratorType_EIA1_LARGE()

Experimental.

func AcceleratorType_EIA1_LARGE

func AcceleratorType_EIA1_LARGE() AcceleratorType

func AcceleratorType_EIA1_MEDIUM

func AcceleratorType_EIA1_MEDIUM() AcceleratorType

func AcceleratorType_EIA1_XLARGE

func AcceleratorType_EIA1_XLARGE() AcceleratorType

func AcceleratorType_EIA2_LARGE

func AcceleratorType_EIA2_LARGE() AcceleratorType

func AcceleratorType_EIA2_MEDIUM

func AcceleratorType_EIA2_MEDIUM() AcceleratorType

func AcceleratorType_EIA2_XLARGE

func AcceleratorType_EIA2_XLARGE() AcceleratorType

func AcceleratorType_Of

func AcceleratorType_Of(acceleratorType *string) AcceleratorType

Builds an AcceleratorType from a given string or token (such as a CfnParameter).

Returns: A strongly typed AcceleratorType. Experimental.

func NewAcceleratorType

func NewAcceleratorType(acceleratorType *string) AcceleratorType

Experimental.

type ContainerDefinition

type ContainerDefinition struct {
	// The image used to start a container.
	// Experimental.
	Image ContainerImage `field:"required" json:"image" yaml:"image"`
	// Hostname of the container within an inference pipeline.
	//
	// For single container models, this field
	// is ignored. When specifying a hostname for one ContainerDefinition in a pipeline, hostnames
	// must be specified for all other ContainerDefinitions in that pipeline.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-containerhostname
	//
	// Default: - Amazon SageMaker will automatically assign a unique name based on the position of
	// this ContainerDefinition in an inference pipeline.
	//
	// Experimental.
	ContainerHostname *string `field:"optional" json:"containerHostname" yaml:"containerHostname"`
	// A map of environment variables to pass into the container.
	// Default: - none.
	//
	// Experimental.
	Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
	// S3 path to the model artifacts.
	// Default: - none.
	//
	// Experimental.
	ModelData ModelData `field:"optional" json:"modelData" yaml:"modelData"`
}

Describes the container, as part of model definition.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var containerImage containerImage
var modelData modelData

containerDefinition := &ContainerDefinition{
	Image: containerImage,

	// the properties below are optional
	ContainerHostname: jsii.String("containerHostname"),
	Environment: map[string]*string{
		"environmentKey": jsii.String("environment"),
	},
	ModelData: modelData,
}

Experimental.

type ContainerImage

type ContainerImage interface {
	// Called when the image is used by a Model.
	// Experimental.
	Bind(scope constructs.Construct, model Model) *ContainerImageConfig
}

Constructs for types of container images.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image containerImage
var modelData modelData

model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})

Experimental.

func ContainerImage_FromAsset

func ContainerImage_FromAsset(directory *string, options *awsecrassets.DockerImageAssetOptions) ContainerImage

Reference an image that's constructed directly from sources on disk. Experimental.

func ContainerImage_FromDlc

func ContainerImage_FromDlc(repositoryName *string, tag *string, accountId *string) ContainerImage

Reference an AWS Deep Learning Container image. Experimental.

func ContainerImage_FromEcrRepository

func ContainerImage_FromEcrRepository(repository awsecr.IRepository, tag *string) ContainerImage

Reference an image in an ECR repository. Experimental.

type ContainerImageConfig

type ContainerImageConfig struct {
	// The image name. Images in Amazon ECR repositories can be specified by either using the full registry/repository:tag or registry/repository@digest.
	//
	// For example, `012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>:latest` or
	// `012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>@sha256:94afd1f2e64d908bc90dbca0035a5b567EXAMPLE`.
	// Experimental.
	ImageName *string `field:"required" json:"imageName" yaml:"imageName"`
}

The configuration for creating a container image.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

containerImageConfig := &ContainerImageConfig{
	ImageName: jsii.String("imageName"),
}

Experimental.

type Endpoint

type Endpoint interface {
	awscdk.Resource
	IEndpoint
	// The ARN of the endpoint.
	// Experimental.
	EndpointArn() *string
	// The name of the endpoint.
	// Experimental.
	EndpointName() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// Get instance production variants associated with endpoint.
	// Experimental.
	InstanceProductionVariants() *[]IEndpointInstanceProductionVariant
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Find instance production variant based on variant name.
	// Experimental.
	FindInstanceProductionVariant(name *string) IEndpointInstanceProductionVariant
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Permits an IAM principal to invoke this endpoint.
	// Experimental.
	GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Defines a SageMaker endpoint.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var endpointConfig endpointConfig

endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(jsii.String("my-variant"))
productionVariant.MetricModelLatency().CreateAlarm(this, jsii.String("ModelLatencyAlarm"), &CreateAlarmOptions{
	Threshold: jsii.Number(100000),
	EvaluationPeriods: jsii.Number(3),
})

Experimental.

func NewEndpoint

func NewEndpoint(scope constructs.Construct, id *string, props *EndpointProps) Endpoint

Experimental.

type EndpointAttributes

type EndpointAttributes struct {
	// The ARN of this endpoint.
	// Experimental.
	EndpointArn *string `field:"required" json:"endpointArn" yaml:"endpointArn"`
}

Represents an Endpoint resource defined outside this stack.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

endpointAttributes := &EndpointAttributes{
	EndpointArn: jsii.String("endpointArn"),
}

Experimental.

type EndpointConfig

type EndpointConfig interface {
	awscdk.Resource
	IEndpointConfig
	// The ARN of the endpoint configuration.
	// Experimental.
	EndpointConfigArn() *string
	// The name of the endpoint configuration.
	// Experimental.
	EndpointConfigName() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Add production variant to the endpoint configuration.
	// Experimental.
	AddInstanceProductionVariant(props *InstanceProductionVariantProps)
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Defines a SageMaker EndpointConfig.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var modelA model
var modelB model

endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: modelA,
			VariantName: jsii.String("modelA"),
			InitialVariantWeight: jsii.Number(2),
		},
		&instanceProductionVariantProps{
			Model: modelB,
			VariantName: jsii.String("variantB"),
			InitialVariantWeight: jsii.Number(1),
		},
	},
})

Experimental.

func NewEndpointConfig

func NewEndpointConfig(scope constructs.Construct, id *string, props *EndpointConfigProps) EndpointConfig

Experimental.

type EndpointConfigProps

type EndpointConfigProps struct {
	// Optional KMS encryption key associated with this stream.
	// Default: - none.
	//
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// Name of the endpoint configuration.
	// Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the endpoint
	// configuration's name.
	//
	// Experimental.
	EndpointConfigName *string `field:"optional" json:"endpointConfigName" yaml:"endpointConfigName"`
	// A list of instance production variants.
	//
	// You can always add more variants later by calling
	// `EndpointConfig#addInstanceProductionVariant`.
	// Default: - none.
	//
	// Experimental.
	InstanceProductionVariants *[]*InstanceProductionVariantProps `field:"optional" json:"instanceProductionVariants" yaml:"instanceProductionVariants"`
}

Construction properties for a SageMaker EndpointConfig.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var modelA model
var modelB model

endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: modelA,
			VariantName: jsii.String("modelA"),
			InitialVariantWeight: jsii.Number(2),
		},
		&instanceProductionVariantProps{
			Model: modelB,
			VariantName: jsii.String("variantB"),
			InitialVariantWeight: jsii.Number(1),
		},
	},
})

Experimental.

type EndpointProps

type EndpointProps struct {
	// The endpoint configuration to use for this endpoint.
	// Experimental.
	EndpointConfig IEndpointConfig `field:"required" json:"endpointConfig" yaml:"endpointConfig"`
	// Name of the endpoint.
	// Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the
	// endpoint's name.
	//
	// Experimental.
	EndpointName *string `field:"optional" json:"endpointName" yaml:"endpointName"`
}

Construction properties for a SageMaker Endpoint.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var endpointConfig endpointConfig

endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(jsii.String("my-variant"))
productionVariant.MetricModelLatency().CreateAlarm(this, jsii.String("ModelLatencyAlarm"), &CreateAlarmOptions{
	Threshold: jsii.Number(100000),
	EvaluationPeriods: jsii.Number(3),
})

Experimental.

type IEndpoint

type IEndpoint interface {
	awssagemaker.IEndpoint
}

The Interface for a SageMaker Endpoint resource. Experimental.

func Endpoint_FromEndpointArn

func Endpoint_FromEndpointArn(scope constructs.Construct, id *string, endpointArn *string) IEndpoint

Imports an Endpoint defined either outside the CDK or in a different CDK stack. Experimental.

func Endpoint_FromEndpointAttributes

func Endpoint_FromEndpointAttributes(scope constructs.Construct, id *string, attrs *EndpointAttributes) IEndpoint

Imports an Endpoint defined either outside the CDK or in a different CDK stack. Experimental.

func Endpoint_FromEndpointName

func Endpoint_FromEndpointName(scope constructs.Construct, id *string, endpointName *string) IEndpoint

Imports an Endpoint defined either outside the CDK or in a different CDK stack. Experimental.

type IEndpointConfig

type IEndpointConfig interface {
	awscdk.IResource
	// The ARN of the endpoint configuration.
	// Experimental.
	EndpointConfigArn() *string
	// The name of the endpoint configuration.
	// Experimental.
	EndpointConfigName() *string
}

The interface for a SageMaker EndpointConfig resource. Experimental.

func EndpointConfig_FromEndpointConfigArn

func EndpointConfig_FromEndpointConfigArn(scope constructs.Construct, id *string, endpointConfigArn *string) IEndpointConfig

Imports an EndpointConfig defined either outside the CDK or in a different CDK stack. Experimental.

func EndpointConfig_FromEndpointConfigName

func EndpointConfig_FromEndpointConfigName(scope constructs.Construct, id *string, endpointConfigName *string) IEndpointConfig

Imports an EndpointConfig defined either outside the CDK or in a different CDK stack. Experimental.

type IEndpointInstanceProductionVariant

type IEndpointInstanceProductionVariant interface {
	// Enable autoscaling for SageMaker Endpoint production variant.
	// Experimental.
	AutoScaleInstanceCount(scalingProps *awsapplicationautoscaling.EnableScalingProps) ScalableInstanceCount
	// Return the given named metric for Endpoint.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	Metric(namespace *string, metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for CPU utilization.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricCpuUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for disk utilization.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricDiskUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for GPU memory utilization.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricGpuMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for GPU utilization.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricGpuUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of invocations by HTTP response code.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricInvocationResponseCode(responseCode InvocationHttpResponseCode, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of invocations.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of invocations per instance.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricInvocationsPerInstance(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for memory utilization.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for model latency.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricModelLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for overhead latency.
	// Default: - average over 5 minutes.
	//
	// Experimental.
	MetricOverheadLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The name of the production variant.
	// Experimental.
	VariantName() *string
}

Represents an instance production variant that has been associated with an endpoint. Experimental.

type IModel

type IModel interface {
	awsec2.IConnectable
	awsiam.IGrantable
	awscdk.IResource
	// Adds a statement to the IAM role assumed by the instance.
	// Experimental.
	AddToRolePolicy(statement awsiam.PolicyStatement)
	// Returns the ARN of this model.
	// Experimental.
	ModelArn() *string
	// Returns the name of this model.
	// Experimental.
	ModelName() *string
	// The IAM role associated with this Model.
	// Experimental.
	Role() awsiam.IRole
}

Interface that defines a Model resource. Experimental.

func Model_FromModelArn

func Model_FromModelArn(scope constructs.Construct, id *string, modelArn *string) IModel

Imports a Model defined either outside the CDK or in a different CDK stack. Experimental.

func Model_FromModelAttributes

func Model_FromModelAttributes(scope constructs.Construct, id *string, attrs *ModelAttributes) IModel

Imports a Model defined either outside the CDK or in a different CDK stack. Experimental.

func Model_FromModelName

func Model_FromModelName(scope constructs.Construct, id *string, modelName *string) IModel

Imports a Model defined either outside the CDK or in a different CDK stack. Experimental.

type InstanceProductionVariantProps

type InstanceProductionVariantProps struct {
	// The model to host.
	// Experimental.
	Model IModel `field:"required" json:"model" yaml:"model"`
	// Name of the production variant.
	// Experimental.
	VariantName *string `field:"required" json:"variantName" yaml:"variantName"`
	// The size of the Elastic Inference (EI) instance to use for the production variant.
	//
	// EI instances
	// provide on-demand GPU computing for inference.
	// Default: - none.
	//
	// Experimental.
	AcceleratorType AcceleratorType `field:"optional" json:"acceleratorType" yaml:"acceleratorType"`
	// Number of instances to launch initially.
	// Default: 1.
	//
	// Experimental.
	InitialInstanceCount *float64 `field:"optional" json:"initialInstanceCount" yaml:"initialInstanceCount"`
	// Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.
	//
	// The traffic to a production variant is determined by the ratio of the
	// variant weight to the sum of all variant weight values across all production variants.
	// Default: 1.0
	//
	// Experimental.
	InitialVariantWeight *float64 `field:"optional" json:"initialVariantWeight" yaml:"initialVariantWeight"`
	// Instance type of the production variant.
	// Default: InstanceType.T2_MEDIUM
	//
	// Experimental.
	InstanceType InstanceType `field:"optional" json:"instanceType" yaml:"instanceType"`
}

Construction properties for an instance production variant.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var acceleratorType acceleratorType
var instanceType instanceType
var model model

instanceProductionVariantProps := &InstanceProductionVariantProps{
	Model: model,
	VariantName: jsii.String("variantName"),

	// the properties below are optional
	AcceleratorType: acceleratorType,
	InitialInstanceCount: jsii.Number(123),
	InitialVariantWeight: jsii.Number(123),
	InstanceType: instanceType,
}

Experimental.

type InstanceType

type InstanceType interface {
	// Return the instance type as a string.
	//
	// Returns: The instance type as a string.
	// Experimental.
	ToString() *string
}

Supported instance types for SageMaker instance-based production variants.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

instanceType := sagemaker_alpha.InstanceType_C4_2XLARGE()

Experimental.

func InstanceType_C4_2XLARGE

func InstanceType_C4_2XLARGE() InstanceType

func InstanceType_C4_4XLARGE

func InstanceType_C4_4XLARGE() InstanceType

func InstanceType_C4_8XLARGE

func InstanceType_C4_8XLARGE() InstanceType

func InstanceType_C4_LARGE

func InstanceType_C4_LARGE() InstanceType

func InstanceType_C4_XLARGE

func InstanceType_C4_XLARGE() InstanceType

func InstanceType_C5D_18XLARGE

func InstanceType_C5D_18XLARGE() InstanceType

func InstanceType_C5D_2XLARGE

func InstanceType_C5D_2XLARGE() InstanceType

func InstanceType_C5D_4XLARGE

func InstanceType_C5D_4XLARGE() InstanceType

func InstanceType_C5D_9XLARGE

func InstanceType_C5D_9XLARGE() InstanceType

func InstanceType_C5D_LARGE

func InstanceType_C5D_LARGE() InstanceType

func InstanceType_C5D_XLARGE

func InstanceType_C5D_XLARGE() InstanceType

func InstanceType_C5_18XLARGE

func InstanceType_C5_18XLARGE() InstanceType

func InstanceType_C5_2XLARGE

func InstanceType_C5_2XLARGE() InstanceType

func InstanceType_C5_4XLARGE

func InstanceType_C5_4XLARGE() InstanceType

func InstanceType_C5_9XLARGE

func InstanceType_C5_9XLARGE() InstanceType

func InstanceType_C5_LARGE

func InstanceType_C5_LARGE() InstanceType

func InstanceType_C5_XLARGE

func InstanceType_C5_XLARGE() InstanceType

func InstanceType_C6I_12XLARGE

func InstanceType_C6I_12XLARGE() InstanceType

func InstanceType_C6I_16XLARGE

func InstanceType_C6I_16XLARGE() InstanceType

func InstanceType_C6I_24XLARGE

func InstanceType_C6I_24XLARGE() InstanceType

func InstanceType_C6I_2XLARGE

func InstanceType_C6I_2XLARGE() InstanceType

func InstanceType_C6I_32XLARGE

func InstanceType_C6I_32XLARGE() InstanceType

func InstanceType_C6I_4XLARGE

func InstanceType_C6I_4XLARGE() InstanceType

func InstanceType_C6I_8XLARGE

func InstanceType_C6I_8XLARGE() InstanceType

func InstanceType_C6I_LARGE

func InstanceType_C6I_LARGE() InstanceType

func InstanceType_C6I_XLARGE

func InstanceType_C6I_XLARGE() InstanceType

func InstanceType_G4DN_12XLARGE

func InstanceType_G4DN_12XLARGE() InstanceType

func InstanceType_G4DN_16XLARGE

func InstanceType_G4DN_16XLARGE() InstanceType

func InstanceType_G4DN_2XLARGE

func InstanceType_G4DN_2XLARGE() InstanceType

func InstanceType_G4DN_4XLARGE

func InstanceType_G4DN_4XLARGE() InstanceType

func InstanceType_G4DN_8XLARGE

func InstanceType_G4DN_8XLARGE() InstanceType

func InstanceType_G4DN_XLARGE

func InstanceType_G4DN_XLARGE() InstanceType

func InstanceType_G5_12XLARGE

func InstanceType_G5_12XLARGE() InstanceType

func InstanceType_G5_16XLARGE

func InstanceType_G5_16XLARGE() InstanceType

func InstanceType_G5_24XLARGE

func InstanceType_G5_24XLARGE() InstanceType

func InstanceType_G5_2XLARGE

func InstanceType_G5_2XLARGE() InstanceType

func InstanceType_G5_48XLARGE

func InstanceType_G5_48XLARGE() InstanceType

func InstanceType_G5_4XLARGE

func InstanceType_G5_4XLARGE() InstanceType

func InstanceType_G5_8XLARGE

func InstanceType_G5_8XLARGE() InstanceType

func InstanceType_G5_XLARGE

func InstanceType_G5_XLARGE() InstanceType

func InstanceType_G6_12XLARGE

func InstanceType_G6_12XLARGE() InstanceType

func InstanceType_G6_16XLARGE

func InstanceType_G6_16XLARGE() InstanceType

func InstanceType_G6_24XLARGE

func InstanceType_G6_24XLARGE() InstanceType

func InstanceType_G6_2XLARGE

func InstanceType_G6_2XLARGE() InstanceType

func InstanceType_G6_48XLARGE

func InstanceType_G6_48XLARGE() InstanceType

func InstanceType_G6_4XLARGE

func InstanceType_G6_4XLARGE() InstanceType

func InstanceType_G6_8XLARGE

func InstanceType_G6_8XLARGE() InstanceType

func InstanceType_G6_XLARGE

func InstanceType_G6_XLARGE() InstanceType

func InstanceType_INF1_24XLARGE

func InstanceType_INF1_24XLARGE() InstanceType

func InstanceType_INF1_2XLARGE

func InstanceType_INF1_2XLARGE() InstanceType

func InstanceType_INF1_6XLARGE

func InstanceType_INF1_6XLARGE() InstanceType

func InstanceType_INF1_XLARGE

func InstanceType_INF1_XLARGE() InstanceType

func InstanceType_INF2_24XLARGE

func InstanceType_INF2_24XLARGE() InstanceType

func InstanceType_INF2_48XLARGE

func InstanceType_INF2_48XLARGE() InstanceType

func InstanceType_INF2_8XLARGE

func InstanceType_INF2_8XLARGE() InstanceType

func InstanceType_INF2_XLARGE

func InstanceType_INF2_XLARGE() InstanceType

func InstanceType_M4_10XLARGE

func InstanceType_M4_10XLARGE() InstanceType

func InstanceType_M4_16XLARGE

func InstanceType_M4_16XLARGE() InstanceType

func InstanceType_M4_2XLARGE

func InstanceType_M4_2XLARGE() InstanceType

func InstanceType_M4_4XLARGE

func InstanceType_M4_4XLARGE() InstanceType

func InstanceType_M4_XLARGE

func InstanceType_M4_XLARGE() InstanceType

func InstanceType_M5D_12XLARGE

func InstanceType_M5D_12XLARGE() InstanceType

func InstanceType_M5D_24XLARGE

func InstanceType_M5D_24XLARGE() InstanceType

func InstanceType_M5D_2XLARGE

func InstanceType_M5D_2XLARGE() InstanceType

func InstanceType_M5D_4XLARGE

func InstanceType_M5D_4XLARGE() InstanceType

func InstanceType_M5D_LARGE

func InstanceType_M5D_LARGE() InstanceType

func InstanceType_M5D_XLARGE

func InstanceType_M5D_XLARGE() InstanceType

func InstanceType_M5_12XLARGE

func InstanceType_M5_12XLARGE() InstanceType

func InstanceType_M5_24XLARGE

func InstanceType_M5_24XLARGE() InstanceType

func InstanceType_M5_2XLARGE

func InstanceType_M5_2XLARGE() InstanceType

func InstanceType_M5_4XLARGE

func InstanceType_M5_4XLARGE() InstanceType

func InstanceType_M5_LARGE

func InstanceType_M5_LARGE() InstanceType

func InstanceType_M5_XLARGE

func InstanceType_M5_XLARGE() InstanceType

func InstanceType_Of

func InstanceType_Of(instanceType *string) InstanceType

Builds an InstanceType from a given string or token (such as a CfnParameter).

Returns: A strongly typed InstanceType. Experimental.

func InstanceType_P2_16XLARGE

func InstanceType_P2_16XLARGE() InstanceType

func InstanceType_P2_8XLARGE

func InstanceType_P2_8XLARGE() InstanceType

func InstanceType_P2_XLARGE

func InstanceType_P2_XLARGE() InstanceType

func InstanceType_P3_16XLARGE

func InstanceType_P3_16XLARGE() InstanceType

func InstanceType_P3_2XLARGE

func InstanceType_P3_2XLARGE() InstanceType

func InstanceType_P3_8XLARGE

func InstanceType_P3_8XLARGE() InstanceType

func InstanceType_P4D_24XLARGE

func InstanceType_P4D_24XLARGE() InstanceType

func InstanceType_R5D_12XLARGE

func InstanceType_R5D_12XLARGE() InstanceType

func InstanceType_R5D_24XLARGE

func InstanceType_R5D_24XLARGE() InstanceType

func InstanceType_R5D_2XLARGE

func InstanceType_R5D_2XLARGE() InstanceType

func InstanceType_R5D_4XLARGE

func InstanceType_R5D_4XLARGE() InstanceType

func InstanceType_R5D_LARGE

func InstanceType_R5D_LARGE() InstanceType

func InstanceType_R5D_XLARGE

func InstanceType_R5D_XLARGE() InstanceType

func InstanceType_R5_12XLARGE

func InstanceType_R5_12XLARGE() InstanceType

func InstanceType_R5_24XLARGE

func InstanceType_R5_24XLARGE() InstanceType

func InstanceType_R5_2XLARGE

func InstanceType_R5_2XLARGE() InstanceType

func InstanceType_R5_4XLARGE

func InstanceType_R5_4XLARGE() InstanceType

func InstanceType_R5_LARGE

func InstanceType_R5_LARGE() InstanceType

func InstanceType_R5_XLARGE

func InstanceType_R5_XLARGE() InstanceType

func InstanceType_T2_2XLARGE

func InstanceType_T2_2XLARGE() InstanceType

func InstanceType_T2_LARGE

func InstanceType_T2_LARGE() InstanceType

func InstanceType_T2_MEDIUM

func InstanceType_T2_MEDIUM() InstanceType

func InstanceType_T2_XLARGE

func InstanceType_T2_XLARGE() InstanceType

func NewInstanceType

func NewInstanceType(instanceType *string) InstanceType

Experimental.

type InvocationHttpResponseCode

type InvocationHttpResponseCode string

HTTP response codes for Endpoint invocations. Experimental.

const (
	// 4xx response codes from Endpoint invocations.
	// Experimental.
	InvocationHttpResponseCode_INVOCATION_4XX_ERRORS InvocationHttpResponseCode = "INVOCATION_4XX_ERRORS"
	// 5xx response codes from Endpoint invocations.
	// Experimental.
	InvocationHttpResponseCode_INVOCATION_5XX_ERRORS InvocationHttpResponseCode = "INVOCATION_5XX_ERRORS"
)

type InvocationsScalingProps

type InvocationsScalingProps struct {
	// Indicates whether scale in by the target tracking policy is disabled.
	//
	// If the value is true, scale in is disabled and the target tracking policy
	// won't remove capacity from the scalable resource. Otherwise, scale in is
	// enabled and the target tracking policy can remove capacity from the
	// scalable resource.
	// Default: false.
	//
	// Experimental.
	DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"`
	// A name for the scaling policy.
	// Default: - Automatically generated name.
	//
	// Experimental.
	PolicyName *string `field:"optional" json:"policyName" yaml:"policyName"`
	// Period after a scale in activity completes before another scale in activity can start.
	// Default: Duration.seconds(300) for the following scalable targets: ECS services,
	// Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
	// Amazon SageMaker endpoint variants, Custom resources. For all other scalable
	// targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
	// global secondary indexes, Amazon Comprehend document classification endpoints,
	// Lambda provisioned concurrency.
	//
	// Experimental.
	ScaleInCooldown awscdk.Duration `field:"optional" json:"scaleInCooldown" yaml:"scaleInCooldown"`
	// Period after a scale out activity completes before another scale out activity can start.
	// Default: Duration.seconds(300) for the following scalable targets: ECS services,
	// Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
	// Amazon SageMaker endpoint variants, Custom resources. For all other scalable
	// targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
	// global secondary indexes, Amazon Comprehend document classification endpoints,
	// Lambda provisioned concurrency.
	//
	// Experimental.
	ScaleOutCooldown awscdk.Duration `field:"optional" json:"scaleOutCooldown" yaml:"scaleOutCooldown"`
	// Max RPS per instance used for calculating the target SageMaker variant invocation per instance.
	//
	// More documentation available here: https://docs.aws.amazon.com/sagemaker/latest/dg/endpoint-scaling-loadtest.html
	// Experimental.
	MaxRequestsPerSecond *float64 `field:"required" json:"maxRequestsPerSecond" yaml:"maxRequestsPerSecond"`
	// Safty factor for calculating the target SageMaker variant invocation per instance.
	//
	// More documentation available here: https://docs.aws.amazon.com/sagemaker/latest/dg/endpoint-scaling-loadtest.html
	// Default: 0.5
	//
	// Experimental.
	SafetyFactor *float64 `field:"optional" json:"safetyFactor" yaml:"safetyFactor"`
}

Properties for enabling SageMaker Endpoint utilization tracking.

Example:

import "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var model model

variantName := "my-variant"
endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: model,
			VariantName: variantName,
		},
	},
})

endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(variantName)
instanceCount := productionVariant.AutoScaleInstanceCount(&EnableScalingProps{
	MaxCapacity: jsii.Number(3),
})
instanceCount.ScaleOnInvocations(jsii.String("LimitRPS"), &InvocationsScalingProps{
	MaxRequestsPerSecond: jsii.Number(30),
})

Experimental.

type Model

type Model interface {
	awscdk.Resource
	IModel
	// An accessor for the Connections object that will fail if this Model does not have a VPC configured.
	// Experimental.
	Connections() awsec2.Connections
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The principal this Model is running as.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// Returns the ARN of this model.
	// Experimental.
	ModelArn() *string
	// Returns the name of the model.
	// Experimental.
	ModelName() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// Execution role for SageMaker Model.
	// Experimental.
	Role() awsiam.IRole
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Add containers to the model.
	// Experimental.
	AddContainer(container *ContainerDefinition)
	// Adds a statement to the IAM role assumed by the instance.
	// Experimental.
	AddToRolePolicy(statement awsiam.PolicyStatement)
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Defines a SageMaker Model.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image containerImage
var modelData modelData

model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})

Experimental.

func NewModel

func NewModel(scope constructs.Construct, id *string, props *ModelProps) Model

Experimental.

type ModelAttributes

type ModelAttributes struct {
	// The ARN of this model.
	// Experimental.
	ModelArn *string `field:"required" json:"modelArn" yaml:"modelArn"`
	// The IAM execution role associated with this model.
	// Default: - When not provided, any role-related operations will no-op.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The security groups for this model, if in a VPC.
	// Default: - When not provided, the connections to/from this model cannot be managed.
	//
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
}

Represents a Model resource defined outside this stack.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var role role
var securityGroup securityGroup

modelAttributes := &ModelAttributes{
	ModelArn: jsii.String("modelArn"),

	// the properties below are optional
	Role: role,
	SecurityGroups: []iSecurityGroup{
		securityGroup,
	},
}

Experimental.

type ModelData

type ModelData interface {
	// This method is invoked by the SageMaker Model construct when it needs to resolve the model data to a URI.
	// Experimental.
	Bind(scope constructs.Construct, model IModel) *ModelDataConfig
}

Model data represents the source of model artifacts, which will ultimately be loaded from an S3 location.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image containerImage
var modelData modelData

model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})

Experimental.

func ModelData_FromAsset

func ModelData_FromAsset(path *string, options *awss3assets.AssetOptions) ModelData

Constructs model data that will be uploaded to S3 as part of the CDK app deployment. Experimental.

func ModelData_FromBucket

func ModelData_FromBucket(bucket awss3.IBucket, objectKey *string) ModelData

Constructs model data which is already available within S3. Experimental.

type ModelDataConfig

type ModelDataConfig struct {
	// The S3 path where the model artifacts, which result from model training, are stored.
	//
	// This path
	// must point to a single gzip compressed tar archive (.tar.gz suffix).
	// Experimental.
	Uri *string `field:"required" json:"uri" yaml:"uri"`
}

The configuration needed to reference model artifacts.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

modelDataConfig := &ModelDataConfig{
	Uri: jsii.String("uri"),
}

Experimental.

type ModelProps

type ModelProps struct {
	// Whether to allow the SageMaker Model to send all network traffic.
	//
	// If set to false, you must individually add traffic rules to allow the
	// SageMaker Model to connect to network targets.
	//
	// Only used if 'vpc' is supplied.
	// Default: true.
	//
	// Experimental.
	AllowAllOutbound *bool `field:"optional" json:"allowAllOutbound" yaml:"allowAllOutbound"`
	// Specifies the container definitions for this model, consisting of either a single primary container or an inference pipeline of multiple containers.
	// Default: - none.
	//
	// Experimental.
	Containers *[]*ContainerDefinition `field:"optional" json:"containers" yaml:"containers"`
	// Name of the SageMaker Model.
	// Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the model's
	// name.
	//
	// Experimental.
	ModelName *string `field:"optional" json:"modelName" yaml:"modelName"`
	// Whether to enable network isolation for the model container.
	//
	// When enabled, no inbound or outbound network calls can be made to or from the model container.
	// See: https://docs.aws.amazon.com/sagemaker/latest/dg/mkt-algo-model-internet-free.html
	//
	// Default: false.
	//
	// Experimental.
	NetworkIsolation *bool `field:"optional" json:"networkIsolation" yaml:"networkIsolation"`
	// The IAM role that the Amazon SageMaker service assumes.
	// See: https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html#sagemaker-roles-createmodel-perms
	//
	// Default: - a new IAM role will be created with the `AmazonSageMakerFullAccess` policy attached.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The security groups to associate to the Model.
	//
	// If no security groups are provided and 'vpc' is
	// configured, one security group will be created automatically.
	// Default: - A security group will be automatically created if 'vpc' is supplied.
	//
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
	// The VPC to deploy model containers to.
	// Default: - none.
	//
	// Experimental.
	Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
	// The VPC subnets to use when deploying model containers.
	// Default: - none.
	//
	// Experimental.
	VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Construction properties for a SageMaker Model.

Example:

import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image containerImage
var modelData modelData

model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []containerDefinition{
		&containerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})

Experimental.

type ScalableInstanceCount

type ScalableInstanceCount interface {
	awsapplicationautoscaling.BaseScalableAttribute
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	Props() *awsapplicationautoscaling.BaseScalableAttributeProps
	// Scale out or in based on a metric value.
	// Experimental.
	DoScaleOnMetric(id *string, props *awsapplicationautoscaling.BasicStepScalingPolicyProps)
	// Scale out or in based on time.
	// Experimental.
	DoScaleOnSchedule(id *string, props *awsapplicationautoscaling.ScalingSchedule)
	// Scale out or in in order to keep a metric around a target value.
	// Experimental.
	DoScaleToTrackMetric(id *string, props *awsapplicationautoscaling.BasicTargetTrackingScalingPolicyProps)
	// Scales in or out to achieve a target requests per second per instance.
	// Experimental.
	ScaleOnInvocations(id *string, props *InvocationsScalingProps)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A scalable sagemaker endpoint attribute.

Example:

import "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var model model

variantName := "my-variant"
endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
	InstanceProductionVariants: []instanceProductionVariantProps{
		&instanceProductionVariantProps{
			Model: model,
			VariantName: variantName,
		},
	},
})

endpoint := sagemaker.NewEndpoint(this, jsii.String("Endpoint"), &EndpointProps{
	EndpointConfig: EndpointConfig,
})
productionVariant := endpoint.FindInstanceProductionVariant(variantName)
instanceCount := productionVariant.AutoScaleInstanceCount(&EnableScalingProps{
	MaxCapacity: jsii.Number(3),
})
instanceCount.ScaleOnInvocations(jsii.String("LimitRPS"), &InvocationsScalingProps{
	MaxRequestsPerSecond: jsii.Number(30),
})

Experimental.

func NewScalableInstanceCount

func NewScalableInstanceCount(scope constructs.Construct, id *string, props *ScalableInstanceCountProps) ScalableInstanceCount

Constructs a new instance of the ScalableInstanceCount class. Experimental.

type ScalableInstanceCountProps

type ScalableInstanceCountProps struct {
	// Maximum capacity to scale to.
	// Experimental.
	MaxCapacity *float64 `field:"required" json:"maxCapacity" yaml:"maxCapacity"`
	// Minimum capacity to scale to.
	// Default: 1.
	//
	// Experimental.
	MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"`
	// Scalable dimension of the attribute.
	// Experimental.
	Dimension *string `field:"required" json:"dimension" yaml:"dimension"`
	// Resource ID of the attribute.
	// Experimental.
	ResourceId *string `field:"required" json:"resourceId" yaml:"resourceId"`
	// Role to use for scaling.
	// Experimental.
	Role awsiam.IRole `field:"required" json:"role" yaml:"role"`
	// Service namespace of the scalable attribute.
	// Experimental.
	ServiceNamespace awsapplicationautoscaling.ServiceNamespace `field:"required" json:"serviceNamespace" yaml:"serviceNamespace"`
}

The properties of a scalable attribute representing task count.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import sagemaker_alpha "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var role role

scalableInstanceCountProps := &ScalableInstanceCountProps{
	Dimension: jsii.String("dimension"),
	MaxCapacity: jsii.Number(123),
	ResourceId: jsii.String("resourceId"),
	Role: role,
	ServiceNamespace: awscdk.Aws_applicationautoscaling.ServiceNamespace_ECS,

	// the properties below are optional
	MinCapacity: jsii.Number(123),
}

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL