By Rohan Khamkar and Rahul Shettigar
In this article, we will walk through the process of deploying a highly available e-commerce website on DigitalOcean using a Global Load Balancer (GLB) and VPC peering to ensure seamless connectivity between distributed resources. The website, built with Next.js for the front end and Node.js for the backend, will have a scalable infrastructure with load balancing and high availability.
We’ll use two droplets in Frankfurt and San Francisco behind the GLB, with a MySQL-managed database configured for high availability in Singapore. The setup also involves VPC peering to allow secure communication between the front-end servers and the database.
Here’s a video demonstrating how to deploy a Global Load Balancer (GLB) and implement VPC peering for a website with services deployed across multiple regions.
Before you begin, ensure that you have the following:
To create redundancy and minimize latency for users in different regions, we have deployed two droplets, one in Frankfurt & another in the San Francisco region.
For our e-commerce website to remain available during outages, we need to ensure our database is set up with high availability.
A Global Load Balancer (GLB) is crucial for distributing traffic evenly across multiple regions, ensuring that users from different parts of the world get the best performance.
By the end of this step, your GLB should be active and distributing traffic between your Frankfurt and San Francisco droplets.
VPC peering allows secure communication between your frontend droplets and the managed database by using private IPs instead of public IPs.
telnet
to privately connect to the DB.Now that the infrastructure is in place, we can deploy the e-commerce app on the droplets.
In this article, we successfully deployed an e-commerce website using a Global Load Balancer and VPC peering. By leveraging cloud services like a managed MySQL database with high availability and setting up multiple droplets in different regions, we ensured high availability and low latency for our global user base. With VPC peering between the frontend droplets and the database, we secured communication while maintaining a scalable infrastructure. With these steps, you can build a resilient and performant architecture for any globally distributed e-commerce application.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Jump in! Follow our easy steps to deploy Hugging Face HUGS on DigitalOcean GPU Droplets and bring your AI models to life.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.