Quick Reference & Decision Summary โ
๐ฏ Key Decisions at a Glance โ
| Question | Decision | Document Reference |
|---|---|---|
| Language? | C# (.NET 8+) | 04-LANGUAGE-PERFORMANCE.md |
| CDK or Terraform? | AWS CDK | 00-PROJECT-HUB.md |
| Split or Unified? | Unified with layers | 06-FRAMEWORK-ARCHITECTURE.md |
| Dynamic Config? | DynamoDB + Lambda | 03-DYNAMIC-CONFIGURATION.md |
| Lambda Runtime? | .NET 8 Native AOT | 04-LANGUAGE-PERFORMANCE.md |
| Design Patterns? | GOF + System Patterns | 02-ARCHITECTURE-PATTERNS.md |
| Testing Framework? | xUnit | 05-PROJECT-SETUP.md |
๐ Architecture Layers โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ High-Level API (Public) โ โ Users interact here
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Framework Core (Internal) โ โ Implementation details
โ โข Configuration Manager โ
โ โข Infrastructure Provisioner โ
โ โข Flow Builder โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ AWS Layer (L1 + SDK) โ โ Direct AWS interaction
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐๏ธ Design Patterns Used โ
| Pattern | Purpose | Where Used |
|---|---|---|
| Builder | Fluent flow construction | FlowBuilder, QueueBuilder |
| Factory | Create actions/components | ActionFactory, FlowFactory |
| Strategy | Routing algorithms | RoutingStrategy |
| Decorator | Add cross-cutting concerns | Logging, Validation, Caching |
| Composite | Flow hierarchy | FlowModule, ContactFlow |
| Singleton | Configuration manager | ConfigManager |
| Observer | Config change notifications | ConfigChangeNotifier |
| Repository | Data access abstraction | ConfigRepository |
| Unit of Work | Transaction coordination | ConfigUnitOfWork |
| CQRS | Separate read/write | Commands vs Queries |
๐พ DynamoDB Tables โ
| Table Name | Partition Key | Sort Key | Purpose |
|---|---|---|---|
ConnectFlowConfigurations | flowId | version | Flow runtime config |
ConnectQueueConfigurations | queueId | - | Queue settings |
ConnectRoutingConfigurations | routingKey | conditionId | Routing rules |
ConnectLoggingConfigurations | resourceType | resourceId | Logging config |
ConnectFeatureFlags | featureName | environment | Feature toggles |
โก Performance Benchmarks โ
| Configuration | Cold Start | Warm Execution | Cost (1M invocations) |
|---|---|---|---|
| Node.js 20 | 287ms | 12ms | $3.20 |
| Python 3.12 | 412ms | 18ms | $3.20 |
| C# Traditional | 1543ms | 24ms | $4.50 |
| C# Native AOT | 398ms | 21ms | $3.20 |
| C# + Provisioned | 0ms | 24ms | $24.80 |
Recommendation: Use C# Native AOT for best balance of performance and cost.
๐ Configuration Update Flow โ
Admin Updates Config in DynamoDB
โ
Cache Invalidation (Redis)
โ
Next Call to Connect
โ
Lambda Fetches Fresh Config
โ
Flow Executes with New Config
โ
โ
Zero Downtime๐ฆ Project Structure โ
amazon-connect-cdk-framework/
โโโ src/
โ โโโ MyCompany.Connect.Framework/ # Main framework
โ โ โโโ Core/ # Orchestration
โ โ โโโ Configuration/ # DynamoDB config
โ โ โโโ Infrastructure/ # CDK constructs
โ โ โโโ Flows/ # Flow builder
โ โ โโโ Models/ # Shared models
โ โโโ MyCompany.Connect.Lambda.ConfigFetcher/
โ โโโ MyCompany.Connect.Deployment/ # CDK app
โโโ test/
โ โโโ MyCompany.Connect.Framework.Tests/
โ โโโ MyCompany.Connect.Lambda.Tests/
โโโ examples/๐ Quick Start Commands โ
bash
# Setup
dotnet new sln
dotnet new classlib -n Framework
dotnet new lambda.EmptyFunction -n ConfigFetcher
dotnet add package Amazon.CDK.Lib
# Build
dotnet build
# Test
dotnet test
# Deploy
cd src/Deployment
cdk synth
cdk deploy
# Lambda Native AOT
dotnet publish -c Release -r linux-x64 /p:PublishAot=true๐งช Testing Strategy โ
| Test Type | Purpose | Framework |
|---|---|---|
| Unit | Individual components | xUnit |
| Integration | CDK + DynamoDB | xUnit + Amazon.CDK.Assertions |
| Snapshot | CloudFormation templates | CDK Assertions |
| E2E | Complete workflows | LocalStack |
Sample Unit Test โ
csharp
[Fact]
public void TestQueueCreation()
{
var app = new App();
var stack = new Stack(app, "test");
var template = Template.FromStack(stack);
template.ResourceCountIs("AWS::Connect::Queue", 1);
template.HasResourceProperties("AWS::Connect::Queue",
new Dictionary<string, object>
{
{ "MaxContacts", 50 }
});
}๐ Security Checklist โ
- [x] DynamoDB encryption at rest with KMS
- [x] All API calls over HTTPS
- [x] Lambda in VPC private subnets
- [x] IAM least privilege roles
- [x] Secrets in AWS Secrets Manager
- [x] CloudTrail logging enabled
- [x] Input validation on all configs
- [x] No secrets in code or Git
๐ฐ Cost Estimates โ
Monthly Infrastructure (medium call center):
- DynamoDB: $10-20
- Lambda: $5-15
- S3: $1-5
- ElastiCache (optional): $30-50
- Total: ~$50-90/month
Excludes Amazon Connect per-minute usage charges
๐ Implementation Phases โ
| Phase | Duration | Focus |
|---|---|---|
| 1. Foundation | Weeks 1-2 | Models, setup, structure |
| 2. Flow Builder | Weeks 3-4 | Fluent interface, actions |
| 3. CDK Constructs | Weeks 5-6 | L2 wrappers, dependencies |
| 4. Config Layer | Weeks 7-8 | DynamoDB, Lambda, cache |
| 5. Testing | Weeks 9-10 | Comprehensive tests |
| 6. Hardening | Weeks 11-12 | Security, docs, examples |
๐จ Code Style Conventions โ
csharp
// Namespaces
namespace MyCompany.Connect.Framework.Core;
// Public classes - PascalCase
public class ContactFlowBuilder { }
// Methods - PascalCase
public void AddAction() { }
// Properties - PascalCase
public string FlowName { get; set; }
// Private fields - _camelCase
private readonly string _flowId;
// Constants - PascalCase
public const int MaxActions = 250;
// Fluent interface - return this
public ContactFlowBuilder SetName(string name)
{
_name = name;
return this;
}๐ Essential Links โ
- AWS CDK: https://docs.aws.amazon.com/cdk/
- Amazon Connect API: https://docs.aws.amazon.com/connect/latest/APIReference/
- Flow Language: https://docs.aws.amazon.com/connect/latest/APIReference/flow-language.html
- .NET Lambda: https://docs.aws.amazon.com/lambda/latest/dg/csharp-handler.html
- Native AOT: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/
๐ Common Issues & Solutions โ
| Issue | Solution |
|---|---|
| CDK bootstrap fails | Check AWS credentials: aws sts get-caller-identity |
| Lambda cold starts too slow | Use Native AOT or provisioned concurrency |
| DynamoDB throttling | Increase provisioned capacity or use on-demand |
| Flow validation errors | Check action count (<250) and JSON structure |
| CDK synth timeout | Break into smaller stacks |
| Test failures | Run dotnet restore --force |
๐ Learning Resources โ
Start Here โ
- Read 00-PROJECT-HUB.md - Overview
- Follow 05-PROJECT-SETUP.md - Setup
- Study 02-ARCHITECTURE-PATTERNS.md - Patterns
Deep Dives โ
- Dynamic Config: 03-DYNAMIC-CONFIGURATION.md
- Performance: 04-LANGUAGE-PERFORMANCE.md
- Architecture: 06-FRAMEWORK-ARCHITECTURE.md
๐ Getting Help โ
- Check this quick reference
- Search specific document
- Review code examples
- Check troubleshooting guide
- Ask team/community
โ Pre-Deployment Checklist โ
- [ ] All tests passing
- [ ] CDK synth succeeds
- [ ] Security review completed
- [ ] Cost estimates reviewed
- [ ] Documentation updated
- [ ] Examples working
- [ ] CI/CD pipeline tested
- [ ] Monitoring configured
- [ ] Rollback plan documented
๐ Update Workflow โ
bash
# Make code changes
# โ
# Run tests
dotnet test
# โ
# Check CDK diff
cdk diff
# โ
# Deploy to dev
cdk deploy --profile dev
# โ
# Verify in dev environment
# โ
# Deploy to prod
cdk deploy --profile prod
# โ
# Monitor metrics๐ฏ Success Metrics โ
| Metric | Target | Tracking |
|---|---|---|
| Test Coverage | >80% | dotnet test --collect:"XPlat Code Coverage" |
| Cold Start | <500ms | CloudWatch Logs |
| Config Fetch | <50ms | CloudWatch Metrics |
| Deployment Time | <5min | CI/CD pipeline |
| Documentation | 100% public APIs | XML comments |
๐ก Pro Tips โ
- Start Simple: Use high-level API first
- Test Early: Write tests as you build
- Cache Aggressively: Reduce DynamoDB reads
- Monitor Always: CloudWatch dashboards
- Version Everything: Git + semantic versioning
- Document Decisions: ADRs in Notion
- Review Regularly: Weekly progress checks
- Refactor Ruthlessly: Keep code clean
- Optimize Later: Make it work, then fast
- Share Knowledge: Team demos and docs
Print this page for quick reference during development!