使用Pulumi设置EventBridge Cron进行AWS批处理工作
我正在尝试设置EventBridge,以定期开始批处理工作。我可以通过PULUMI部署批处理作业和事件规则,但是当我尝试部署EventTarget时,我会得到此错误:
创建EventBridge目标失败:验证Exception:参数(S) batchparameter不支持目标:my_event_target-ca7145e。
我已经通过AWS控制台为同一批处理作业设置了一个EventBridge,没有任何问题,而且运行良好。
这是代码:
const eventBridgeDeadLetterQueue = new aws.sns.Topic("myEventBridge", {});
const myJob = new aws.batch.JobDefinition("my_job", {
containerProperties: pulumi.interpolate `{
"image": "${myImage}",
"resourceRequirements": [
{"type": "VCPU", "value": "1"},
{"type": "MEMORY", "value": "4096"}
],
"environment": [],
"jobRoleArn": "${myEcsTaskRole.arn}",
"executionRoleArn": "${myEcsTaskExecutionRole.arn}"
}`,
type: "container",
timeout: {
'attemptDurationSeconds': 30 * 60
},
platformCapabilities: ['FARGATE']
});
const myRule = new aws.cloudwatch.EventRule("myRule", {
description: "Fire a batch job",
scheduleExpression: "cron(30 15 * * ? *)"
});
//if I comment out this target, then I can successfully deploy
const myEventTarget = new aws.cloudwatch.EventTarget("my_event_target", {
arn: eventBridgeDeadLetterQueue.arn,
rule: myRule.name,
inputPath: "$", //I have also tried with input: "" and get the same error
batchTarget: {
jobDefinition: myJob.arn,
jobName: "My Job Name"
}
});
我在做什么错?谢谢!
I'm trying to set up EventBridge to kick off a Batch job on a regular schedule. I can deploy the batch job and the event rule through Pulumi, but when I attempt to deploy the EventTarget, I get this error:
Creating EventBridge Target failed: ValidationException: Parameter(s)
BatchParameters not supported for target: my_event_target-ca7145e.
I have set up an EventBridge for the same batch job through the AWS Console with no issue, and it runs fine.
Here is the code:
const eventBridgeDeadLetterQueue = new aws.sns.Topic("myEventBridge", {});
const myJob = new aws.batch.JobDefinition("my_job", {
containerProperties: pulumi.interpolate `{
"image": "${myImage}",
"resourceRequirements": [
{"type": "VCPU", "value": "1"},
{"type": "MEMORY", "value": "4096"}
],
"environment": [],
"jobRoleArn": "${myEcsTaskRole.arn}",
"executionRoleArn": "${myEcsTaskExecutionRole.arn}"
}`,
type: "container",
timeout: {
'attemptDurationSeconds': 30 * 60
},
platformCapabilities: ['FARGATE']
});
const myRule = new aws.cloudwatch.EventRule("myRule", {
description: "Fire a batch job",
scheduleExpression: "cron(30 15 * * ? *)"
});
//if I comment out this target, then I can successfully deploy
const myEventTarget = new aws.cloudwatch.EventTarget("my_event_target", {
arn: eventBridgeDeadLetterQueue.arn,
rule: myRule.name,
inputPath: "quot;, //I have also tried with input: "" and get the same error
batchTarget: {
jobDefinition: myJob.arn,
jobName: "My Job Name"
}
});
What am I doing wrong? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论