# rapticore/aws-onboarding architecture

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

- Interactive diagram: https://gitdiagram.com/rapticore/aws-onboarding
- Repository: https://github.com/rapticore/aws-onboarding

## Overview

##### Project type and purpose
- This is an infrastructure-as-code repository containing AWS CloudFormation templates (JSON/YAML) for onboarding AWS accounts into the Rapticore ecosystem.
- Its goal is to deploy IAM roles (cross-account trust), VPCs, EC2 instances, and supporting resources in either a “standard” or “freemium” configuration.
- There is also a small Kubernetes RBAC manifest and an Azure identity-pool setup via an AWS Lambda.

##### File structure
Top-level files:
- RapticoreCrossAccountStack.json/.yaml – the main cross-account IAM role template
- cloudAccountSample.csv – example bulk upload format
- freemium/… – CFN stacks for a cost-limited (“freemium”) environment
- standard/… – CFN stacks and scripts for the “standard” environment, including VPC, EC2, and an Azure-identity-pool Lambda
- kubernetes/viewer-role-binding.yml – Kubernetes RBAC for a viewer role in a cluster
Patterns:
- Separate directories per offering (“freemium” vs. “standard”)
- Templates for core IAM cross-account roles, VPC setup, EC2 provisioning
- A shell script + Lambda backup artifacts under standard/setup-azure-identity-pool-lambda

##### README for additional insights
- Describes two deployment methods (Console vs. AWS CLI) for the RapticoreCrossAccountStack
- Parameters required: RapticoreAccountId, RapticoreTenantId
- The end result is an IAM role ARN to be consumed by the Rapticore portal or CSV bulk onboarding

##### Detail
- Parameters being passed (RapticoreAccountId, RapticoreTenantId)
- Optional vs. mandatory components

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External systems
    RP["Rapticore Portal"]:::external
    CLI["AWS CLI"]:::external

    %% Deployment trigger
    subgraph "Deployment Trigger"
        RP -->|"Deploy Stack"| CFN["CloudFormation Service"]:::aws
        CLI -->|"Deploy Stack"| CFN
    end

    %% Target AWS Account
    CFN -->|"Execute Templates"| AWSAccount["Target AWS Account"]:::aws

    %% Core Cross-Account IAM
    subgraph "Core Cross-Account IAM" 
        IAMCore["RapticoreCrossAccountStack.yaml"]:::core
    end
    AWSAccount --> IAMCore
    IAMCore -->|Assume Role| RP

    %% Freemium Environment
    subgraph "Freemium Environment" 
        FR1["IAMRoleFreemiumCrossAccountStack.yaml"]:::core
        FR2["FreemiumEC2InstanceStack.yml"]:::compute
        FR3["FreemiumEC2InstanceWithNewVPCStack.yaml"]:::compute
        IAMCore --> FR1
        FR1 --> FR2
        FR1 --> FR3
    end

    %% Standard Environment
    subgraph "Standard Environment"
        STDAgg["StandardStack.yaml"]:::aws
        STD1["StandardVpcOnlyInfrastructure.yaml"]:::network
        STD2["StandardEC2InstanceOnly.yml"]:::compute
        STD3["StandardEC2InstanceOnlyWithNewVPCStack.yaml"]:::network
        IAMCore --> STDAgg
        STDAgg --> STD1
        STDAgg --> STD2
        STDAgg --> STD3

        %% Azure Identity-Pool Lambda
        subgraph "Azure Identity-Pool Lambda" 
            LRD["README.md"]:::code
            LSH["duplicate-lambda.sh"]:::code
            LZ1["function.zip"]:::code
            LZ2["function-config.json"]:::code
            LZ3["metadata.json"]:::code
            STDAgg --> LRD
            STDAgg --> LSH
            STDAgg --> LZ1
            STDAgg --> LZ2
            STDAgg --> LZ3
        end
    end

    %% Kubernetes RBAC
    Kubectl["kubectl apply"]:::external
    subgraph "Kubernetes Cluster"
        ViewerRBAC["viewer-role-binding.yml"]:::k8s
    end
    Kubectl --> ViewerRBAC

    %% Sample CSV
    CSV["cloudAccountSample.csv"]:::data

    %% Artifact
    CFN --> CSV

    %% Click Events
    click IAMCore "https://github.com/rapticore/aws-onboarding/blob/main/RapticoreCrossAccountStack.yaml"
    click FR1 "https://github.com/rapticore/aws-onboarding/blob/main/freemium/IAMRoleFreemiumCrossAccountStack.yaml"
    click FR2 "https://github.com/rapticore/aws-onboarding/blob/main/freemium/FreemiumEC2InstanceStack.yml"
    click FR3 "https://github.com/rapticore/aws-onboarding/blob/main/freemium/FreemiumEC2InstanceWithNewVPCStack.yaml"
    click STD1 "https://github.com/rapticore/aws-onboarding/blob/main/standard/StandardVpcOnlyInfrastructure.yaml"
    click STD2 "https://github.com/rapticore/aws-onboarding/blob/main/standard/StandardEC2InstanceOnly.yml"
    click STD3 "https://github.com/rapticore/aws-onboarding/blob/main/standard/StandardEC2InstanceOnlyWithNewVPCStack.yaml"
    click STDAgg "https://github.com/rapticore/aws-onboarding/blob/main/standard/StandardStack.yaml"
    click LRD "https://github.com/rapticore/aws-onboarding/blob/main/standard/setup-azure-identity-pool-lambda/README.md"
    click LSH "https://github.com/rapticore/aws-onboarding/blob/main/standard/setup-azure-identity-pool-lambda/duplicate-lambda.sh"
    click LZ1 "https://github.com/rapticore/aws-onboarding/blob/main/standard/setup-azure-identity-pool-lambda/lambda-backup/function.zip"
    click LZ2 "https://github.com/rapticore/aws-onboarding/blob/main/standard/setup-azure-identity-pool-lambda/lambda-backup/function-config.json"
    click LZ3 "https://github.com/rapticore/aws-onboarding/blob/main/standard/setup-azure-identity-pool-lambda/lambda-backup/metadata.json"
    click ViewerRBAC "https://github.com/rapticore/aws-onboarding/blob/main/kubernetes/viewer-role-binding.yml"
    click CSV "https://github.com/rapticore/aws-onboarding/blob/main/cloudAccountSample.csv"

    %% Styles
    classDef external fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef aws fill:#ebf5fb,stroke:#3498db,stroke-width:2px
    classDef core fill:#d6eaf8,stroke:#21618c,stroke-width:2px
    classDef network fill:#d5f5e3,stroke:#27ae60,stroke-width:2px
    classDef compute fill:#a9dfbf,stroke:#229954,stroke-width:2px
    classDef code fill:#fdf2e9,stroke:#e67e22,stroke-width:2px
    classDef k8s fill:#f5eef8,stroke:#8e44ad,stroke-width:2px
    classDef data fill:#fcf3cf,stroke:#b7950b,stroke-width:2px
```
