saayam-for-all / saayam-for-all/devsecops
Automated AWS Security Auditing and Compliance with Serverless Architecture
@praveen3599 is already working on this.
Since Jun 10, 2025.
- Dominant language
- Python
- Stars
- 2
- Forks
- 17
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Problem Statement:
To ensure continuous compliance and security within the AWS environment, there is a need for an automated mechanism to detect misconfigurations, unauthorized changes, and potential vulnerabilities across critical cloud services. Given the scale of services used—such as S3, IAM, EC2, RDS, Lambda, and others—manual audits are time-consuming and prone to oversight. Without proactive monitoring, issues like publicly accessible data, unencrypted resources, or unused access keys may go unnoticed, increasing the risk of breaches.
To address this, AWS Lambda can be scheduled via EventBridge to run daily scans across services using the Boto3 SDK. The findings can be stored in AWS S3, visualized through QuickSight, and enriched using Glue and Athena for querying. Alerts and summaries can be sent through SNS or SES to the DevSecOps team. This serverless, scheduled approach ensures regular, low-cost audits and enables early detection and response to security risks across the infrastructure.
Applied Solution:
-
Created SecurityAuditLambdaPolicy policy which grants permissions required for a Lambda function to perform automated security audits across AWS services. It includes scanning S3 buckets for encryption and public access configurations, checking IAM user keys, evaluating EC2 instances and RDS databases for security issues, inspecting Lambda function policies, saving audit results to a specific S3 bucket (saayam-security-audit-results), and publishing security alerts via SNS notifications.
-
Create a LambdaAuditRole and attach the SecurityAuditLambdaPolicy to it to give the Lambda function the precise, least-privilege permissions it needs in a secure, manageable way.
-
Created SecurityAuditAlerts SNS topic Topic in standard type to send notifications like emails related to security risks for testing purpose i've used my email later I'll change the email with organisation standard email.
-
Created DailySecurityAudit Lambda function to run the security checks automatically by selecting the existing role LambdaAuditRole.
-
Python Boto3 code was implemented(audit_scan.py) using lamdba function(DailySecurityAudit) to perform the following security checks:
Identify unencrypted S3 buckets
Detect unused IAM access keys
Analyze EC2 instance configurations
Verify RDS instance encryption
Inspect Lambda functions for public access
Save audit findings to an S3 bucket
Send security alerts via SNS notifications -
The above lambda function will create audit_findings object to store the data in saayam-virginia-private S3 bucket
-
. Created DailySecurityAuditTrigger EventBridge schedule that triggers audit_scan.py lambda function daily at 09:00AM PST Time Zone: America/New_York
Cron Expression: 0 12 * * ? * -
Created SecurityAuditScanResultsCrawler in AWS glue for generating scan results and attaching it to audit_findings. Created AWSGlueServiceRole-S3BucketScan IAM role to scan S3 bucket. Created security_audit_scans_db DB to store the tables Glue discovers.
-
Created athena-audit-query-results S3 object in saayam-virginia-private to store the results of the query processed in anthena
-
Query uusing Anthena by setting database to security_audit_scans_db
-
Qucksight integration is pending
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.