Skip to content
v2.277.0

Experimental

@aws-cdk/aws-sagemaker-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ContainerImage Class ​

Constructs for types of container images.

Example ​

ts
import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha';

declare const image: sagemaker.ContainerImage;
declare const modelData: sagemaker.ModelData;

const model = new sagemaker.Model(this, 'ContainerModel', {
  containers: [
    {
      image,
      modelData,
    }
  ],
  networkIsolation: true,
});
python
import aws_cdk.aws_sagemaker_alpha as sagemaker

# image: sagemaker.ContainerImage
# model_data: sagemaker.ModelData


model = sagemaker.Model(self, "ContainerModel",
    containers=[sagemaker.ContainerDefinition(
        image=image,
        model_data=model_data
    )
    ],
    network_isolation=True
)
java
import software.amazon.awscdk.services.sagemaker.alpha.*;

ContainerImage image;
ModelData modelData;


Model model = Model.Builder.create(this, "ContainerModel")
        .containers(List.of(ContainerDefinition.builder()
                .image(image)
                .modelData(modelData)
                .build()))
        .networkIsolation(true)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Sagemaker.Alpha
using Amazon.CDK.AWS.Sagemaker.Alpha;

ContainerImage image;
ModelData modelData;


var model = new Model(this, "ContainerModel", new ModelProps {
    Containers = new [] { new ContainerDefinition {
        Image = image,
        ModelData = modelData
    } },
    NetworkIsolation = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdksagemakeralpha/v2
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),
})

Initializer ​

ts
new ContainerImage()
python
ContainerImage()
java
new ContainerImage()
csharp
new ContainerImage()
go
NewContainerImage()

Methods ​

bind(scope: Construct, model: Model): ContainerImageConfigdef bind(self, scope: Construct, model: Model) -> ContainerImageConfigpublic ContainerImageConfig bind(Construct scope, Model model)public ContainerImageConfig Bind(Construct scope, Model model)func Bind(Scope Construct, Model Model) ContainerImageConfig #
Called when the image is used by a Model.
fromAsset(directory: string, options?: DockerImageAssetOptions): ContainerImage // chainable@staticmethod def from_asset(directory: str, options: typing.Optional[DockerImageAssetOptions] = None) -> ContainerImagepublic static ContainerImage fromAsset(String directory, DockerImageAssetOptions options)public static ContainerImage FromAsset(string directory, DockerImageAssetOptions? options = null)func FromAsset(Directory *string, Options DockerImageAssetOptions) ContainerImage static #
Reference an image that's constructed directly from sources on disk.
2 parameters

Parameters

  • directorydirectorydirectorydirectoryDirectory — The directory where the Dockerfile is stored.
  • optionsoptionsoptionsoptionsOptions — The options to further configure the selected image.
fromDlc(repositoryName: string, tag: string, accountId?: string): ContainerImage // chainable@staticmethod def from_dlc(repository_name: str, tag: str, account_id: typing.Optional[str] = None) -> ContainerImagepublic static ContainerImage fromDlc(String repositoryName, String tag, String accountId)public static ContainerImage FromDlc(string repositoryName, string tag, string? accountId = null)func FromDlc(RepositoryName *string, Tag *string, AccountId *string) ContainerImage static #
Reference an AWS Deep Learning Container image.
fromEcrRepository(repository: IRepository, tag?: string): ContainerImage // chainable@staticmethod def from_ecr_repository(repository: IRepository, tag: typing.Optional[str] = None) -> ContainerImagepublic static ContainerImage fromEcrRepository(IRepository repository, String tag)public static ContainerImage FromEcrRepository(IRepository repository, string? tag = null)func FromEcrRepository(Repository IRepository, Tag *string) ContainerImage static #
Reference an image in an ECR repository.