View a markdown version of this page

Set up the Infrastructure Documentation Generator - AWS Prescriptive Guidance

Set up the Infrastructure Documentation Generator

This section describes how to build and run the Infrastructure Documentation Generator tool. It provides a systematic approach to setting up both the backend service (FastAPI) and the frontend application (React UI) so that you can scan, analyze, and visualize AWS infrastructure. The backend is responsible for discovering resources, generating documentation, and mapping dependencies. The frontend presents results in an interactive UI. Together, these components form a complete approach for understanding and optimizing AWS environments.

Set up the backend service

These instructions guide you through setting up the backend service, which is responsible for scanning AWS accounts and generating structured infrastructure data. The backend API layer is built with FastAPI, a modern Python web framework. FastAPI provides endpoints for infrastructure scanning, documentation generation, dependency mapping, and cache operations. The backend interacts with various AWS services and provides an API for managing and retrieving cloud infrastructure details.

Prerequisites

Before you begin, make sure you meet the following prerequisites:

  • Python 3.9 or a later version installed on your machine.

  • AWS credentials configured—this prerequisite is mandatory. The tool requires AWS credentials to interact with your AWS account. You must use the AWS Command Line Interface (AWS CLI) aws configure command to configure your credentials to allow the service to access AWS resources.

  • Amazon Bedrock with access to Claude 3.7 Sonnet enabled.

Set up and run the backend environment

To set up the backend environment, use the following steps:

  1. To clone the repository, run the following command:

    git clone https://github.com/awslabs/InfraDocGen.git

  2. To create and activate a virtual environment, run the following command:

    python3 -m venv venv source venv/bin/activate

  3. To install backend dependencies, run the following command:

    pip install -r requirements.txt

  4. To start the API server, run the following command:

    uvicorn main:app --reload

Set up the frontend application

These instructions guide you through setting up the frontend application, which visualizes AWS resources, analysis reports, and dependency graphs in an interactive web UI. The frontend uses a React Flow library to render interactive, zoomable, and searchable graphs of AWS resource dependencies. The frontend application interacts with the backend service to display infrastructure data in a user-friendly and insightful way.

Prerequisites

Before you begin, make sure you meet the following prerequisites:

  • Node.js v20+ or a later version installed.

  • A package manager to install frontend dependencies, for example, npm or Yarn.

Set up and run the frontend application

To set up the frontend environment and run the application, use the following steps.

  1. To move to the UI project, run the following command:

    cd infra-ui

  2. To create an environment file to connect to the backend service, run the following command:

    echo "VITE_API_BASE_URL=http://127.0.0.1:8000" > .env

  3. To install frontend dependencies, run the following command:

    npm install

  4. To start the frontend development server, run the following command:

    npm run dev

Run the backend and the frontend together

After the backend service and the frontend application are set up successfully, you can run the full system to experience the complete functionality. To use the system effectively, start both the backend API server and the frontend UI in parallel, each in its own terminal window or tab.

To run the backend and the frontend together, use the following steps:

  1. Start the backend API (uvicorn main:app --reload) in one terminal.

  2. Start the frontend UI (npm run dev) in another terminal.

  3. Open the UI at http://localhost:3000". The UI connects automatically to the backend at http://127.0.0.1:8000.

From the UI, you can trigger scans, view service-wise expandable infrastructure data, explore dependency graphs, and download Markdown documentation.