Class EksContainerDefinition
- All Implemented Interfaces:
IEksContainerDefinition
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Example:
EksJobDefinition jobDefn = EksJobDefinition.Builder.create(this, "eksf2") .container(EksContainerDefinition.Builder.create(this, "container") .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample")) .volumes(List.of(EksVolume.emptyDir(EmptyDirVolumeOptions.builder() .name("myEmptyDirVolume") .mountPath("/mount/path") .medium(EmptyDirMediumType.MEMORY) .readonly(true) .sizeLimit(Size.mebibytes(2048)) .build()))) .build()) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IEksContainerDefinition
IEksContainerDefinition.Jsii$Default, IEksContainerDefinition.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
EksContainerDefinition
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
EksContainerDefinition
(software.amazon.jsii.JsiiObjectRef objRef) EksContainerDefinition
(software.constructs.Construct scope, String id, EksContainerDefinitionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Mount a Volume to this container.getArgs()
An array of arguments to the entrypoint.The entrypoint for the container.The hard limit of CPUs to present to this container.The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.getEnv()
The environment variables to pass to this container.The hard limit of GPUs to present to this container.The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.getImage()
The image that this container will run.The image pull policy for this container.The amount (in MiB) of memory to present to the container.The soft limit (in MiB) of memory to reserve for the container.getName()
The name of this container.If specified, gives this container elevated permissions on the host container instance.If specified, gives this container readonly access to its root file system.If specified, the container is run as the specified group ID (gid
).If specified, the container is run as a user with auid
other than 0.If specified, this container is run as the specified user ID (uid
).The Volumes to mount to this container.Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
EksContainerDefinition
protected EksContainerDefinition(software.amazon.jsii.JsiiObjectRef objRef) -
EksContainerDefinition
protected EksContainerDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EksContainerDefinition
@Stability(Stable) public EksContainerDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EksContainerDefinitionProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
addVolume
Mount a Volume to this container.Automatically added to the Pod.
- Specified by:
addVolume
in interfaceIEksContainerDefinition
- Parameters:
volume
- This parameter is required.
-
getImage
The image that this container will run.- Specified by:
getImage
in interfaceIEksContainerDefinition
-
getVolumes
The Volumes to mount to this container.Automatically added to the Pod.
- Specified by:
getVolumes
in interfaceIEksContainerDefinition
- See Also:
-
getArgs
An array of arguments to the entrypoint.If this isn't specified, the CMD of the container image is used. This corresponds to the args member in the Entrypoint portion of the Pod in Kubernetes. Environment variable references are expanded using the container's environment. If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to "$(NAME1)" and the NAME1 environment variable doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with $, and the resulting string isn't expanded. or example, $$(VAR_NAME) is passed as $(VAR_NAME) whether or not the VAR_NAME environment variable exists.
- Specified by:
getArgs
in interfaceIEksContainerDefinition
- See Also:
-
getCommand
The entrypoint for the container.This isn't run within a shell. If this isn't specified, the
ENTRYPOINT
of the container image is used. Environment variable references are expanded using the container's environment. If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to"$(NAME1)"
and theNAME1
environment variable doesn't exist, the command string will remain"$(NAME1)."
$$
is replaced with$
and the resulting string isn't expanded. For example,$$(VAR_NAME)
will be passed as$(VAR_NAME)
whether or not theVAR_NAME
environment variable exists.The entrypoint can't be updated.
- Specified by:
getCommand
in interfaceIEksContainerDefinition
- See Also:
-
getCpuLimit
The hard limit of CPUs to present to this container. Must be an even multiple of 0.25.If your container attempts to exceed this limit, it will be terminated.
At least one of
cpuReservation
andcpuLimit
is required. If both are specified, thencpuLimit
must be at least as large ascpuReservation
.- Specified by:
getCpuLimit
in interfaceIEksContainerDefinition
- See Also:
-
getCpuReservation
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.The container will given at least this many CPUs, but may consume more.
At least one of
cpuReservation
andcpuLimit
is required. If both are specified, thencpuLimit
must be at least as large ascpuReservation
.- Specified by:
getCpuReservation
in interfaceIEksContainerDefinition
- See Also:
-
getEnv
The environment variables to pass to this container.Note: Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for variables that AWS Batch sets.
- Specified by:
getEnv
in interfaceIEksContainerDefinition
-
getGpuLimit
The hard limit of GPUs to present to this container.If your container attempts to exceed this limit, it will be terminated.
If both
gpuReservation
andgpuLimit
are specified, thengpuLimit
must be equal togpuReservation
.- Specified by:
getGpuLimit
in interfaceIEksContainerDefinition
- See Also:
-
getGpuReservation
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.The container will given at least this many CPUs, but may consume more.
If both
gpuReservation
andgpuLimit
are specified, thengpuLimit
must be equal togpuReservation
.- Specified by:
getGpuReservation
in interfaceIEksContainerDefinition
- See Also:
-
getImagePullPolicy
The image pull policy for this container.- Specified by:
getImagePullPolicy
in interfaceIEksContainerDefinition
- See Also:
-
getMemoryLimit
The amount (in MiB) of memory to present to the container.If your container attempts to exceed the allocated memory, it will be terminated.
Must be larger that 4 MiB
At least one of
memoryLimit
andmemoryReservation
is requiredNote: To maximize your resource utilization, provide your jobs with as much memory as possible for the specific instance type that you are using.
- Specified by:
getMemoryLimit
in interfaceIEksContainerDefinition
- See Also:
-
getMemoryReservation
The soft limit (in MiB) of memory to reserve for the container.Your container will be given at least this much memory, but may consume more.
Must be larger that 4 MiB
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
memoryLimit
andmemoryReservation
is required. If both are specified, thenmemoryLimit
must be equal tomemoryReservation
Note: To maximize your resource utilization, provide your jobs with as much memory as possible for the specific instance type that you are using.
- Specified by:
getMemoryReservation
in interfaceIEksContainerDefinition
- See Also:
-
getName
The name of this container.- Specified by:
getName
in interfaceIEksContainerDefinition
-
getPrivileged
If specified, gives this container elevated permissions on the host container instance.The level of permissions are similar to the root user permissions.
This parameter maps to
privileged
policy in the Privileged pod security policies in the Kubernetes documentation.Note: this is only compatible with Kubernetes < v1.25
- Specified by:
getPrivileged
in interfaceIEksContainerDefinition
- See Also:
-
getReadonlyRootFilesystem
If specified, gives this container readonly access to its root file system.This parameter maps to
ReadOnlyRootFilesystem
policy in the Volumes and file systems pod security policies in the Kubernetes documentation.Note: this is only compatible with Kubernetes < v1.25
- Specified by:
getReadonlyRootFilesystem
in interfaceIEksContainerDefinition
- See Also:
-
getRunAsGroup
If specified, the container is run as the specified group ID (gid
).If this parameter isn't specified, the default is the group that's specified in the image metadata. This parameter maps to
RunAsGroup
andMustRunAs
policy in the Users and groups pod security policies in the Kubernetes documentation.Note: this is only compatible with Kubernetes < v1.25
- Specified by:
getRunAsGroup
in interfaceIEksContainerDefinition
- See Also:
-
getRunAsRoot
If specified, the container is run as a user with auid
other than 0.Otherwise, no such rule is enforced. This parameter maps to
RunAsUser
andMustRunAsNonRoot
policy in the Users and groups pod security policies in the Kubernetes documentation.Note: this is only compatible with Kubernetes < v1.25
- Specified by:
getRunAsRoot
in interfaceIEksContainerDefinition
- See Also:
-
getRunAsUser
If specified, this container is run as the specified user ID (uid
).This parameter maps to
RunAsUser
andMustRunAs
policy in the Users and groups pod security policies in the Kubernetes documentation.Note: this is only compatible with Kubernetes < v1.25
- Specified by:
getRunAsUser
in interfaceIEksContainerDefinition
- See Also:
-