Show / Hide Table of Contents

Interface IEcsContainerDefinitionProps

Props to configure an EcsContainerDefinition.

Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IEcsContainerDefinitionProps
Syntax (vb)
Public Interface IEcsContainerDefinitionProps
Remarks

ExampleMetadata: fixture=_generated

Examples
// The code below shows an example of how to instantiate this type.
            // The values are placeholders you should change.
            using Amazon.CDK;
            using Amazon.CDK.AWS.Batch;
            using Amazon.CDK.AWS.ECS;
            using Amazon.CDK.AWS.IAM;

            ContainerImage containerImage;
            EcsVolume ecsVolume;
            LinuxParameters linuxParameters;
            LogDriver logDriver;
            Role role;
            Secret secret;
            Size size;

            var ecsContainerDefinitionProps = new EcsContainerDefinitionProps {
                Cpu = 123,
                Image = containerImage,
                Memory = size,

                // the properties below are optional
                Command = new [] { "command" },
                EnableExecuteCommand = false,
                Environment = new Dictionary<string, string> {
                    { "environmentKey", "environment" }
                },
                ExecutionRole = role,
                JobRole = role,
                LinuxParameters = linuxParameters,
                Logging = logDriver,
                ReadonlyRootFilesystem = false,
                Secrets = new Dictionary<string, Secret> {
                    { "secretsKey", secret }
                },
                User = "user",
                Volumes = new [] { ecsVolume }
            };

Synopsis

Properties

Command

The command that's passed to the container.

Cpu

The number of vCPUs reserved for the container.

EnableExecuteCommand

Determines whether execute command functionality is turned on for this task.

Environment

The environment variables to pass to a container.

ExecutionRole

The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.

Image

The image that this container will run.

JobRole

The role that the container can assume.

LinuxParameters

Linux-specific modifications that are applied to the container, such as details for device mappings.

Logging

The loging configuration for this Job.

Memory

The memory hard limit present to the container.

ReadonlyRootFilesystem

Gives the container readonly access to its root filesystem.

Secrets

A map from environment variable names to the secrets for the container.

User

The user name to use inside the container.

Volumes

The volumes to mount to this container.

Properties

Command

The command that's passed to the container.

string[]? Command { get; }
Property Value

string[]

Remarks

Default: - no command

See: https://docs.docker.com/engine/reference/builder/#cmd

Cpu

The number of vCPUs reserved for the container.

double Cpu { get; }
Property Value

double

Remarks

Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.

EnableExecuteCommand

Determines whether execute command functionality is turned on for this task.

bool? EnableExecuteCommand { get; }
Property Value

bool?

Remarks

If true, execute command functionality is turned on all the containers in the task.

This allows you to use ECS Exec to access containers interactively. When enabled, a job role with required SSM permissions will be created automatically if no job role is provided. If a job role is alreadyprovided, the required permissions will be added to it.

Default: undefined - AWS Batch default is false

See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html

Environment

The environment variables to pass to a container.

IDictionary<string, string>? Environment { get; }
Property Value

IDictionary<string, string>

Remarks

Cannot start with AWS_BATCH. We don't recommend using plaintext environment variables for sensitive information, such as credential data.

Default: - no environment variables

ExecutionRole

The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.

IRole? ExecutionRole { get; }
Property Value

IRole

Remarks

Default: - a Role will be created

See: https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html

Image

The image that this container will run.

ContainerImage Image { get; }
Property Value

ContainerImage

Remarks

ExampleMetadata: fixture=_generated

JobRole

The role that the container can assume.

IRole? JobRole { get; }
Property Value

IRole

Remarks

Default: - no job role

See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html

LinuxParameters

Linux-specific modifications that are applied to the container, such as details for device mappings.

LinuxParameters? LinuxParameters { get; }
Property Value

LinuxParameters

Remarks

Default: none

Logging

The loging configuration for this Job.

LogDriver? Logging { get; }
Property Value

LogDriver

Remarks

Default: - the log configuration of the Docker daemon

Memory

The memory hard limit present to the container.

Size Memory { get; }
Property Value

Size

Remarks

If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.

ReadonlyRootFilesystem

Gives the container readonly access to its root filesystem.

bool? ReadonlyRootFilesystem { get; }
Property Value

bool?

Remarks

Default: false

Secrets

A map from environment variable names to the secrets for the container.

IDictionary<string, Secret>? Secrets { get; }
Property Value

IDictionary<string, Secret>

Remarks

Allows your job definitions to reference the secret by the environment variable name defined in this property.

Default: - no secrets

See: https://docs.aws.amazon.com/batch/latest/userguide/specifying-sensitive-data.html

User

The user name to use inside the container.

string? User { get; }
Property Value

string

Remarks

Default: - no user

Volumes

The volumes to mount to this container.

EcsVolume[]? Volumes { get; }
Property Value

EcsVolume[]

Remarks

Automatically added to the job definition.

Default: - no volumes

Back to top Generated by DocFX