HARDVerified Real Interview• Data Engineer / Business Intelligence Engineer

AWS Server Utilization Time

Amazon Web Services (AWS) tracks uptime logs for ec2 instances. A server is started with a start event and subsequently stopped with a stop event. Each start has a matching stop event.

Write a query to calculate the total uptime in full days across all servers in the fleet. Convert the total seconds or hours of uptime into whole days (i.e. FLOOR(total_seconds / 86400) or total_hours / 24).

Table:

  • server_utilization (server_id INT, status_time TIMESTAMP, session_status VARCHAR)

Execution Sandbox:

Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.

Standard SQL (ANSI)|Ln 1, Col 1
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.