Host Plex on AWS and Wasabi
Table of Contents
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
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:
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.
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:
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.
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.
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:
To learn how to edit a security group, please refer to AWS’s guide.
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):
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.
Create a directory for your media i.e.
sudo snap install rclone --classic
- 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
[Unit] Description=Wasabi (rclone) AssertPathIsDirectory=/home/ubuntu/plex After=plexdrive.service [Service] Type=simple User=plex Group=plex ExecStart=/usr/bin/rclone mount wasabi:FOLDERNAME /path/to/local/folder/ \ --config=/home/plex/.config/rclone/rclone.conf \
- 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
[wasabi] type = s3 provider = Wasabi access_key_id = @@@@@@@@@@@@@@ secret_access_key = @@@@@@@@@@@@@@@@@@@@@ region = us-east-1 endpoint = s3.wasabisys.com
- Start the rclone service
sudo systemctl start rclone
- Test the rclone service by listing your Wasabi directory.
rclone ls wasabi:foldername
- 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.
Review and test your performance settings. This will vary based on your instance type and amount of available bandwidth.
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).
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.
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.
- Look into speeding up Wasabi uploads
- Allow Plex to write to Wasabi
- Create an easier way for download/upload. I have found other posts on this I just haven’t tried it myself.