# easttimor/aws-incident-response architecture

> Architecture diagram of the GitHub repository easttimor/aws-incident-response, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/easttimor/aws-incident-response
- Repository: https://github.com/easttimor/aws-incident-response

## Overview

The project is focused on AWS Incident Response—providing both documentation (via GitHub Pages using Jekyll _layouts and a detailed README) and deployable infrastructure (using Terraform) for investigating API activities and automating notifications when high‐risk AWS API events occur. In essence, it documents Athena SQL queries to analyze CloudTrail logs and deploys AWS EventBridge rules (with SNS notifications) to alert on suspicious or misconfiguration activities.

##### Main Components
- Documentation/UI Component:
– The root contains a README.md and _layouts directory which shows that the project has a web-based component (e.g. GitHub Pages) where users can review incident response documentation and query examples.
- Terraform Infrastructure-as-Code (IaC) Component:
– The “terraform” directory includes main.tf, terragrunt.hcl, and multiple modules (e.g., rules and sns_topic). These are responsible for deploying EventBridge event filters and SNS topics into AWS.
- AWS Services (Conceptual Components):
– AWS CloudTrail: Source of security-related event logs.
– Amazon Athena: Used for querying and analyzing CloudTrail logs with SQL.
– AWS EventBridge: Configured to catch high-risk API events based on rules defined by Terraform.
– Amazon SNS: Deployed for notifications triggered by EventBridge.
– Optional AWS Config, VPC Flow Logs, and Lambda are mentioned in the documentation as part of the observation and incident response ecosystem.

##### File Structure and Relationships
- Terraform Modules:
– The “terraform/modules/rules” directory contains several .tf files with eventbridge-rule configurations and CloudTrail investigation queries. This signals that EventBridge is a major trigger point.
– The “terraform/modules/sns_topic” directory provides configuration for SNS topics that receive notifications from the EventBridge rules.
- The main Terraform configuration (e.g., main.tf in terraform/) ties these modules together and deploys the necessary AWS resources.
- Configuration files like terragrunt.hcl indicate potential environment management for reusable Terraform configurations.
- The _layouts directory and GitHub Pages link in the README show that the deployment not only handles infrastructure but also serves as a browsable incident response playbook.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Guidance/Playbook Layer
    subgraph "Guidance/Playbook Layer"
        DOC_README["Documentation (GitHub Pages - README)"]:::doc
        DOC_LAYOUT["Documentation (Layouts)"]:::doc
    end

    %% Terraform/IaC Deployment Layer
    subgraph "Terraform/IaC Deployment Layer"
        TF_CONF["Terraform Configuration"]:::terraform
        RULES_MODULE["EventBridge Rules Module"]:::terraform
        SNS_MODULE["SNS Topic Module"]:::terraform
        TF_CONF --> RULES_MODULE
        TF_CONF --> SNS_MODULE
    end

    %% Operational/Monitoring Layer
    subgraph "Operational/Monitoring Layer"
        CT["AWS CloudTrail – Log Source"]:::aws
        ATH["Amazon Athena – Query Engine"]:::aws
        EB["AWS EventBridge – Event Router"]:::aws
        SNS["Amazon SNS – Notification Service"]:::aws
    end

    %% Data Flows Between AWS Services
    CT -->|"logs"| ATH
    CT -->|"triggers"| EB
    EB -->|"alerts"| SNS

    %% Terraform Deployments to AWS Services
    TF_CONF -->|"provisions"| EB
    TF_CONF -->|"provisions"| SNS
    RULES_MODULE -->|"deploys_rules"| EB
    SNS_MODULE -->|"deploys_config"| SNS

    %% Interaction Between Documentation and Analytics
    DOC_README -->|"correlates"| ATH

    %% Class Definitions for Color Coding
    classDef doc fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef terraform fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef aws fill:#FFB6C1,stroke:#000,stroke-width:2px;

    %% Click Events for Documentation/UI Component
    click DOC_README "https://github.com/easttimor/aws-incident-response/blob/master/README.md"
    click DOC_LAYOUT "https://github.com/easttimor/aws-incident-response/blob/master/_layouts/default.html"

    %% Click Events for Terraform Infrastructure Component
    click TF_CONF "https://github.com/easttimor/aws-incident-response/blob/master/terraform/main.tf"
    click TF_CONF "https://github.com/easttimor/aws-incident-response/blob/master/terraform/terragrunt.hcl"

    %% Click Events for Event Filtering and Alerting (AWS EventBridge Rules)
    click RULES_MODULE "https://github.com/easttimor/aws-incident-response/blob/master/terraform/modules/rules/eventbridge-rule.tf"
    click RULES_MODULE "https://github.com/easttimor/aws-incident-response/blob/master/terraform/rules/ct-disruption-cloudtrail.tf"
    click RULES_MODULE "https://github.com/easttimor/aws-incident-response/blob/master/terraform/rules/ct-access-credentials.tf"

    %% Click Events for Notification (AWS SNS)
    click SNS_MODULE "https://github.com/easttimor/aws-incident-response/blob/master/terraform/modules/sns_topic/main.tf"
    click SNS_MODULE "https://github.com/easttimor/aws-incident-response/blob/master/terraform/modules/sns_topic/outputs.tf"
```
