# Microtica

This a step-by-step guide on how to deploy Strapi on your AWS account using Microtica (opens new window).

Microtica is a developer self-service platform that helps developers and ops teams with cloud infrastructure setup and app deployment in minutes.

Using Microtica for your Strapi projects gives you simplicity of setup and low maintenance, while having the infrastructure on your own AWS account. Strapi can coexist with your existing AWS infrastructure and you can always extend this setup with additional cloud resources.

✏️ NOTE

Microtica’s default version of the Strapi component is v4.

To use a previous version of Strapi, see Deploy Strapi Infrastructure.

# What will be provisioned on AWS

Microtica's pre-made Strapi template will create a new environment and automatically create a few components in the environment:

  • VPC – VPC, subnets and networking.
  • AppRunner – Container infrastructure based on Fargate and application load balancer. This component will run the Strapi project.
  • StrapiInfra – Persistent storage, relational database and S3 storage.
  • (optional) StrapiApp – Component for your existing Strapi project. If not provided, a standalone Strapi development environment is created.

# Persistent Storage

The Strapi template uses an Amazon EFS file system to store the persistent Strapi files:

  • image uploads – media files storage
  • API folder – only for the standalone setup where the source code is not connected via git (default). This guide explains how to deploy an existing Strapi project.
  • data folder – store the SQLite data file, if database client is sqlite (default)

The data stored in these folders will persist on subsequent deployments, application restarts, or even if the container is killed.

# Relational Database

The template provisions an RDS MySql database only if the database client is mysql.

The database is encrypted using a custom KMS key. Database password is automatically generated and stored securely in a AWS Secret Manager secret.

# Container Environment

By default, the template provisions an AWS Fargate cluster with one container. For production environments, it's recommended to use at least 2 containers running all the time. This will also ensure a zero-downtime deployment.

The Fargate services is exposed via Application Load Balancer. When using custom domain, which is recommended for production, the domain certificate will be attached and SSL termination will happen on this load balancer.

Since Mirotica uses persistent file storage, all containers share the same file system.

# Strapi Logs

The Strapi application logs are stored in CloudWatch Logs. Logs can be monitored from the Fargate console under tasks. The default log retention is 90 days.

# Deploy Strapi Infrastructure

Microtica provides a built-in environment template that provisions the necessary infrastructure to run Strapi on your AWS account in a scalable, secure, and reliable way with zero downtime deployment.

# 1. Create a Microtica Account

Go to Microtica Portal (opens new window) to create an account, if you don't have one already.

# 2. Create a project

Click on Create project and add the information for your project.

# 3. Create an environment

Choose Environments under Infrastructure Builder from the main menu and hit on Create Environment (opens new window).

Enter the environment name and description, choose AWS as cloud provider and Cloudformation as IaC tool. Then select the Strapi template card.

✏️ NOTE

You can optionally enable Cost Optimization for non-production environments. This will stop the RDS instances if you use mysql as database client.

# 4. Select a Strapi version (optional)

Microtica uses Strapi v4 as a default version for the StrapiInfra component. To use a previous Strapi version, configure the StrapiInfra component’s imageUrl parameter with microtica/strapi:v3.6.2.

# 5. Deploy the environment

To deploy the environment click the Quick Deploy button. Since the environment is new, a target AWS account, where the Strapi infrastructure will be provisioned, should be configured (see How to Connect your AWS account (opens new window)).

Once the AWS account is connected and configured in the environment, click again on Quick Deploy to trigger the deployment.

It takes up to 10 minutes to create a live Strapi environment.

Once the environment deployment finishes, you can find the access URL in the environment details by expanding the AppRunner component.

# Configure a Custom Domain and SSL

By default, Strapi will be available on an auto-generated domain via http protocol.

To configure a custom domain you would need to do the following:

# 1. Configure the custom domain

To configure the custom domain, enter the custom domain in the AppRunner component DomainName parameter.

# 2. Configure the SSL certificate

To create an SSL certificate follow the How to create SSL certificate guide (opens new window).

Once you have your issued SSL certificate through AWS Certificate Manager you just need to copy the certificate ARN and past it in the AppRunner component CertificateArn parameter.

# 3. Add the DNS records in your domain provider

While in the environment details, expand the AppRunner component and copy the value of the CNAME parameter and add it as a CNAME record in your DNS provider.

# Scaling

A Strapi project can be scaled vertically and horizontally.

For vertical scaling, update the CPU and Memory configuration in the StrapiInfra component. For horizontal scaling, update the number of desired replicas in the same StrapiInfra component.

# Deploy an Existing Strapi Project

For production environments, it's recommended to use GitHub for your Strapi projects. This also makes the process of moving content types from one environment to another much easier and deployments more predictable. To deploy an existing Strapi project on AWS, please refer to Mirotica's documentation (opens new window).