LinuxParameters
- class aws_cdk.aws_ecs.LinuxParameters(scope, id, *, init_process_enabled=None, max_swap=None, shared_memory_size=None, swappiness=None)
Bases:
Construct
Linux-specific options that are applied to the container.
- 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 ) )
Constructs a new instance of the LinuxParameters class.
- Parameters:
scope (
Construct
) –id (
str
) –init_process_enabled (
Optional
[bool
]) – Specifies whether to run an init process inside the container that forwards signals and reaps processes. Default: falsemax_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
Methods
- add_capabilities(*cap)
Adds one or more Linux capabilities to the Docker configuration of a container.
Tasks launched on Fargate only support adding the ‘SYS_PTRACE’ kernel capability.
- Parameters:
cap (
Capability
) –- Return type:
None
- add_devices(*device)
Adds one or more host devices to a container.
- Parameters:
device (
Device
) –- Return type:
None
- add_tmpfs(*tmpfs)
Specifies the container path, mount options, and size (in MiB) of the tmpfs mount for a container.
Only works with EC2 launch type.
- Parameters:
tmpfs (
Tmpfs
) –- Return type:
None
- drop_capabilities(*cap)
Removes one or more Linux capabilities to the Docker configuration of a container.
- Parameters:
cap (
Capability
) –- Return type:
None
- render_linux_parameters()
Renders the Linux parameters to a CloudFormation object.
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- node
The tree node.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.