We decided to move our PostgreSQL and Redis extensions from Heroku to separate services based on Amazon EC2 instances.
First of all, let’s create two instances based on Ubuntu 16.04 LTS operating system:
Cool. Now we have two instances up and running. One for PostgreSQL and one for Redis.
To allow remote connection to our instances and ports - 5432 for PG and 6379 for Redis, we need to create Security Groups and assign them to each instance.
Now let’s create rules for Postgresql.
And rules for Redis.
Now we can change security group of each instance and assign right one.
This post assumes, what you have experience with Linux and bash, you had installed Postgresql and Redis on your instances, customized config files to allow remote connections with correct default port bindings.