> **Experimental**
>
> `@aws-cdk/aws-sagemaker-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ContainerDefinition

Describes the container, as part of model definition.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/model.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-sagemaker-alpha/lib/model.ts#L116)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as sagemaker_alpha from '@aws-cdk/aws-sagemaker-alpha';

declare const containerImage: sagemaker_alpha.ContainerImage;
declare const modelData: sagemaker_alpha.ModelData;
const containerDefinition: sagemaker_alpha.ContainerDefinition = {
  image: containerImage,

  // the properties below are optional
  containerHostname: 'containerHostname',
  environment: {
    environmentKey: 'environment',
  },
  modelData: modelData,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker_alpha as sagemaker_alpha

# container_image: sagemaker_alpha.ContainerImage
# model_data: sagemaker_alpha.ModelData

container_definition = sagemaker_alpha.ContainerDefinition(
    image=container_image,

    # the properties below are optional
    container_hostname="containerHostname",
    environment={
        "environment_key": "environment"
    },
    model_data=model_data
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.sagemaker.alpha.*;

ContainerImage containerImage;
ModelData modelData;

ContainerDefinition containerDefinition = ContainerDefinition.builder()
        .image(containerImage)

        // the properties below are optional
        .containerHostname("containerHostname")
        .environment(Map.of(
                "environmentKey", "environment"))
        .modelData(modelData)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Sagemaker.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Sagemaker.Alpha;

ContainerImage containerImage;
ModelData modelData;

var containerDefinition = new ContainerDefinition {
    Image = containerImage,

    // the properties below are optional
    ContainerHostname = "containerHostname",
    Environment = new Dictionary<string, string> {
        { "environmentKey", "environment" }
    },
    ModelData = modelData
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdksagemakeralpha/v2
// 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,
}
```

## Properties

- `containerHostname`: string — Hostname of the container within an inference pipeline.

  **Default:** Amazon SageMaker will automatically assign a unique name based on the position of this ContainerDefinition in 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.

- `environment`: { [key: string]: string } = none — A map of environment variables to pass into the container.

- `image`: [ContainerImage](/cdk/api/v2/docs/@aws-cdk_aws-sagemaker-alpha.ContainerImage.html) (required) — The image used to start a container.

- `modelData`: [ModelData](/cdk/api/v2/docs/@aws-cdk_aws-sagemaker-alpha.ModelData.html) = none — S3 path to the model artifacts.
