- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.3k
 
chore(sqs): increase maximum message size limit to 1 MiB #35283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update maxMessageSizeBytes limit from 262,144 bytes (256 KiB) to 1,048,576 bytes (1 MiB) - Update validation rules to enforce new maximum limit - Add comprehensive tests for boundary validation and edge cases - Ensure CloudFormation synthesis works correctly with new limit
          self-review and TODO notes:The current tests are quite comprehensive and cover the essential scenarios: boundary conditions, token handling, and CloudFormation synthesis. They effectively validate the change. However, if we were to raise the bar even higher, we could make a small improvement by using data-driven tests for the boundary validation. This would make the test more concise and easier to Here's how we could refactor the maxMessageSizeBytes validation enforces correct limits test using test.each:     1 test.each([
    2   { size: 1023, valid: false, description: 'just below lower bound' },
    3   { size: 1024, valid: true, description: 'at lower bound' },
    4   { size: 1048576, valid: true, description: 'at upper bound' },
    5   { size: 1048577, valid: false, description: 'just above upper bound' },
    6 ])('maxMessageSizeBytes validation for $size bytes ($description)', ({ size, valid }) => {
    7   const stack = new Stack();
    8   const constructId = `QueueWithSize${size}`;
    9   const action = () => new sqs.Queue(stack, constructId, { maxMessageSizeBytes: size });
   10
   11   if (valid) {
   12     expect(action).not.toThrow();
   13   } else {
   14     expect(action).toThrow(`Queue initialization failed due to the following validation error(s):\\n- maximum message size must be between 1,024 and 1,048,576 bytes, but ${size} was
      provided`);
   15   }
   16 });Benefits of this approach: 
  | 
    
Update documentation to reflect that AWS SQS default maximum message size has changed from 256 KiB to 1 MiB as per AWS CloudFormation documentation. Addresses review feedback on PR aws#35283.
| 
           Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).  | 
    
| 
           Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).  | 
    
| 
           Comments on closed issues and PRs are hard for our team to see.  | 
    
Issue # (if applicable)
Closes #35276.
Reason for this change
AWS SQS recently increased the maximum message size limit from 256KB to 1MB (announced August 2025), but the CDK validation logic still enforces the old 256KB limit. This prevents users from creating SQS queues with the new maximum message size of 1MB, limiting their ability to fully utilize AWS SQS capabilities.
This enhancement aligns the CDK validation with the current AWS SQS service limits, enabling developers to create queues that can handle larger messages up to 1MB as supported by the underlying AWS service.
Description of changes
Updated the SQS queue validation logic and documentation to support the new 1MB maximum message size limit:
validate-queue-props.tsto change the maximum limit from 262,144 bytes (256KB) to 1,048,576 bytes (1MB) in thevalidateRangefunction callqueue.tsto reflect the new maximum limit from "262144 bytes (256 KiB)" to "1048576 bytes (1 MiB)"Key Design Decisions:
Why These Changes Address the Issue:
Describe any new or updated permissions being added
N/A - This change only updates validation limits and does not require any new IAM permissions or modify resource access patterns.
Description of how you validated changes
Unit Tests: Added comprehensive test coverage with 5 new test scenarios:
Integration Tests: Verified that CDK synthesizes correct CloudFormation templates with the new maximum message size values and that the
MaximumMessageSizeproperty is correctly set to 1048576.Manual Validation:
Regression Testing: All existing SQS tests pass without modification, confirming full backward compatibility is maintained. No existing functionality is broken by these changes.
Performance Testing: No performance impact expected as this only changes validation constants and adds minimal test overhead.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license