Search code examples
amazon-web-servicesamazon-ec2amazon-cloudfrontamazon-elb

What's the point of an AWS ELB setup with Cloudfront, rather than a single EC2 instance?


If AWS Cloudfront caches your website content for visitors, what’s the point of also setting up an ELB, instead of a standard, single web-server EC2 instance?

As surely, it’s only a few Cloudfront connections that will communicate with the server.


Solution

  • You do not need an ELB between CloudFront and your single EC2 instance. Both ELB and CloudFront provide additional protection (DDoS) but for a single instance setting up both is not required or necessary.

    However, one of the great design benefits of AWS is load balancing and Auto Scaling (ASG). You will need a load balancer to add these features. Web sites do crash and having ASG enabled will make sure that a new instance is launched when your web server becomes unresponsive.

    Note. You do not want your EC2 instance to be available to the public Internet. You will attract a large number of hackers who know the AWS IP addresses. This traffic can quickly consume the resources on small T.x instances. Make sure that your Security Groups are setup to only allow traffic from CloudFront.