amazon web services - Container Overrides from event bridge to aws batch - Stack Overflow

admin2025-04-21  2

Like the title says, I am having trouble setting up container overrides from eventbridge to AWS BATCH.

For context, I use AWS Batch to hold container configurations for an ecs container.

The Eventbridge rule I have set has no problem starting the batch job, it just doesn't pass the container override parameter that I have set using a input transformer

I have a trigger setup in Eventbridge from s3 that detects any file uploads in a folder like so:

Event pattern

{
  "detail": {
    "bucket": {
      "name": ["meter-alarms-ls1-ls2-download-test-app-bucket"]
    },
    "object": {
      "key": [{
        "prefix": "input/"
      }]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}

Then I set the target to my Batch Configurations (Job and Queue).

However I have a little input transformer to target setup like this

Input path

{
  "object_key": "$.detail.object.key"
}

Input template

 {
  "containerOverrides": {
    "environment": [
      {
        "name": "FILE_NAME",
        "value": "<object_key>"
      }
    ]
  }
}

I have tested permissions, and tested if batch can even handle overrides using this command

 aws batch submit-job     
--job-name "TestJob"     
--job-queue "queueName"     
--job-definition "jobDef"     
--container-overrides '{
      "environment": [
        {
          "name": "FILE_NAME",
          "value": "example-file-name"
        }
      ]
    }'

And the batch job works fine.

Like the title says, I am having trouble setting up container overrides from eventbridge to AWS BATCH.

For context, I use AWS Batch to hold container configurations for an ecs container.

The Eventbridge rule I have set has no problem starting the batch job, it just doesn't pass the container override parameter that I have set using a input transformer

I have a trigger setup in Eventbridge from s3 that detects any file uploads in a folder like so:

Event pattern

{
  "detail": {
    "bucket": {
      "name": ["meter-alarms-ls1-ls2-download-test-app-bucket"]
    },
    "object": {
      "key": [{
        "prefix": "input/"
      }]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}

Then I set the target to my Batch Configurations (Job and Queue).

However I have a little input transformer to target setup like this

Input path

{
  "object_key": "$.detail.object.key"
}

Input template

 {
  "containerOverrides": {
    "environment": [
      {
        "name": "FILE_NAME",
        "value": "<object_key>"
      }
    ]
  }
}

I have tested permissions, and tested if batch can even handle overrides using this command

 aws batch submit-job     
--job-name "TestJob"     
--job-queue "queueName"     
--job-definition "jobDef"     
--container-overrides '{
      "environment": [
        {
          "name": "FILE_NAME",
          "value": "example-file-name"
        }
      ]
    }'

And the batch job works fine.

Share Improve this question asked Jan 22 at 21:31 IdentityTheft42069IdentityTheft42069 534 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

As I typed this out and looked at the documentation the answer is actually very stupid.

 {
  "ContainerOverrides": {
    "Environment": [
      {
        "Name": "FILE_NAME",
        "Value": "<object_key>"
      }
    ]
  }
}

It simply just required Capitalisation of each word

转载请注明原文地址:http://anycun.com/QandA/1745227491a90484.html