1
---
2
name: aws-cloud-expert
3
description: |
4
Designs and implements AWS cloud architectures with focus on Well-Architected Framework, cost optimization, and security. Use when:
5
1. Designing or reviewing AWS infrastructure architecture
6
2. Migrating workloads to AWS or between AWS services
7
3. Optimizing AWS costs (right-sizing, Reserved Instances, Savings Plans)
8
4. Implementing AWS security, compliance, or disaster recovery
9
5. Troubleshooting AWS service issues or performance problems
10
---
11
12
**Region**: ${region:us-east-1}
13
**Secondary Region**: ${secondary_region:us-west-2}
14
**Environment**: ${environment:production}
15
**VPC CIDR**: ${vpc_cidr:10.0.0.0/16}
16
**Instance Type**: ${instance_type:t3.medium}
17
18
# AWS Architecture Decision Framework
19
20
## Service Selection Matrix
21
22
| Workload Type | Primary Service | Alternative | Decision Factor |
23
|---------------|-----------------|-------------|-----------------|
24
| Stateless API | Lambda + API Gateway | ECS Fargate | Request duration >15min -> ECS |
25
| Stateful web app | ECS/EKS | EC2 Auto Scaling | Container expertise -> ECS/EKS |
26
| Batch processing | Step Functions + Lambda | AWS Batch | GPU/long-running -> Batch |
27
| Real-time streaming | Kinesis Data Streams | MSK (Kafka) | Existing Kafka -> MSK |
28
| Static website | S3 + CloudFront | Amplify | Full-stack -> Amplify |
29
| Relational DB | Aurora | RDS | High availability -> Aurora |
30
| Key-value store | DynamoDB | ElastiCache | Sub-ms latency -> ElastiCache |
31
| Data warehouse | Redshift | Athena | Ad-hoc queries -> Athena |
32
33
## Compute Decision Tree
34
35
```
36
Start: What's your workload pattern?
37
|
38
+-> Event-driven, <15min execution
39
| +-> Lambda
40
| Consider: Memory ${lambda_memory:512}MB, concurrent executions, cold starts
41
|
42
+-> Long-running containers
43
| +-> Need Kubernetes?
44
| +-> Yes: EKS (managed) or self-managed K8s on EC2
45
| +-> No: ECS Fargate (serverless) or ECS EC2 (cost optimization)
46
|
47
+-> GPU/HPC/Custom AMI required
48
| +-> EC2 with appropriate instance family
49
| g4dn/p4d (ML), c6i (compute), r6i (memory), i3en (storage)
50
|
51
+-> Batch jobs, queue-based
52
+-> AWS Batch with Spot instances (up to 90% savings)
53
```
54
55
## Networking Architecture
56
57
### VPC Design Pattern
58
59
```
60
${environment:production} VPC (${vpc_cidr:10.0.0.0/16})
61
|
62
+-- Public Subnets (${public_subnet_cidr:10.0.0.0/24}, 10.0.1.0/24, 10.0.2.0/24)
63
| +-- ALB, NAT Gateways, Bastion (if needed)
64
|
65
+-- Private Subnets (${private_subnet_cidr:10.0.10.0/24}, 10.0.11.0/24, 10.0.12.0/24)
66
| +-- Application tier (ECS, EC2, Lambda VPC)
67
|
68
+-- Data Subnets (${data_subnet_cidr:10.0.20.0/24}, 10.0.21.0/24, 10.0.22.0/24)
69
+-- RDS, ElastiCache, other data stores
70
```
71
72
### Security Group Rules
73
74
| Tier | Inbound From | Ports |
75
|------|--------------|-------|
76
| ALB | 0.0.0.0/0 | 443 |
77
| App | ALB SG | ${app_port:8080} |
78
| Data | App SG | ${db_port:5432} |
79
80
### VPC Endpoints (Cost Optimization)
81
82
Always create for high-traffic services:
83
- S3 Gateway Endpoint (free)
84
- DynamoDB Gateway Endpoint (free)
85
- Interface Endpoints: ECR, Secrets Manager, SSM, CloudWatch Logs
86
87
## Cost Optimization Checklist
88
89
### Immediate Actions (Week 1)
90
- [ ] Enable Cost Explorer and set up budgets with alerts
91
- [ ] Review and terminate unused resources (Cost Explorer idle resources report)
92
- [ ] Right-size EC2 instances (AWS Compute Optimizer recommendations)
93
- [ ] Delete unattached EBS volumes and old snapshots
94
- [ ] Review NAT Gateway data processing charges
95
96
### Cost Estimation Quick Reference
97
98
| Resource | Monthly Cost Estimate |
99
|----------|----------------------|
100
| ${instance_type:t3.medium} (on-demand) | ~$30 |
101
| ${instance_type:t3.medium} (1yr RI) | ~$18 |
102
| Lambda (1M invocations, 1s, ${lambda_memory:512}MB) | ~$8 |
103
| RDS db.${instance_type:t3.medium} (Multi-AZ) | ~$100 |
104
| Aurora Serverless v2 (${aurora_acu:8} ACU avg) | ~$350 |
105
| NAT Gateway + 100GB data | ~$50 |
106
| S3 (1TB Standard) | ~$23 |
107
| CloudFront (1TB transfer) | ~$85 |
108
109
## Security Implementation
110
111
### IAM Best Practices
112
113
```
114
Principle: Least privilege with explicit deny
115
116
1. Use IAM roles (not users) for applications
117
2. Require MFA for all human users
118
3. Use permission boundaries for delegated admin
119
4. Implement SCPs at Organization level
120
5. Regular access reviews with IAM Access Analyzer
121
```
122
123
### Example IAM Policy Pattern
124
125
```json
126
{
127
"Version": "2012-10-17",
128
"Statement": [
129
{
130
"Sid": "AllowS3BucketAccess",
131
"Effect": "Allow",
132
"Action": ["s3:GetObject", "s3:PutObject"],
133
"Resource": "arn:aws:s3:::${bucket_name:my-bucket}/*",
134
"Condition": {
135
"StringEquals": {"aws:PrincipalTag/Environment": "${environment:production}"}
136
}
137
}
138
]
139
}
140
```
141
142
### Security Checklist
143
144
- [ ] Enable CloudTrail in all regions with log file validation
145
- [ ] Configure AWS Config rules for compliance monitoring
146
- [ ] Enable GuardDuty for threat detection
147
- [ ] Use Secrets Manager or Parameter Store for secrets (not env vars)
148
- [ ] Enable encryption at rest for all data stores
149
- [ ] Enforce TLS 1.2+ for all connections
150
- [ ] Implement VPC Flow Logs for network monitoring
151
- [ ] Use Security Hub for centralized security view
152
153
## High Availability Patterns
154
155
### Multi-AZ Architecture (${availability_target:99.99%} target)
156
157
```
158
Region: ${region:us-east-1}
159
|
160
+-- AZ-a +-- AZ-b +-- AZ-c
161
| | |
162
ALB (active) ALB (active) ALB (active)
163
| | |
164
ECS Tasks (${replicas_per_az:2}) ECS Tasks (${replicas_per_az:2}) ECS Tasks (${replicas_per_az:2})
165
| | |
166
Aurora Writer Aurora Reader Aurora Reader
167
```
168
169
### Multi-Region Architecture (99.999% target)
170
171
```
172
Primary: ${region:us-east-1} Secondary: ${secondary_region:us-west-2}
173
| |
174
Route 53 (failover routing) Route 53 (health checks)
175
| |
176
CloudFront CloudFront
177
| |
178
Full stack Full stack (passive or active)
179
| |
180
Aurora Global Database -------> Aurora Read Replica
181
(async replication)
182
```
183
184
### RTO/RPO Decision Matrix
185
186
| Tier | RTO Target | RPO Target | Strategy |
187
|------|------------|------------|----------|
188
| Tier 1 (Critical) | <${rto:15 min} | <${rpo:1 min} | Multi-region active-active |
189
| Tier 2 (Important) | <1 hour | <15 min | Multi-region active-passive |
190
| Tier 3 (Standard) | <4 hours | <1 hour | Multi-AZ with cross-region backup |
191
| Tier 4 (Non-critical) | <24 hours | <24 hours | Single region, backup/restore |
192
193
## Monitoring and Observability
194
195
### CloudWatch Implementation
196
197
| Metric Type | Service | Key Metrics |
198
|-------------|---------|-------------|
199
| Compute | EC2/ECS | CPUUtilization, MemoryUtilization, NetworkIn/Out |
200
| Database | RDS/Aurora | DatabaseConnections, ReadLatency, WriteLatency |
201
| Serverless | Lambda | Duration, Errors, Throttles, ConcurrentExecutions |
202
| API | API Gateway | 4XXError, 5XXError, Latency, Count |
203
| Storage | S3 | BucketSizeBytes, NumberOfObjects, 4xxErrors |
204
205
### Alerting Thresholds
206
207
| Resource | Warning | Critical | Action |
208
|----------|---------|----------|--------|
209
| EC2 CPU | >${cpu_warning:70%} 5min | >${cpu_critical:90%} 5min | Scale out, investigate |
210
| RDS CPU | >${rds_cpu_warning:80%} 5min | >${rds_cpu_critical:95%} 5min | Scale up, query optimization |
211
| Lambda errors | >1% | >5% | Investigate, rollback |
212
| ALB 5xx | >0.1% | >1% | Investigate backend |
213
| DynamoDB throttle | Any | Sustained | Increase capacity |
214
215
## Verification Checklist
216
217
### Before Production Launch
218
219
- [ ] Well-Architected Review completed (all 6 pillars)
220
- [ ] Load testing completed with expected peak + 50% headroom
221
- [ ] Disaster recovery tested with documented RTO/RPO
222
- [ ] Security assessment passed (penetration test if required)
223
- [ ] Compliance controls verified (if applicable)
224
- [ ] Monitoring dashboards and alerts configured
225
- [ ] Runbooks documented for common operations
226
- [ ] Cost projection validated and budgets set
227
- [ ] Tagging strategy implemented for all resources
228
- [ ] Backup and restore procedures tested