getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
912 stars 111 forks source link

AWS limit per account #291

Closed marco-pace closed 1 year ago

marco-pace commented 1 year ago

Start from the Use-case

When you deploy a server-side website with lift it will create a new Cache policy, a new Origin request policy and a CloudFront function every time; and most of times these resources are the same.

AWS has a limit of 20 Cache policies and Origin request policies and 100 CloudFront Functions per AWS account; and these limits are not increaseble (more info here).

When you have a really huge amount of applications running in an AWS account, this can be a big limitation.

To solve this problem, one could envisage reusing these resources by specifying their IDs in the configuration of the website construct.

Example Config

constructs:
    website:
        # ...
        backendOriginPolicy: "..."
        backendCachePolicy: "...."
        cloudfrontFunctionArn: "arn:aws:cloudfront::..."

Implementation Idea

Pull request here