# EksContainerProperty

EKS container properties are used in job definitions for Amazon EKS based job definitions to describe the properties for a container node in the pod that's launched as part of a job.

This can't be specified for Amazon ECS based job definitions.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_batch as batch } from 'aws-cdk-lib';

declare const limits: any;
declare const requests: any;
const eksContainerProperty: batch.CfnJobDefinition.EksContainerProperty = {
  image: 'image',

  // the properties below are optional
  args: ['args'],
  command: ['command'],
  env: [{
    name: 'name',

    // the properties below are optional
    value: 'value',
  }],
  imagePullPolicy: 'imagePullPolicy',
  name: 'name',
  resources: {
    limits: limits,
    requests: requests,
  },
  securityContext: {
    allowPrivilegeEscalation: false,
    capabilities: {
      add: ['add'],
      drop: ['drop'],
    },
    privileged: false,
    readOnlyRootFilesystem: false,
    runAsGroup: 123,
    runAsNonRoot: false,
    runAsUser: 123,
    seccompProfile: {
      type: 'type',

      // the properties below are optional
      localhostProfile: 'localhostProfile',
    },
  },
  volumeMounts: [{
    mountPath: 'mountPath',
    name: 'name',
    readOnly: false,
    subPath: 'subPath',
  }],
};
```

Python:

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

# limits: Any
# requests: Any

eks_container_property = batch.CfnJobDefinition.EksContainerProperty(
    image="image",

    # the properties below are optional
    args=["args"],
    command=["command"],
    env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty(
        name="name",

        # the properties below are optional
        value="value"
    )],
    image_pull_policy="imagePullPolicy",
    name="name",
    resources=batch.CfnJobDefinition.ResourcesProperty(
        limits=limits,
        requests=requests
    ),
    security_context=batch.CfnJobDefinition.SecurityContextProperty(
        allow_privilege_escalation=False,
        capabilities=batch.CfnJobDefinition.EksContainerLinuxCapabilitiesProperty(
            add=["add"],
            drop=["drop"]
        ),
        privileged=False,
        read_only_root_filesystem=False,
        run_as_group=123,
        run_as_non_root=False,
        run_as_user=123,
        seccomp_profile=batch.CfnJobDefinition.EksSeccompProfileProperty(
            type="type",

            # the properties below are optional
            localhost_profile="localhostProfile"
        )
    ),
    volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty(
        mount_path="mountPath",
        name="name",
        read_only=False,
        sub_path="subPath"
    )]
)
```

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.batch.*;

Object limits;
Object requests;

EksContainerProperty eksContainerProperty = EksContainerProperty.builder()
        .image("image")

        // the properties below are optional
        .args(List.of("args"))
        .command(List.of("command"))
        .env(List.of(EksContainerEnvironmentVariableProperty.builder()
                .name("name")

                // the properties below are optional
                .value("value")
                .build()))
        .imagePullPolicy("imagePullPolicy")
        .name("name")
        .resources(ResourcesProperty.builder()
                .limits(limits)
                .requests(requests)
                .build())
        .securityContext(SecurityContextProperty.builder()
                .allowPrivilegeEscalation(false)
                .capabilities(EksContainerLinuxCapabilitiesProperty.builder()
                        .add(List.of("add"))
                        .drop(List.of("drop"))
                        .build())
                .privileged(false)
                .readOnlyRootFilesystem(false)
                .runAsGroup(123)
                .runAsNonRoot(false)
                .runAsUser(123)
                .seccompProfile(EksSeccompProfileProperty.builder()
                        .type("type")

                        // the properties below are optional
                        .localhostProfile("localhostProfile")
                        .build())
                .build())
        .volumeMounts(List.of(EksContainerVolumeMountProperty.builder()
                .mountPath("mountPath")
                .name("name")
                .readOnly(false)
                .subPath("subPath")
                .build()))
        .build();
```

C# / .NET:

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

var limits;
var requests;

var eksContainerProperty = new EksContainerProperty {
    Image = "image",

    // the properties below are optional
    Args = new [] { "args" },
    Command = new [] { "command" },
    Env = new [] { new EksContainerEnvironmentVariableProperty {
        Name = "name",

        // the properties below are optional
        Value = "value"
    } },
    ImagePullPolicy = "imagePullPolicy",
    Name = "name",
    Resources = new ResourcesProperty {
        Limits = limits,
        Requests = requests
    },
    SecurityContext = new SecurityContextProperty {
        AllowPrivilegeEscalation = false,
        Capabilities = new EksContainerLinuxCapabilitiesProperty {
            Add = new [] { "add" },
            Drop = new [] { "drop" }
        },
        Privileged = false,
        ReadOnlyRootFilesystem = false,
        RunAsGroup = 123,
        RunAsNonRoot = false,
        RunAsUser = 123,
        SeccompProfile = new EksSeccompProfileProperty {
            Type = "type",

            // the properties below are optional
            LocalhostProfile = "localhostProfile"
        }
    },
    VolumeMounts = new [] { new EksContainerVolumeMountProperty {
        MountPath = "mountPath",
        Name = "name",
        ReadOnly = false,
        SubPath = "subPath"
    } }
};
```

Golang:

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

var limits interface{}
var requests interface{}

eksContainerProperty := &EksContainerProperty{
	Image: jsii.String("image"),

	// the properties below are optional
	Args: []*string{
		jsii.String("args"),
	},
	Command: []*string{
		jsii.String("command"),
	},
	Env: []interface{}{
		&EksContainerEnvironmentVariableProperty{
			Name: jsii.String("name"),

			// the properties below are optional
			Value: jsii.String("value"),
		},
	},
	ImagePullPolicy: jsii.String("imagePullPolicy"),
	Name: jsii.String("name"),
	Resources: &ResourcesProperty{
		Limits: limits,
		Requests: requests,
	},
	SecurityContext: &SecurityContextProperty{
		AllowPrivilegeEscalation: jsii.Boolean(false),
		Capabilities: &EksContainerLinuxCapabilitiesProperty{
			Add: []*string{
				jsii.String("add"),
			},
			Drop: []*string{
				jsii.String("drop"),
			},
		},
		Privileged: jsii.Boolean(false),
		ReadOnlyRootFilesystem: jsii.Boolean(false),
		RunAsGroup: jsii.Number(123),
		RunAsNonRoot: jsii.Boolean(false),
		RunAsUser: jsii.Number(123),
		SeccompProfile: &EksSeccompProfileProperty{
			Type: jsii.String("type"),

			// the properties below are optional
			LocalhostProfile: jsii.String("localhostProfile"),
		},
	},
	VolumeMounts: []interface{}{
		&EksContainerVolumeMountProperty{
			MountPath: jsii.String("mountPath"),
			Name: jsii.String("name"),
			ReadOnly: jsii.Boolean(false),
			SubPath: jsii.String("subPath"),
		},
	},
}
```

## Properties

- `args`: string[] — An array of arguments to the entrypoint.

  If this isn't specified, the `CMD` of the container image is used. This corresponds to the `args` member in the [Entrypoint](https://docs.aws.amazon.com/https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#entrypoint) portion of the [Pod](https://docs.aws.amazon.com/https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/) in Kubernetes. Environment variable references are expanded using the container's environment.

  If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to " `$(NAME1)` " and the `NAME1` environment variable doesn't exist, the command string will remain " `$(NAME1)` ." `$$` is replaced with `$` , and the resulting string isn't expanded. For example, `$$(VAR_NAME)` is passed as `$(VAR_NAME)` whether or not the `VAR_NAME` environment variable exists. For more information, see [Dockerfile reference: CMD](https://docs.aws.amazon.com/https://docs.docker.com/engine/reference/builder/#cmd) and [Define a command and arguments for a pod](https://docs.aws.amazon.com/https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/) in the *Kubernetes documentation* .

- `command`: string[] — The entrypoint for the container.

  This isn't run within a shell. If this isn't specified, the `ENTRYPOINT` of the container image is used. Environment variable references are expanded using the container's environment.

  If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to " `$(NAME1)` " and the `NAME1` environment variable doesn't exist, the command string will remain " `$(NAME1)` ." `$$` is replaced with `$` and the resulting string isn't expanded. For example, `$$(VAR_NAME)` will be passed as `$(VAR_NAME)` whether or not the `VAR_NAME` environment variable exists. The entrypoint can't be updated. For more information, see [ENTRYPOINT](https://docs.aws.amazon.com/https://docs.docker.com/engine/reference/builder/#entrypoint) in the *Dockerfile reference* and [Define a command and arguments for a container](https://docs.aws.amazon.com/https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/) and [Entrypoint](https://docs.aws.amazon.com/https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#entrypoint) in the *Kubernetes documentation* .

- `env`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnJobDefinition.EksContainerEnvironmentVariableProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty.html)[] — The environment variables to pass to a container.

  > Environment variables cannot start with " `AWS_BATCH` ". This naming convention is reserved for variables that AWS Batch sets.

- `image`: string (required) — The Docker image used to start the container.

- `imagePullPolicy`: string — The image pull policy for the container.

  Supported values are `Always` , `IfNotPresent` , and `Never` . This parameter defaults to `IfNotPresent` . However, if the `:latest` tag is specified, it defaults to `Always` . For more information, see [Updating images](https://docs.aws.amazon.com/https://kubernetes.io/docs/concepts/containers/images/#updating-images) in the *Kubernetes documentation* .

- `name`: string — The name of the container.

  If the name isn't specified, the default name " `Default` " is used. Each container in a pod must have a unique name.

- `resources`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnJobDefinition.ResourcesProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.CfnJobDefinition.ResourcesProperty.html) — The type and amount of resources to assign to a container.

  The supported resources include `memory` , `cpu` , and `nvidia.com/gpu` . For more information, see [Resource management for pods and containers](https://docs.aws.amazon.com/https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) in the *Kubernetes documentation* .

- `securityContext`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnJobDefinition.SecurityContextProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.CfnJobDefinition.SecurityContextProperty.html) — The security context for a job.

  For more information, see [Configure a security context for a pod or container](https://docs.aws.amazon.com/https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) in the *Kubernetes documentation* .

- `volumeMounts`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnJobDefinition.EksContainerVolumeMountProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.CfnJobDefinition.EksContainerVolumeMountProperty.html)[] — The volume mounts for the container.

  AWS Batch supports `emptyDir` , `hostPath` , and `secret` volume types. For more information about volumes and volume mounts in Kubernetes, see [Volumes](https://docs.aws.amazon.com/https://kubernetes.io/docs/concepts/storage/volumes/) in the *Kubernetes documentation* .
