Reputation: 4000
I've setup an aws-lambda function that is triggered by an S3 bucket.
The bucket will have different "categories" of things uploaded to it and those will be put into the key when they are uploaded. We didn't want to create a bunch of buckets with short lifetimes.
We'd like to be able to install different instances of the lambda via script, and be able to tell each, "You will only act on keys containing this string prefix"
I can do that in the code if I had the value to filter on, but how can I communicate this configuration/parameter to the lambda at deployment time?
Upvotes: 0
Views: 101
Reputation: 78553
You should plan for the different categories of object to each have a different prefix, for example:
Then you can configure notifications for each prefix individually. That way, you can trigger one Lambda function for images, one for documents, etc.
To see how to use the S3 Console to set up event notifications that trigger a Lambda function (or write to SQS or SNS), see How Do I Enable and Configure Event Notifications for an S3 Bucket?
Upvotes: 1
Reputation: 13111
Using AWS Lambda environment variables would be a common solution, iiuc.
Also, +1000 to "didn't want to create a bunch of buckets with short lifetimes" :)
Upvotes: 0