Home
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.
Key Features¶
- ๐ Lambda Functions: Comprehensive Lambda construct with 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
- ๐งช Testing Helpers: Extensive testing utilities with fluent assertions and builders
- ๐ Type Safety: Full TypeScript-style intellisense and compile-time validation
- โก Performance: Optimized for cold starts with AWS Lambda SnapStart support
Installation¶
Quick Start¶
using Amazon.CDK;
using LayeredCraft.Cdk.Constructs;
using LayeredCraft.Cdk.Constructs.Models;
public class MyStack : Stack
{
public MyStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
// Create a Lambda function
var lambda = new LambdaFunctionConstruct(this, "MyLambda", new LambdaFunctionConstructProps
{
FunctionName = "my-api",
FunctionSuffix = "prod",
AssetPath = "./lambda-deployment.zip",
RoleName = "my-api-role",
PolicyName = "my-api-policy",
GenerateUrl = true // Creates a Function URL for HTTP access
});
// Create a static website
var site = new StaticSiteConstruct(this, "MySite", new StaticSiteConstructProps
{
SiteBucketName = "my-website-bucket",
DomainName = "example.com",
AssetPath = "./website-build"
});
}
}
Available Constructs¶
Lambda Function Construct¶
Full-featured Lambda functions with:
- OpenTelemetry integration
- IAM roles and policies
- Environment variables
- Function URLs
- SnapStart support
- Versioning and aliases
Static Site Construct¶
Complete static website hosting with:
- S3 website hosting
- CloudFront CDN
- SSL certificates
- Route53 DNS
- API proxy support
DynamoDB Table Construct¶
Production-ready DynamoDB tables with:
- Global secondary indexes
- DynamoDB streams
- TTL configuration
- Lambda stream integration
Documentation¶
- Testing Guide - Comprehensive testing utilities and patterns
- Examples - Real-world usage examples and patterns
Requirements¶
- .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)
Contributing¶
See the main README for contribution guidelines.
License¶
This project is licensed under the MIT License.