IoT Core to Amazon S3 to AWS Lambda

IoT → S3 → Lambda

Create a IoT Rule with a S3 action that puts messages in a S3 bucket and triggers a Lambda function to extract the S3 object key.

This pattern contains a sample AWS CDK stack to create an IoT Rule with a S3 action and an AWS Lambda function.
When a message is published to the IoT topic defined in the IoT Rule, this message will be saved as an object in the S3 bucket. The object is added to the prefix `iot/` and is identified by the timestamp in unix format. The Lambda function is configured with an event source mapping and it will be triggered when a new object is added to the `iot/` prefix. In this sample the Lambda function extracts and logs the S3 object key.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/iot-s3-lambda-cdk

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk delete.

Created by:

Patrick Malatesta

Patrick Malatesta

Cloud Infrastructure Architect at AWS Professional Services