Back to the Recipe Book

Recipe 04 · Choose your ingredients

Python + FastAPI

For evidence collection, repeatable checks, and automation.

Learn by building: Open the guided GRC project lesson for this stack.

Each recipe uses the same learning path: understand the ingredients, follow one realistic example, build a small first version, test failure cases, then decide whether to add more. You do not need every ingredient on day one.

All five recipes · Jump to a recipe

When to choose this

What problem does it solve?

A script or service that reads permitted cloud data, applies a documented rule, and produces evidence for human review.

Try the simpler option first: A spreadsheet export or one Python script may be the right first version.

New to the terminology? Start with What Is a Technology Stack? or follow the browser-to-server diagram.

Under the hood

Meet the ingredients

Frontend

None for a scheduled script; add a simple page or React UI only if people need one

Backend

Python scripts; FastAPI when a real HTTP API is needed

Storage

Local files or SQLite for a prototype; PostgreSQL or object storage as requirements grow

Source control

GitHub

Why it works with AI-assisted coding: Python libraries and cloud SDKs make it practical to inspect one operation at a time. AI can explain API responses and help generate test fixtures.

See the stack in action

One project, from input to result

Goal: Run a repeatable evidence check

01 · Input

A fictional JSON record describing a storage encryption setting

02 · What the stack does

Python applies one documented rule; FastAPI is optional if other systems need an endpoint

03 · Result

A JSON or CSV report with Pass, Fail, or Unknown and a reason

Your first working milestone

One function tested with compliant, noncompliant, and missing-data fixtures

Check that it works

Each sample returns its expected result and explanation

Check what happens when it fails

Missing data never becomes a false Pass; file and API errors are visible

Only then consider: Connect read-only cloud APIs only after local tests work; add FastAPI only if needed

Three GRC ideas

What could you build?

  1. AWS configuration evidence collector using permitted read-only APIs
  2. Automated control check with documented pass/fail criteria
  3. Compliance evidence report generator from fictional inputs

Your first version

Build a little, test a little

  1. Start with a Python script reading synthetic evidence from a local file.
  2. Define the check, expected output, and what happens when data is missing.
  3. Replace the fixture with a read-only cloud API call in a properly authorized test account.
  4. Schedule the script only after logging, credential handling, and failure alerts work. Add FastAPI only if another system needs an endpoint.

Where it runs: Run locally during learning. For scheduled production jobs, evaluate AWS Lambda, a managed container, or another scheduled runtime. Hosting a FastAPI service requires an API-capable runtime; a script alone does not.

Ask AI, then decide

A prompt worth trying

I want a small Python evidence collector. First show a version using fictional JSON. Define success, failure, and missing-data behavior. Explain whether I need FastAPI, a database, or just a scheduled script.

Review the recommendation against your Playbook blueprint. Ask what can be removed, what could go wrong, and how you will test it.