This seems like an ideal use case for Powertools to reduce the boilerplate code and be able to unwrap an SQS, check for large payload support and retrieve the message as part of the receipt of the message.
{
"Records": [
{
"messageId": "4bdc116c-dda9-4344-bfb1-cf49a2bcdd68",
"receiptHandle": "",
"body": "[\"com.amazon.sqs.javamessaging.MessageS3Pointer\",{\"s3BucketName\":\"bucket_name\",\"s3Key\":\"s3_key\"}]",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1726071666910",
"SequenceNumber": "18888618420438511616",
"MessageGroupId": "d57f6826-89c2-497e-b920-ec6dc5dff067",
"SenderId": "user_id:user@domain.com",
"MessageDeduplicationId": "d39dc4b9-52eb-425e-be3a-c57649d59740",
"ApproximateFirstReceiveTimestamp": "1726071666910"
},
"messageAttributes": {
"SQSLargePayloadSize": {
"stringValue": "300000",
"stringListValues": [],
"binaryListValues": [],
"dataType": "Number"
}
},
"md5OfMessageAttributes": "5db28f0fb9aab47287f040ec3714a262",
"md5OfBody": "d7b208d9230692ec7d4ab5588266024c",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:sqs_name",
"awsRegion": "us-east-1"
}
]
}
Use case
AWS has support for large payloads in SQS using the extended client library: https://pypi.org/project/sqs-extended-client/ - However there's still a fair amount of boilerplate when reacting to the event in a lambda on the receiving end to unwrap the message, check if it's a large payload message, and retrieve the payload from S3.
Solution/User Experience
This seems like an ideal use case for Powertools to reduce the boilerplate code and be able to unwrap an SQS, check for large payload support and retrieve the message as part of the receipt of the message.
Example payload:
Alternative solutions
No response
Acknowledgment