# yash-sonani/lambdacodetostopec2 architecture

> Architecture diagram of the GitHub repository yash-sonani/lambdacodetostopec2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash-sonani/lambdacodetostopec2
- Repository: https://github.com/yash-sonani/lambdacodetostopec2

## Overview

Project Type: AWS Serverless Automation Tool

##### Main Components

a. AWS Services:
- AWS Lambda (central component)
- Amazon EC2 Instances (target resources)
- Amazon CloudWatch Events/EventBridge (trigger mechanism)
- IAM Role/Permissions (security layer)

##### Component Relationships
- Lambda as the processing unit
- EC2 instances as the target resources
- IAM roles connecting Lambda to EC2 services

##### Important Details

a. Annotations:
- Cron schedule: "01 15 * * ? *"
- EC2 tag filtering logic
- Python 3.7 runtime

b. Process Flow:
- Sequential flow of the automation
- Tag-based filtering mechanism

##### Additional Elements

- Scheduled trigger timing (9:01 PM daily)
- Tag-based filtering mechanism
- Service interactions

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Scheduled Trigger: 9:01 PM Daily]
        L2[Tag-based EC2 Instance Filtering]
        L3[Service Interactions]
    end

    subgraph Trigger
        CW[CloudWatch Events/EventBridge]:::cloudwatch
        CRON["Cron Schedule:<br/>01 15 * * ? *"]:::schedule
    end

    subgraph Processing
        Lambda["AWS Lambda Function<br/>(Python 3.7)"]:::lambda
        Filter["EC2 Tag Filter<br/>Logic"]:::process
    end

    subgraph Resources
        EC2["Amazon EC2<br/>Instances"]:::ec2
    end

    subgraph Security
        IAM["IAM Role/<br/>Permissions"]:::iam
    end

    CW --> CRON
    CRON --> Lambda
    Lambda --> Filter
    Filter --> EC2
    IAM -.-> Lambda
    IAM -.-> EC2

    click Lambda "https://github.com/yash-sonani/LambdaCodeToStopEC2/blob/master/lambda_function.py"

    classDef cloudwatch fill:#3B48CC,color:#fff,stroke:#333
    classDef schedule fill:#666,color:#fff,stroke:#333
    classDef lambda fill:#FF9900,color:#000,stroke:#333
    classDef process fill:#999,color:#fff,stroke:#333
    classDef ec2 fill:#FF0000,color:#fff,stroke:#333
    classDef iam fill:#FF9900,color:#000,stroke:#333
```
