Contents

Host Plex on AWS and Wasabi

Wasabi Storage

Storage is one of the costliest options in the cloud and probably the biggest deterrent to migration. Fortunately, a handful of contenders are changing the game and breaking into affordable options for personal budgets. One of these companies is Wasabi. I have embraced the AWS platform, so on the surface this appears to be in opposition to that. Maybe it is, but Wasabi utilizes AWS S3 on the backend with a pricing strategy fit for personal as well as business use. So, for me, it’s the best of both worlds. I get AWS performance, reliability, and command syntax with Wasabi pricing, utilities, and features.

For files not in my Plex media library I have my sights set on AWS Glacier Deep Store for long-term backup

Wasabi Pricing

With around 2 TBs of storage it should cost roughly $5-10/month. There are no egress charges.

Loading Data into Wasabi

Once you have an account and have created a folder in Wasabi you are ready to upload your media. For the sake of brevity this blog doesn’t address that. The Wasabi home screen should look something like this though:

Wasabi Home

To load data into Wasabi configure the AWS CLI for Wasabi and then use the standard S3 command with the Wasabi parameters. This will sync the specified folders. The same command can be used every time there is a file change.

aws s3 sync myfolder s3://mybucket/myfolder --endpoint-url=https://s3.wasabisys.com

Loading the data this way is a little slower than I expected, but it works. Wasabi has a client utility for use among other options that may speed up the initial upload.

Spin up Server on AWS EC2

After loading the media into Wasabi the server build can begin. This is the part where you start to taste freedom from the bondages of PC/home server ownership! This example (and my personal Plex instance) is running on an AWS EC2 instance; though you could use some other inferior platform :-P. The following sections describe my personal build and options. If you’re following this example, your build may differ depending on your requirements.

For instructions on how to launch an EC2 instance click here.

EC2 Sizing

I am running Plex only for personal/family use generally with 1 user at a time. Your use case may vary. Along with this, I am also using this server to run my security camera software. As such, I chose a t3a.small instance type. With the media storage on Wasabi, a 30 GB volume is plenty of space for the OS and software. For more information on EC2 instance types, here a few links:

EC2 Pricing

Based on this instance type and my usage, I am again expecting to pay $5-10 / month. A large reason for my cost is due to the camera software needing to run 24/7. I may be able to actually find a cheaper solution by running two instances and having Plex powered on only during potential usage times.

EC2 Performance

With just my camera software running, the server only uses a few percent of CPU. If it’s storing a recording or a camera is being viewed it uses a bit more. This skews the performance perspective a bit from the standpoint of isolating Plex. When Plex is in full usage the CPU does spike to 100% at times. Even with this though, I haven’t experienced any major buffering issue or stop in video or music. Here is the average with things running without a full Plex load.

Plex Camera EC2 Baseline

EC2 Security

Security is rather simple in this case. For management, the standard SSH port 22 is needed from your IP address (x.x.x.x/32). Plex requires port 32400. In my case, I opened that to 0.0.0.0/0 so I can view Plex from anywhere. This could be locked down if desired. Here is my ruleset:

Plex EC2 Security Group

To learn how to edit a security group, please refer to AWS’s guide.

EC2 Networking

Networking for your EC2 instance can be very simple or complex depending on your requirements and level of experience. For example, you could utilize a load balancer with a private VPC and autoscaling for the instance. In this case, my server is in a private subnet with an elastic IP address. If a standard public IP is used it will change with every reboot.

Please remember, that charges will be incurred if an elastic IP address is not attached to an interface or the server is shutdown!

Once again, please refer directly to AWS’s elastic IP documentation for a how-to.

Once running, Plex can be accessed from the https://plex.tv console or the server can be accessed directly. If it’s accessed directly then assigning a hostname to the elastic IP is recommended for easier usability. In the case of direct access your URL (without a hostname) would look like this (replacing the 5’s with your elastic IP):

https://55.55.55.55:32400/

EC2 Backup

As with all EC2 instances, snapshots and AMIs are recommended for backing up your configuration. It would be wise to take a snapshot after the installation and setup of Plex is complete in order to have an easier starting point should something happen. That is beyond the scope of this post though.

EC2 Media Access

At this point, the EC2 instance only has access to its 30 GB EBS volume. In order for Plex to be useful it will require access to the media stored on Wasabi. rclone is a great tool for accessing remote storage. At this point, it is assumed that the EC2 instance is running, an elastic IP has been assigned and associated, the security group allows SSH (port 22), and you have a shell open and ready to continue.

  1. Create a directory for your media i.e. mkdir /plex

  2. Install rclone

sudo snap install rclone --classic

  1. Edit the rclone service to include the created directory and mount point. This will enable the rclone service upon boot.

sudo vi /etc/systemd/system/rclone.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[Unit]
Description=Wasabi (rclone)
AssertPathIsDirectory=/PATH/TO/MEDIA/ (my personal mount point is /media/)
#After=plexdrive.service

[Service]
Type=notify
Environment=RCLONE_CONFIG=/home/plex/.config/rclone/rclone.conf #PATH TO RCLONE CONFIG FILE
KillMode=none
RestartSec=5
User=plex #user might need to be a different account with permissions. root will work too but isn't advised
Group=plex #group might need to be a different account with permissions. root will work too but isn't advised
ExecStart=/usr/bin/rclone mount wasabi:WASABIFOLDERNAME /path/to/local/folder/ \
	--rc \
	--rc-addr 127.0.0.1:5572 \
	--dir-cache-time=160h \
	--log-level INFO \
	--log-file /var/log/rclone.log \
	--fuse-flag sync_read \
	--buffer-size=256M \
	--timeout 1h \
	--allow-other
ExecStop=/bin/fusermount -uz /path/to/local/folder
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Edit the rclone config file to include the access key and secret access key. Make sure the region is correct!

sudo vi .config/rclone/rclone.conf

1
2
3
4
5
6
7
[wasabi]
type = s3
provider = Wasabi
access_key_id = @@@@@@@@@@@@@@
secret_access_key = @@@@@@@@@@@@@@@@@@@@@
region = us-east-1
endpoint = s3.wasabisys.com
  1. Start the rclone service

sudo systemctl start rclone

  1. Test the rclone service by listing your Wasabi directory.

rclone ls wasabi:foldername

Plex

  1. Install Plex (instructions here)

Being that this is a remote installation, it will require the use of an SSH tunnel. A decent blog post on this can be found here . The tunnel will allow you to access the first-time login and configuration of Plex at http://127.0.0.1:32400. All other installation options should be the same as the instructions.

  1. Review and test your performance settings. This will vary based on your instance type and amount of available bandwidth.

  2. I experienced issues around user permissions and folder ownership. Most of it was straightforward, but Plex also has a configuration file that might need to be updated (as was my case):

sudo vi /etc/default/plexmediaserver

Look for the following line and update it to reflect the Plex user (it’s ‘plex’ by default). export PLEX_MEDIA_SERVER_USER=plex

You may also have to change the user in this file: sudo vi /lib/systemd/system/plexmediaserver.service

Once everything is working, you should be able to login and see your home screen.

Plex Home Screen

Pros and Cons

Pros

  • Cheaper overall
  • Less maintenance
  • Potential for better server-side performance
  • Unlimited space

Cons

  • No DVR capability
  • No disc burner for recording movies
  • Bandwidth limitations
  • Quality limitations due to remote bandwidth

This is decidedly a pretty high-level overview with quite a few references to other sources of documentation. If any of it is confusing, feel free to post a comment or contact me. I enjoy helping others.

Technical Debt

  1. Look into speeding up Wasabi uploads
  2. Allow Plex to write to Wasabi
  3. Create an easier way for download/upload. I have found other posts on this I just haven’t tried it myself.