Batch job tags don't show up everywhere

0

When creating new AWS Batch jobs via the SubmitJob API (done in Python, boto3), I see the submitted tags show up in the AWS Batch console. Where I don't see them though, is

  • The DescribeJob API (done via AWS CLI, aws batch describe-jobs ...
  • Job State change events sent to EventBridge

Is this a bug or intended behavior?

If it's intended, what is the appropriate way to tag my jobs so that Batch events have arbitrary key/value pairs that I can match EventBridge rules against?

질문됨 2년 전306회 조회
1개 답변
0
수락된 답변

I found a way to do solve my (EventBridge) problem using AWS Batch's parameters option for jobs.

This is a way to write an EventBridge rule that matches a specific parameter set for filtering purposes

{
  "source": ["aws.batch"],
  "detail-type": ["Batch Job State Change"],
  "detail": {
    "parameters": {
      "match_me_exactly": ["only-this-should-match"]
    }
  }
}

This will filter down to job state events that come from a job submitted like so

batch_client.submit_job(
  # other stuff here ...
  parameters={"match_me_exactly": "only-this-should-match"}
)

Other types of content matching can be figured out from EventBridge's docs https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html#eb-filtering-complex-example

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인