AWS Certified Solutions Architect - Professional 2020

Sign Up Free or Log In to participate!

Cloudfront vs API Gateway in API distribution

Which of the two is a better choice? If you want to set up a distribution for an API that is hosted on a group of auto scaled EC2 instances. Factors to consider are consistent connection, fast loading time, global audience, cost effective. It’d be very much appreciated if you can point out any AWS documentation to support your opinion. I know API Gateway uses CloudFront’s technology, but I don’t see any difference between the two when it comes to delivering dynamic content.

2 Answers

CloudFront and API Gateway serve different core purposes.  Yes, API Gateway does use Cloudfront behind the scenes but lots of AWS services use other services behind the scenes. 

I suggest you read up on CloudFront and API Gateway seprerately and you’ll uncover the differences.  This will also reveal the AWS documentation you’re seeking as well.

I would add to Scott’s answer: 
1) from a DDoS (security) perspective, you’re increasing your posture by applying CloudFront in front of API Gateway/ELB.
2) I wouldn’t put API Gateway vs. CloudFront (which one is best), I think you could/should use both because they serve different objectives;
3) CloudFront + Shield -> S3|API Gateway + Cognito -> ELB|ALB -> EC2|Fargate|Lambda is an AWS "reference architecture" that you can easily find on documentation and/or blog posts;

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?