# rahulchidambaram/aws-automation-with-lambda-boto3 architecture

> Architecture diagram of the GitHub repository rahulchidambaram/aws-automation-with-lambda-boto3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahulchidambaram/aws-automation-with-lambda-boto3
- Repository: https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3

## Overview

This repository is a collection of four independent AWS Lambda automations, not one shared application. Each workflow is initiated by a Lambda invocation, performs a distinct storage, backup, tagging, or cost-monitoring task, and uses Boto3 to interact with AWS services. The README documents EventBridge scheduling or event triggers for the assignments; trigger configuration is not implemented in the sampled Lambda source, so those links are documented rather than inferred from code. IAM policies are permissions configuration, not runtime components.

Main entry points: [`03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py) (Launch tagging), [`04-Cost-Alert-SNS/lambda_function.py`](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/04-Cost-Alert-SNS/lambda_function.py) (Cost threshold check), [`01-Automated-S3-Bucket-Cleanup/lambda_function.py`](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/01-Automated-S3-Bucket-Cleanup/lambda_function.py) (Object cleanup), [`02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py`](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py) (Snapshot lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storage["Storage cleanup"]
  node_s3_cleanup["Object cleanup<br/>[lambda_function.py]"]
  node_s3[("Amazon S3")]
end

subgraph group_backup["EBS backups"]
  node_ebs_backup["Snapshot lifecycle<br/>[lambda_function.py]"]
  node_ec2_backup[("Amazon EC2 / EBS")]
  node_backup_schedule["EventBridge schedule"]
end

subgraph group_tagging["EC2 tagging"]
  node_tag_handler["Launch tagging<br/>[lambda_function.py]"]
  node_tag_event["EC2 state event"]
  node_cloudtrail_lookup["Launch principal lookup<br/>[lambda_function.py]"]
  node_cloudtrail[("AWS CloudTrail")]
  node_ec2_tags[("EC2 instance tags")]
end

subgraph group_cost["Cost alerts"]
  node_cost_handler["Cost threshold check<br/>[lambda_function.py]"]
  node_cost_explorer[("Cost Explorer")]
  node_sns["Amazon SNS"]
  node_cost_schedule["Daily schedule"]
end

node_caller(("Lambda invocation"))

node_caller -->|"invokes"| node_s3_cleanup
node_s3_cleanup -->|"lists and deletes"| node_s3
node_caller -->|"invokes"| node_ebs_backup
node_ebs_backup -->|"creates, lists, deletes"| node_ec2_backup
node_backup_schedule -.->|"triggers weekly"| node_caller
node_tag_event -.->|"invokes"| node_tag_handler
node_tag_handler -->|"looks up owner"| node_cloudtrail_lookup
node_cloudtrail_lookup -->|"searches events"| node_cloudtrail
node_tag_handler -->|"writes tags"| node_ec2_tags
node_caller -->|"invokes"| node_cost_handler
node_cost_handler -->|"queries spend"| node_cost_explorer
node_cost_handler -->|"publishes alert"| node_sns
node_cost_schedule -.->|"triggers daily"| node_caller

click node_s3_cleanup "https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/01-Automated-S3-Bucket-Cleanup/lambda_function.py"
click node_ebs_backup "https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py"
click node_tag_handler "https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py"
click node_cloudtrail_lookup "https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py"
click node_cost_handler "https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/04-Cost-Alert-SNS/lambda_function.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_s3_cleanup,node_s3 toneBlue
class node_ebs_backup,node_ec2_backup,node_backup_schedule toneAmber
class node_tag_handler,node_tag_event,node_cloudtrail_lookup,node_cloudtrail,node_ec2_tags toneMint
class node_cost_handler,node_cost_explorer,node_sns,node_cost_schedule toneRose
class node_caller toneIndigo
```

## Components

### Storage cleanup

- [Object cleanup](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/01-Automated-S3-Bucket-Cleanup/lambda_function.py): `01-Automated-S3-Bucket-Cleanup/lambda_function.py`
- **Amazon S3**

### EBS backups

- [Snapshot lifecycle](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py): `02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py`
- **Amazon EC2 / EBS**
- **EventBridge schedule**

### EC2 tagging

- [Launch tagging](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py): `03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`
- **EC2 state event**
- [Launch principal lookup](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py): `03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`
- **AWS CloudTrail**
- **EC2 instance tags**

### Cost alerts

- [Cost threshold check](https://github.com/rahulchidambaram/aws-automation-with-lambda-boto3/blob/main/04-Cost-Alert-SNS/lambda_function.py): `04-Cost-Alert-SNS/lambda_function.py`
- **Cost Explorer**
- **Amazon SNS**
- **Daily schedule**

### Other components

- **Lambda invocation**

## Connections

- Lambda invocation → Object cleanup: invokes (evidence: `01-Automated-S3-Bucket-Cleanup/lambda_function.py`)
- Object cleanup → Amazon S3: lists and deletes (evidence: `01-Automated-S3-Bucket-Cleanup/lambda_function.py`)
- Lambda invocation → Snapshot lifecycle: invokes (evidence: `02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py`)
- Snapshot lifecycle → Amazon EC2 / EBS: creates, lists, deletes (evidence: `02-Automated-EBS-Snapshot-Creation-and-Cleanup/lambda_function.py`)
- EventBridge schedule → Lambda invocation: triggers weekly
- EC2 state event → Launch tagging: invokes
- Launch tagging → Launch principal lookup: looks up owner (evidence: `03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`)
- Launch principal lookup → AWS CloudTrail: searches events (evidence: `03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`)
- Launch tagging → EC2 instance tags: writes tags (evidence: `03-Auto-Tagging-EC2-Instances-on-Launch/lambda_function.py`)
- Lambda invocation → Cost threshold check: invokes (evidence: `04-Cost-Alert-SNS/lambda_function.py`)
- Cost threshold check → Cost Explorer: queries spend (evidence: `04-Cost-Alert-SNS/lambda_function.py`)
- Cost threshold check → Amazon SNS: publishes alert (evidence: `04-Cost-Alert-SNS/lambda_function.py`)
- Daily schedule → Lambda invocation: triggers daily
