Class EcsEc2ContainerDefinition
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.batch.EcsEc2ContainerDefinition
- All Implemented Interfaces:
IEcsContainerDefinition
,IEcsEc2ContainerDefinition
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-09-11T18:01:11.994Z")
@Stability(Stable)
public class EcsEc2ContainerDefinition
extends software.constructs.Construct
implements IEcsEc2ContainerDefinition, IEcsContainerDefinition
A container orchestrated by ECS that uses EC2 resources.
Example:
IVpc vpc; EcsJobDefinition ecsJob = EcsJobDefinition.Builder.create(this, "JobDefn") .container(EcsEc2ContainerDefinition.Builder.create(this, "containerDefn") .image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest")) .memory(Size.mebibytes(2048)) .cpu(256) .build()) .build(); JobQueue queue = JobQueue.Builder.create(this, "JobQueue") .computeEnvironments(List.of(OrderedComputeEnvironment.builder() .computeEnvironment(ManagedEc2EcsComputeEnvironment.Builder.create(this, "managedEc2CE") .vpc(vpc) .build()) .order(1) .build())) .priority(10) .build(); User user = new User(this, "MyUser"); ecsJob.grantSubmitJob(user, queue);
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A fluent builder forEcsEc2ContainerDefinition
.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.IEcsContainerDefinition
IEcsContainerDefinition.Jsii$Default, IEcsContainerDefinition.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IEcsEc2ContainerDefinition
IEcsEc2ContainerDefinition.Jsii$Default, IEcsEc2ContainerDefinition.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
EcsEc2ContainerDefinition
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
EcsEc2ContainerDefinition
(software.amazon.jsii.JsiiObjectRef objRef) EcsEc2ContainerDefinition
(software.constructs.Construct scope, String id, EcsEc2ContainerDefinitionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a ulimit to this container.void
Add a Volume to this container.The command that's passed to the container.getCpu()
The number of vCPUs reserved for the container.The environment variables to pass to a container.The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.getGpu()
The number of physical GPUs to reserve for the container.getImage()
The image that this container will run.The role that the container can assume.Linux-specific modifications that are applied to the container, such as details for device mappings.The configuration of the log driver.The memory hard limit present to the container.When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).Gives the container readonly access to its root filesystem.A map from environment variable names to the secrets for the container.Limits to set for the user this docker container will run as.getUser()
The user name to use inside the container.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
-
EcsEc2ContainerDefinition
protected EcsEc2ContainerDefinition(software.amazon.jsii.JsiiObjectRef objRef) -
EcsEc2ContainerDefinition
protected EcsEc2ContainerDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EcsEc2ContainerDefinition
@Stability(Stable) public EcsEc2ContainerDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EcsEc2ContainerDefinitionProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
addUlimit
Add a ulimit to this container.- Specified by:
addUlimit
in interfaceIEcsEc2ContainerDefinition
- Parameters:
ulimit
- This parameter is required.
-
addVolume
Add a Volume to this container.- Specified by:
addVolume
in interfaceIEcsContainerDefinition
- Parameters:
volume
- This parameter is required.
-
getCpu
The number of vCPUs reserved for the container.Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.
- Specified by:
getCpu
in interfaceIEcsContainerDefinition
-
getExecutionRole
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.- Specified by:
getExecutionRole
in interfaceIEcsContainerDefinition
- See Also:
-
getImage
The image that this container will run.- Specified by:
getImage
in interfaceIEcsContainerDefinition
-
getMemory
The memory hard limit present to the container.If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.
- Specified by:
getMemory
in interfaceIEcsContainerDefinition
-
getUlimits
Limits to set for the user this docker container will run as.- Specified by:
getUlimits
in interfaceIEcsEc2ContainerDefinition
-
getVolumes
The volumes to mount to this container.Automatically added to the job definition.
- Specified by:
getVolumes
in interfaceIEcsContainerDefinition
-
getCommand
The command that's passed to the container.- Specified by:
getCommand
in interfaceIEcsContainerDefinition
- See Also:
-
getEnvironment
The environment variables to pass to a container.Cannot start with
AWS_BATCH
. We don't recommend using plaintext environment variables for sensitive information, such as credential data.- Specified by:
getEnvironment
in interfaceIEcsContainerDefinition
-
getGpu
The number of physical GPUs to reserve for the container.Make sure that the number of GPUs reserved for all containers in a job doesn't exceed the number of available GPUs on the compute resource that the job is launched on.
- Specified by:
getGpu
in interfaceIEcsEc2ContainerDefinition
-
getJobRole
The role that the container can assume.- Specified by:
getJobRole
in interfaceIEcsContainerDefinition
- See Also:
-
getLinuxParameters
Linux-specific modifications that are applied to the container, such as details for device mappings.- Specified by:
getLinuxParameters
in interfaceIEcsContainerDefinition
-
getLogDriverConfig
The configuration of the log driver.- Specified by:
getLogDriverConfig
in interfaceIEcsContainerDefinition
-
getPrivileged
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).- Specified by:
getPrivileged
in interfaceIEcsEc2ContainerDefinition
-
getReadonlyRootFilesystem
Gives the container readonly access to its root filesystem.- Specified by:
getReadonlyRootFilesystem
in interfaceIEcsContainerDefinition
-
getSecrets
A map from environment variable names to the secrets for the container.Allows your job definitions to reference the secret by the environment variable name defined in this property.
- Specified by:
getSecrets
in interfaceIEcsContainerDefinition
- See Also:
-
getUser
The user name to use inside the container.- Specified by:
getUser
in interfaceIEcsContainerDefinition
-