Skip to content

Instantly share code, notes, and snippets.

@ganapativs
Last active July 30, 2025 18:32
Show Gist options
  • Save ganapativs/a77095e5ed42976b645d829f1c1f8972 to your computer and use it in GitHub Desktop.
Save ganapativs/a77095e5ed42976b645d829f1c1f8972 to your computer and use it in GitHub Desktop.
Platform Engineer: Practical Design Problems

Platform Engineer: Practical Design Problems

πŸ”Ή BASIC LEVEL (5 Problems)


1. Design a system to rotate and archive log files daily.

Answer:

Use logrotate or a cron job with find + tar. Example:

0 0 * * * /usr/bin/find /var/log/myapp -name '*.log' -mtime +1 -exec gzip {} \;

Scorecard:

  • 5 – Understands rotation, retention, cron
  • 3 – Suggests manual cleanup only
  • 1 – Doesn’t understand log management

For: Junior


2. Automate user creation on multiple Linux servers using Ansible.

Answer:

- name: Create user
  hosts: all
  become: yes
  tasks:
    - name: Ensure user exists
      user:
        name: devuser
        state: present

Scorecard:

  • 5 – Uses Ansible with user module
  • 3 – Uses bash loop with SSH
  • 1 – Suggests manual creation

For: Junior


3. Create a secure S3 bucket and upload application configs.

Answer:

  • Enable encryption, versioning, restrict access via bucket policy.
  • Use boto3 or aws s3 cp for upload.

Scorecard:

  • 5 – Mentions bucket policy, encryption
  • 3 – Uploads to open bucket
  • 1 – Doesn’t know IAM or config storage

For: Junior


4. Design a cron-based backup for a directory to a remote server.

Answer:

# cron job
0 2 * * * rsync -az /data user@remote:/backups/data

Scorecard:

  • 5 – Uses rsync, secure transport
  • 3 – Uses scp, less efficient
  • 1 – No incremental or schedule awareness

For: Junior


5. Monitor a service and restart it if it fails (without external tools).

Answer:

#!/bin/bash
pgrep nginx > /dev/null || systemctl restart nginx

Hook to cron every minute.

Scorecard:

  • 5 – Combines pgrep, systemctl, cron
  • 3 – Hardcoded restart
  • 1 – Doesn’t detect failure

For: Junior



πŸ”Έ INTERMEDIATE LEVEL (5 Problems)


6. Design a simple CI/CD pipeline for a Python app using Git, Ansible, and systemd.

Answer:

  • Git push triggers pipeline
  • Ansible deploys app to VM, installs deps
  • systemd unit manages process

Scorecard:

  • 5 – Covers Git trigger, Ansible deploy, systemd run
  • 3 – Mixes build/deploy logic
  • 1 – Doesn't integrate stages

For: Both


7. Build an Ansible playbook to provision an EC2, install NGINX, and open port 80.

Answer:

  • Use ec2 module or Terraform for provisioning
  • Ansible installs NGINX and updates security group

Scorecard:

  • 5 – Understands provisioning and config
  • 3 – Only installs package
  • 1 – Misses networking/security

For: Both


8. Design a lightweight monitoring system using shell and cron that alerts on high disk usage.

Answer:

#!/bin/bash
df -h | awk '$5+0 > 80 { print $6 " is above threshold" }' | mail -s "Disk Alert" [email protected]

Scorecard:

  • 5 – Efficient script + mail + cron
  • 3 – Alerts without thresholds
  • 1 – No script or notification

For: Both


9. Secure a Linux VM with firewall rules, SSH hardening, and user restrictions.

Answer:

  • Use ufw or iptables, disable root login, use SSH keys, restrict sudoers.
sudo ufw allow 22
sudo ufw enable

Scorecard:

  • 5 – Mentions all areas (SSH, firewall, sudo)
  • 3 – Hardens one area only
  • 1 – Doesn’t mention security features

For: Both


10. Build a Python tool that uploads logs from a directory to S3 every hour.

Answer:

import boto3, os

s3 = boto3.client('s3')
for file in os.listdir('/var/log/app'):
    s3.upload_file(f'/var/log/app/{file}', 'my-bucket', f'logs/{file}')

Add as cron job.

Scorecard:

  • 5 – Uses boto3, cron, structure
  • 3 – Static upload logic
  • 1 – Doesn’t know how to automate

For: Both



πŸ”Ά ADVANCED LEVEL (5 Problems)


11. Design an auto-scaling group that runs a Python microservice behind a load balancer.

Answer:

  • Use EC2 ASG + Launch Template
  • ALB routes traffic
  • Health checks on /health

Scorecard:

  • 5 – Mentions ASG, ALB, health check
  • 3 – Deploys EC2 only
  • 1 – No scaling or load balancer

For: Senior


12. Create a secure file sync system across multiple regions (via S3 + shell + IAM).

Answer:

  • Upload to primary S3 bucket
  • Use cross-region replication
  • Sync with aws s3 sync

Scorecard:

  • 5 – Covers sync, IAM, security
  • 3 – Uses CLI but no policies
  • 1 – Manual copy without safety

For: Senior


13. Implement a canary deployment mechanism using Ansible or scripting.

Answer:

  • Tag small subset of hosts
  • Deploy to tagged group
  • Verify health, then deploy to rest

Scorecard:

  • 5 – Uses groups, checks, staged rollout
  • 3 – Deploys to all at once
  • 1 – No rollout logic

For: Senior


14. Design a system where application logs from multiple VMs go to a central server.

Answer:

  • Use rsyslog to forward logs
  • Central server collects and rotates them
  • Secure using TLS or VPN

Scorecard:

  • 5 – Uses syslog, rotation, security
  • 3 – Hardcodes log copy
  • 1 – No centralization logic

For: Senior


15. Build a Python agent that runs on remote VMs, collects metrics, and sends them via REST API.

Answer:

import psutil, requests

data = {'cpu': psutil.cpu_percent(), 'mem': psutil.virtual_memory().percent}
requests.post('https://monitor/api/metrics', json=data)

Scorecard:

  • 5 – Uses psutil, REST, cron or daemon
  • 3 – Collects but no push logic
  • 1 – Just prints data locally

For: Senior


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment