AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

EcsFargateContainerDefinition

A container orchestrated by ECS that uses Fargate resources.

Import

import { EcsFargateContainerDefinition } from 'aws-cdk-lib/aws-batch';

Or use the module namespace:

import * as batch from 'aws-cdk-lib/aws-batch';
// batch.EcsFargateContainerDefinition

Properties

Configuration passed to the constructor as EcsFargateContainerDefinitionProps.

assignPublicIpOptional
boolean

Indicates whether the job has a public IP address. For a job that's running on Fargate resources in a private subnet to send outbound traffic to the internet (for example, to pull container images), the private subnet requires a NAT gateway be attached to route requests to the internet.

Default: false

ephemeralStorageSizeOptional
Size

The size for ephemeral storage.

Default: - 20 GiB

fargateCpuArchitectureOptional
CpuArchitecture

The vCPU architecture of Fargate Runtime.

Default: - X86_64

fargateOperatingSystemFamilyOptional
OperatingSystemFamily

The operating system for the compute environment.

Default: - LINUX

fargatePlatformVersionOptional
FargatePlatformVersion

Which version of Fargate to use when running this container.

Default: LATEST

14 properties inherited from EcsContainerDefinitionProps
cpuRequiredinherited from EcsContainerDefinitionProps
number

The number of vCPUs reserved for the container. Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.

imageRequiredinherited from EcsContainerDefinitionProps
ContainerImage

The image that this container will run.

memoryRequiredinherited from EcsContainerDefinitionProps
Size

The memory hard limit present to the container. 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.

commandOptionalinherited from EcsContainerDefinitionProps
string[]

The command that's passed to the container.

Default: - no command

enableExecuteCommandOptionalinherited from EcsContainerDefinitionProps
boolean

Determines whether execute command functionality is turned on for this task. 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

environmentOptionalinherited from EcsContainerDefinitionProps
{ [key: string]: string }

The environment variables to pass to a container. Cannot start with `AWS_BATCH`. We don't recommend using plaintext environment variables for sensitive information, such as credential data.

Default: - no environment variables

executionRoleOptionalinherited from EcsContainerDefinitionProps
IRole

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

Default: - a Role will be created

jobRoleOptionalinherited from EcsContainerDefinitionProps
IRole

The role that the container can assume.

Default: - no job role

linuxParametersOptionalinherited from EcsContainerDefinitionProps
LinuxParameters

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

Default: none

loggingOptionalinherited from EcsContainerDefinitionProps
LogDriver

The loging configuration for this Job.

Default: - the log configuration of the Docker daemon

readonlyRootFilesystemOptionalinherited from EcsContainerDefinitionProps
boolean

Gives the container readonly access to its root filesystem.

Default: false

secretsOptionalinherited from EcsContainerDefinitionProps
{ [key: string]: Secret }

A map from environment variable names to the secrets for the container. Allows your job definitions to reference the secret by the environment variable name defined in this property.

Default: - no secrets

userOptionalinherited from EcsContainerDefinitionProps
string

The user name to use inside the container.

Default: - no user

volumesOptionalinherited from EcsContainerDefinitionProps
EcsVolume[]

The volumes to mount to this container. Automatically added to the job definition.

Default: - no volumes

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter