Using RDS for PostgreSQL to Set Up Umami on ECS
In this blueprint we are going to set up Umami on T Cloud Public leveraging an Elastic Cloud Server (ECS), while using Relational Database Service (RDS) for PostgreSQL to manage the database.
Prerequisites
We are going to need, create and configure the following components:
- a PostgreSQL Instance in RDS: RDS automates database management tasks like backups, patching, and scaling. It simplifies deploying a PostgreSQL instance without needing to manage the infrastructure directly.
- an ECS Server for Umami: The server will be used to run Umami's application layer. You will install and configure Umami on this ECS instance, which will interact with the PostgreSQL database.
- Networking: Set up secure network configurations between your ECS and RDS, ensuring communication between the Umami application and the PostgreSQL instance.
- Deployment: After configuring the ECS and connecting it to the RDS database, you can deploy Umami, connect it to the database, and start monitoring your web traffic.
Creating an ECS Server
Click on the console Elastic Cloud Server->Create ECS and pick the flavor and operating system that suits your needs. Make sure though, you place it in the same VPC/Subnet that you are planning to install your RDS DB instance. For this blueprint we are going to set up Ubuntu 22.04 on a s7n.large.4 flavor. Consequently some of the commands that are going to be executed later, will assume you are working on a Ubuntu (or Debian-based) distribution.
Creating a PostgreSQL Database
We are going to create a single, non highly available PostgreSQL v16. In Relational Database Service click Create DB Instance:

Make sure you place the database server in the same VPC/Subnet that the ECS instance lives. Choose the flavor of your liking, provide the root password and press Create Now. For the time being, we are going to make no changes in the Security Groups; we are going to fix this in the next step.

Picking a single non-HA instance is just for demonstration purposes and not suitable for production. While implementing this blueprint adjust instances and replicas according to your needs and volume projections.
Installing Cryptographic Functions Plugins
In Relational Database Service click your instance and then navigate to Plugins. Search the list for the plugin pgcrypto, and install it by click the Install link.

Establishing Connectivity
In Relational Database Service click your instance and then navigate to Connectivity & Security and under Connection Topology choose Private Connection:

In this blueprint, we are interested in variant 2, where our database instance (with floating IP 172.16.0.30) needs to establish two-way communication with the ECS(B) instance, which in our case is the ECS instance that hold the Umami installation. For that matter we need to create two Security Groups, one that will allow inbound connections to port 5432 and will be assigned to our RDS instance and a second one that will allow outbound connections from port 5432 and will be assigned to the ECS instance that our workload will run.
Creating Security Group for RDS

For additional security, make sure you set as Source the CIDR of the your Subnet (in this case 172.16.0.0/24); in that way you prohibit anyone access your database outside your VPC/Subnet.
Go back to the Connectivity & Security panel of your database and replace under Security Group Rules -> Security Group, the default Security Group with the one we just created:
