Open mdvertola opened 1 month ago
Thank you. aws-ecs-patterns
is an opinionated L3 construct. Having additional cloudfront support is awesome but it may add the maintenance complexity. For example, other people might suggest to have optional AWS Global Accelerator support or WAF support. I am not sure if it's a good idea to keep adding features like this on it but you can definitely build your own L3 construct on top of it. Making this a p3 feat request and please help us prioritize with 👍 .
Describe the feature
The
ApplicationLoadBalancedFargateService
makes for super easy deployments of modern SSR web applications (among many other things of course). The construct appears to be fundamentally designed as a "one stop shop" for these services as it handles everything from networking, scaling, domain and cert setup, etc.Following the ethos of this design pattern, I feel it would be useful if there were a way to attach a CloudFront distribution between the domain and the load balancer out of the box with the
ApplicationLoadBalancedFargateService
construct.Use Case
When deploying a NextJS site (for example) via the ApplicationLoadBalancedFargateService, large static content such as images and videos take a longer time to load than they would if they were served with Cloudfront.
Serving this content behind a Cloudfront distribution would drastically improve this performance. Incorporating it into the ApplicationLoadBalancedFargateService would further the design pattern of a "one-stop shop"/easily deployable fargate service to support a variety of tasks.
Proposed Solution
Other Information
Another thing that may be worth considering here is a forced full invalidation (i.e., invalidate
/*
) on the distribution when a change is detected in the service so that we don't have any hanging cache across deployments.Acknowledgements
CDK version used
2.149.0
Environment details (OS name and version, etc.)
macOS Sonoma 14.5