copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Current version does not provide ability to setup cloudfront for frontend web service.

Open sanjeevtejyan opened this issue 5 years ago • 8 comments

Imagine service development is done using Angular or ReactJS. Then there are two options

  1. Deploy ECS Fargate cluster with frontend service running using nodejs based docker image and tie-up public alb with cloudfront.
  2. Deploy frontend code in S3 private bucket and expose it via cloudfront

sanjeevtejyan avatar Aug 23 '20 10:08 sanjeevtejyan

Further note: it's difficult to do this as an add-on at the moment. I think this is because the ALB listener rules Copilot creates check the Host header of the incoming request. If the CloudFront distribution uses a domain name that Copilot is not aware of, the ALB will route the request to the default target group, which, at least for my Copilot app, doesn't route to any valid targets.

wolverian avatar Nov 29 '21 09:11 wolverian

This is definitely a usecase that we'd like to support -- making it easy to a cloudfront distribution in front of load balanced web services! Once we're in a design stage, we'll update the issue here to let you know 🙇

If you have any sample cloudformation snippets that you used for cloudfront and copilot, we would really appreciate it if you share it here to ensure that we're building the right thing!

efekarakus avatar Nov 29 '21 18:11 efekarakus

@efekarakus any updates?

bdevore17 avatar Feb 17 '22 22:02 bdevore17

Hi @bdevore17 !

Apologies, we haven't yet started on the integration of cloudfront natively into the manifest. I wonder if it's possible to create it using an addon. For example: https://github.com/aws/copilot-cli/issues/1848#issue-789372393

efekarakus avatar Feb 17 '22 22:02 efekarakus

@efekarakus the addon method doesn't seem to work unfortunately. It just gives back 503s. My guess is that this is because the ALB and the cloudfront to not agree on what domain should be accessible.

bdevore17 avatar Feb 18 '22 03:02 bdevore17

Adding this in as an easy option would be hugely beneficial. Even without caching the benefits of cloudfront on dynamic API's are significant. https://www.youtube.com/watch?v=oVaTiRl9-v0

bdevore17 avatar Feb 18 '22 03:02 bdevore17

That talk was great, thanks for sharing!

efekarakus avatar Feb 24 '22 22:02 efekarakus

Design has been made to begin implementing this feature! #3701 I look forward to helping create this for everyone.

CaptainCarpensir avatar Jun 28 '22 22:06 CaptainCarpensir