Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions docs/migration/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ to .NET 10 or 11.

## 2. `Amazon.CDK.Lib` 2.278.0 or later (upgrade-induced)

The minimum AWS CDK version is now 2.278.0. That release adds AWS's own Web Function L2 types to
`Amazon.CDK.AWS.Lambda`, and eight of their names match this library's:
The minimum AWS CDK version is now 2.278.0. Upgrade this library and `Amazon.CDK.Lib` together.
With 2.6.0, `WebFunctionConstruct` was observed to fail at synthesis against `Amazon.CDK.Lib` 2.278.0
(`MissingMethodException`: `Amazon.CDK.Annotations.AddWarningV2`). If you stay on 2.x (for example on
.NET 8 or 9) and use the Web Function constructs, keep `Amazon.CDK.Lib` below 2.278.0 (2.6.0 was built
against 2.274.0 and was validated downstream with 2.275.0).

2.278.0 also adds AWS's own Web Function L2 types to `Amazon.CDK.AWS.Lambda`, and eight of their
names match this library's:

- `IWebFunctionEndpoint` (namespace `LayeredCraft.Cdk.Constructs`);
- `WebFunctionCode`, `WebFunctionRuntime`, `WebFunctionAuthType`, `WebFunctionEndpointType`,
Expand Down Expand Up @@ -119,7 +125,39 @@ Custom implementations of the interface need those members.
alias only), and `ShouldHaveCloudWatchLogsPermissions` asserts the scoped policy; its `region` and
`account` parameters are kept for source compatibility and are ignored.

## 6. Consumer test projects
## 6. New `PrivateStaticAssetsConstruct` (additive)

A new construct for web assets in a private, versioned bucket behind CloudFront. It is additive:
nothing changes for existing constructs, and `StaticSiteConstruct` is unchanged.

The bucket has S3 object versioning, but that does not make asset URLs immutable. Deployments go to
the bucket root unless you set `DestinationKeyPrefix`. For immutable paths, pass a prefix that is
unique per release (for example `game/<commit-sha>/`); with the default `Prune = false`, earlier
prefixes remain available.

Use it instead of `StaticSiteConstruct` when the bucket must stay private:

| | `StaticSiteConstruct` | `PrivateStaticAssetsConstruct` |
|---|---|---|
| Bucket access | Public-read website bucket, Block Public Access off | Block Public Access on; CloudFront origin access control only |
| Website endpoint | Yes | No |
| DNS and certificate | Required (Route53 lookup and ACM) | Optional; the CloudFront domain is used by default |
| SPA rewrites | Always on | Off by default |
| Deployment | Prunes, auto-deletes objects, bucket destroyed with the stack | Bucket root or a caller-supplied `DestinationKeyPrefix`; no prune; objects and bucket retained by default |

Switching an existing site from `StaticSiteConstruct` to the new construct is not a drop-in change.
What happens depends on the construct ID:

- **Same parent scope and construct ID:** the distribution (`{id}-cdn`) keeps its logical ID and is
updated in place, so the CloudFront domain is kept. The bucket (`{id}-bucket`) is still replaced:
`StaticSiteConstruct` names it after the site domain, and a bucket name cannot change in place. The
DNS alias records use different construct IDs and are recreated.
- **New construct ID:** every resource is new, including the distribution and its CloudFront domain.

In both cases, copy the content to the new bucket and review `cdk diff` before deploying. See
[Private Static Assets](../constructs/private-static-assets.md).

## 7. Consumer test projects

No change is required. The library's own tests moved from AutoFixture/NSubstitute to Compono; that
does not affect the shipped `Testing` helpers' dependencies.