Network Diagnostic API
A containerized Flask API for ping and DNS diagnostics, built and deployed to Google Cloud Run through Cloud Build.
Overview
A small web service that answers two common network questions: is a host reachable, and what IP address does a domain resolve to? It runs on Google Cloud and redeploys automatically from a build pipeline.
What I did
I wrote the API, packaged it as a container, and set up the pipeline that builds the image, stores it in Google's registry, and deploys it to Cloud Run.
Architecture
Flask app served by gunicorn inside a python:3.11-slim image with ping and DNS tools installed. Cloud Build builds and pushes to Artifact Registry, then runs `gcloud run deploy` to a managed Cloud Run service in us-central1.
System flow
- git push
- Cloud Build
- Artifact Registry
- Cloud Run
Technical decisions
- No shell interpolationCommands run via subprocess with argument lists and a 10-second timeout, never through a shell string.
- Clear endpoint contract`/health`, `/ping?host=`, and `/dns?domain=` return JSON with explicit 400 errors for missing parameters and DNS lookup timing in ms.
Technologies
Python · Flask · gunicorn · Docker · Google Cloud Run · Cloud Build · Artifact Registry