Skip to content
v2.274.0

FirelensLogRouter ​

Firelens log router.

Example ​

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

declare const appProtocol: ecs.AppProtocol;
declare const containerImage: ecs.ContainerImage;
declare const credentialSpec: ecs.CredentialSpec;
declare const environmentFile: ecs.EnvironmentFile;
declare const linuxParameters: ecs.LinuxParameters;
declare const logDriver: ecs.LogDriver;
declare const secret: ecs.Secret;
declare const taskDefinition: ecs.TaskDefinition;
const firelensLogRouter = new ecs.FirelensLogRouter(this, 'MyFirelensLogRouter', {
  firelensConfig: {
    type: ecs.FirelensLogRouterType.FLUENTBIT,

    // the properties below are optional
    options: {
      configFileType: ecs.FirelensConfigFileType.S3,
      configFileValue: 'configFileValue',
      enableECSLogMetadata: false,
    },
  },
  image: containerImage,
  taskDefinition: taskDefinition,

  // the properties below are optional
  command: ['command'],
  containerName: 'containerName',
  cpu: 123,
  credentialSpecs: [credentialSpec],
  disableNetworking: false,
  dnsSearchDomains: ['dnsSearchDomains'],
  dnsServers: ['dnsServers'],
  dockerLabels: {
    dockerLabelsKey: 'dockerLabels',
  },
  dockerSecurityOptions: ['dockerSecurityOptions'],
  enableRestartPolicy: false,
  entryPoint: ['entryPoint'],
  environment: {
    environmentKey: 'environment',
  },
  environmentFiles: [environmentFile],
  essential: false,
  extraHosts: {
    extraHostsKey: 'extraHosts',
  },
  gpuCount: 123,
  healthCheck: {
    command: ['command'],

    // the properties below are optional
    interval: cdk.Duration.minutes(30),
    retries: 123,
    startPeriod: cdk.Duration.minutes(30),
    timeout: cdk.Duration.minutes(30),
  },
  hostname: 'hostname',
  inferenceAcceleratorResources: ['inferenceAcceleratorResources'],
  interactive: false,
  linuxParameters: linuxParameters,
  logging: logDriver,
  memoryLimitMiB: 123,
  memoryReservationMiB: 123,
  portMappings: [{
    containerPort: 123,

    // the properties below are optional
    appProtocol: appProtocol,
    containerPortRange: 'containerPortRange',
    hostPort: 123,
    name: 'name',
    protocol: ecs.Protocol.TCP,
  }],
  privileged: false,
  pseudoTerminal: false,
  readonlyRootFilesystem: false,
  restartAttemptPeriod: cdk.Duration.minutes(30),
  restartIgnoredExitCodes: [123],
  secrets: {
    secretsKey: secret,
  },
  startTimeout: cdk.Duration.minutes(30),
  stopTimeout: cdk.Duration.minutes(30),
  systemControls: [{
    namespace: 'namespace',
    value: 'value',
  }],
  ulimits: [{
    hardLimit: 123,
    name: ecs.UlimitName.CORE,
    softLimit: 123,
  }],
  user: 'user',
  versionConsistency: ecs.VersionConsistency.ENABLED,
  workingDirectory: 'workingDirectory',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ecs as ecs

# app_protocol: ecs.AppProtocol
# container_image: ecs.ContainerImage
# credential_spec: ecs.CredentialSpec
# environment_file: ecs.EnvironmentFile
# linux_parameters: ecs.LinuxParameters
# log_driver: ecs.LogDriver
# secret: ecs.Secret
# task_definition: ecs.TaskDefinition

firelens_log_router = ecs.FirelensLogRouter(self, "MyFirelensLogRouter",
    firelens_config=ecs.FirelensConfig(
        type=ecs.FirelensLogRouterType.FLUENTBIT,

        # the properties below are optional
        options=ecs.FirelensOptions(
            config_file_type=ecs.FirelensConfigFileType.S3,
            config_file_value="configFileValue",
            enable_ecs_log_metadata=False
        )
    ),
    image=container_image,
    task_definition=task_definition,

    # the properties below are optional
    command=["command"],
    container_name="containerName",
    cpu=123,
    credential_specs=[credential_spec],
    disable_networking=False,
    dns_search_domains=["dnsSearchDomains"],
    dns_servers=["dnsServers"],
    docker_labels={
        "docker_labels_key": "dockerLabels"
    },
    docker_security_options=["dockerSecurityOptions"],
    enable_restart_policy=False,
    entry_point=["entryPoint"],
    environment={
        "environment_key": "environment"
    },
    environment_files=[environment_file],
    essential=False,
    extra_hosts={
        "extra_hosts_key": "extraHosts"
    },
    gpu_count=123,
    health_check=ecs.HealthCheck(
        command=["command"],

        # the properties below are optional
        interval=cdk.Duration.minutes(30),
        retries=123,
        start_period=cdk.Duration.minutes(30),
        timeout=cdk.Duration.minutes(30)
    ),
    hostname="hostname",
    inference_accelerator_resources=["inferenceAcceleratorResources"],
    interactive=False,
    linux_parameters=linux_parameters,
    logging=log_driver,
    memory_limit_mi_b=123,
    memory_reservation_mi_b=123,
    port_mappings=[ecs.PortMapping(
        container_port=123,

        # the properties below are optional
        app_protocol=app_protocol,
        container_port_range="containerPortRange",
        host_port=123,
        name="name",
        protocol=ecs.Protocol.TCP
    )],
    privileged=False,
    pseudo_terminal=False,
    readonly_root_filesystem=False,
    restart_attempt_period=cdk.Duration.minutes(30),
    restart_ignored_exit_codes=[123],
    secrets={
        "secrets_key": secret
    },
    start_timeout=cdk.Duration.minutes(30),
    stop_timeout=cdk.Duration.minutes(30),
    system_controls=[ecs.SystemControl(
        namespace="namespace",
        value="value"
    )],
    ulimits=[ecs.Ulimit(
        hard_limit=123,
        name=ecs.UlimitName.CORE,
        soft_limit=123
    )],
    user="user",
    version_consistency=ecs.VersionConsistency.ENABLED,
    working_directory="workingDirectory"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ecs.*;

AppProtocol appProtocol;
ContainerImage containerImage;
CredentialSpec credentialSpec;
EnvironmentFile environmentFile;
LinuxParameters linuxParameters;
LogDriver logDriver;
Secret secret;
TaskDefinition taskDefinition;

FirelensLogRouter firelensLogRouter = FirelensLogRouter.Builder.create(this, "MyFirelensLogRouter")
        .firelensConfig(FirelensConfig.builder()
                .type(FirelensLogRouterType.FLUENTBIT)

                // the properties below are optional
                .options(FirelensOptions.builder()
                        .configFileType(FirelensConfigFileType.S3)
                        .configFileValue("configFileValue")
                        .enableECSLogMetadata(false)
                        .build())
                .build())
        .image(containerImage)
        .taskDefinition(taskDefinition)

        // the properties below are optional
        .command(List.of("command"))
        .containerName("containerName")
        .cpu(123)
        .credentialSpecs(List.of(credentialSpec))
        .disableNetworking(false)
        .dnsSearchDomains(List.of("dnsSearchDomains"))
        .dnsServers(List.of("dnsServers"))
        .dockerLabels(Map.of(
                "dockerLabelsKey", "dockerLabels"))
        .dockerSecurityOptions(List.of("dockerSecurityOptions"))
        .enableRestartPolicy(false)
        .entryPoint(List.of("entryPoint"))
        .environment(Map.of(
                "environmentKey", "environment"))
        .environmentFiles(List.of(environmentFile))
        .essential(false)
        .extraHosts(Map.of(
                "extraHostsKey", "extraHosts"))
        .gpuCount(123)
        .healthCheck(HealthCheck.builder()
                .command(List.of("command"))

                // the properties below are optional
                .interval(Duration.minutes(30))
                .retries(123)
                .startPeriod(Duration.minutes(30))
                .timeout(Duration.minutes(30))
                .build())
        .hostname("hostname")
        .inferenceAcceleratorResources(List.of("inferenceAcceleratorResources"))
        .interactive(false)
        .linuxParameters(linuxParameters)
        .logging(logDriver)
        .memoryLimitMiB(123)
        .memoryReservationMiB(123)
        .portMappings(List.of(PortMapping.builder()
                .containerPort(123)

                // the properties below are optional
                .appProtocol(appProtocol)
                .containerPortRange("containerPortRange")
                .hostPort(123)
                .name("name")
                .protocol(Protocol.TCP)
                .build()))
        .privileged(false)
        .pseudoTerminal(false)
        .readonlyRootFilesystem(false)
        .restartAttemptPeriod(Duration.minutes(30))
        .restartIgnoredExitCodes(List.of(123))
        .secrets(Map.of(
                "secretsKey", secret))
        .startTimeout(Duration.minutes(30))
        .stopTimeout(Duration.minutes(30))
        .systemControls(List.of(SystemControl.builder()
                .namespace("namespace")
                .value("value")
                .build()))
        .ulimits(List.of(Ulimit.builder()
                .hardLimit(123)
                .name(UlimitName.CORE)
                .softLimit(123)
                .build()))
        .user("user")
        .versionConsistency(VersionConsistency.ENABLED)
        .workingDirectory("workingDirectory")
        .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;
using Amazon.CDK.AWS.ECS;

AppProtocol appProtocol;
ContainerImage containerImage;
CredentialSpec credentialSpec;
EnvironmentFile environmentFile;
LinuxParameters linuxParameters;
LogDriver logDriver;
Secret secret;
TaskDefinition taskDefinition;

var firelensLogRouter = new FirelensLogRouter(this, "MyFirelensLogRouter", new FirelensLogRouterProps {
    FirelensConfig = new FirelensConfig {
        Type = FirelensLogRouterType.FLUENTBIT,

        // the properties below are optional
        Options = new FirelensOptions {
            ConfigFileType = FirelensConfigFileType.S3,
            ConfigFileValue = "configFileValue",
            EnableECSLogMetadata = false
        }
    },
    Image = containerImage,
    TaskDefinition = taskDefinition,

    // the properties below are optional
    Command = new [] { "command" },
    ContainerName = "containerName",
    Cpu = 123,
    CredentialSpecs = new [] { credentialSpec },
    DisableNetworking = false,
    DnsSearchDomains = new [] { "dnsSearchDomains" },
    DnsServers = new [] { "dnsServers" },
    DockerLabels = new Dictionary<string, string> {
        { "dockerLabelsKey", "dockerLabels" }
    },
    DockerSecurityOptions = new [] { "dockerSecurityOptions" },
    EnableRestartPolicy = false,
    EntryPoint = new [] { "entryPoint" },
    Environment = new Dictionary<string, string> {
        { "environmentKey", "environment" }
    },
    EnvironmentFiles = new [] { environmentFile },
    Essential = false,
    ExtraHosts = new Dictionary<string, string> {
        { "extraHostsKey", "extraHosts" }
    },
    GpuCount = 123,
    HealthCheck = new HealthCheck {
        Command = new [] { "command" },

        // the properties below are optional
        Interval = Duration.Minutes(30),
        Retries = 123,
        StartPeriod = Duration.Minutes(30),
        Timeout = Duration.Minutes(30)
    },
    Hostname = "hostname",
    InferenceAcceleratorResources = new [] { "inferenceAcceleratorResources" },
    Interactive = false,
    LinuxParameters = linuxParameters,
    Logging = logDriver,
    MemoryLimitMiB = 123,
    MemoryReservationMiB = 123,
    PortMappings = new [] { new PortMapping {
        ContainerPort = 123,

        // the properties below are optional
        AppProtocol = appProtocol,
        ContainerPortRange = "containerPortRange",
        HostPort = 123,
        Name = "name",
        Protocol = Protocol.TCP
    } },
    Privileged = false,
    PseudoTerminal = false,
    ReadonlyRootFilesystem = false,
    RestartAttemptPeriod = Duration.Minutes(30),
    RestartIgnoredExitCodes = new [] { 123 },
    Secrets = new Dictionary<string, Secret> {
        { "secretsKey", secret }
    },
    StartTimeout = Duration.Minutes(30),
    StopTimeout = Duration.Minutes(30),
    SystemControls = new [] { new SystemControl {
        Namespace = "namespace",
        Value = "value"
    } },
    Ulimits = new [] { new Ulimit {
        HardLimit = 123,
        Name = UlimitName.CORE,
        SoftLimit = 123
    } },
    User = "user",
    VersionConsistency = VersionConsistency.ENABLED,
    WorkingDirectory = "workingDirectory"
});
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 appProtocol AppProtocol
var containerImage ContainerImage
var credentialSpec CredentialSpec
var environmentFile EnvironmentFile
var linuxParameters LinuxParameters
var logDriver LogDriver
var secret Secret
var taskDefinition TaskDefinition

firelensLogRouter := awscdk.Aws_ecs.NewFirelensLogRouter(this, jsii.String("MyFirelensLogRouter"), &FirelensLogRouterProps{
	FirelensConfig: &FirelensConfig{
		Type: awscdk.*Aws_ecs.FirelensLogRouterType_FLUENTBIT,

		// the properties below are optional
		Options: &FirelensOptions{
			ConfigFileType: awscdk.*Aws_ecs.FirelensConfigFileType_S3,
			ConfigFileValue: jsii.String("configFileValue"),
			EnableECSLogMetadata: jsii.Boolean(false),
		},
	},
	Image: containerImage,
	TaskDefinition: taskDefinition,

	// the properties below are optional
	Command: []*string{
		jsii.String("command"),
	},
	ContainerName: jsii.String("containerName"),
	Cpu: jsii.Number(123),
	CredentialSpecs: []CredentialSpec{
		credentialSpec,
	},
	DisableNetworking: jsii.Boolean(false),
	DnsSearchDomains: []*string{
		jsii.String("dnsSearchDomains"),
	},
	DnsServers: []*string{
		jsii.String("dnsServers"),
	},
	DockerLabels: map[string]*string{
		"dockerLabelsKey": jsii.String("dockerLabels"),
	},
	DockerSecurityOptions: []*string{
		jsii.String("dockerSecurityOptions"),
	},
	EnableRestartPolicy: jsii.Boolean(false),
	EntryPoint: []*string{
		jsii.String("entryPoint"),
	},
	Environment: map[string]*string{
		"environmentKey": jsii.String("environment"),
	},
	EnvironmentFiles: []EnvironmentFile{
		environmentFile,
	},
	Essential: jsii.Boolean(false),
	ExtraHosts: map[string]*string{
		"extraHostsKey": jsii.String("extraHosts"),
	},
	GpuCount: jsii.Number(123),
	HealthCheck: &HealthCheck{
		Command: []*string{
			jsii.String("command"),
		},

		// the properties below are optional
		Interval: cdk.Duration_Minutes(jsii.Number(30)),
		Retries: jsii.Number(123),
		StartPeriod: cdk.Duration_*Minutes(jsii.Number(30)),
		Timeout: cdk.Duration_*Minutes(jsii.Number(30)),
	},
	Hostname: jsii.String("hostname"),
	InferenceAcceleratorResources: []*string{
		jsii.String("inferenceAcceleratorResources"),
	},
	Interactive: jsii.Boolean(false),
	LinuxParameters: linuxParameters,
	Logging: logDriver,
	MemoryLimitMiB: jsii.Number(123),
	MemoryReservationMiB: jsii.Number(123),
	PortMappings: []PortMapping{
		&PortMapping{
			ContainerPort: jsii.Number(123),

			// the properties below are optional
			AppProtocol: appProtocol,
			ContainerPortRange: jsii.String("containerPortRange"),
			HostPort: jsii.Number(123),
			Name: jsii.String("name"),
			Protocol: awscdk.*Aws_ecs.Protocol_TCP,
		},
	},
	Privileged: jsii.Boolean(false),
	PseudoTerminal: jsii.Boolean(false),
	ReadonlyRootFilesystem: jsii.Boolean(false),
	RestartAttemptPeriod: cdk.Duration_*Minutes(jsii.Number(30)),
	RestartIgnoredExitCodes: []*f64{
		jsii.Number(123),
	},
	Secrets: map[string]Secret{
		"secretsKey": secret,
	},
	StartTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
	StopTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
	SystemControls: []SystemControl{
		&SystemControl{
			Namespace: jsii.String("namespace"),
			Value: jsii.String("value"),
		},
	},
	Ulimits: []Ulimit{
		&Ulimit{
			HardLimit: jsii.Number(123),
			Name: awscdk.*Aws_ecs.UlimitName_CORE,
			SoftLimit: jsii.Number(123),
		},
	},
	User: jsii.String("user"),
	VersionConsistency: awscdk.*Aws_ecs.VersionConsistency_ENABLED,
	WorkingDirectory: jsii.String("workingDirectory"),
})

Initializer ​

ts
new FirelensLogRouter(scope: Construct, id: string, props: FirelensLogRouterProps)
python
FirelensLogRouter(scope: Construct, id: str, props: FirelensLogRouterProps)
java
new FirelensLogRouter(Construct scope, String id, FirelensLogRouterProps props)
csharp
new FirelensLogRouter(Construct scope, string id, FirelensLogRouterProps props)
go
NewFirelensLogRouter(Scope Construct, Id *string, Props FirelensLogRouterProps)

Construct Props ​

commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string#
The command that is passed to the container.

Default: CMD value built into container image.

If you provide a shell command as a single string, you have to quote command-line arguments.

containerNameoptionalstringcontainer_nameoptionalstrcontainerNameoptionalStringContainerNameoptionalstringContainerNameoptional*string#
The name of the container.

Default: id of node associated with ContainerDefinition.

cpuoptionalnumbercpuoptionalint | floatcpuoptionalNumberCpuoptionaldoubleCpuoptional*float64#
The minimum number of CPU units to reserve for the container.

Default: No minimum CPU units reserved.

credentialSpecsoptionalCredentialSpec[]credential_specsoptionaltyping.List[CredentialSpec]credentialSpecsoptionalList<CredentialSpec>CredentialSpecsoptionalCredentialSpec[]CredentialSpecsoptional*[]CredentialSpec#
A list of ARNs in SSM or Amazon S3 to a credential spec (`CredSpec`) file that configures the container for Active Directory authentication.

Default: No credential specs.

We recommend that you use this parameter instead of the dockerSecurityOptions.

Currently, only one credential spec is allowed per container definition.

disableNetworkingoptionalbooleandisable_networkingoptionalbooldisableNetworkingoptionalBooleanDisableNetworkingoptionalboolDisableNetworkingoptional*bool= false#
Specifies whether networking is disabled within the container.

When this parameter is true, networking is disabled within the container.

dnsSearchDomainsoptionalstring[]dns_search_domainsoptionaltyping.List[str]dnsSearchDomainsoptionalList<String>DnsSearchDomainsoptionalstring[]DnsSearchDomainsoptional*[]*string#
A list of DNS search domains that are presented to the container.

Default: No search domains.

dnsServersoptionalstring[]dns_serversoptionaltyping.List[str]dnsServersoptionalList<String>DnsServersoptionalstring[]DnsServersoptional*[]*string#
A list of DNS servers that are presented to the container.

Default: Default DNS servers.

dockerLabelsoptional{ [key: string]: string }docker_labelsoptionaltyping.Mapping[str, str]dockerLabelsoptionalMap<String, String>DockerLabelsoptionalIDictionary<string, string>DockerLabelsoptional*map[string]*string#
A key/value map of labels to add to the container.

Default: No labels.

dockerSecurityOptionsoptionalstring[]docker_security_optionsoptionaltyping.List[str]dockerSecurityOptionsoptionalList<String>DockerSecurityOptionsoptionalstring[]DockerSecurityOptionsoptional*[]*string#
A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.

Default: No security labels.

enableRestartPolicyoptionalbooleanenable_restart_policyoptionalboolenableRestartPolicyoptionalBooleanEnableRestartPolicyoptionalboolEnableRestartPolicyoptional*bool#
Enable a restart policy for a container.

Default: false unless restartIgnoredExitCodes or restartAttemptPeriod is set.

When you set up a restart policy, Amazon ECS can restart the container without needing to replace the task.

entryPointoptionalstring[]entry_pointoptionaltyping.List[str]entryPointoptionalList<String>EntryPointoptionalstring[]EntryPointoptional*[]*string#
The ENTRYPOINT value to pass to the container.

Default: Entry point configured in container.

environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#
The environment variables to pass to the container.

Default: No environment variables.

environmentFilesoptionalEnvironmentFile[]environment_filesoptionaltyping.List[EnvironmentFile]environmentFilesoptionalList<EnvironmentFile>EnvironmentFilesoptionalEnvironmentFile[]EnvironmentFilesoptional*[]EnvironmentFile#
The environment files to pass to the container.

Default: No environment files.

essentialoptionalbooleanessentialoptionalboolessentialoptionalBooleanEssentialoptionalboolEssentialoptional*bool= true#
Specifies whether the container is marked essential.
notes

If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false, then its failure does not affect the rest of the containers in a task. All tasks must have at least one essential container.

If this parameter is omitted, a container is assumed to be essential.

extraHostsoptional{ [key: string]: string }extra_hostsoptionaltyping.Mapping[str, str]extraHostsoptionalMap<String, String>ExtraHostsoptionalIDictionary<string, string>ExtraHostsoptional*map[string]*string#
A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.

Default: No extra hosts.

firelensConfigFirelensConfigfirelens_configFirelensConfigfirelensConfigFirelensConfigFirelensConfigFirelensConfigFirelensConfigFirelensConfigrequired#
Firelens configuration.
gpuCountoptionalnumbergpu_countoptionalint | floatgpuCountoptionalNumberGpuCountoptionaldoubleGpuCountoptional*float64#
The number of GPUs assigned to the container.

Default: No GPUs assigned.

healthCheckoptionalHealthCheckhealth_checkoptionalHealthCheckhealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheck#
The health check command and associated configuration parameters for the container.

Default: Health check configuration from container.

hostnameoptionalstringhostnameoptionalstrhostnameoptionalStringHostnameoptionalstringHostnameoptional*string#
The hostname to use for your container.

Default: Automatic hostname.

The image used to start a container.
notes

This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest. TODO: Update these to specify using classes of IContainerImage

inferenceAcceleratorResourcesoptionalstring[]inference_accelerator_resourcesoptionaltyping.List[str]inferenceAcceleratorResourcesoptionalList<String>InferenceAcceleratorResourcesoptionalstring[]InferenceAcceleratorResourcesoptional*[]*string#
The inference accelerators referenced by the container.

Default: No inference accelerators assigned.

interactiveoptionalbooleaninteractiveoptionalboolinteractiveoptionalBooleanInteractiveoptionalboolInteractiveoptional*bool= false#
When this parameter is true, you can deploy containerized applications that require stdin or a tty to be allocated.
linuxParametersoptionalLinuxParameterslinux_parametersoptionalLinuxParameterslinuxParametersoptionalLinuxParametersLinuxParametersoptionalLinuxParametersLinuxParametersoptionalLinuxParameters#
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.

Default: No Linux parameters.

For more information see KernelCapabilities.

loggingoptionalLogDriverloggingoptionalLogDriverloggingoptionalLogDriverLoggingoptionalLogDriverLoggingoptionalLogDriver#
The log configuration specification for the container.

Default: Containers use the same logging driver that the Docker daemon uses.

memoryLimitMiBoptionalnumbermemory_limit_mi_boptionalint | floatmemoryLimitMiBoptionalNumberMemoryLimitMiBoptionaldoubleMemoryLimitMiBoptional*float64#
The amount (in MiB) of memory to present to the container.

Default: No memory limit.

If your container attempts to exceed the allocated memory, the container is terminated.

At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

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

Default: No memory reserved.

notes

When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first.

At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

portMappingsoptionalPortMapping[]port_mappingsoptionaltyping.List[PortMapping]portMappingsoptionalList<PortMapping>PortMappingsoptionalPortMapping[]PortMappingsoptional*[]PortMapping#
The port mappings to add to the container definition.

Default: No ports are mapped.

privilegedoptionalbooleanprivilegedoptionalboolprivilegedoptionalBooleanPrivilegedoptionalboolPrivilegedoptional*bool= false#
Specifies whether the container is marked as privileged.

When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).

pseudoTerminaloptionalbooleanpseudo_terminaloptionalboolpseudoTerminaloptionalBooleanPseudoTerminaloptionalboolPseudoTerminaloptional*bool= false#
When this parameter is true, a TTY is allocated.

This parameter maps to Tty in the "Create a container section" of the Docker Remote API and the --tty option to docker run.

readonlyRootFilesystemoptionalbooleanreadonly_root_filesystemoptionalboolreadonlyRootFilesystemoptionalBooleanReadonlyRootFilesystemoptionalboolReadonlyRootFilesystemoptional*bool= false#
When this parameter is true, the container is given read-only access to its root file system.
restartAttemptPeriodoptionalDurationrestart_attempt_periodoptionalDurationrestartAttemptPeriodoptionalDurationRestartAttemptPeriodoptionalDurationRestartAttemptPeriodoptionalDuration#
A period of time that the container must run for before a restart can be attempted.

Default: Duration.seconds(300) if enableRestartPolicy is true, otherwise no period.

notes

A container can be restarted only once every restartAttemptPeriod seconds. If a container isn't able to run for this time period and exits early, it will not be restarted.

This property can't be used if enableRestartPolicy is set to false.

You can set a minimum restartAttemptPeriod of 60 seconds and a maximum restartAttemptPeriod of 1800 seconds.

restartIgnoredExitCodesoptionalnumber[]restart_ignored_exit_codesoptionaltyping.List[int | float]restartIgnoredExitCodesoptionalList<Number>RestartIgnoredExitCodesoptionaldouble[]RestartIgnoredExitCodesoptional*[]*float64#
A list of exit codes that Amazon ECS will ignore and not attempt a restart on.

Default: No exit codes are ignored.

This property can't be used if enableRestartPolicy is set to false.

You can specify a maximum of 50 container exit codes.

secretsoptional{ [key: string]: Secret }secretsoptionaltyping.Mapping[str, Secret]secretsoptionalMap<String, Secret>SecretsoptionalIDictionary<string, Secret>Secretsoptional*map[string]Secret#
The secret environment variables to pass to the container.

Default: No secret environment variables.

startTimeoutoptionalDurationstart_timeoutoptionalDurationstartTimeoutoptionalDurationStartTimeoutoptionalDurationStartTimeoutoptionalDuration= none#
Time duration (in seconds) to wait before giving up on resolving dependencies for a container.
stopTimeoutoptionalDurationstop_timeoutoptionalDurationstopTimeoutoptionalDurationStopTimeoutoptionalDurationStopTimeoutoptionalDuration= none#
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.
systemControlsoptionalSystemControl[]system_controlsoptionaltyping.List[SystemControl]systemControlsoptionalList<SystemControl>SystemControlsoptionalSystemControl[]SystemControlsoptional*[]SystemControl#
A list of namespaced kernel parameters to set in the container.

Default: No system controls are set.

taskDefinitionTaskDefinitiontask_definitionTaskDefinitiontaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionrequired#
The name of the task definition that includes this container definition.

[disable-awslint:ref-via-interface]

ulimitsoptionalUlimit[]ulimitsoptionaltyping.List[Ulimit]ulimitsoptionalList<Ulimit>UlimitsoptionalUlimit[]Ulimitsoptional*[]Ulimit#
An array of ulimits to set in the container.
useroptionalstringuseroptionalstruseroptionalStringUseroptionalstringUseroptional*string= root#
The user to use inside the container.

This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

versionConsistencyoptionalVersionConsistencyversion_consistencyoptionalVersionConsistencyversionConsistencyoptionalVersionConsistencyVersionConsistencyoptionalVersionConsistencyVersionConsistencyoptionalVersionConsistency#
Specifies whether Amazon ECS will resolve the container image tag provided in the container definition to an image digest.

Default: VersionConsistency.DISABLED if image is a CDK asset, VersionConsistency.ENABLED otherwise

If you set the value for a container as disabled, Amazon ECS will not resolve the provided container image tag to a digest and will use the original image URI specified in the container definition for deployment.

workingDirectoryoptionalstringworking_directoryoptionalstrworkingDirectoryoptionalStringWorkingDirectoryoptionalstringWorkingDirectoryoptional*string= /#
The working directory in which to run commands inside the container.

Properties ​

CONTAINER_PORT_USE_RANGEnumbercontainer_port_use_rangeint | floatCONTAINER_PORT_USE_RANGENumberCONTAINER_PORT_USE_RANGEdoubleCONTAINER_PORT_USE_RANGE*float64requiredstatic#
containerDependenciesContainerDependency[]container_dependenciestyping.List[ContainerDependency]containerDependenciesList<ContainerDependency>ContainerDependenciesContainerDependency[]ContainerDependencies*[]ContainerDependencyrequired#
An array dependencies defined for container startup and shutdown.
containerNamestringcontainer_namestrcontainerNameStringContainerNamestringContainerName*stringrequired#
The name of this container.
containerPortnumbercontainer_portint | floatcontainerPortNumberContainerPortdoubleContainerPort*float64required#
The port the container will listen on.
cpumay be undefinednumbercpumay be undefinedint | floatcpumay be undefinedNumberCpumay be undefineddoubleCpumay be undefined*float64#
The number of cpu units reserved for the container.
credentialSpecsmay be undefinedCredentialSpecConfig[]credential_specsmay be undefinedtyping.List[CredentialSpecConfig]credentialSpecsmay be undefinedList<CredentialSpecConfig>CredentialSpecsmay be undefinedCredentialSpecConfig[]CredentialSpecsmay be undefined*[]CredentialSpecConfig#
The crdential specifications for this container.
environmentFilesmay be undefinedEnvironmentFileConfig[]environment_filesmay be undefinedtyping.List[EnvironmentFileConfig]environmentFilesmay be undefinedList<EnvironmentFileConfig>EnvironmentFilesmay be undefinedEnvironmentFileConfig[]EnvironmentFilesmay be undefined*[]EnvironmentFileConfig#
The environment files for this container.
essentialbooleanessentialboolessentialBooleanEssentialboolEssential*boolrequired#
Specifies whether the container will be marked essential.
notes

If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false, then its failure does not affect the rest of the containers in a task.

If this parameter is omitted, a container is assumed to be essential.

firelensConfigFirelensConfigfirelens_configFirelensConfigfirelensConfigFirelensConfigFirelensConfigFirelensConfigFirelensConfigFirelensConfigrequired#
Firelens configuration.
imageNamestringimage_namestrimageNameStringImageNamestringImageName*stringrequired#
The name of the image referenced by this container.
ingressPortnumberingress_portint | floatingressPortNumberIngressPortdoubleIngressPort*float64required#
The inbound rules associated with the security group the task or service will use.

This property is only used for tasks that use the awsvpc network mode.

linuxParametersmay be undefinedLinuxParameterslinux_parametersmay be undefinedLinuxParameterslinuxParametersmay be undefinedLinuxParametersLinuxParametersmay be undefinedLinuxParametersLinuxParametersmay be undefinedLinuxParameters#
The Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.
logDriverConfigmay be undefinedLogDriverConfiglog_driver_configmay be undefinedLogDriverConfiglogDriverConfigmay be undefinedLogDriverConfigLogDriverConfigmay be undefinedLogDriverConfigLogDriverConfigmay be undefinedLogDriverConfig#
The log configuration specification for the container.
memoryLimitSpecifiedbooleanmemory_limit_specifiedboolmemoryLimitSpecifiedBooleanMemoryLimitSpecifiedboolMemoryLimitSpecified*boolrequired#
Whether there was at least one memory limit specified in this definition.
mountPointsMountPoint[]mount_pointstyping.List[MountPoint]mountPointsList<MountPoint>MountPointsMountPoint[]MountPoints*[]MountPointrequired#
The mount points for data volumes in your container.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
portMappingsPortMapping[]port_mappingstyping.List[PortMapping]portMappingsList<PortMapping>PortMappingsPortMapping[]PortMappings*[]PortMappingrequired#
The list of port mappings for the container.

Port mappings allow containers to access ports on the host container instance to send or receive traffic.

PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
pseudoTerminalmay be undefinedbooleanpseudo_terminalmay be undefinedboolpseudoTerminalmay be undefinedBooleanPseudoTerminalmay be undefinedboolPseudoTerminalmay be undefined*bool#
Specifies whether a TTY must be allocated for this container.
referencesSecretJsonFieldmay be undefinedbooleanreferences_secret_json_fieldmay be undefinedboolreferencesSecretJsonFieldmay be undefinedBooleanReferencesSecretJsonFieldmay be undefinedboolReferencesSecretJsonFieldmay be undefined*bool#
Whether this container definition references a specific JSON field of a secret stored in Secrets Manager.
taskDefinitionTaskDefinitiontask_definitionTaskDefinitiontaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionrequired#
The name of the task definition that includes this container definition.
ulimitsUlimit[]ulimitstyping.List[Ulimit]ulimitsList<Ulimit>UlimitsUlimit[]Ulimits*[]Ulimitrequired#
An array of ulimits to set in the container.
volumesFromVolumeFrom[]volumes_fromtyping.List[VolumeFrom]volumesFromList<VolumeFrom>VolumesFromVolumeFrom[]VolumesFrom*[]VolumeFromrequired#
The data volumes to mount from another container in the same task definition.

Methods ​

addContainerDependencies(...containerDependencies: ContainerDependency[]): voiddef add_container_dependencies(self, container_dependencies: ContainerDependency) -> Nonepublic void addContainerDependencies(ContainerDependency containerDependencies)public void AddContainerDependencies(ContainerDependency containerDependencies)func AddContainerDependencies(ContainerDependencies ContainerDependency)#
This method adds one or more container dependencies to the container.
addDockerLabel(name: string, value: string): voiddef add_docker_label(self, name: str, value: str) -> Nonepublic void addDockerLabel(String name, String value)public void AddDockerLabel(string name, string value)func AddDockerLabel(Name *string, Value *string)#
This method adds a Docker label to the container.
addEnvironment(name: string, value: string): voiddef add_environment(self, name: str, value: str) -> Nonepublic void addEnvironment(String name, String value)public void AddEnvironment(string name, string value)func AddEnvironment(Name *string, Value *string)#
This method adds an environment variable to the container.
addInferenceAcceleratorResource(...inferenceAcceleratorResources: string[]): voiddef add_inference_accelerator_resource(self, inference_accelerator_resources: str) -> Nonepublic void addInferenceAcceleratorResource(String inferenceAcceleratorResources)public void AddInferenceAcceleratorResource(string inferenceAcceleratorResources)func AddInferenceAcceleratorResource(InferenceAcceleratorResources *string)#
This method adds one or more resources to the container.
addMountPoints(...mountPoints: MountPoint[]): voiddef add_mount_points(self, mount_points: MountPoint) -> Nonepublic void addMountPoints(MountPoint mountPoints)public void AddMountPoints(MountPoint mountPoints)func AddMountPoints(MountPoints MountPoint)#
This method adds one or more mount points for data volumes to the container.
addPortMappings(...portMappings: PortMapping[]): voiddef add_port_mappings(self, port_mappings: PortMapping) -> Nonepublic void addPortMappings(PortMapping portMappings)public void AddPortMappings(PortMapping portMappings)func AddPortMappings(PortMappings PortMapping)#
This method adds one or more port mappings to the container.
addScratch(scratch: ScratchSpace): voiddef add_scratch(self, scratch: ScratchSpace) -> Nonepublic void addScratch(ScratchSpace scratch)public void AddScratch(ScratchSpace scratch)func AddScratch(Scratch ScratchSpace)#
This method mounts temporary disk space to the container.

This adds the correct container mountPoint and task definition volume.

addSecret(name: string, secret: Secret): voiddef add_secret(self, name: str, secret: Secret) -> Nonepublic void addSecret(String name, Secret secret)public void AddSecret(string name, Secret secret)func AddSecret(Name *string, Secret Secret)#
This method adds a secret as environment variable to the container.
addToExecutionPolicy(statement: PolicyStatement): voiddef add_to_execution_policy(self, statement: PolicyStatement) -> Nonepublic void addToExecutionPolicy(PolicyStatement statement)public void AddToExecutionPolicy(PolicyStatement statement)func AddToExecutionPolicy(Statement PolicyStatement)#
This method adds the specified statement to the IAM task execution policy in the task definition.
addUlimits(...ulimits: Ulimit[]): voiddef add_ulimits(self, ulimits: Ulimit) -> Nonepublic void addUlimits(Ulimit ulimits)public void AddUlimits(Ulimit ulimits)func AddUlimits(Ulimits Ulimit)#
This method adds one or more ulimits to the container.
addVolumesFrom(...volumesFrom: VolumeFrom[]): voiddef add_volumes_from(self, volumes_from: VolumeFrom) -> Nonepublic void addVolumesFrom(VolumeFrom volumesFrom)public void AddVolumesFrom(VolumeFrom volumesFrom)func AddVolumesFrom(VolumesFrom VolumeFrom)#
This method adds one or more volumes to the container.
findPortMapping(containerPort: number, protocol: Protocol): PortMappingdef find_port_mapping(self, container_port: int | float, protocol: Protocol) -> PortMappingpublic PortMapping findPortMapping(Number containerPort, Protocol protocol)public PortMapping FindPortMapping(double containerPort, Protocol protocol)func FindPortMapping(ContainerPort *float64, Protocol Protocol) PortMapping#
Returns the host port for the requested container port if it exists.
findPortMappingByName(name: string): PortMappingdef find_port_mapping_by_name(self, name: str) -> PortMappingpublic PortMapping findPortMappingByName(String name)public PortMapping FindPortMappingByName(string name)func FindPortMappingByName(Name *string) PortMapping#
Returns the port mapping with the given name, if it exists.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

renderContainerDefinition(_taskDefinition?: TaskDefinition): CfnTaskDefinition.ContainerDefinitionPropertydef render_container_definition(self, _task_definition: typing.Optional[TaskDefinition] = None) -> ContainerDefinitionPropertypublic ContainerDefinitionProperty renderContainerDefinition(TaskDefinition _taskDefinition)public ContainerDefinitionProperty RenderContainerDefinition(TaskDefinition? _taskDefinition = null)func RenderContainerDefinition(_taskDefinition TaskDefinition) ContainerDefinitionProperty#
Render this container definition to a CloudFormation object.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining