A comprehensive library of reusable AWS CDK constructs for .NET projects, designed for serverless applications and static websites. Built with best practices, observability, and cost efficiency in mind.
- 🚀 Lambda Functions: Comprehensive Lambda construct with configurable OpenTelemetry support, IAM management, and environment configuration
- 🌐 Static Sites: Complete static website hosting with S3, CloudFront, SSL certificates, and Route53 DNS management
- 📊 DynamoDB Tables: Full-featured DynamoDB construct with streams, TTL, and global secondary indexes
- 🔐 Cognito User Pools: Complete Cognito user pool with custom domains, resource servers, OAuth clients, and Managed Login branding
- 🧪 Testing Helpers: Extensive testing utilities with fluent assertions and builders
- 📝 Type Safety: Full intellisense and compile-time validation
- ⚡ Performance: Optimized for cold starts with AWS Lambda SnapStart support
dotnet add package LayeredCraft.Cdk.ConstructsusingAmazon.CDK;usingLayeredCraft.Cdk.Constructs;usingLayeredCraft.Cdk.Constructs.Models;publicclassMyStack:Stack{publicMyStack(Constructscope,stringid,IStackPropsprops=null):base(scope,id,props){varlambda=newLambdaFunctionConstruct(this,"MyLambda",newLambdaFunctionConstructProps{FunctionName="my-api",FunctionSuffix="prod",AssetPath="./lambda-deployment.zip",RoleName="my-api-role",PolicyName="my-api-policy",GenerateUrl=true,// Creates Function URL for HTTP accessIncludeOtelLayer=true,// Enable OpenTelemetry (disabled by default in v2.0+)Architecture="arm64",// Optional: specify architecture (default: amd64)EnvironmentVariables=newDictionary<string,string>{{"ENVIRONMENT","production"},{"LOG_LEVEL","info"}}});}}varwebsite=newStaticSiteConstruct(this,"Website",newStaticSiteConstructProps{DomainName="example.com",SiteSubDomain="www",AssetPath="./website-build"});vartable=newDynamoDbTableConstruct(this,"UserTable",newDynamoDbTableConstructProps{TableName="users",PartitionKey=newAttributeDefinition{AttributeName="userId",AttributeType=AttributeType.STRING},GlobalSecondaryIndexes=[newGlobalSecondaryIndex{IndexName="email-index",PartitionKey=newAttributeDefinition{AttributeName="email",AttributeType=AttributeType.STRING},ProjectionType=ProjectionType.ALL}]});- Lambda Function Construct - Full-featured Lambda functions with OpenTelemetry, IAM, and more
- Static Site Construct - Complete static website hosting with CloudFront and SSL
- DynamoDB Table Construct - Production-ready DynamoDB tables with streams and indexes
- Cognito User Pool Construct - Full-featured Cognito user pool with custom domains, OAuth clients, and branding
- Testing Guide - Comprehensive testing utilities and patterns
- Examples - Real-world usage examples and patterns
- .NET 8.0 or .NET 9.0
- AWS CDK v2 (Amazon.CDK.Lib 2.203.1+)
- AWS CLI configured with appropriate permissions
- Node.js (for CDK deployment)
We welcome contributions! Please see our Contributing Guidelines for details.
# Clone the repository
git clone https://github.com/LayeredCraft/cdk-constructs.git
cd cdk-constructs
# Restore dependencies
dotnet restore
# Build the project
dotnet build
# Run tests
dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net8.0- Follow C# coding conventions
- Use meaningful names for variables and methods
- Add XML documentation for public APIs
- Include unit tests for new features
- Run tests before submitting PRs
This project is licensed under the MIT License.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: https://layeredcraft.github.io/cdk-constructs/
See CHANGELOG.md for details on releases and changes.
Built with ❤️ by the LayeredCraft team
Thanks goes to these wonderful people (emoji key):
Taylor Christian 📖 | Nick Cipollina 💻📖🚇 |
This project follows the all-contributors specification. Contributions of any kind welcome!