1

I am new to AWS lambda service. I want to know if there is way to trigger a lambda function when a specific file arrives.

helloV
  • 50,176
  • 7
  • 137
  • 145
Gilli
  • 237
  • 3
  • 5
  • trigger Lambda Function once the file is uploaded to s3 bucket; https://stackoverflow.com/questions/43314871/how-to-trigger-my-lambda-function-once-the-file-is-uploaded-to-s3-bucket – Sheece Gardazi Dec 31 '18 at 05:12

3 Answers3

2

S3 can trigger a Lambda based on an event (example: s3:ObjectCreated). It cannot trigger a Lambda for a specific object. That logic should be in Lambda.

When a Lambda gets triggered due to object creation, the Lambda function also gets information about the object. Lambda can then choose to continue or exit based on the object attributes.

helloV
  • 50,176
  • 7
  • 137
  • 145
1

If I understand your requirement correctly, one option you could try is "Prefix" filtering.

You can also use prefix filters on the object name (the “path” is just a string in reality). So if you name files like, “IMAGE001” and “DOC002” and you only want to send documents to Lambda, you can set a prefix of “DOC”.

kosa
  • 65,990
  • 13
  • 130
  • 167
0

Option 1 : upload those files to specific prefix and trigger an event for object created.

Option 2 : add a prefix to your object key and trigger an event for object created. Then filter event from lamda based on file name prefix

Amith Jayasekara
  • 421
  • 1
  • 4
  • 11