EcsJobDefinitionProps Struct
Props for EcsJobDefinition.
Example
ts
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
container: new batch.EcsFargateContainerDefinition(this, 'myFargateContainer', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
memory: cdk.Size.mebibytes(2048),
cpu: 256,
ephemeralStorageSize: cdk.Size.gibibytes(100),
fargateCpuArchitecture: ecs.CpuArchitecture.ARM64,
fargateOperatingSystemFamily: ecs.OperatingSystemFamily.LINUX,
}),
});
python
job_defn = batch.EcsJobDefinition(self, "JobDefn",
container=batch.EcsFargateContainerDefinition(self, "myFargateContainer",
image=ecs.ContainerImage.from_registry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
memory=cdk.Size.mebibytes(2048),
cpu=256,
ephemeral_storage_size=cdk.Size.gibibytes(100),
fargate_cpu_architecture=ecs.CpuArchitecture.ARM64,
fargate_operating_system_family=ecs.OperatingSystemFamily.LINUX
)
)
java
EcsJobDefinition jobDefn = EcsJobDefinition.Builder.create(this, "JobDefn")
.container(EcsFargateContainerDefinition.Builder.create(this, "myFargateContainer")
.image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"))
.memory(Size.mebibytes(2048))
.cpu(256)
.ephemeralStorageSize(Size.gibibytes(100))
.fargateCpuArchitecture(CpuArchitecture.ARM64)
.fargateOperatingSystemFamily(OperatingSystemFamily.LINUX)
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var jobDefn = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
Container = new EcsFargateContainerDefinition(this, "myFargateContainer", new EcsFargateContainerDefinitionProps {
Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
Memory = Size.Mebibytes(2048),
Cpu = 256,
EphemeralStorageSize = Size.Gibibytes(100),
FargateCpuArchitecture = CpuArchitecture.ARM64,
FargateOperatingSystemFamily = OperatingSystemFamily.LINUX
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
jobDefn := batch.NewEcsJobDefinition(this, jsii.String("JobDefn"), &EcsJobDefinitionProps{
Container: batch.NewEcsFargateContainerDefinition(this, jsii.String("myFargateContainer"), &EcsFargateContainerDefinitionProps{
Image: ecs.ContainerImage_FromRegistry(jsii.String("public.ecr.aws/amazonlinux/amazonlinux:latest")),
Memory: cdk.Size_Mebibytes(jsii.Number(2048)),
Cpu: jsii.Number(256),
EphemeralStorageSize: cdk.Size_Gibibytes(jsii.Number(100)),
FargateCpuArchitecture: ecs.CpuArchitecture_ARM64(),
FargateOperatingSystemFamily: ecs.OperatingSystemFamily_LINUX(),
}),
})
Properties
containerIEcsContainerDefinitioncontainerIEcsContainerDefinitioncontainerIEcsContainerDefinitionContainerIEcsContainerDefinitionContainerIEcsContainerDefinitionrequired#The container that this job will run.
jobDefinitionNameoptionalstringjob_definition_nameoptionalstrjobDefinitionNameoptionalStringJobDefinitionNameoptionalstringJobDefinitionNameoptional*string#The name of this job definition.
Default: generated by CloudFormation
parametersoptional{ [key: string]: any }parametersoptionaltyping.Mapping[str, Any]parametersoptionalMap<String, Object>ParametersoptionalIDictionary<string, object>Parametersoptional*map[string]interface{}= none#The default parameters passed to the container These parameters can be referenced in the `command` that you give to the container.
propagateTagsoptionalbooleanpropagate_tagsoptionalboolpropagateTagsoptionalBooleanPropagateTagsoptionalboolPropagateTagsoptional*bool= false#Whether to propagate tags from the JobDefinition to the ECS task that Batch spawns.
retryAttemptsoptionalnumberretry_attemptsoptionalint | floatretryAttemptsoptionalNumberRetryAttemptsoptionaldoubleRetryAttemptsoptional*float64= 1#The number of times to retry a job.
The job is retried on failure the same number of attempts as the value.
retryStrategiesoptionalRetryStrategy[]retry_strategiesoptionaltyping.List[RetryStrategy]retryStrategiesoptionalList<RetryStrategy>RetryStrategiesoptionalRetryStrategy[]RetryStrategiesoptional*[]RetryStrategy#Defines the retry behavior for this job.
Default: no RetryStrategy
schedulingPriorityoptionalnumberscheduling_priorityoptionalint | floatschedulingPriorityoptionalNumberSchedulingPriorityoptionaldoubleSchedulingPriorityoptional*float64= none#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.
skipDeregisterOnUpdateoptionalbooleanskip_deregister_on_updateoptionalboolskipDeregisterOnUpdateoptionalBooleanSkipDeregisterOnUpdateoptionalboolSkipDeregisterOnUpdateoptional*bool#Specifies whether the previous revision of the job definition is retained in an active status after UPDATE events for the resource.
Default: undefined - AWS Batch default is false
When the property is set to false, the previous revision of the job definition is de-registered after a new revision is created. When the property is set to true, the previous revision of the job definition is not de-registered.
timeoutoptionalDurationtimeoutoptionalDurationtimeoutoptionalDurationTimeoutoptionalDurationTimeoutoptionalDuration#The timeout time for jobs that are submitted with this job definition.
Default: no timeout
After the amount of time you specify passes, Batch terminates your jobs if they aren't finished.