How edelwud/dynamodb-s3-export works
<explanation>
To craft an accurate, detailed system‐design diagram for this AWS CDK–based “DynamoDB‐to‐S3 export” project, follow these steps tailored to its structure and purpose:
1. Identify the project type and purpose
- This is an Infrastructure‑as‑Code (IaC) project using AWS CDK in TypeScript.
- Its goal: provision AWS resources that run a Lambda function to export data from a DynamoDB table into an S3 bucket.
- It also includes a GitHub Actions stack for CI/CD.
2. Analyze the file structure
- Top‑level CDK entrypoint: src/main.ts
- Stacks under src/:
• network.stack.ts – VPC, subnets, security groups
• dynamodb‑s3‑export.stack.ts – DynamoDB table, S3 bucket, IAM roles
• github‑actions.stack.ts – constructs to set up GitHub Actions secrets/roles
- Stage definition: src/exporter‑application.stage.ts groups multiple stacks into a deployable unit.
- Lambda code under src/services/:
• export-function.ts and export.lambda.ts – handler logic using AWS Powertools
- CI config: .github/workflows//*.yml**
- Diagram reference in docs/diagram/diagram.png
3. Examine the README for additional insights
- The diagram already hints at components: network → DynamoDB → Lambda → S3
- Mentions a separate “Security” repository for initializing the GitHubActionsStack
4. Main components to represent in your diagram
a. Developer / GitHub
– Pushes code → triggers GitHub Actions workflow
b. CI/CD Pipeline (GitHub Actions)
– Builds & deploys the CDK app
– Deploys three stacks in the exporter stage
c. Network Stack
– VPC, public/private subnets, security groups
d. DynamoDB‑to‑S3 Export Stack
– DynamoDB Table (cylinder icon)
– S3 Bucket (bucket icon)
– Lambda (compute icon) with IAM Role
– CloudWatch Logs (optional)
e. Service Code
– Lambda handler code uses AWS Powertools for tracing/metrics
f. GitHub Actions Stack
– IAM Role/Secrets to allow GitHub to assume deploy permissions
5. Relationships and interactions
- Arrow from Developer → GitHub Actions (code push)
- Arrow from GitHub Actions → AWS CDK Deploy (deploy stacks)
- Network Stack provisions VPC → all other resources are deployed into that VPC context.
- Lambda ↔ DynamoDB (Read)
- Lambda → S3 (Write)
- IAM Role arrows:
– GitHub Actions Role → CDK deploy permissions
– Lambda Role → DynamoDB & S3 permissions
6. Highlight architectural patterns and design principles
- Separation of Concerns: distinct stacks for network, application, CI/CD
- CDK Stage Pattern: exporter-application.stage.ts groups stacks for single deploy
- Infrastructure as Code: all resources defined in TypeScript
- Modular Lambda design: service code separated under services/
- Use of AWS Powertools for observability
7. Diagram styling guidelines
- Use AWS official icons (VPC, Lambda, DynamoDB, S3, IAM, GitHub)
- Color‑code by layer:
• Purple for CI/CD (GitHub Actions)
• Orange for AWS infra resources
• Blue for service code/lambda functions
- Use rectangles for logical groupings (e.g., “Network Stack”, “Export Stack”)
- Use cylinders for data stores, arrows for data flow and permissions
- Label each arrow with the protocol or action (e.g., “ReadItems”, “PutObject”)
8. Tailoring for this project
- Emphasize that CDK is the control plane: show main.ts → deploy Stage → stacks
- Show that the github-actions.stack.ts is initialized separately (in a security repo)
- In the Export Stack box, break out sub‑components: DynamoDB table, S3 bucket, Export Lambda
9. Final checklist for your diagram
- [ ] Clearly labeled components: Developer, GitHub Actions, CDK, VPC, Lambda, DynamoDB, S3
- [ ] Directional arrows showing trigger (push → build), deploy (CDK deploy), data flow (Lambda → S3)
- [ ] Color coding for different concern areas
- [ ] Shapes per AWS iconography and data store conventions
- [ ] Grouping boxes for each CDK stack and stage
By following these steps, you will produce a detailed, accurate architecture diagram that maps exactly to the file structure, CDK constructs, and runtime flow of this DynamoDB‑to‑S3 export solution.