Installing Medusa eCommerce Server on Ubuntu 22.04 on AWS

Last Updated: May 22, 2023

This is a series of guides that will cover how to deploy a Medusa backend server hosted on AWS.

If you are not familiar with Medusa, you can learn more on the project web site.

Medusa is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any product that needs foundational commerce primitives. All modules are open-source and freely available on npm.

Medusa is extemely flexible and customizable, which is great. However, it can be very intimidating for people just discovering it. This guide aims to address that by being opinionated. It shows one possible roadmap for deploying Medusa on one possible cloud provider so that readers can see how Medusa’s building blocks can be put together. This is by no means the “right” way. Or, at least, it is not the only “right” way.

Although this guide was made with AWS EC2 in mind, most parts will work with any cloud provider that gives you a bare or VM linux instance that you can configure from scratch, the old-school sysadmin way.

This type of set up—with the Medusa backend application, Postgres database, Redis database, and Meilisearch search engine service all on the same instance/machine—can be very convenient and economical.

  • The databases and meilisearch instance do not have to be accessible on the Internet. They only need to bind to localhost.
  • You don’t have to pay extra for cloud-based Postgres, Redis, or Meilisearch services.
  • You don’t have to pay extra for a transactional email service, up to 50,000 emails per month.
  • Everything is on your own instance, so you have greater control over your own and your customers’ data.
  • If you work with sensitive clients or customers that are governmental entities or in the financial services sector, you can point them to the AWS SOC 1, 2, and 3 reports to help them understand the security of your setup.
  • You can easily back up everything by making an AMI of the instance. Yes, setting up differential backups of the databases is better and way more efficient in terms of storage space. But storage is cheap and your time is not, so this is a good start and super easy.
  • Deploying new instances is convenient even without sophisticated CI/CD, which is useful for development. You can easily choose an AMI you’ve made and deploy it to a brand new instance any time you want.
  • You can copy the AMI to other regions for disaster recovery.
  • It holds up well under moderate traffic. You can always scale up later if you need to.