Home > Mobile >  Does CloudFront is useful if we fetch data from S3 bucket through EC2 Instance when EC2 Instance and
Does CloudFront is useful if we fetch data from S3 bucket through EC2 Instance when EC2 Instance and

Time:01-10

For e.g.: -

Consider a scenario where I have a back-end service which takes dynamic data from RDS and static data (Audio/Video/pdf) from S3 Bucket.

Back-End Service is deployed over an EC2 instance which internally uses AWS SDK to fetch static data from S3 Bucket. Below is the flow:

User Request Data ---> AWS Route 53 ---? ALB ---> Target EC2 Instance ---> Fetch Data from S3 Bucket.

Based on the above scenario if a user request is always going to route to EC2 Instance and EC2 Instance and S3 are in the same region then is there any need of configuring CloudFront in the flow?

CodePudding user response:

Yes I strongly recommend to use CLoudfront with s3 for your static dat.

In fact this is one of the primary use case. This will also give you advantage not only in terms of latency and cost but also in terms of security because you can choose who can access content from your S3 using OAI ( origin access identity )

If you want to know more and understand how cloudfront can help you here is a dedicated blog from aws on this use case -> https://aws.amazon.com/blogs/networking-and-content-delivery/amazon-s3-amazon-cloudfront-a-match-made-in-the-cloud/

  • Related