Skip to content
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

Cloudformation stack refactor fails with templateBody size constraint error #9297

Open
1 task
SorinFlueras opened this issue Feb 13, 2025 · 9 comments
Open
1 task
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@SorinFlueras
Copy link

Describe the bug

Issue Summary

The aws cloudformation create-stack-refactor command executes successfully and returns a StackRefactorId. However, when running aws cloudformation describe-stack-refactor on the returned StackRefactorId, the following error appears:

{
    "StackRefactorId": "xxxxx-xxxxx-xxxxx",
    "StackIds": [
        "arn:aws:cloudformation:region:account-id:stack/my-stack-1/xxxxx",
        "arn:aws:cloudformation:region:account-id:stack/my-stack-2/xxxxx"
    ],
    "ExecutionStatus": "UNAVAILABLE",
    "Status": "CREATE_FAILED",
    "StatusReason": "arn:aws:cloudformation:region:account-id:stack/my-stack-1/xxxxx:  1 validation error detected: Value '{Cloudformation Template Content}' at 'templateBody' failed to satisfy constraint: Member must have length less than or equal to 51200"
}

This happens even when TemplateBody is not passed and only TemplateURL is used.

Command used

aws cloudformation create-stack-refactor \
  --stack-definitions \
    StackName=my-stack-1,TemplateURL=https://example-bucket.s3.us-east-1.amazonaws.com/infrastructure.yaml \
    StackName=my-stack-2,TemplateURL=https://example-bucket.s3.us-east-1.amazonaws.com/database.yaml \
  --enable-stack-creation

(My templates in S3 are 59.1 KB and 2.7 KB.)

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

• The stack refactor operation should proceed successfully because TemplateBody is not provided.
• Since TemplateURL is being used, the 51200-character limit should not apply.
• The describe-stack-refactor command should not fail due to a template size limitation.

Current Behavior

Command fails as described in Issue summary

Reproduction Steps

Run the aws cloudformation create-stack-refactor command using TemplateURL from S3 with a size bigger than 50 KB.

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.24.2 Python/3.12.6 Darwin/24.3.0 exe/x86_64

Environment details (OS name and version, etc.)

macOS Sequoia 15.3

@SorinFlueras SorinFlueras added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 13, 2025
@khushail khushail self-assigned this Feb 14, 2025
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 14, 2025
@seanmurph
Copy link

seanmurph commented Feb 14, 2025

+1 experiencing this issue with all templates in S3. (aws-cli/2.24.4 Python/3.12.6 Darwin/24.3.0 exe/x86_64). I tried using both HTTPs and S3 URIs.

@khushail khushail added the p2 This is a standard priority issue label Feb 18, 2025
@saeidp
Copy link

saeidp commented Feb 19, 2025

We are also experiencing the same issue

@nanookmetaal
Copy link

Experiencing the same issue - aws-cli/2.24.7 Python/3.12.6 Linux/5.15.167.4-microsoft-standard-WSL2 exe/x86_64.ubuntu.24

@khushail
Copy link

Thanks for reporting this @SorinFlueras, I am able to reproduce the issue and can see getting error with template size >50kb.
However I did not find any doc that mentions this limit in size in neither Cloudformation API doc nor in CLI Docs. Investigating further to find the root cause. Will share updates.

@khushail
Copy link

khushail commented Feb 19, 2025

So this is whats mentioned in AWS Docs -https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html

Image

Stack refactoring -https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stack-refactoring.html

@khushail khushail added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Feb 19, 2025
@khushail
Copy link

.Seems to be a service API Issue, created an internal ticket with them for further analysis -P202904574

@khushail khushail removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Feb 19, 2025
@LoganB99
Copy link

On a similar note, my first command doesn't succeed at all.

Unable to parse response (syntax error: line 1, column 0), invalid XML received. Further retries may succeed:
b'HTTP content length exceeded 251904 bytes.'

One file is 203 KB and the other is 41 KB.

@humanonymous
Copy link

@RyanFitzSimmonsAK can this get a higher priority please? We are stuck in the middle of migration because of this bug.

@RyanFitzSimmonsAK
Copy link
Contributor

@RyanFitzSimmonsAK can this get a higher priority please? We are stuck in the middle of migration because of this bug.

We have not heard back from the service team yet. I just reached out again and emphasized that this is blocking people. I'll let you know when I have any updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

8 participants