interface BatchJobProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Targets.BatchJobProps |
![]() | software.amazon.awscdk.services.events.targets.BatchJobProps |
![]() | aws_cdk.aws_events_targets.BatchJobProps |
![]() | @aws-cdk/aws-events-targets » BatchJobProps |
Customize the Batch Job Event Target.
Example
import * as batch from '@aws-cdk/aws-batch';
import { ContainerImage } from '@aws-cdk/aws-ecs';
const jobQueue = new batch.JobQueue(this, 'MyQueue', {
computeEnvironments: [
{
computeEnvironment: new batch.ComputeEnvironment(this, 'ComputeEnvironment', {
managed: false,
}),
order: 1,
},
],
});
const jobDefinition = new batch.JobDefinition(this, 'MyJob', {
container: {
image: ContainerImage.fromRegistry('test-repo'),
},
});
const queue = new sqs.Queue(this, 'Queue');
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
rule.addTarget(new targets.BatchJob(
jobQueue.jobQueueArn,
jobQueue,
jobDefinition.jobDefinitionArn,
jobDefinition, {
deadLetterQueue: queue,
event: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
retryAttempts: 2,
maxEventAge: cdk.Duration.hours(2),
},
));
Properties
Name | Type | Description |
---|---|---|
attempts? | number | The number of times to attempt to retry, if the job fails. |
dead | IQueue | The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue. |
event? | Rule | The event to send to the Lambda. |
job | string | The name of the submitted job. |
max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
retry | number | The maximum number of times to retry when the function returns an error. |
size? | number | The size of the array, if this is an array batch job. |
attempts?
Type:
number
(optional, default: no retryStrategy is set)
The number of times to attempt to retry, if the job fails.
Valid values are 1–10.
deadLetterQueue?
Type:
IQueue
(optional, default: no dead-letter queue)
The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
event?
Type:
Rule
(optional, default: the entire EventBridge event)
The event to send to the Lambda.
This will be the payload sent to the Lambda Function.
jobName?
Type:
string
(optional, default: Automatically generated)
The name of the submitted job.
maxEventAge?
Type:
Duration
(optional, default: Duration.hours(24))
The maximum age of a request that Lambda sends to a function for processing.
Minimum value of 60. Maximum value of 86400.
retryAttempts?
Type:
number
(optional, default: 185)
The maximum number of times to retry when the function returns an error.
Minimum value of 0. Maximum value of 185.
size?
Type:
number
(optional, default: no arrayProperties are set)
The size of the array, if this is an array batch job.
Valid values are integers between 2 and 10,000.