LinuxParametersProps

class aws_cdk.aws_ecs.LinuxParametersProps(*, init_process_enabled=None, max_swap=None, shared_memory_size=None, swappiness=None)

Bases: object

The properties for defining Linux-specific options that are applied to the container.

Parameters:
  • init_process_enabled (Optional[bool]) – Specifies whether to run an init process inside the container that forwards signals and reaps processes. Default: false

  • max_swap (Optional[Size]) – The total amount of swap memory a container can use. This parameter will be translated to the –memory-swap option to docker run. This parameter is only supported when you are using the EC2 launch type. Accepted values are positive integers. Default: No swap.

  • shared_memory_size (Union[int, float, None]) – The value for the size of the /dev/shm volume. Default: No shared memory.

  • swappiness (Union[int, float, None]) – This allows you to tune a container’s memory swappiness behavior. This parameter maps to the –memory-swappiness option to docker run. The swappiness relates to the kernel’s tendency to swap memory. A value of 0 will cause swapping to not happen unless absolutely necessary. A value of 100 will cause pages to be swapped very aggressively. This parameter is only supported when you are using the EC2 launch type. Accepted values are whole numbers between 0 and 100. If a value is not specified for maxSwap then this parameter is ignored. Default: 60

ExampleMetadata:

infused

Example:

# task_definition: ecs.TaskDefinition


task_definition.add_container("container",
    image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
    memory_limit_mi_b=1024,
    linux_parameters=ecs.LinuxParameters(self, "LinuxParameters",
        init_process_enabled=True,
        shared_memory_size=1024,
        max_swap=Size.mebibytes(5000),
        swappiness=90
    )
)

Attributes

init_process_enabled

Specifies whether to run an init process inside the container that forwards signals and reaps processes.

Default:

false

max_swap

The total amount of swap memory a container can use.

This parameter will be translated to the –memory-swap option to docker run.

This parameter is only supported when you are using the EC2 launch type. Accepted values are positive integers.

Default:

No swap.

shared_memory_size

The value for the size of the /dev/shm volume.

Default:

No shared memory.

swappiness

This allows you to tune a container’s memory swappiness behavior.

This parameter maps to the –memory-swappiness option to docker run. The swappiness relates to the kernel’s tendency to swap memory. A value of 0 will cause swapping to not happen unless absolutely necessary. A value of 100 will cause pages to be swapped very aggressively.

This parameter is only supported when you are using the EC2 launch type. Accepted values are whole numbers between 0 and 100. If a value is not specified for maxSwap then this parameter is ignored.

Default:

60