Alvecta.Foundation.Deployment.Cdk 6.3.64

There is a newer version of this package available.
See the version list below for details.
dotnet add package Alvecta.Foundation.Deployment.Cdk --version 6.3.64
                    
NuGet\Install-Package Alvecta.Foundation.Deployment.Cdk -Version 6.3.64
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alvecta.Foundation.Deployment.Cdk" Version="6.3.64" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alvecta.Foundation.Deployment.Cdk" Version="6.3.64" />
                    
Directory.Packages.props
<PackageReference Include="Alvecta.Foundation.Deployment.Cdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alvecta.Foundation.Deployment.Cdk --version 6.3.64
                    
#r "nuget: Alvecta.Foundation.Deployment.Cdk, 6.3.64"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alvecta.Foundation.Deployment.Cdk@6.3.64
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alvecta.Foundation.Deployment.Cdk&version=6.3.64
                    
Install as a Cake Addin
#tool nuget:?package=Alvecta.Foundation.Deployment.Cdk&version=6.3.64
                    
Install as a Cake Tool

Alvecta.Foundation.Deployment.Cdk

Reusable AWS CDK (C#) building blocks that deploy an Alvecta application from one cdk.json manifest: DNS and certificates, one Lambda per service (.NET behind HTTP API Gateway, Node.js/SSR behind CloudFront), SNS notification topics, SSM secrets and IAM grants, plus an optional Aurora DSQL cluster in a separate database app.

It sits outside the Clean Architecture layers: it is referenced only by a solution's *.Deployment.Cdk project, never by application code. Dependencies: Amazon.CDK.Lib, Constructs, Alvecta.Utils and Alvecta.Utils.Json.

Two CDK apps

App Entry point Stacks
Application Hosting.CdkApplicationHost.Run(applicationName, createApplicationStack) {env}-{app}-DnsAndCert-Stack in us-east-1 (subdomain hosted zone, NS delegation, CloudFront wildcard certificate), then {env}-{app}-Stack, your regional stack
Database Hosting.CdkDatabaseHost.Run(applicationName) {env}-{app}-Database-Stack: the Aurora DSQL cluster, termination-protected and retained on delete

Both pick the environment from the env context value (cdk deploy -c env=Dev) and read its block from Environments in cdk.json. The database app is deployed on its own and first. It writes the cluster's endpoint and ARN to SSM Parameter Store, where the application stack reads them at deploy time, so the two apps share no CloudFormation export and an application deploy never touches the database.

What the regional stack gets

A single Composition.ServicesConstruct builds the whole regional stack from a list of ServiceDefinitions:

  • ServiceDefinition.DotNet<TSettings>(serviceName, projectName, iamPolicies) — a .NET Lambda published from src/Parts/<serviceName>/<projectName>/<projectName>.csproj, fronted by HTTP API Gateway on <hostName>.<subdomain>, with throttling, an optional warm-up schedule and an optional long-timeout migration function.
  • ServiceDefinition.Node<TSettings>(...) — a Node.js (SSR) Lambda fronted by CloudFront.
  • Settings checked at synth time — each service's EnvironmentVariables block must deserialize into TSettings, so a missing required setting fails cdk synth, not the running service. The block is flattened into Lambda environment variables with __ separators.
  • secret:<ssm-name> values — each referenced parameter is created as a SecureString with the placeholder default when it does not exist yet (an existing value is never overwritten). The service resolves it at startup with Alvecta.Foundation.Infrastructure.AmazonSsm.
  • variable:<name> and ${variable:<name>} values — replaced with stack values: the ARN of a declared notification topic, or DsqlClusterEndpoint / DsqlClusterArn. An unknown name fails synth.
  • IAM — Helpers.ServiceIamPolicyFactory.CreateServicePolicies grants SSM read/write under the environment's parameter prefix, dsql:DbConnectAdmin on the cluster (when there is one) and sns:Publish on the topics the service references; CreateFrontendPolicies grants SSM read only.

The lower-level constructs (DotNetLambdaApiConstruct, NodeLambdaApiConstruct, CloudFrontFrontendConstruct, SsmSecretInitializerConstruct) and stacks (DnsAndCertificateStack, DsqlClusterStack) are public for stacks that need a different shape.

Usage

dotnet add package Alvecta.Foundation.Deployment.Cdk

The application app's entry point and regional stack:

using Alvecta.Foundation.Deployment.Cdk;
using Alvecta.Foundation.Deployment.Cdk.Composition;
using Alvecta.Foundation.Deployment.Cdk.Helpers;
using Alvecta.Foundation.Deployment.Cdk.Hosting;
using Amazon.CDK;
using Constructs;

public static class Program
{
    public static void Main() =>
        CdkApplicationHost.Run(
            applicationName: "Shop",
            createApplicationStack: (app, id, props) => new ShopStack(app, id, props));
}

public class ShopStack : Stack
{
    public ShopStack(Construct scope, string id, ApplicationStackProps props)
        : base(scope, id, props)
    {
        _ = new ServicesConstruct(
            this,
            "Services",
            new ServicesConstructProps
            {
                EnvironmentName = props.EnvironmentName,
                ApplicationName = props.ApplicationName,
                EnvironmentConfig = props.EnvironmentConfig,
                CloudFrontCertificate = props.CloudFrontCertificate,
                SubdomainZone = props.SubdomainZone,
                ServicesFolder = "src/Parts",
                Services =
                [
                    ServiceDefinition.DotNet<BackendSettings>(
                        "Backend",
                        "Acme.Shop.Backend.Hosting.WebApi.AmazonLambda",
                        ServiceIamPolicyFactory.CreateServicePolicies),
                ],
            });
    }
}

The database app is a second entry point with its own --app command:

public static class Program
{
    public static void Main() => CdkDatabaseHost.Run(applicationName: "Shop");
}

The cdk.json context both apps read (property names are case-insensitive; DsqlConfig, Notifications, WarmupConfig, ThrottlingConfig and MigrationLambdaConfig are optional):

{
  "context": {
    "Environments": {
      "Dev": {
        "AwsConfig": { "Account": "123456789012", "Region": "eu-central-1" },
        "DnsConfig": {
          "ParentHostedZoneId": "Z0123456789ABCDEFGHIJ",
          "ParentHostedZoneName": "example.com",
          "SubdomainName": "dev-shop",
          "BaseDomainName": "example.com"
        },
        "SsmParameterPrefix": "/DevShop",
        "DsqlConfig": { "DeletionProtection": true },
        "Notifications": [
          { "Name": "Orders", "Emails": [ "ops@example.com" ], "ResultSnsTopicArnVariableName": "OrdersTopicArn" }
        ],
        "Services": {
          "Backend": {
            "DomainConfig": { "HostName": "api" },
            "LambdaConfig": { "MemorySizeMb": 1024, "TimeoutSeconds": 20 },
            "ThrottlingConfig": { "RequestsPerSecond": 100, "BurstRequests": 50 },
            "WarmupConfig": { "IntervalMinutes": 3 },
            "MigrationLambdaConfig": { "MemorySizeMb": 1024, "TimeoutSeconds": 900 },
            "EnvironmentVariables": {
              "Database": {
                "ConnectionString": "Server=${variable:DsqlClusterEndpoint};Database=postgres;User Id=admin;SearchPath=Shop"
              },
              "Payments": { "ApiKey": "secret:/DevShop/PaymentsApiKey" },
              "Notifications": { "OrdersTopicArn": "variable:OrdersTopicArn" }
            }
          }
        }
      }
    }
  }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
7.0.66 0 10/19/2026
7.0.65 0 10/19/2026
6.3.64 0 10/19/2026
6.3.63 0 10/19/2026
6.2.62 43 10/14/2026
6.1.61 85 10/9/2026
6.1.60 87 10/7/2026
6.1.59 88 10/6/2026
6.1.58 89 10/5/2026
6.0.57 92 10/2/2026
6.0.56 90 10/1/2026
6.0.55 90 10/1/2026
5.0.54 109 9/30/2026
5.0.53 98 9/28/2026
5.0.52 98 9/17/2026
5.0.51 102 9/17/2026
5.0.50 97 9/17/2026
5.0.49 96 9/17/2026
5.0.48 98 9/17/2026
4.1.47 98 9/16/2026
Loading failed