You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-2Lines changed: 80 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,9 @@
5
5
6
6
# aws-lambda-router
7
7
8
-
A small library for [AWS Lambda](https://aws.amazon.com/lambda/details) providing routing for [API Gateway](https://aws.amazon.com/api-gateway)[Proxy Integrations](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html) and [SNS](https://aws.amazon.com/sns).
8
+
A small library for [AWS Lambda](https://aws.amazon.com/lambda/details) providing routing for [API Gateway](https://aws.amazon.com/api-gateway),
For handling calls in Lambdas initiated from AWS-SNS you can use the following code snippet:
126
130
127
131
```js
@@ -173,6 +177,80 @@ The `action` method gets all body elements from the router as an array.
173
177
174
178
If more than one route matches, only the **first** is used!
175
179
180
+
## S3 to Lambda Integrations
181
+
182
+
183
+
Lambdas can be triggered by S3 events. The router now supports these events.
184
+
With the router it is very easy and flexible to connect a lambda to different s3 sources (different buckets). The following possibilities are available:
185
+
186
+
- bucketName: By specifying a fixed _bucketName_ all s3 events with this bucket name are forwarded to a certain action. Instead of a fixed bucket a _RegExp_ is also possible.
187
+
- eventName: By configuring the [S3 event name](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#supported-notification-event-types) the routing can be further restricted. A _RegExp_ is also possible here.
188
+
- objectKeyPrefix: fixed string as an prefix of an object key (but not an RegExp). Is useful if you want to organize your bucket in subfolder.
189
+
190
+
A combination of bucketName, eventName and objectKeyPrefix is possible. If no _bucketName_, _eventName_ and _objectKeyPrefix_ is configured, all s3 events are forwarded to the action.
191
+
192
+
The action method will be called with the [S3Event Structure](https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html)
193
+
194
+
The following examples demonstrates the most use cases:
Per s3 event there can be several entries per event. Than the action methods are called one after the other. The result is an array with objects insides.
253
+
176
254
### Custom response
177
255
178
256
Per default a status code 200 will be returned. This behavior can be overridden.
0 commit comments