How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v25.4.0 (npm 11.7.0)
Amplify CLI Version
14.5.0
What operating system are you using?
macOS 26.5.1 (Apple Silicon)
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Amplify Categories
api
Amplify Commands
migrate (gen2-migration)
Describe the bug
Running amplify gen2-migration lock fails during the Planning phase with a
CloudFormation templateBody validation error. One of our @model types
(Document) generates a nested stack whose template body is ~57.8 KB, which
exceeds CloudFormation's hard 51,200-byte limit for an inline TemplateBody.
The migration tooling appears to send this nested stack template inline
(TemplateBody) to a CloudFormation API call (e.g. ValidateTemplate /
CreateChangeSet) during the lock/plan step, rather than uploading it to S3
and referencing it via TemplateURL. Because Gen 1's own amplify push
already uploads these same templates to the deployment bucket and uses
TemplateURL, the project deploys fine on Gen 1 but cannot be locked for
Gen 2 migration.
The Document model is large because it declares 7 @index GSIs
(byOrganization, byUnit, byProperty, byInsurance, byPortfolio,
byReports, byMortgage). Each generated resolver (get/list/CRUD/3
subscriptions + 7 index queries) inlines a sizable VTL request-mapping
template into the nested stack, pushing the single template over 51,200 bytes.
Expected behavior
amplify gen2-migration lock should succeed for any project that currently
deploys successfully with amplify push. Nested stack templates larger than
51,200 bytes should be uploaded to the deployment S3 bucket and referenced via
TemplateURL (the same approach Gen 1 push uses), instead of being passed
inline via TemplateBody.
Reproduction steps
- Have a Gen 1 GraphQL API with an
@model that has enough @index
directives / resolvers that its generated nested stack template exceeds
51,200 bytes (in our case a model with 7 GSIs).
amplify gen2-migration assess (passes).
- Run
amplify gen2-migration lock.
- Planning fails with the validation error below.
GraphQL schema (minimal repro shape)
type Document @model {
id: ID!
organizationID: ID! @index(name: "byOrganization")
unitID: ID! @index(name: "byUnit")
propertyID: ID! @index(name: "byProperty")
insuranceID: ID! @index(name: "byInsurance")
portfolioID: ID! @index(name: "byPortfolio")
reportsID: ID! @index(name: "byReports")
mortgageID: ID! @index(name: "byMortgage")
}
Log output
→ Planning failed
🛑 1 validation error detected: Value '{"Parameters":{ ... <Document nested
stack template, ~57,843 bytes> ... "transformerrootstackDocumentDocumentTable193B08C2Ref":
{"Value":{"Ref":"DocumentTable"}}}}' at 'templateBody' failed to satisfy
constraint: Member must have length less than or equal to 51200
From ~/.amplify/logs:
amplify gen2-migration core lock
...
error : 1 validation error detected: Value '{...}' at 'templateBody' failed to
satisfy constraint: Member must have length less than or equal to 51200
UnknownFault: 1 validation error detected: Value '{...}' at 'templateBody' ...
The offending nested stack template measures 57,843 bytes (> 51,200).
Additional information
- Gen 1
amplify push succeeds for the same project — it uploads these
templates to the deployment bucket and uses TemplateURL.
- Workaround attempts: none successful from the user side, since the template
size is generated by the transformer based on the number of indexes/resolvers.
- IDs (account, identity pool, user pool, table ARNs) redacted from the log
excerpt above.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v25.4.0 (npm 11.7.0)
Amplify CLI Version
14.5.0
What operating system are you using?
macOS 26.5.1 (Apple Silicon)
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Amplify Categories
api
Amplify Commands
migrate (gen2-migration)
Describe the bug
Running
amplify gen2-migration lockfails during the Planning phase with aCloudFormation
templateBodyvalidation error. One of our@modeltypes(
Document) generates a nested stack whose template body is ~57.8 KB, whichexceeds CloudFormation's hard 51,200-byte limit for an inline
TemplateBody.The migration tooling appears to send this nested stack template inline
(
TemplateBody) to a CloudFormation API call (e.g.ValidateTemplate/CreateChangeSet) during the lock/plan step, rather than uploading it to S3and referencing it via
TemplateURL. Because Gen 1's ownamplify pushalready uploads these same templates to the deployment bucket and uses
TemplateURL, the project deploys fine on Gen 1 but cannot be locked forGen 2 migration.
The
Documentmodel is large because it declares 7@indexGSIs(
byOrganization,byUnit,byProperty,byInsurance,byPortfolio,byReports,byMortgage). Each generated resolver (get/list/CRUD/3subscriptions + 7 index queries) inlines a sizable VTL request-mapping
template into the nested stack, pushing the single template over 51,200 bytes.
Expected behavior
amplify gen2-migration lockshould succeed for any project that currentlydeploys successfully with
amplify push. Nested stack templates larger than51,200 bytes should be uploaded to the deployment S3 bucket and referenced via
TemplateURL(the same approach Gen 1 push uses), instead of being passedinline via
TemplateBody.Reproduction steps
@modelthat has enough@indexdirectives / resolvers that its generated nested stack template exceeds
51,200 bytes (in our case a model with 7 GSIs).
amplify gen2-migration assess(passes).amplify gen2-migration lock.GraphQL schema (minimal repro shape)
Log output
From
~/.amplify/logs:The offending nested stack template measures 57,843 bytes (> 51,200).
Additional information
amplify pushsucceeds for the same project — it uploads thesetemplates to the deployment bucket and uses
TemplateURL.size is generated by the transformer based on the number of indexes/resolvers.
excerpt above.