Running an E-Commerce Website on AWS

By September 13, 2019 September 16th, 2019 AWS

Written By: Siva S, Founder and CEO at Powerupcloud Technologies.

We see a lot of traction among e-commerce startups to use cloud platforms like AWS, Azure, and Google to host their website. Some top e-commerce sites like Snapdeal, Zovi, Zivame, and Amazon (obvious) run on cloud platforms quite successfully even though these cloud platforms are not in India.

So what are the compelling reasons which e-commerce startups consider when planning for cloud-based hosting?

  1. High availability options
  2. Auto-scaling features
  3. Automation in backups, deployments, databases, etc
  4. Performance & reliability
  5. Reduced GTM time
  6. Pay-per-use model 
    and many more.

But most of the above can be achieved only if the architecture is designed to support the awesome features of the cloud. So in this post, we will focus on the architecture design and other PaaS solutions that can blend in with an e-commerce website.

E-Commerce is all about images

Agree or not, your e-commerce site is only as good as the images. So the quality of images and the speed at which it renders plays an important role in defining the success of your website. Keeping this mind, cloud platforms provide massive object stores like Amazon S3Azure Blob, and Google Cloud Storage to help e-commerce sites host millions of images and link them with their app code-base.

In a typical data centre or VPS based hosting, your images may very well lie in the local hard disk. But in the cloud, the images are stored in these object storage PaaS platforms and rendered directly to the end-user. So what’s the advantage? In AWS, the Amazon S3 storage has native integration with Amazon CloudFront (AWS CDN Service) and this helps to render the images to end-users directly over CDN without hitting the web and app servers again thus bringing down the load on these servers.

How can I integrate my e-commerce application with S3?

It’s pretty straight forward.

  1. Create an S3 bucket to store your images.
  2. Upload the images to the bucket using a third party S3 browser or through AWS console.
  3. Use the API provided by AWS to integrate your web-app servers with S3.
  4. Enable CloudFront to speak to S3.
  5. You are done.

Single box approach vs Multi-tier approach!

The other dilemma faced by application and infra engineers of an e-commerce application is the choice of architecture design when moving to the cloud. The single box approach where you have all your application tiers — web, app & database in a single server brings in high risk of SPOF — Single Point of Failure. Here is where the cloud comes in handy. Now you can run a highly distributed, highly available setup by replacing a single box approach to a multi-tier HA approach. A typical 3-tier web application running on AWS looks like the one below,

So how does this work?

  1. The user requests hit the DNS service of AWS (Route53) and then the load balancer.
  2. The requests are parsed by the web and app servers.
  3. The corresponding images are rendered from S3 using Amazon CloudFront.
  4. The servers are setup in Multi-AZ (2 different Availability Zones) mode to ensure that even if one availability zone goes down, the site continues to work.
  5. A NAT instance for secure access by deployment & development engineers.
  6. Auto-scaling is enabled at the web and app tier to handle the spike in traffic.

Alternately, you can also plan for a 2-tier approach (like the one below) if separating web and app tier turns out to be a time consuming one.

So the checklist goes like,

  1. Ensure that your application can be implemented in a 2-tier or 3-tier model.
  2. Replace Amazon S3 APIs for object storage (images, videos, files) in the application code.
  3. Setup a staging environment, deploy the new codebase and test for functionality.
  4. Use the AMIs (Amazon Machine Images) to create the production setup and make DNS changes while going live.

Hope this gives you a fair idea of hosting or migrating a highly available e-commerce application on cloud. Please contact us for any queries or help in setting up your e-commerce portal on the cloud.

Leave a Reply