jetbridge / cdk-nextjs

Deploy a NextJS application using AWS CDK
https://constructs.dev/packages/cdk-nextjs-standalone
Apache License 2.0
273 stars 45 forks source link

Limit exceeded for resource of type 'AWS::CloudFront::ResponseHeadersPolicy' when deploying multiple sites #194

Closed onhate closed 9 months ago

onhate commented 9 months ago

There is a hard limit of 20 Response headers policies per AWS account and Cache policies per AWS account and when deploying multiple sites this limit is easily reached.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-policies

For instance, I have a shared distribution with 2 nextjs deployments each, for each deployment it creates 3 response headers policy x2 (one for each deployment) = 6, so I can only deploy 3 tenants per AWS account.

My suggestion is to pass existing policies to the override props and use them instead of creating new ones.

I'll try to work on this feature.