1 Answer
- Newest
- Most votes
- Most comments
0
Hi Brent,
To parse your CSV data and store each data point as a separate item in DynamoDB, follow these steps:
-
Create an IoT Rule:
- Set up a rule to trigger a Lambda function when data is received.
-
Lambda Function:
- Write a Lambda function to process the data and insert each data point into DynamoDB. Here's a concise Python example:
import json import boto3 dynamodb = boto3.client('dynamodb') def lambda_handler(event, context): payload = event['payload'] for i, data_point in enumerate(payload): item = { 'Key': {'S': f'dDataMain-{i}'}, 'DataPoint': {'S': str(data_point)} } dynamodb.put_item(TableName='YourDynamoDBTableName', Item=item) return {'statusCode': 200, 'body': 'Data points written to DynamoDB successfully'}
-
Deploy and Test:
- Deploy the Lambda function.
- Update the IoT rule to invoke the Lambda.
- Test with your CSV data to ensure each point is stored as a separate item.
I'm glad to help.
Relevant content
- asked 9 months ago
- asked 10 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago
Thank you very much Victor. Much appreciated!!!