-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
APIGW: Template format error with resources exceeds error though using nested stack #7391
Comments
Can you please paste your deployment log with the error? Also, I am curious what’s the size of the JSON templates (both nested and top-level) in your A quick bash command that will return the number of resources in a template: node -p “Object.keys(require('./cdk.out/xxxx.json').Resources).length)” |
Main stack has 2 resources, StackOne(First nested stack) has resources 204, ideally this should be 196 stacks and StackTwo (second nested stack) has 0 resouces, ideally this should have 8 resources.
|
I believe the issue here is that the API resources of APIGW are always defined in the same stack as the REST API resource itself. So even if you call What I would recommend is to split things up a bit differently: put both Lambda functions in one nested stack (or two) and the API definitions in the other. Let me know how it goes. |
This is actually more of an APIGW guidance issue then a CLI bug. Reassigning/labeling. |
@eladb API gateway stack resource has 204, hence it can be alone in a single stack. but tried other ways as well, in all cases, API gateway is coming under a single stack. and exceeding the count 200 |
Is it 204 resources even after you move away everything else like the lambda functions? |
Each Lambda has around 6 resources |
The apigateway CDK construct library creates a large number of CloudFormation resources. To define a single Method that is backed with a Lambda function and authorizer with an Authorizer, ~8 CloudFormation resources are created. This quickly grows and a reasonable sized RestApi is bound to hit the 200 resource limit on their stack. Re-organizing the CDK app into multiple `Stack`s that share the same instance of `RestApi` will not resolve this problem, since the CDK still makes an executive decision to keep the Methods and Resources in the same stack as the `RestApi` construct. (see #7391) This change introduces a new import style API `fromRestApiAttributes()` that returns an instance of `IRestApi` that allows for new Resources to be defined across stacks. As a nice side effect, this change also adds the ability to define Resources on SpecRestApi in addition to what has already been defined in the OpenAPI spec. closes #1477
The apigateway CDK construct library creates a large number of CloudFormation resources. To define a single Method that is backed with a Lambda function and authorizer with an Authorizer, ~8 CloudFormation resources are created. This quickly grows and a reasonable sized RestApi is bound to hit the 200 resource limit on their stack. Re-organizing the CDK app into multiple `Stack`s that share the same instance of `RestApi` will not resolve this problem, since the CDK still makes an executive decision to keep the Methods and Resources in the same stack as the `RestApi` construct. (see #7391) This change introduces a new import style API `fromRestApiAttributes()` that returns an instance of `IRestApi` that allows for new Resources to be defined across stacks. As a nice side effect, this change also adds the ability to define Resources on SpecRestApi in addition to what has already been defined in the OpenAPI spec. closes #1477
The apigateway CDK construct library creates a large number of CloudFormation resources. To define a single Method that is backed with a Lambda function and authorizer with an Authorizer, ~8 CloudFormation resources are created. This quickly grows and a reasonable sized RestApi is bound to hit the 200 resource limit on their stack. Re-organizing the CDK app into multiple `Stack`s that share the same instance of `RestApi` will not resolve this problem, since the CDK still makes an executive decision to keep the Methods and Resources in the same stack as the `RestApi` construct. (see #7391) This change introduces a new import style API `fromRestApiAttributes()` that returns an instance of `IRestApi` that allows for new Resources to be defined across stacks. As a nice side effect, this change also adds the ability to define Resources on SpecRestApi in addition to what has already been defined in the OpenAPI spec. closes #1477 closes #7391 fixes #8347 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Template format error is thrown though nested stacks are used.
Using single stack was throwing template format error with resource exceeds 200, hence started with nested stack, but issue still the same.
Reproduction Steps
Error Log
Template format error: Number of resources, 204, is greater than maximum allowed, 200
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: