Create a Headless CMS in a few hours with Strapi

1. Setup a local Strapi

npx create-strapi-app@latest my-project--After initializing the project,you can run the follow command to start your instancenpm run develop

2. Set up AWS S3 as the content repository

2.a Create S3 bucket in AWS

npm install strapi-provider-upload-aws-s3
modulePath = require.resolve(`strapi-provider-upload-${providerName}`);

2.c create an access key in AWS

2.d configure Strapi

module.exports = ({ env }) => ({upload: {config: {provider: ‘aws-s3-private’,providerOptions: {accessKeyId: env(‘AWS_ACCESS_KEY_ID’),secretAccessKey: env(‘AWS_ACCESS_SECRET’),region: env(‘AWS_REGION’),params: {Bucket: env(‘AWS_BUCKET_NAME’),},},},}});
// AWS S3AWS_ACCESS_KEY_ID=yourkeyAWS_ACCESS_SECRET=yoursecretAWS_REGION=yourAWSregionAWS_BUCKET_NAME=yourAWSS3bucketName

3. Setup AWS RDS as backend DB

3.b configure Strapi to connect to RDS

module.exports = ({ env }) => ({connection: {client: “postgres”,connection: {host: env(“DATABASE_HOST”, env(‘DATABASE_HOST’)),port: env.int(“DATABASE_PORT”, env(‘DATABASE_PORT’)),database: env(“DATABASE_NAME”, env(‘DATABASE_NAME’)),user: env(“DATABASE_USERNAME”, env(‘DATABASE_USERNAME’)),password: env(“DATABASE_PASSWORD”, env(‘DATABASE_PASSWORD’)),},useNullAsDefault: true,},});

4. Migrate Strapi to AWS

4.a check in your code to a git server — I used Bitbucket

4.b install Node on EC2

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash. ~/.nvm/nvm.shnvm install 12.22.10

4.c install git on EC2

sudo yum install git -y

4.d clone your code from your git server

Git clone https://yourgitrepo

4.e install packages in your project

4.f fix the private S3 connection issue as in step 2.b

4.g create .env file in your EC2 Strapi folder

--

--

--

I am not a coder, but I like solving problems programmably

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Diving into Vapor, Part 3: Introduction to Routing and Fluent in Vapor 3

Nuts and Bolts of Big-O

Learn about Recursion Using Python

Using Delta Sharing with Google Colab

A Concise Guide To Nonfunctional Requirements

Hyperconvergence vs SAN: A Comparative Analysis

GCP api gateway

AWS IAM

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Yu

Aaron Yu

I am not a coder, but I like solving problems programmably

More from Medium

Generate QR code Price Tag using React

What is low code? Introduction to low code development

How I Used Raspberry Pi to Detect Water Leaks in My Home

Build an Appointment Scheduler using Node, Firebase, and Vonage