# pratikmahajan/aws-to-azure-infrastructure-migration architecture

> Architecture diagram of the GitHub repository pratikmahajan/aws-to-azure-infrastructure-migration, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pratikmahajan/aws-to-azure-infrastructure-migration
- Repository: https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration

## Overview

##### Project Type and Purpose
- The project is an Infrastructure as Code solution designed to provision and manage cloud resources on both AWS and Azure.
- The README emphasizes the ability to deploy infrastructure for a Webapp, implement CI/CD pipelines, and facilitate migration between AWS and Azure.
- The project follows best practices: environments (such as dev and prod) are segregated and modules are used to represent reusable pieces of cloud infrastructure.

##### File Structure
- Top-level files include standard version controls (e.g., .gitignore, CODEOWNERS, LICENSE) and the README.
- There are two main cloud directories: “aws” and “azure”. Each contains subdirectories for environments (mostly “prod” shown) and a modules folder.
- Under each modules folder, you see distinct Terraform modules representing different resources (e.g., AWS: ec2_instance, vpc, lambda, etc.; Azure: virtual_network, blob_storage, function, etc.).
- The “terraform_install” directory holds scripts and instructions to install Terraform, an essential part of the deployment pipeline.

##### Using the README for Additional Insights
- The README outlines the project’s structure, key Terraform commands, and even provides a table that maps AWS resources to Azure services.
- This mapping shows that the system is not just provisioning separate infrastructures; it’s enabling a migration or comparison between two major cloud providers.
- Additionally, the README emphasizes the CI/CD aspect hinting at integrations like Codedeploy on AWS (e.g., modules like codedeploy_application) and corresponding services on Azure.

a. Main Components:
- Terraform Installation: Represented by the terraform_install scripts.
- Environments: Highlight dev and prod environments (even if the file tree shows prod, note that best practices include both).
- AWS Infrastructure: A cluster of modules such as VPC, EC2 instance, Auto Scaling, Load Balancer, Lambda, RDS, SNS, CodeDeploy, etc.
- Azure Infrastructure: A corresponding cluster of modules such as Virtual Network, Storage Accounts, Blob Storage, Cosmos DB, Functions, Event Grid, Load Balancer, etc.
- CI/CD/CD Integration: A component for automation, e.g., the IAM module for CircleCI and possibly references to Codedeploy in AWS.
- Additional components: Migration mapping (table shown in README) that connects AWS components to Azure services.

b. Relationships and Interactions:
- For each environment, show how Terraform (deployment tool) initiates the provisioning of modules on either cloud provider.
- Within each cloud cluster, illustrate the dependencies e.g., VPC/Virtual Network is foundational to security groups, EC2 instances, load balancers, etc.

c. Architectural Patterns and Design Principles:
- Modularity: The use of separate Terraform modules demonstrates a modular design. Emphasize this by grouping modules logically per cloud provider.
- Abstraction and Mapping: Show the abstraction layer that maps AWS resources to their Azure service equivalents, as shown in the README’s table.
- CI/CD Integration: Clearly note the CI/CD mechanisms that trigger Terraform plans and applies.

d. Relevant Technologies, Frameworks, or Libraries:
- Terraform is the central technology used for managing infrastructure.
- AWS-specific modules (e.g., VPC, EC2, Lambda) and Azure-specific modules (e.g., Virtual Network, Functions) should be labeled.

- In the AWS section, add modules such as:
– VPC
– EC2 Instance and related autoscaling, ELB, Security Group modules
– Lambda functions, RDS, DynamoDB, SNS, and CodeDeploy related modules.
- In the Azure section, add modules such as:
– Virtual Network, Blob Storage, Cosmos DB, Functions, Load Balancer, DNS, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    TCD["Terraform & CI/CD Pipeline"]:::terraform
    TCD --> AWS_ENV["AWS Environment: Prod"]:::aws
    TCD --> AZ_ENV["Azure Environment: Prod"]:::azure

    subgraph "AWS Infrastructure (Prod)"
        AWS_ENV
        AWS_VPC["AWS VPC"]:::aws
        AWS_SG["AWS Security Group"]:::aws
        AWS_EC2["AWS EC2 Instance"]:::aws
        AWS_AS_CONFIG["AWS Auto Scaling Config"]:::aws
        AWS_AS_POLICY["AWS Auto Scaling Policy"]:::aws
        AWS_LAMBDA["AWS Lambda"]:::aws
        AWS_RDS["AWS RDS Database"]:::aws
        AWS_SNS["AWS SNS Topic"]:::aws
        AWS_COD_DEP_APP["AWS CodeDeploy Application"]:::aws
        AWS_COD_DEP_GROUP["AWS CodeDeploy Group"]:::aws
        AWS_COD_DEP_LB["AWS CodeDeploy Group Loadbalancer"]:::aws
        AWS_IAM_CI["AWS CI/CD Integration (CircleCI IAM)"]:::aws
        AWS_DYNAMODB["AWS Dynamodb"]:::aws
    end

    subgraph "Azure Infrastructure (Prod)"
        AZ_ENV
        AZ_VNET["Azure Virtual Network"]:::azure
        AZ_BLOB["Azure Blob Storage"]:::azure
        AZ_FUNCTION["Azure Function"]:::azure
        AZ_LOAD_BALANCER["Azure Load Balancer"]:::azure
        AZ_DNS["Azure DNS"]:::azure
        AZ_COSMOS["Azure Cosmos DB"]:::azure
        AZ_EVENT_GRID["Azure Event Grid"]:::azure
        AZ_KEYVAULT["Azure Key Vault"]:::azure
        AZ_STORAGE_ACC["Azure Storage Account"]:::azure
        AZ_MARIADB["Azure MariaDB Database"]:::azure
    end

    %% Connections within AWS
    AWS_ENV -->|"provisions"| AWS_VPC
    AWS_ENV -->|"configures"| AWS_SG
    AWS_VPC -->|"hosts"| AWS_EC2
    AWS_EC2 -->|"scales_via"| AWS_AS_CONFIG
    AWS_AS_CONFIG -->|"policy"| AWS_AS_POLICY
    AWS_VPC -->|"triggers"| AWS_LAMBDA
    AWS_VPC -->|"supports"| AWS_RDS
    AWS_VPC -->|"notifies"| AWS_SNS
    AWS_VPC -->|"stores_data_in"| AWS_DYNAMODB
    AWS_ENV -->|"deploys"| AWS_COD_DEP_APP
    AWS_COD_DEP_APP -->|"groups_with"| AWS_COD_DEP_GROUP
    AWS_COD_DEP_GROUP -->|"balances"| AWS_COD_DEP_LB
    AWS_ENV -->|"integrates"| AWS_IAM_CI

    %% Connections within Azure
    AZ_ENV -->|"provisions"| AZ_VNET
    AZ_VNET -->|"stores_in"| AZ_BLOB
    AZ_VNET -->|"runs"| AZ_FUNCTION
    AZ_VNET -->|"balances"| AZ_LOAD_BALANCER
    AZ_VNET -->|"manages"| AZ_DNS
    AZ_VNET -->|"hosts"| AZ_COSMOS
    AZ_VNET -->|"routes_events"| AZ_EVENT_GRID
    AZ_VNET -->|"secures"| AZ_KEYVAULT
    AZ_VNET -->|"allocates"| AZ_STORAGE_ACC
    AZ_VNET -->|"supports"| AZ_MARIADB

    %% Migration Mapping between AWS and Azure
    AWS_ENV ---|"migration_mapping"| AZ_ENV

    %% Click Events
    click TCD "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/blob/master/terraform_install/install_terraform.sh"
    click AWS_ENV "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/environments/prod"
    click AWS_VPC "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/vpc"
    click AWS_SG "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/security_group"
    click AWS_EC2 "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/ec2_instance"
    click AWS_AS_CONFIG "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/ec2_autoscaling_config"
    click AWS_AS_POLICY "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/ec2_autoscaling_policy"
    click AWS_LAMBDA "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/lambda"
    click AWS_RDS "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/rds_database"
    click AWS_SNS "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/sns_topic"
    click AWS_COD_DEP_APP "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/codedeploy_application"
    click AWS_COD_DEP_GROUP "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/codedeploy_group"
    click AWS_COD_DEP_LB "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/codedeploy_group_loadbalancer"
    click AWS_IAM_CI "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/iam_circleci"
    click AWS_DYNAMODB "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/aws/modules/dynamodb_instance"
    click AZ_ENV "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/environments/prod"
    click AZ_VNET "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/virtual_network"
    click AZ_BLOB "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/blob_storage"
    click AZ_FUNCTION "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/function"
    click AZ_LOAD_BALANCER "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/loadbalancer"
    click AZ_DNS "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/dns"
    click AZ_COSMOS "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/cosmos_db"
    click AZ_EVENT_GRID "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/event_grid"
    click AZ_KEYVAULT "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/key_vault"
    click AZ_STORAGE_ACC "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/storage_account"
    click AZ_MARIADB "https://github.com/pratikmahajan/aws-to-azure-infrastructure-migration/tree/master/azure/modules/mariadb_database"

    %% Styles
    classDef terraform fill:#d8b0ff,stroke:#4b0082,stroke-width:2px;
    classDef aws fill:#b3e5fc,stroke:#0277bd,stroke-width:2px;
    classDef azure fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
```
