This guide details the step-by-step procedure to deploy Wiki.js on AWS using their managed service offerings.
We'll use Elastic Container Service to run the container and the Rational Database Service for the PostgreSQL database.
Alternatively you could bundle run it all on a single EC2 instance but that is essentially already covered in the Linux installation guide.
By the end of this we'll deploy
We will need two security groups, one for the load balancer and another for the database.
Navigate to the EC2 service, and select Security Groups.
Navigate to the IAM service, then under Roles
We're going to store our database password in Systems Manager Parameter Store.
General wisedom is to use Secrets Manager to store passwords, but you get the same security for free with Secure Strings in Paramater Store.
We'll first create an RDS instance for the database for our wiki.
I have selected the most cost effective values here to keep the bill low. Best practice and performance should be followed but isn't required to get up and running.
Log onto an EC2 instance with access to the database using your favourite PostgreSQL client then create the database.
Here's an example using an Amazon Linux 2 instance
# Enable extra packages sudo amazon-linux-extras install postgresql14 # Install postgresql client sudo yum install postgresql # Get IP of RDS instance host wikijs.random.region.rds.amazonaws.com # Connect to database psql "sslmode=disable dbname=postgres user=postgres hostaddr=10.1.0.113" # Create wikijs database CREATE DATABASE wikijs;
Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications.
I've used the smallest possible values here to control costs but ECS allows easy vertical and horiztonal capacity scaling should you ever have the need.
A task definition is required to run Docker containers in Amazon ECS.
Navigate to Amazon ECS
Under Task definitions, click Create new task definition
Complete the fields for Container 1
|DB_PASS||ValueFrom||wikijs-db-password (parameter path|
Complete the fields for Environment
An Amazon ECS cluster is a logical grouping of tasks or services.
An Amazon ECS service is used to run and maintain a specified number of instances of a task definition simultaneously in a cluster. If one of your tasks fails or stops, the service scheduler launches another instance of your task definition to replace it. This helps maintain your desired number of tasks in the service.
We will be deploying an Elastic Load Balancer as part of the service. The load balancer to be the public presence of our wiki on the internet. It will also distributes traffic across the tasks if you decide to scale beyond a single container for high availability.
Once your cluster is created, click Create under the Services tab.
Use the following values:
Once the container has downloaded and started running your cluster should have 1 service and 1 running task. Click into the task and drill down to review logs if anything appears to be not working.
Head on over to EC2 service, under Load Balancers, you should see your new load balancer listed. Copy the DNS name and paste it into a browser e.g. http://wikijs-alb-random.elb.eu-west-1.amazonaws.com
You should now be up and running with WikiJS but if you have time to spare consider the following tasks...