Class EcsJobDefinition
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.batch.EcsJobDefinition
- All Implemented Interfaces:
IEnvironmentAware,IResource,IJobDefinition,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:09:59.632Z")
@Stability(Stable)
public class EcsJobDefinition
extends Resource
implements IJobDefinition
A JobDefinition that uses ECS orchestration.
Example:
IFileSystem myFileSystem;
Role myJobRole;
myFileSystem.grantRead(myJobRole);
EcsJobDefinition jobDefn = 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)
.volumes(List.of(EcsVolume.efs(EfsVolumeOptions.builder()
.name("myVolume")
.fileSystem(myFileSystem)
.containerPath("/Volumes/myVolume")
.useJobRole(true)
.build())))
.jobRole(myJobRole)
.build())
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IJobDefinition
IJobDefinition.Jsii$Default, IJobDefinition.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEcsJobDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedEcsJobDefinition(software.amazon.jsii.JsiiObjectRef objRef) EcsJobDefinition(software.constructs.Construct scope, String id, EcsJobDefinitionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRetryStrategy(RetryStrategy strategy) Add a RetryStrategy to this JobDefinition.static IJobDefinitionfromJobDefinitionArn(software.constructs.Construct scope, String id, String jobDefinitionArn) Import a JobDefinition by its arn.The container that this job will run.The ARN of this job definition.The name of this job definition.The default parameters passed to the container These parameters can be referenced in thecommandthat you give to the container.Whether to propagate tags from the JobDefinition to the ECS task that Batch spawns.The number of times to retry a job.Defines the retry behavior for this job.The priority of this Job.The timeout time for jobs that are submitted with this job definition.voidgrantSubmitJob(IGrantable identity, IJobQueue queue) Grants thebatch:submitJobpermission to the identity on both this job definition and thequeue.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
EcsJobDefinition
protected EcsJobDefinition(software.amazon.jsii.JsiiObjectRef objRef) -
EcsJobDefinition
protected EcsJobDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EcsJobDefinition
@Stability(Stable) public EcsJobDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EcsJobDefinitionProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromJobDefinitionArn
@Stability(Stable) @NotNull public static IJobDefinition fromJobDefinitionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String jobDefinitionArn) Import a JobDefinition by its arn.- Parameters:
scope- This parameter is required.id- This parameter is required.jobDefinitionArn- This parameter is required.
-
addRetryStrategy
Add a RetryStrategy to this JobDefinition.- Specified by:
addRetryStrategyin interfaceIJobDefinition- Parameters:
strategy- This parameter is required.
-
grantSubmitJob
@Stability(Stable) public void grantSubmitJob(@NotNull IGrantable identity, @NotNull IJobQueue queue) Grants thebatch:submitJobpermission to the identity on both this job definition and thequeue.- Parameters:
identity- This parameter is required.queue- This parameter is required.
-
getContainer
The container that this job will run. -
getJobDefinitionArn
The ARN of this job definition.- Specified by:
getJobDefinitionArnin interfaceIJobDefinition
-
getJobDefinitionName
The name of this job definition.- Specified by:
getJobDefinitionNamein interfaceIJobDefinition
-
getRetryStrategies
Defines the retry behavior for this job.- Specified by:
getRetryStrategiesin interfaceIJobDefinition
-
getParameters
The default parameters passed to the container These parameters can be referenced in thecommandthat you give to the container.- Specified by:
getParametersin interfaceIJobDefinition- See Also:
-
getPropagateTags
Whether to propagate tags from the JobDefinition to the ECS task that Batch spawns. -
getRetryAttempts
The number of times to retry a job.The job is retried on failure the same number of attempts as the value.
- Specified by:
getRetryAttemptsin interfaceIJobDefinition
-
getSchedulingPriority
The priority of this Job.Only used in Fairshare Scheduling to decide which job to run first when there are multiple jobs with the same share identifier.
- Specified by:
getSchedulingPriorityin interfaceIJobDefinition
-
getTimeout
The timeout time for jobs that are submitted with this job definition.After the amount of time you specify passes, Batch terminates your jobs if they aren't finished.
- Specified by:
getTimeoutin interfaceIJobDefinition
-