CloudFormation: 51,200-byte template limit is applied to templates referenced by S3 URL (CreateStack and CreateChangeSet)

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, rust

Research direction

Start by locating the CloudFormation CreateStack and CreateChangeSet handlers and tracing how each processes TemplateURL versus TemplateBody. Check where the 51,200-byte validation is applied, then compare it with the documented 1 MB limit for S3 templates. Done means both operations accept a template larger than 51,200 bytes from S3 while inline templates still enforce the existing limit.

Written by the indexing model from the issue text.

Description

What happened

Creating a stack from a template stored in S3 fails when the template is larger than 51,200 bytes, even though the template is passed by URL rather than inline.

  • Uploaded a 66,829-byte JSON template to an S3 bucket in the emulator and called CreateStack with TemplateURL. It failed with: 1 validation error detected: Value at 'templateBody' failed to satisfy constraint: Member must have length less than or equal to 51200
  • CreateChangeSet with the same TemplateURL failed with the same error.
  • For comparison, CreateStack with the same content passed as TemplateBody fails with the same message. That one matches AWS.

What you expected

Per the CloudFormation quotas documentation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html), the 51,200-byte limit applies to a template body passed directly in a request, while a template stored in an S3 object may be up to 1 MB. A 66,829-byte template referenced by TemplateURL should therefore be accepted, as it is on AWS.

Steps to reproduce

  1. Install and start the emulator (Linux .deb package, default settings, endpoint https://127.0.0.1:9297, Region us-east-1). Pointed the client at it using the emulator's own config and credentials files, plus AWS_ENDPOINT_URL.
  2. Create an S3 bucket in the emulator and upload a JSON CloudFormation template larger than 51,200 bytes (the one used was 66,829 bytes).
  3. Call CreateStack (or CreateChangeSet) with TemplateURL set to the uploaded object.

Client: boto3 1.44.1 (Python). Reproduces every time.

Emulator version

Version: 1.0.322
Release date: 2026.11.10
Commit: 7753983c6e495ec3612695b1336bf4936fc7b7fd

Impact and workaround

Any stack whose template exceeds 51,200 bytes cannot be deployed on the emulator at all, including via the S3 route AWS provides for large templates. Workaround for now: split the template into smaller stacks, for example with nested stacks, each under 51,200 bytes.

Additional context

Smaller templates deploy fine through the same S3 route (verified with a small stack containing an S3 bucket and a DynamoDB table reaching CREATE_COMPLETE, with the provisioned resources usable), so the blocker is specifically the size check applied to S3-referenced templates.

Dominant language
Rust
Stars
2.2k
Forks
44
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-emulator

All issues in aws/aws-emulator

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.