The SQS Message Processor efficiently processes messages from Amazon SQS, where each message represents an IMEI and a date range for data retrieval.
-
Fetch Data from MongoDB:
- Retrieve data for the specified IMEI and date range from MongoDB.
- Maintain a reusable database connection.
-
Convert Data to XLSX:
- Convert fetched data to XLSX format in memory.
-
Upload XLSX to S3:
- Upload XLSX file to S3 with format:
{IMEI}/{YYYY-MM-DDT00:00:00.000Z}-{IMEI}.xlsx
- Upload XLSX file to S3 with format:
- Memory: 1.5 GB
- Execution Time: 60 seconds
Generates daily backup events for unique IMEIs, pushing them to SQS at 00:00:01 UTC for the previous day.
-
Retrieve Unique IMEIs:
- Fetch unique IMEIs from the database.
-
Create Events in SQS:
- For each IMEI, create an event in SQS with a 5-second delay between events.
- For 100 devices: ~497.5 seconds
- Lambda Limit: 900 seconds
REST API endpoint for retrieving pre-signed S3 URLs for a specified IMEI and date range.
- Lambda Time: 15 minutes
- Memory: 512 MB
-
S3 Object Lifecycle:
- Objects older than 30 days may transition to S3 Glacier.
- Retrieving older data may take extra time; high day requests may timeout.
-
To-Do:
- Implement authentication for secure access.