Trigger glue workflow when specific file type is uploaded in the S3 bucket object

0

I am trying to create rule in eventbridge to trigger a workflow when a specific file format is upload in the desired object of s3 bucket.

{
  "source": ["aws.s3"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": ["s3.amazonaws.com"],
    "eventName": ["PutObject"],
    "requestParameters": {
      "bucketName": ["my-bucket"],
      "key": [{
        "prefix": "folder1/folder2"
      }],
        "FileName": [ { "suffix": ".xlsx" } ]
    }
  }
}

I upload files say in s3://my-bucket/folder1/folder2/folder3/test.xlsx, glue workflow is not triggered. Can someone help me in this event pattern to trigger workflow for specific file type?

2 Answers
0

Have you also added a target to the rule - the above code defines what eventbridge should be looking for, not what to do with it.

There is a page in AWS documentation outlining the steps to add the target - https://docs.aws.amazon.com/glue/latest/dg/starting-workflow-eventbridge.html

profile picture
answered a year ago
  • Thank you @simon hammer! Yes, I added a target in the workflow with event-bridge trigger.

0

Hi, if you look at the "suffix" example in https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html it gives an example "FileName": [ { "suffix": ".png" } ] which checks if the field "FileName" in the event has the suffix ".png". I see you too have used "FileName" but does your event really have a field with this name? I haven't checked the S3 event definition but maybe you mean "key"?

EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions