Skip to content
v2.274.0

LinuxParameters ​

Linux-specific options that are applied to the container.

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_batch as batch } from 'aws-cdk-lib';

declare const size: cdk.Size;
const linuxParameters = new batch.LinuxParameters(this, 'MyLinuxParameters', /* all optional props */ {
  initProcessEnabled: false,
  maxSwap: size,
  sharedMemorySize: size,
  swappiness: 123,
});
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_batch as batch

# size: cdk.Size

linux_parameters = batch.LinuxParameters(self, "MyLinuxParameters",
    init_process_enabled=False,
    max_swap=size,
    shared_memory_size=size,
    swappiness=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.*;
import software.amazon.awscdk.services.batch.*;

Size size;

LinuxParameters linuxParameters = LinuxParameters.Builder.create(this, "MyLinuxParameters")
        .initProcessEnabled(false)
        .maxSwap(size)
        .sharedMemorySize(size)
        .swappiness(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;
using Amazon.CDK.AWS.Batch;

Size size;

var linuxParameters = new LinuxParameters(this, "MyLinuxParameters", new LinuxParametersProps {
    InitProcessEnabled = false,
    MaxSwap = size,
    SharedMemorySize = size,
    Swappiness = 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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var size Size

linuxParameters := awscdk.Aws_batch.NewLinuxParameters(this, jsii.String("MyLinuxParameters"), &LinuxParametersProps{
	InitProcessEnabled: jsii.Boolean(false),
	MaxSwap: size,
	SharedMemorySize: size,
	Swappiness: jsii.Number(123),
})

Initializer ​

ts
new LinuxParameters(scope: Construct, id: string, props?: LinuxParametersProps)
python
LinuxParameters(scope: Construct, id: str, props: typing.Optional[LinuxParametersProps] = None)
java
new LinuxParameters(Construct scope, String id, LinuxParametersProps props)
csharp
new LinuxParameters(Construct scope, string id, LinuxParametersProps? props = null)
go
NewLinuxParameters(Scope Construct, Id *string, Props LinuxParametersProps)

Construct Props ​

initProcessEnabledbooleaninit_process_enabledboolinitProcessEnabledBooleanInitProcessEnabledboolInitProcessEnabled*bool= false#
Specifies whether to run an init process inside the container that forwards signals and reaps processes.
maxSwapSizemax_swapSizemaxSwapSizeMaxSwapSizeMaxSwapSize= No 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.

sharedMemorySizeSizeshared_memory_sizeSizesharedMemorySizeSizeSharedMemorySizeSizeSharedMemorySizeSize= No shared memory.#
The value for the size of the /dev/shm volume.
swappinessnumberswappinessint | floatswappinessNumberSwappinessdoubleSwappiness*float64= 60#
This allows you to tune a container's memory swappiness behavior.
notes

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.

Properties ​

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.

Methods ​

addDevices(...device: Device[]): voiddef add_devices(self, device: Device) -> Nonepublic void addDevices(Device device)public void AddDevices(Device device)func AddDevices(Device Device)#
Adds one or more host devices to a container.
addTmpfs(...tmpfs: Tmpfs[]): voiddef add_tmpfs(self, tmpfs: Tmpfs) -> Nonepublic void addTmpfs(Tmpfs tmpfs)public void AddTmpfs(Tmpfs tmpfs)func AddTmpfs(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.

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.

renderLinuxParameters(): CfnJobDefinition.LinuxParametersPropertydef render_linux_parameters(self, ) -> LinuxParametersPropertypublic LinuxParametersProperty renderLinuxParameters()public LinuxParametersProperty RenderLinuxParameters()func RenderLinuxParameters() LinuxParametersProperty#
Renders the Linux parameters to the Batch version of this resource, which does not have 'capabilities' and requires tmpfs.containerPath to be defined.
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