I am working with 4 AWS EC2 instances (servers). Each Instance has Instance ID and Instance Name. Instance ID is unique. Each of them having multiple application servers, like on of them is running PUMA server and another one is running NGINX and so on. I want to store the running status of the instances and their application servers in a database.
Like, If Instance A
is running or not, that I can get by continuously hit into the exposed port per second and store it in the database. I am scanning it in each minute. There will be 3 columns I can think of right now,
Instance ID Running Status Time
Instance A Running 10:10:04
Instance A Running 10:11:04
Instance A Running 10:12:04
Next, I want to store the status if Application Servers within Instance A running or not. There will be 3 columns I can think of right now,
Let's say PUMA and NGINX are running in Instance A
Instance A :-
Application Name Running Status Time
PUMA Running 10:10:20
NGINX Running 10:10:30
PUMA Running 10:11:21
NGINX Running 10:11:30
I am using Postgresql. What will be the recommended schema design ? Should I create a table for each instance and how will I map the applications with that particular Instance ? If I take Instance ID
as a primary key then duplicate values in that column are not possible.