Search code examples
amazon-web-servicesamazon-cloudwatchaws-batch

How do I add a custom tag to an AWS Batch job submission so that it shows up in CloudWatch status change events?


For example, for billing purposes, I'd like to pass a tag with information that can be passed to the CloudWatch event.

  1. Submit job to AWS Batch with tag "billTo: Jensen121"
  2. Cloudwatch fires status change event with the tag
  3. Separate application reads the Cloudwatch event, reads the tag, and bills the correct customer

Solution

  • Job tags are not included in the CloudWatch state change event, see the documentation. However, your application can read the job ID from the detail.jobId event field and then use DescribeJobs API to get the tags.