Architecting a Secure Serverless Audit Platform on AWS: EC2 Cognito, S3, and DynamoDB
An architectural deep dive into shipping AuditIQ Cloud using AWS App Runner, Amazon Cognito JWT authentication with IDOR protection, private encrypted S3 storage, and DynamoDB audit run persistence.
Shipping Enterprise AI on AWS Infrastructure
Building a cloud application for sensitive corporate financial data requires strict security isolation, low latency, and operational simplicity.
For AuditIQ Cloud, we engineered a cloud infrastructure utilizing AWS EC2, AWS Amplify, Amazon Cognito, Amazon S3, Amazon DynamoDB, and Amazon Bedrock.
☁️ The AWS Infrastructure Stack
┌──────────────────────────────┐
│ AWS Amplify Hosting │
│ React 19 + Vite Frontend │
└──────────────┬───────────────┘
│
┌──────────────┴───────────────┐
│ │
▼ ▼
┌───────────────────┐ ┌──────────────────────┐
│ Amazon Cognito │ │ AWS EC2 │
│ User Pool │ │ FastAPI Container │
│ RS256 JWT Auth │ │ │
└───────────────────┘ └───────────┬──────────┘
│
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Amazon S3 │ │ Amazon DynamoDB│ │ Amazon Bedrock │
│ │ │ │ │ │
│ AES-256 Data │ │ Persistent │ │ Claude / Nova │
│ Storage │ │ Runs │ │ LLMs │
└────────────────┘ └────────────────┘ └────────────────┘
🔐 Key Security & Architectural Implementations
1. Identity & Access Management with Amazon Cognito
- JWT Bearer Authentication: Users authenticate against Amazon Cognito User Pools and receive RS256-signed JSON Web Tokens.
- Role-Based Authorization: Custom claims such as
AUDITORandADMINare embedded within the JWT and used for authorization.
- IDOR Protection: The EC2 backend extracts
user_iddirectly from the validated token claims, ensuring users can only access datasets they own.
2. Auto-Scaling Container Microservice with AWS EC2
We packaged our Python FastAPI backend as a lightweight Docker container and deployed it using AWS EC2.
- IAM Instance Roles: Eliminates hardcoded AWS credentials. The container assumes a least-privilege IAM role to access Amazon S3, Amazon DynamoDB, and Amazon Bedrock.
- Automatic Scaling: Dynamically handles concurrent analysis requests without requiring manual server provisioning or infrastructure management.
3. Encrypted Data Durability with Amazon S3 & DynamoDB
Amazon S3
Raw transaction CSVs, normalized data frames, and exported PDF reports are stored in Amazon S3 with server-side encryption.
- Encryption at Rest: Data is protected using AES-256 server-side encryption.
- Secure Downloads: PDF reports are delivered through time-limited presigned URLs, preventing direct public access to stored reports.
# S3 Presigned URL Generation for Secure PDF Downloads
def generate_report_presigned_url(
s3_key: str,
expires_in: int = 900
) -> str:
s3_client = boto3.client(
"s3",
region_name="us-east-1"
)
return s3_client.generate_presigned_url(
"get_object",
Params={
"Bucket": "auditiq-cloud-reports",
"Key": s3_key
},
ExpiresIn=expires_in
)Amazon DynamoDB
Amazon DynamoDB maintains persistent application state, including:
- Dataset metadata in
AuditIQDatasets
- Immutable investigation runs in
AuditIQAuditRuns
- Historical analysis sessions
- Audit-related application state
This allows auditors to resume historical investigations even after backend container restarts.
🤖 AI Processing with Amazon Bedrock
Amazon Bedrock provides the foundation-model layer for AuditIQ Cloud.
The backend can securely invoke supported foundation models, such as Anthropic Claude or Amazon Nova, without managing model infrastructure directly.
This architecture keeps AI processing integrated with the application's AWS-native security and IAM model.
🏆 Summary
Using AWS-native services enabled us to ship AuditIQ Cloud with:
- Zero server provisioning and management
- Secure identity and role-based access control
- Encrypted financial data storage
- Isolated user datasets
- Persistent investigation history
- Time-limited secure report downloads
- Automatic application scaling
- Managed access to enterprise AI models through Amazon Bedrock
The result is a secure, scalable, and operationally simple cloud architecture designed for enterprise financial-data analysis.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article