Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zahorniak/terraform-aws-plex

Terraform module for Plex Media Server on AWS using Spot Instances and S3 for Media Storage
https://github.com/zahorniak/terraform-aws-plex

aws aws-spot plex plex-media-server s3 terraform terraform-module terraform-modules

Last synced: 29 days ago
JSON representation

Terraform module for Plex Media Server on AWS using Spot Instances and S3 for Media Storage

Awesome Lists containing this project

README

        

# Terraform module for Plex Media Server on AWS using Spot Instances and S3 for Media Storage

## Plex Claim Token

Get Plex Claim Token: https://www.plex.tv/claim

The Claim Token is only good for a few minutes, so it is easiest to not set this variable and let Terraform prompt you for it.

## After your server is done spinning up

### If the plex app cannot connect to your server

* Go to http://{ip}:32400/web
* Settings -> Remote Access -> Enable Remote Access
* Check Specify Port (leave the port the same) and retry

### Create Libraries

* Go to Manage -> Libraries
* Create libraries seleting folders within the /plex-data folder

### Minimize EBS and S3 API Requests to Reduce Cost

To avoid scanning of the files in the S3 bucket (meaning additional S3 api requests and additional EBS i/o requests -> additional cost)
* Don't set Plex to periodically scan library
* Turn off scheduled tasks that will scan the library - I leave on the following
* Backup database every three days
* Optimize database every week
* Remove old bundles every week
* Remove old cache files every week
* Upgrade media analysis during maintenance

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.7 |
| [aws](#requirement\_aws) | >= 4.30 |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 4.30 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| [plex\_autoscaling](#module\_plex\_autoscaling) | terraform-aws-modules/autoscaling/aws | ~> 7.7 |
| [s3\_plex\_db](#module\_s3\_plex\_db) | terraform-aws-modules/s3-bucket/aws | ~> 3.3 |
| [s3\_plex\_storage](#module\_s3\_plex\_storage) | terraform-aws-modules/s3-bucket/aws | ~> 3.3 |
| [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.9 |

## Resources

| Name | Type |
|------|------|
| [aws_iam_policy.plex_server](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_security_group.plex_admin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_ssm_parameter.plex_claim_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
| [aws_ami.plex](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |
| [aws_availability_zones.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
| [aws_iam_policy_document.plex_ec2](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [aws\_region](#input\_aws\_region) | AWS Region | `string` | `"eu-central-1"` | no |
| [force\_destroy](#input\_force\_destroy) | Force destroy the S3 bucket | `bool` | `false` | no |
| [instance\_storage\_size](#input\_instance\_storage\_size) | Size for EC2 EBS root volume | `number` | `30` | no |
| [instance\_type](#input\_instance\_type) | Type of EC2 instance | `string` | `"t3a.micro"` | no |
| [plex\_claim\_token](#input\_plex\_claim\_token) | Token to claim your plex media server. You can get this by going to https://www.plex.tv/claim. | `string` | n/a | yes |
| [plex\_libraries](#input\_plex\_libraries) | List of Plex libraries | `list(string)` | n/a | yes |

## Outputs

No outputs.