AWS Security ChangesHomeSearch

AWS powertools documentation change

Service: powertools · 2025-11-16 · Documentation low

File: powertools/java/latest/utilities/large_messages.md

Summary

Updated documentation for AWS Lambda Powertools Large Messages utility with increased message size limit from 256KB to 1MB, added functional API examples, version updates to 2.7.0, and improved configuration guidance.

Security assessment

The changes primarily update size limits and usage patterns without addressing security vulnerabilities. While message size limits relate to system reliability, there's no evidence of a security vulnerability being patched. The version update to 2.7.0 might include security improvements, but the diff doesn't explicitly mention any security fixes.

Diff

diff --git a/powertools/java/latest/utilities/large_messages.md b/powertools/java/latest/utilities/large_messages.md
index f5e8f50ce..6302a70b0 100644
--- a//powertools/java/latest/utilities/large_messages.md
+++ b//powertools/java/latest/utilities/large_messages.md
@@ -22,0 +23 @@ Initializing search
+  * [ Usage patterns  ](../../usage-patterns/)
@@ -41 +42,2 @@ Initializing search
-      * Annotation 
+      * Usage 
+        * Basic usage 
@@ -62 +64,2 @@ Table of contents
-  * Annotation 
+  * Usage 
+    * Basic usage 
@@ -70 +73 @@ Table of contents
-The large message utility handles SQS and SNS messages which have had their payloads offloaded to S3 if they are larger than the maximum allowed size (256 KB).
+The large message utility handles SQS and SNS messages which have had their payloads offloaded to S3 if they are larger than the maximum allowed size (1 MB).
@@ -95 +98 @@ The large message utility handles SQS and SNS messages which have had their payl
-                bigMsg: MessageBody > 256KB ?
+                bigMsg: MessageBody > 1MB ?
@@ -99,2 +102,2 @@ The large message utility handles SQS and SNS messages which have had their payl
-                if_big --> [*]: size(body) <= 256kb
-                if_big --> putObject: size(body) > 256kb
+                if_big --> [*]: size(body) <= 1MB
+                if_big --> putObject: size(body) > 1MB
@@ -139 +142 @@ The large message utility handles SQS and SNS messages which have had their payl
-SQS and SNS message payload is limited to 256KB. If you wish to send messages with a larger payload, you can leverage the [amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) or [amazon-sns-java-extended-client-lib](https://github.com/awslabs/amazon-sns-java-extended-client-lib) which offload the message to Amazon S3. See documentation ([SQS](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-s3-messages.html) / [SNS](https://docs.aws.amazon.com/sns/latest/dg/large-message-payloads.html))
+SQS and SNS message payload is limited to 1MB. If you wish to send messages with a larger payload, you can leverage the [amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) or [amazon-sns-java-extended-client-lib](https://github.com/awslabs/amazon-sns-java-extended-client-lib) which offload the message to Amazon S3. See documentation ([SQS](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-s3-messages.html) / [SNS](https://docs.aws.amazon.com/sns/latest/dg/large-message-payloads.html))
@@ -145 +148 @@ This utility automatically retrieves messages which have been offloaded to S3 us
-This utility is compatible with versions _[1.1.0+](https://github.com/awslabs/amazon-sqs-java-extended-client-lib/releases/tag/1.1.0)_ of amazon-sqs-java-extended-client-lib and _[1.0.0+](https://github.com/awslabs/amazon-sns-java-extended-client-lib/releases/tag/1.0.0)_ of amazon-sns-java-extended-client-lib.
+This utility is compatible with versions _[1.1.0+](https://github.com/awslabs/amazon-sqs-java-extended-client-lib/releases/tag/1.1.0)_ and _[2.0.0+](https://github.com/awslabs/amazon-sqs-java-extended-client-lib/releases/tag/2.0.0)_ of [amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) / [amazon-sns-java-extended-client-lib](https://github.com/awslabs/amazon-sns-java-extended-client-lib).
@@ -199,0 +203 @@ MavenGradle
+    49
@@ -209 +213 @@ MavenGradle
-            <version>2.5.0</version>
+            <version>2.7.0</version>
@@ -214,0 +219 @@ MavenGradle
+    <!-- Note: This AspectJ configuration is not needed when using the functional approach -->
@@ -278 +283 @@ MavenGradle
-            id 'io.freefair.aspectj.post-compile-weaving' version '8.1.0'
+            id 'io.freefair.aspectj.post-compile-weaving' version '8.1.0' // Not needed when using the functional approach
@@ -286 +291 @@ MavenGradle
-            aspect 'software.amazon.lambda:powertools-large-messages:2.5.0'
+            aspect 'software.amazon.lambda:powertools-large-messages:2.7.0' // Use 'implementation' instead of 'aspect' when using the functional approach
@@ -304 +309 @@ As the utility interacts with Amazon S3, the lambda function must have the follo
-## Annotation¶
+## Usage¶
@@ -306 +311,3 @@ As the utility interacts with Amazon S3, the lambda function must have the follo
-The annotation `@LargeMessage` can be used on any method where the _first_ parameter is one of:
+You can use the Large Messages utility with either the `@LargeMessage` annotation or the functional API.
+
+The `@LargeMessage` annotation can be used on any method where the _first_ parameter is one of:
@@ -313 +320,5 @@ The annotation `@LargeMessage` can be used on any method where the _first_ param
-SQS ExampleSNS Example
+The functional API `LargeMessages.processLargeMessage()` accepts the same message types.
+
+### Basic usage¶
+
+@LargeMessage annotation - SQSFunctional API - SQS@LargeMessage annotation - SNSFunctional API - SNS
@@ -355,0 +367,41 @@ SQS ExampleSNS Example
+---|---  
+      
+    
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+    14
+    15
+    16
+
+| 
+    
+    
+    import software.amazon.lambda.powertools.largemessages.LargeMessages;
+    
+    public class SqsMessageHandler implements RequestHandler<SQSEvent, SQSBatchResponse> {
+    
+        @Override
+        public SQSBatchResponse handleRequest(SQSEvent event, Context context) {
+            for (SQSMessage message: event.getRecords()) {
+                LargeMessages.processLargeMessage(message, this::processRawMessage);
+            }
+            return SQSBatchResponse.builder().build();
+        }
+    
+        private void processRawMessage(SQSEvent.SQSMessage sqsMessage) {
+            // sqsMessage.getBody() will contain the content of the S3 object
+        }
+    }
+      
+  
@@ -394,0 +447,37 @@ SQS ExampleSNS Example
+---|---  
+      
+    
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+    14
+
+| 
+    
+    
+    import software.amazon.lambda.powertools.largemessages.LargeMessages;
+    
+    public class SnsRecordHandler implements RequestHandler<SNSEvent, String> {
+    
+        @Override
+        public String handleRequest(SNSEvent event, Context context) {
+            return LargeMessages.processLargeMessage(event.records.get(0), this::processSNSRecord);
+        }
+    
+        private String processSNSRecord(SNSEvent.SNSRecord snsRecord) {
+            // snsRecord.getSNS().getMessage() will contain the content of the S3 object
+            return "Hello World";
+        }
+    }
+      
+  
@@ -401 +490 @@ If this is the case, the utility will retrieve the object from S3 using the `get
-After your code is invoked and returns without error, the object is deleted from S3 using the `deleteObject(bucket, key)` API. You can disable the deletion of S3 objects with the following configuration:
+After your code is invoked and returns without error, the object is deleted from S3 using the `deleteObject(bucket, key)` API. You can disable the deletion of S3 objects:
@@ -403 +492 @@ After your code is invoked and returns without error, the object is deleted from
-Don't delete S3 Objects
+@LargeMessage annotationFunctional API
@@ -419,0 +509,11 @@ Don't delete S3 Objects
+---|---  
+      
+    
+    1
+
+| 
+    
+    
+    LargeMessages.processLargeMessage(message, this::processRawMessage, false);
+      
+  
@@ -425,0 +526,2 @@ This utility works perfectly together with the batch module (`powertools-batch`)
+@LargeMessage annotationFunctional API
+
@@ -473,0 +576,58 @@ Combining batch and large message modules
+Combining batch and large message modules  
+---  
+      
+    
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+    14
+    15
+    16
+    17
+    18
+    19
+    20
+    21
+    22
+    23
+    24
+
+| 
+    
+    
+    import software.amazon.lambda.powertools.largemessages.LargeMessages;
+    
+    public class SqsBatchHandler implements RequestHandler<SQSEvent, SQSBatchResponse> {
+        private final BatchMessageHandler<SQSEvent, SQSBatchResponse> handler;
+    
+        public SqsBatchHandler() {
+            handler = new BatchMessageHandlerBuilder()