Amazon Lightsail

Amazon Lightsail

This is a guide to deploying Collections projects on AWS Lightsail. This guide uses Let's Encrypt certificates to optimize costs.

Amazon Lightsail Installation Requirements

Create a Lightsail instance

Log in to Amazon Lightsail (opens in a new tab) and create an instance of the following environment

  • Linux/Unix + Nginx
  • 2 GM RAM

Collections requires at least 2GB of RAM to build and deploy the management interface.

Attach a static IP address

The IP address attached to a Lightsail instance is dynamic and changes each time the instance is restarted. Refer to the official AWS documentation (opens in a new tab) to attach a static IP address. After attaching, also make sure that the welcome page is displayed by accessing the static IP address.

Routing your own domain

Once the static IP address is attached, refer to the official AWS documentation (opens in a new tab) to find the or other domain name to route to your Amazon Lightsail instance.

Alternatively, if your domain is already hosted on Route53, create an A record and specify a static IP address.

SSL certificates are issued and integrated into the instance

Enhance the security of your website and applications with SSL/TLS. Refer to official AWS documentation (opens in a new tab) to issue a Let's Encrypt certificate and integrate it into your instance, Integrate it into your instance.

Install Node.js

Access Lightsail via console and install Node.js.

curl -o- | bash
source ~/.nvm/
nvm install --lts

Install Collections

Now it is time to install the application. First, go to the Nginx root directory, then run Collections installation.

cd /home/bitnami/stack/nginx/html
npx create-collections-app collections

Configure Nginx

Edit the Nginx configuration file and set Collections to the root directory. Here the domain name is

server {
    root /home/bitnami/stack/nginx/html/collections;
    include "/opt/bitnami/nginx/conf/bitnami/*.conf";


    location / {
            proxy_pass http://localhost:4000;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;

    location /status {
        stub_status on;
        access_log off;
        deny all;

server {
    listen 80;
    listen [::]:80;

    return 301 https://$host$request_uri;

Build the application

cd /home/bitnami/stack/nginx/html/collections
npm run build

Running Applications on PM2

PM2 can keep Node.js processes running at all times and reload them without downtime. Run the following command to install PM2 globally.

npm install pm2@latest -g

Then, start PM2.

pm2 start /home/bitnami/stack/nginx/html/collections/dist/build/main.js --name collections


Finally, restart the basic service to reflect the changes.

sudo /opt/bitnami/ restart