LayeredCraft.Cdk.Constructs
2.0.0.24
dotnet add package LayeredCraft.Cdk.Constructs --version 2.0.0.24
NuGet\Install-Package LayeredCraft.Cdk.Constructs -Version 2.0.0.24
<PackageReference Include="LayeredCraft.Cdk.Constructs" Version="2.0.0.24" />
<PackageVersion Include="LayeredCraft.Cdk.Constructs" Version="2.0.0.24" />
<PackageReference Include="LayeredCraft.Cdk.Constructs" />
paket add LayeredCraft.Cdk.Constructs --version 2.0.0.24
#r "nuget: LayeredCraft.Cdk.Constructs, 2.0.0.24"
#:package LayeredCraft.Cdk.Constructs@2.0.0.24
#addin nuget:?package=LayeredCraft.Cdk.Constructs&version=2.0.0.24
#tool nuget:?package=LayeredCraft.Cdk.Constructs&version=2.0.0.24
LayeredCraft CDK Constructs
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.
Features
- ๐ 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
- ๐งช 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
Installation
dotnet add package LayeredCraft.Cdk.Constructs
Quick Start
Basic Lambda Function
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)
{
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 Function URL for HTTP access
IncludeOtelLayer = true, // Enable OpenTelemetry (disabled by default in v2.0+)
Architecture = "arm64", // Optional: specify architecture (default: amd64)
EnvironmentVariables = new Dictionary<string, string>
{
{ "ENVIRONMENT", "production" },
{ "LOG_LEVEL", "info" }
}
});
}
}
Static Website
var website = new StaticSiteConstruct(this, "Website", new StaticSiteConstructProps
{
SiteBucketName = "my-website-bucket",
DomainName = "example.com",
SiteSubDomain = "www",
AssetPath = "./website-build"
});
DynamoDB Table
var table = new DynamoDbTableConstruct(this, "UserTable", new DynamoDbTableConstructProps
{
TableName = "users",
PartitionKey = new AttributeDefinition { AttributeName = "userId", AttributeType = AttributeType.STRING },
GlobalSecondaryIndexes = [
new GlobalSecondaryIndex
{
IndexName = "email-index",
PartitionKey = new AttributeDefinition { AttributeName = "email", AttributeType = AttributeType.STRING },
ProjectionType = ProjectionType.ALL
}
]
});
Documentation
- 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
- 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
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
# 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
Code Style
- 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
License
This project is licensed under the MIT License.
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: https://layeredcraft.github.io/cdk-constructs/
Changelog
See CHANGELOG.md for details on releases and changes.
Built with โค๏ธ by the LayeredCraft team
Contributors โจ
Thanks goes to these wonderful people (emoji key):
<table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/taylorbobaylor"><img src="https://avatars.githubusercontent.com/u/25238885?v=4?s=100" width="100px;" alt="Taylor Christian"/><br /><sub><b>Taylor Christian</b></sub></a><br /><a href="https://github.com/LayeredCraft/cdk-constructs/commits?author=taylorbobaylor" title="Documentation">๐</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ncipollina"><img src="https://avatars.githubusercontent.com/u/1405469?v=4?s=100" width="100px;" alt="Nick Cipollina"/><br /><sub><b>Nick Cipollina</b></sub></a><br /><a href="https://github.com/LayeredCraft/cdk-constructs/commits?author=ncipollina" title="Code">๐ป</a> <a href="https://github.com/LayeredCraft/cdk-constructs/commits?author=ncipollina" title="Documentation">๐</a> <a href="#infra-ncipollina" title="Infrastructure (Hosting, Build-Tools, etc)">๐</a></td> </tr> </tbody> </table>
This project follows the all-contributors specification. Contributions of any kind welcome!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Amazon.CDK.Lib (>= 2.209.1)
-
net9.0
- Amazon.CDK.Lib (>= 2.209.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.0.0.24 | 164 | 8/6/2025 |
2.0.0-beta.23 | 165 | 8/6/2025 |
1.0.1.22 | 47 | 7/18/2025 |
1.0.0.21 | 167 | 7/11/2025 |
1.0.0.20 | 147 | 7/10/2025 |
1.0.0.19 | 132 | 7/10/2025 |
1.0.0.18 | 131 | 7/10/2025 |
1.0.0.17 | 137 | 7/9/2025 |
1.0.0.16 | 129 | 7/9/2025 |
1.0.0.15 | 137 | 7/9/2025 |
1.0.0.14 | 135 | 7/9/2025 |
1.0.0.13 | 135 | 7/9/2025 |
1.0.0.12 | 136 | 7/9/2025 |
1.0.0.11 | 136 | 7/9/2025 |
0.1.0-beta.10 | 119 | 7/9/2025 |
0.1.0-beta.9 | 116 | 7/8/2025 |
0.1.0-beta.8 | 122 | 7/8/2025 |
0.1.0-beta.7 | 112 | 7/7/2025 |
0.1.0-beta.6 | 113 | 7/4/2025 |
0.1.0-beta.5 | 105 | 7/4/2025 |
0.1.0-beta.4 | 110 | 7/3/2025 |
0.1.0-beta.3 | 108 | 7/3/2025 |
0.1.0-beta.2 | 118 | 7/3/2025 |
0.1.0-beta.1 | 122 | 7/3/2025 |