DEV Community

Cover image for Ditch Google Analytics for Plausible Analytics on Amazon Lightsail
Brian Graf for AWS

Posted on

Ditch Google Analytics for Plausible Analytics on Amazon Lightsail

Plausible is a simple and privacy-friendly alternative to Google Analytics. It's a small (94% smaller than Google Analytics), open-source tool that allows users to either self-host or pay for the cloud-hosted version. If you want an easy-to-use tool and are concerned about privacy or you don't want Google harvesting your analytics data, this is the tool for you!

How can I start using Plausible Analytics?

You have two options:

  1. - Hosted version, paid monthly or yearly, and fully-managed by Plausible.

Plausible Pricing

  1. - Open-source/self-hosted, free, managed by you.

We will be focusing on how to run the open-source version on Amazon Lightsail

What is Amazon Lightsail?

Amazon Lightsail offers easy-to-use virtual private server (VPS) instances, containers, storage, databases, and more at a cost-effective monthly price. Lightsail makes it easy to choose an Operating system or an application blueprint to deploy and use. We will get Plausible running on Lightsail in less than 5 minutes. Let's get started!

Login to Amazon Lightsail

If you do not already have a Lightsail account, head over to Amazon Lightsail and create one.

Once you login to the service, it will look like this:

Lightsail Console

We are going to create an instance. Click 'Create instance'

Create Instance

Choose the region you want this deployed. Currently you have 14 regions globally where your instances can be deployed. I'm using Virginia (US-EAST-1a).

Click the 'OS Only' button and select the latest version of Ubuntu (for me that is 20.04)

Ubuntu Blueprint

To speed up the deployment and configuration we are going to use a Launch Script, which will install and configure some of the required files before we even log in to the instance.

Click on 'Add Launch Script' and paste the following code:

sudo apt update -y
curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli docker-compose -y

sudo mkdir /var/www
cd /var/www
sudo git clone
cd hosting
sudo git clone
sudo chmod +x ./AmazonLightsail/
Enter fullscreen mode Exit fullscreen mode

The above code does the following:

  • Updates available packages repository
  • Download's Docker and additional Docker components
  • Download's Plausible setup files
  • Download's a Plausible config file

Launch Script

Choose an Instance Size

Lightsail offers a number of different sized instances to meet the needs of it's users. We'll choose the 4GB/2vCPU instance but you can choose a smaller or larger instance as you require.

Instance Plans

Lastly, we'll give the Instance a name. We'll call ours 'Plausible-Analytics'. Click 'Create instance'

Create Instance

Add a static IP and Open Port 8000

We want our Lightsail Instance to keep the same IP address even if the instance is rebooted in the future. To add a Static IP, Click on the name of your instance.


Click the 'Networking' tab and click 'Attach static IP'

Instance Networking

Click 'Create Static IP' and give it a name. We'll name ours 'Plausible-Analytics-IP'. Click 'Create'.

Attach Static IP to Instance

We'll go ahead and open TCP Port 8000 so that we can reach our Plausible server once it's configured. Click on your instance name again and go back to the 'Networking' Tab.

Under IPv4 Firewall, click 'Add rule'. Type '8000' in the Port box and click 'Create'

Enable Port 8000

Now we are ready to login to our instance and run the last few commands to get up and running.

Login to the instance

Scroll back up to the top of the page and click the 'Connect' tab, then click 'Connect using SSH' this will open a new window that allows you to run commands in your instance.

Copy and paste (or type in) the following code into the SSH terminal:

# Run the config setup file
sudo /var/www/hosting/AmazonLightsail/

# Change directories to the Plausible files
cd /var/www/hosting

# Kick off the Docker container
sudo docker-compose up --detach
# Wait about 10-20 seconds after the above command completes then run the final command. If it gives an error. Wait another 10 seconds and try it again.
sudo docker-compose exec plausible_db psql -U postgres -d plausible_db -c "UPDATE users SET email_verified = true;"

Enter fullscreen mode Exit fullscreen mode

Once you've run these commands, you will be able to login to Plausible. Copy the IP address of your instance into your web browser and include port 8000. You should now be able to login with the credentials found in the 'plausible-conf.env' file.

Plausible Login

From here you can begin your journey using Plausible instead of Google Analytics. For more information on how to get started with adding your website, you can continue with your setup HERE.

Top comments (3)

liviufromendtest profile image
Liviu Lupei

Personal Opinion:
I would avoid using Plausible Analytics, their entire Marketing strategy is based on "Google Analytics is evil and illegal and they kill babies".
I can't really trust someone like that with our data.

plausible analytics scam

loige profile image
Luciano Mammino

Be aware that with this setup you are running unencrypted HTTP traffic to your Plausible instance. It would be highly recommended to add HTTPS.

Other than that, great post! Thanks for sharing

myrakenyon17 profile image
Erwin Holly