Medusa is an open-source composable commerce engine built with Node.js. Medusa enables developers to build scalable and sophisticated commerce setups with low effort and great developer experience.
The Medusa infrastructure will be provisioned on your own AWS account.
You retain full control over your infrastructure and data while getting all the benefits of infrastructure automation.
Click Deploy with Microtica below and follow the template steps to deploy your Medusa Server application on your AWS account.
What will be provisioned on AWS
Since Microtica deploys on your cloud account, you would expect nothing less than complete transparency of what resources are going to be provisioned.
Using the Medusa Server template, you will create two components in the environment:
- VPC — VPC, subnets and networking
- Medusa - Container infrastructure based on Fargate, application load balancer, persistent storage, S3 bucket, Postgres database, and Redis (in production mode).
Deploy your existing Medusa Server
By default, the template creates a new Medusa Server repo on your Git account with all required setups and no changes required from your side.
But if you already have a Medusa server repo that you want to deploy then you need to perform a couple of changes in your source code.
1. Install the S3 plugin
The first thing you need to do, if you want to use S3 as media storage (recommended), is to install the Medusa S3 plugin.
The template automatically creates an S3 bucket so you just need to install the module and set the proper configuration (step 2).
2. Update Medusa config
Second, update your Medusa config (medusa-config.js) by adding the S3 plugin configuration in the plugins section.
Then, update the project configuration. We are using a custom environment variable called PRODUCTION to determine if the server will use managed databases (RDS Postgres and Redis) or local databases (SQLite and "fake" Redis).
Built-in environment variables
Below is a list of built-in environment variables provided in the Medusa Server runtime. You can access them with process.env.<VARIABLE NAME>
The URL to your bucket. It’s in the form https://<BUCKET_NAME>.s3.<REGION>.amazonaws.com
The name of the bucket created automatically by the template.
The region code of your bucket. For example us-east-1.
The connection string to the Postgres database instance (if PRODUCTION=true)
The connection string to the Redis instance (if PRODUCTION=true)
Auto-generated strong cookie secret (128 characters long).
Auto-generated strong JWT secret (128 characters long).
The application mode. If set to true the template will provision managed RDS Postgres and Redis instance, if set to false the application will use the local SQLite and "fake" Redis databases.
Custom environment variables
Use custom variables to specify the ADMIN_CORS, STORE_CORS, Stripe configuration, etc. The custom variables can be added after the template deployment is completed.
To provide custom environment variables in the Medusa Server runtime, go to your Environment, select the Medusa resource from the list and go to the Resource Settings tab.
Add the custom environment variables in the EnvironmentVariables resource property in the following format: KEY=value,KEY=value.
Click on Save and Deploy button.
Estimated AWS cost
The estimated cost of the AWS cloud depends on the configuration of the Medusa infrastructure. Below is the cost estimation breakdown based on different configurations assuming the resources are running all the time:
- Development mode (SQLite + "fake" Redis) with one app container (0.25 vCPU and 0.5GB memory) the costs is around $30/month
- Production mode (Postgres + Redis) with one app container (0.25 vCPU and 0.5GB memory) the cost would be approximately $70/month
- each additional container with the default config is $14/month