Skip to content
v2.278.0

ContainerOverride Struct ​

A list of container overrides that specify the name of a container and the overrides it should receive.

Example ​

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

declare const containerDefinition: ecs.ContainerDefinition;
const containerOverride: stepfunctions_tasks.ContainerOverride = {
  containerDefinition: containerDefinition,

  // the properties below are optional
  command: ['command'],
  cpu: 123,
  environment: [{
    name: 'name',
    value: 'value',
  }],
  memoryLimit: 123,
  memoryReservation: 123,
};
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_ecs as ecs
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks

# container_definition: ecs.ContainerDefinition

container_override = stepfunctions_tasks.ContainerOverride(
    container_definition=container_definition,

    # the properties below are optional
    command=["command"],
    cpu=123,
    environment=[stepfunctions_tasks.TaskEnvironmentVariable(
        name="name",
        value="value"
    )],
    memory_limit=123,
    memory_reservation=123
)
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.ecs.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

ContainerDefinition containerDefinition;

ContainerOverride containerOverride = ContainerOverride.builder()
        .containerDefinition(containerDefinition)

        // the properties below are optional
        .command(List.of("command"))
        .cpu(123)
        .environment(List.of(TaskEnvironmentVariable.builder()
                .name("name")
                .value("value")
                .build()))
        .memoryLimit(123)
        .memoryReservation(123)
        .build();
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.ECS;
using Amazon.CDK.AWS.StepFunctions.Tasks;

ContainerDefinition containerDefinition;

var containerOverride = new ContainerOverride {
    ContainerDefinition = containerDefinition,

    // the properties below are optional
    Command = new [] { "command" },
    Cpu = 123,
    Environment = new [] { new TaskEnvironmentVariable {
        Name = "name",
        Value = "value"
    } },
    MemoryLimit = 123,
    MemoryReservation = 123
};
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"
import "github.com/aws/aws-cdk-go/awscdk"

var containerDefinition ContainerDefinition

containerOverride := &ContainerOverride{
	ContainerDefinition: containerDefinition,

	// the properties below are optional
	Command: []*string{
		jsii.String("command"),
	},
	Cpu: jsii.Number(123),
	Environment: []TaskEnvironmentVariable{
		&TaskEnvironmentVariable{
			Name: jsii.String("name"),
			Value: jsii.String("value"),
		},
	},
	MemoryLimit: jsii.Number(123),
	MemoryReservation: jsii.Number(123),
}

Properties ​

commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string #
Command to run inside the container.

Default: Default command from the Docker image or the task definition

containerDefinitionContainerDefinitioncontainer_definitionContainerDefinitioncontainerDefinitionContainerDefinitionContainerDefinitionContainerDefinitionContainerDefinitionContainerDefinition required #
Name of the container inside the task definition.
cpuoptionalnumbercpuoptionalint | floatcpuoptionalNumberCpuoptionaldoubleCpuoptional*float64 #
The number of cpu units reserved for the container.

Default: The default value from the task definition.

environmentoptionalTaskEnvironmentVariable[]environmentoptionaltyping.List[TaskEnvironmentVariable]environmentoptionalList<TaskEnvironmentVariable>EnvironmentoptionalTaskEnvironmentVariable[]Environmentoptional*[]TaskEnvironmentVariable #
The environment variables to send to the container.

Default: The existing environment variables from the Docker image or the task definition

You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.

memoryLimitoptionalnumbermemory_limitoptionalint | floatmemoryLimitoptionalNumberMemoryLimitoptionaldoubleMemoryLimitoptional*float64 #
The hard limit (in MiB) of memory to present to the container.

Default: The default value from the task definition.

memoryReservationoptionalnumbermemory_reservationoptionalint | floatmemoryReservationoptionalNumberMemoryReservationoptionaldoubleMemoryReservationoptional*float64 #
The soft limit (in MiB) of memory to reserve for the container.

Default: The default value from the task definition.