Senior questions
Every rated question at this level, grouped by topic and tagged with the company it came up at.
Cloud 2 questions
- Build a Serverless API with Lambda, API Gateway, and DynamoDB
More
Scenario
An internal serverless API is needed for order management. Orders must be stored in a DynamoDB table with all access routed through a Lambda function — never direct database access. The Lambda execution role should follow least-privilege principles, limiting permissions to only what's necessary.
Task
- Create a DynamoDB table named
orderswithorderIdas the partition key - Create an IAM role called
lambda-orders-rolethat assumes Lambda permissions - Create a
orders-handlerLambda function using Python 3.12 with environment variableTABLE_NAME=orders(code provided at/tmp/handler.py) - Create a REST API named
orders-apiwith an/ordersendpoint supporting GET and POST methods - Deploy to a
devstage for public access
- Create a DynamoDB table named
- Deploy an Internal Web Application with VPC, EC2, ALB, and Route 53
More
Scenario
You need to deploy a web application accessible only within a VPC. EC2 instances run in private subnets behind an Application Load Balancer in public subnets. A startup script at
/tmp/userdata.shruns a simple HTTP server with a/healthendpoint on port 80.Task
- Create a VPC named
app-vpcusing CIDR10.0.0.0/16with public and private subnets across two availability zones - Establish two security groups:
alb-sgallowing HTTP from internal networks, andec2-sgallowing HTTP only from the load balancer - Launch two EC2 instances in private subnets using Amazon Linux 2 AMI with the provided startup script
- Configure an ALB named
app-albwith target groupapp-tg, health checks at/health, and HTTP listener on port 80 - Create a private Route 53 hosted zone for
internal.example.comand add a CNAME recordapp.internal.example.compointing to the ALB
- Create a VPC named
Containers 1 question
- Docker Network Configuration Fix
More
Scenario:
You have created a macvlan network called
mymacvlanto give containers their own MAC addresses on the physical network. However, containersmac1andmac2started on this network cannot ping the host or the gateway at192.168.50.1.Task:
Correct the macvlan network configuration so that both
mac1andmac2can successfully ping the gateway at192.168.50.1.
Kubernetes 1 question
- CRD Schema Validation
More
Scenario
You manage a CustomResourceDefinition (CRD) for "Widgets". Currently, the API allows users to create widgets with missing or invalid configuration, which causes the controller to crash.
Task
Modify the existing
widgets.mycompany.ioCRD to enforce a schema. Require the fieldspec.sizeto be present. Restrictspec.sizeto be anintegerwith a minimum value of1. Attempt to create a custom resource namedbad-widget(provided in the filebad-widget.yaml) that is missing the size field. Verify that the creation fails and the resource is not created.
Linux 4 questions
- Automated Archive and Retention
More
Scenario
Configuration files in
/etcare at risk of being lost due to accidental changes or deletions, and there's currently no automated backup process in place.Task
Write a shell script at
/usr/local/bin/backup_etc.shthat accepts a target backup path (where files will be saved at) as a command-line argument, creates a compressed archive of/etcwith the naming formatetc-backup-YYYY-MM-DD.tar.gz, automatically removes backups older than 7 days, and exits with an error if no path is provided. Make the script executable and create a cron job to run it daily at 02:00 AM, storing backups in/backups/etc/usingcrontabcommand. You can use https://crontab.guru for cronjob format.Once script is created execute it
/usr/local/bin/backup_etc.sh /backups/etc/Example
# Before (no automated backups) No backup script exists /etc directory unprotected Manual backups required# After (automated backup system configured) Backup script created and executable Running without argument: Error: Backup directory path required Running with argument creates timestamped backup: /backups/etc/etc-backup-2025-11-06.tar.gz After 7 days of daily backups: etc-backup-2025-11-01.tar.gz (deleted - older than 7 days) etc-backup-2025-11-02.tar.gz (deleted - older than 7 days) etc-backup-2025-11-03.tar.gz etc-backup-2025-11-04.tar.gz etc-backup-2025-11-05.tar.gz etc-backup-2025-11-06.tar.gz etc-backup-2025-11-07.tar.gz etc-backup-2025-11-08.tar.gz etc-backup-2025-11-09.tar.gz Cron job configured: runs daily at 02:00 AM
- Manage Service Failure Recovery
More
Scenario
You have a shell script at
/usr/local/bin/check_app.shthat runs periodically and exits with a non-zero code. The script is currently failing due to a simulated error condition.Task
Create a
systemd servicenamedcheck_app.servicethat automatically restarts the script when it fails, but stops retrying after3 restartattempts within60 seconds. Configure the service to start on boot with a5-second delaybetween restart attempts, then start the service and verify it hits the restart limit.
- Rapid Disk Growth on Var
More
Scenario
Disk usage on the
/varpartition is at 92% and increasing rapidly. You need to identify the largest files consuming space and determine if they're actively used by processes or need log rotation.Task
Find the 10 largest files under
/varand save them to/home/devops/largest_var_files.txt, check which processes are using these files and save results to/home/devops/file_processes.txt, and verify log rotation configuration for any log files found, saving results to/home/devops/logrotate_status.txt.Example
# File: /home/devops/largest_var_files.txt 2.3G /var/log/mysql/mysql-slow.log 1.8G /var/lib/docker/overlay2/abc123/diff/app/data.db 1.3G /var/log/nginx/access.log 891M /var/cache/apt/archives/linux-image-generic.deb 655M /var/log/syslog.1 450M /var/log/myapp/app.log ...# File: /home/devops/file_processes.txt tail 44 root 3r ... /var/log/mysql/sorted.log tail 45 root 3r ... /var/log/nginx/test.log tail 46 root 3r ... /var/log/hello.1 ...# File: /home/devops/logrotate_status.txt /etc/logrotate.d/test:/var/log/test.log /etc/logrotate.d/test:/var/log/hello.log ...
- Trace Process Service Ownership
More
Scenario
A process is consuming excessive resources, but its origin is unclear.
Task
Create a utility script at
/home/devops/trace_service.shthat accepts a PID argument and outputs its managing systemd service name, full status, and the last 20 log entries.trace_service.sh Example:#!/bin/bash PID=$1 echo "PID: $PID" # Extract service name managing this PID using systemd # Hint: systemd can resolve a PID back to its unit SERVICE="" echo "SERVICE: $SERVICE" echo "---- STATUS ----" # Hint: show full systemd status for the identified service with --no-pager flag echo "---- LOGS ----" # Hint: show the last 20 log entries for the service from journald with --no-pager flagExample
Running the script should produce a structured report similar to this:
root@server:~# ./trace_service.sh 4567 Service Identified: nginx.service --- Status --- ● nginx.service - A high performance web server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: active (running) since Fri 2025-12-19 14:00:00 UTC; 1h ago Main PID: 4567 (nginx) --- Last 20 Logs --- Dec 19 14:00:01 server nginx[4567]: Starting web server... Dec 19 14:00:02 server nginx[4567]: Configuration loaded successfully. ...
Networking 1 question
- Nginx Rate Limit Calculation
More
Scenario
Your Nginx web server has recently experienced performance issues caused by excessive traffic from a few aggressive clients. You've decided to enable rate limiting based on the recent traffic pattern. To determine the proper limit, you first need to analyze request frequency.
Task
Find the top 3 client IPs by number of requests from
/var/log/nginx/access.log, calculate the rate limit using the formula(sum of top 3 IP request counts / 3) * 0.8, write this value into/etc/nginx/nginx.confaslimit_req_zone $binary_remote_addr zone=app_limit:10m rate=<rate_limit>r/s;, and verify the configuration withnginx -t.Example
# Before (no rate limiting configured) Access log contains thousands of requests from various IPs No rate limit configured in nginx.conf Need to analyze traffic and set appropriate limit# After (rate limit calculated and configured) Top 3 IPs analyzed: 4523, 3891, 3456 requests Rate limit calculated: 7896 r/s Configuration updated and validated successfully nginx -t: syntax ok, test successful