Skip to content

feat(ec2): support IPv6 IPAM allocation for Subnet - #39752

Open
gauranshahuja wants to merge 1 commit into
aws:mainfrom
gauranshahuja:39750/subnet-ipv6-ipam
Open

gauranshahuja wants to merge 1 commit into
aws:mainfrom
gauranshahuja:39750/subnet-ipv6-ipam

Conversation

@gauranshahuja

Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #39750.

Reason for this change

AWS::EC2::Subnet can allocate its IPv6 CIDR block from an Amazon VPC IP Address Manager pool (Ipv6IpamPoolId + Ipv6NetmaskLength), but the L2 Subnet construct only accepts a concrete ipv6CidrBlock. #38810 added IPv4 IPAM allocation (ipv4IpamAllocation); this adds the IPv6 counterpart, as discussed there when the IPv4 struct was named SubnetIpv4IpamAllocation.

Description of changes

  • New struct SubnetIpv6IpamAllocation ({ ipamPool: IIPAMPoolRef, netmaskLength: number }) next to SubnetIpv4IpamAllocation.
  • New optional SubnetProps.ipv6IpamAllocation, rendered as Ipv6IpamPoolId / Ipv6NetmaskLength on the CfnSubnet.
  • Synth-time validation: ipv6CidrBlock and ipv6IpamAllocation cannot both be set; a concrete netmaskLength must be between 44 and 64 in increments of 4 (subnet sizing for IPv6). Token values are passed through.
  • subnetIpv6CidrBlocks already reads the deploy-time Ipv6CidrBlocks attribute, so it returns the allocated block without changes.
  • README: a paragraph and example under "Allocating a subnet CIDR from AWS IPAM".
  • New integration test integ.subnet-ipv6-ipam.ts: dual-stack VPC, IPv6 resource planning pool in the IPAM public default scope (Amazon-provided IPv6 is public), subnet with ipv6IpamAllocation /64, assertion that the subnet gets a /64 IPv6 block.

Describe any new or updated permissions being added

None.

Description of how you validated changes

Exemption Request: I could not deploy the integration test (no AWS account available), so the snapshot for integ.subnet-ipv6-ipam.ts is not included. It follows the structure of integ.subnet-ipam.ts; the one part I could not confirm without a deployment is the scope of the IPv6 planning pool (public default scope for an Amazon-provided VPC IPv6 CIDR). Happy to adjust it.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions Bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Nov 16, 2026
@mergify

mergify Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@aws-cdk-automation aws-cdk-automation left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@maintainer-for-aws

Copy link
Copy Markdown

Automated review

A maintainer will still review this — treat the notes below as a starting point.

📌 Commit 893b55d

This PR adds IPv6 IPAM allocation support to the aws-ec2 Subnet L2, mirroring the existing IPv4 IPAM feature: a new SubnetIpv6IpamAllocation struct and optional SubnetProps.ipv6IpamAllocation prop that render onto CfnSubnet as Ipv6IpamPoolId/Ipv6NetmaskLength, plus synth-time validation (mutual exclusion with ipv6CidrBlock, and a 44–64 step-4 netmask bound), doc updates, a README example, and unit/integration tests. The change is cleanly additive and well-modeled — the public surface reuses IIPAMPoolRef, defaults and docs are accurate, the netmask check is token-guarded, and the unit tests are branch-complete and genuinely asserting. One item blocks merge: the new integration test ships without its deployed snapshot, so the required integration coverage is not yet discharged. No other issues found on this change.

🔴 1 blocking · 🟡 0 recommended · ⚪ 0 optional

Files with findings (1)
File Findings
packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.subnet-ipv6-ipam.ts 🔴 1

Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.

@maintainer-for-aws maintainer-for-aws Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review summary comment for the overview; the notes below are inline.

Comment on lines +122 to +124
assignIpv6AddressOnCreation: true,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking — This PR adds a new integration test integ.subnet-ipv6-ipam.ts but no companion integ.subnet-ipv6-ipam.js.snapshot/ directory, while every neighboring integ test in this folder (e.g. integ.subnet-ipam, integ.vpc-ipam) has one. The snapshot is the synthesized Cloud Assembly that the build compares against on every run, so without it the test has no regression baseline and the committed test does not prove it deploys. The feature owes an integration test here because it exposes the previously-unused CloudFormation properties Ipv6IpamPoolId/Ipv6NetmaskLength and introduces a Custom Resource (INTEGRATION_TESTS.md#what-are-cdk-integration-tests).

Suggested change: Deploy the test against a real AWS account (not synth-only) and commit the resulting snapshot, e.g. yarn integ --update-on-failed integ.subnet-ipv6-ipam.js. This also needs to confirm the behavior the author flagged as unverified — that the IPv6 resource-planning pool belongs in the public default scope (ipam.attrPublicDefaultScopeId). This feature owes the integ test, so a deployed snapshot is required rather than an integ-test exemption.

@gauranshahuja

Copy link
Copy Markdown
Contributor Author

Exemption Request: I don't have an AWS account to deploy integration tests, so the integ.subnet-ipv6-ipam.js.snapshot directory is not included. The test mirrors integ.subnet-ipam.ts from #38810, whose snapshot was generated from a maintainer deployment. The one assumption I could not verify is the scope of the IPv6 planning pool (the public default scope, for an Amazon-provided VPC IPv6 CIDR). If a maintainer can run it, I'll adjust the test to whatever the deployment shows.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Nov 16, 2026

This branch was previously deployed

1 inactive deployment
automation — 893b55db Deployed Nov 16, 2026 by aws-cdk-automation via validate-pr #379215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ec2): Support IPv6 IPAM allocation in L2 Subnet construct

2 participants