The official doc didn’t work so well I think. For instance iam role policy/security group didn’t add the port for connecting RDS DB, etc.
Therefore, I’m looking for a video that shows how to deploy it to AWS with
EC2(strapi), RDS(database)/S3(static images).
Dealing with SSL with Let’s Encrypt via automated tools like certbot(either provided dns domain name or custom domain name in route53)
installing nginx with preset config?
Source control with GitHub or any others
Auto scaling, load balancing, distributed or centralized deployment?
This is good approach to split it into dev/staging/ production for project management, but outdated.
It would be great if some strapi experts can do it for community.
I do plan on writing out some guides on this in the future utilizing Hashicorp’s Terraform and Red Hat’s Ansible (as we utilize these internally within Strapi and with our own deployments of Strapi) but I don’t currently have an ETA for that.
We are in the process of spinning up a new resource center that will make all of our resources for deployment much more expansive and clear. If you are using AWS you may look instead towards using AWS ELB (Elastic load balancer), Route53 (DNS management) and the built in SSL handling of certificates (I believe they also support Let’s Encrypt).
I’ve added this to my “to-do” list but I am interested to see if anyone else in the community has some ideas or suggestions in their own implementation.
Thank you for your consideration. It’s definitely help a lot of people.
This AWS deployment guide is brilliant. Thank you so much for putting it together.
I’d recommend following this for instructions on installing and configuring nginx and this for configuring the certificate (just skip the apache stuff and adapt to nginx):
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install certbot python-certbot-nginx
sudo certbot --nginx
@daily /usr/bin/certbot renew >> /var/log/letsencrypt-renew.log
sudo service cron reload
What if you deploy strapi after all these steps? cuz it’s easy to set up an nginx server with let’s encrypt I believe.
I’ve deployed Strapi to AWS in an automated way (SAM CloudFormation). I probably can’t share the entire deployment verbatim (but I will ask work).
I created a Docker file that gets built and pushed to Fargate (Elastic Container Service), this spins up EC2 instances. You can’t talk directly to these but we’ve got an AWS Load balancer in place (instead of nginx) to connect.
Working on a similar process but using Terraform cloud instead, anything you could share would be great.
Hi, I need to do exactly the same. Also use DocumentDB as the database.
Any tips?, Can you share the Dockerfile?
@netchart we don’t support DocumentDB as it’s not actually MongoDB and many of the features we use within Strapi do not work with DocumentDB. I would suggest you either use a self-managed MongoDB cluster or use something like Atlas.
That being said, I would strongly advise against MongoDB entirely and use either MySQL, MariaDB, or PostgreSQL on AWS RDS.
@netchart I’ve done a similar setup using AWS Fargate. If it’s still relevant for you I can share the whole setup which is composed of multiple components (https://mk0microtica2di3k2co.kinstacdn.com/wp-content/uploads/2021/06/strapi-component-hl-arch.png):
VPC - all the infrastructure except the ALB runs on a private subnet
Fargate cluster + ALB
Amazon EFS - mounted on the container, a storage for the media files and database (for sqlite)
S3 bucket - if you choose to store media files on S3
RDS MySql - managed MySql database
Secret manager - for storing the database creds
- plus some NodeJS scripts to create the initial database on RDS
The Dockerfile I am using is quite simple.
COPY ./package.json ./
COPY ./yarn.lock ./
RUN yarn install
COPY . .
ENV NODE_ENV development
RUN yarn build
CMD ["yarn", "develop"]
This is part of our free solution to deploy Strapi on AWS (Deploy Strapi on AWS with Microtica in less than 10 mins). It creates a set of CloudFormation stacks on your account, you can see the templates and how it’s all interconnected.
Hope this helps!
Thank you for your help and effort! Without doubt, it helps people out