Skip to content

feat(lambda): add NetworkConnector L2 construct#38266

Open
licjun wants to merge 1 commit into
aws:mainfrom
licjun:feat/lambda-network-connector-l2
Open

feat(lambda): add NetworkConnector L2 construct#38266
licjun wants to merge 1 commit into
aws:mainfrom
licjun:feat/lambda-network-connector-l2

Conversation

@licjun

@licjun licjun commented Jul 7, 2026

Copy link
Copy Markdown

Issue # (if applicable)

N/A — new resource, tracked internally via P459402297

Reason for this change

AWS::Lambda::NetworkConnector is a new CloudFormation resource that enables Lambda compute resources (MicroVMs) to access customer VPCs. This PR adds an L2 construct to provide a developer-friendly interface with sensible defaults.

Description of changes

Implements NetworkConnector L2 construct in aws-cdk-lib/aws-lambda:

  • Static factory pattern for configuration (NetworkConnectorConfig.vpcEgress(...)) — enforces mutual exclusivity by types, extensible for future connector types
  • Auto-generated OperatorRole with AWSLambdaNetworkConnectorOperatorPolicy managed policy when not provided (follows CapacityProvider/Function pattern)
  • Type-safe enums for NetworkProtocol (IPv4, DualStack) and ComputeType (MicroVMs)
  • Import methods: fromNetworkConnectorArn, fromNetworkConnectorAttributes
  • Construct-time validation: subnet count (1-16), security group count (1-5), name format (≤64 chars, alphanumeric/hyphens/underscores)
  • Token-safety: skips validation for unresolved values
  • Property injection and construct metadata support

Describe any new or updated permissions being added

The auto-generated OperatorRole uses the AWS managed policy AWSLambdaNetworkConnectorOperatorPolicy which grants:

  • ec2:CreateNetworkInterface (subnet, security-group, network-interface resources)
  • ec2:CreateTags (network-interface, with condition on ec2:CreateAction and ec2:ManagedResourceOperator)

Description of how you validated changes

  • 20 unit tests covering creation, operator role, configuration mapping, validation, import methods, attributes, and tags
  • 2 integration tests (integ.network-connector-defaults.ts, integ.network-connector-all-fields.ts) — both deployed successfully to AWS
  • jsii compilation: 0 errors
  • eslint: 0 errors
  • awslint: 0 errors

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 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Jul 7, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team July 7, 2026 20:30
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

👋 It looks like your PR description follows the template but is missing a valid issue number in the first section.

PRs without a linked issue will receive lower priority for review and merging. Please update the description to include a reference like Closes #123. If no existing issue matches your change, create one first.

@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.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Jul 7, 2026
@licjun licjun force-pushed the feat/lambda-network-connector-l2 branch from 8a05a63 to 7ed87a8 Compare July 7, 2026 21:43
@licjun licjun changed the title feat(lambda): Add NetworkConnector L2 construct feat(lambda): add NetworkConnector L2 construct Jul 7, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 7, 2026 21:45

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@licjun licjun force-pushed the feat/lambda-network-connector-l2 branch from 7ed87a8 to 49b9b4c Compare July 7, 2026 21:55
Implement L2 construct for AWS::Lambda::NetworkConnector with:
- Static factory pattern for configuration (NetworkConnectorConfig.vpcEgress)
- Auto-generated OperatorRole with AWSLambdaNetworkConnectorOperatorPolicy
- Type-safe enums for NetworkProtocol and ComputeType
- Import methods (fromNetworkConnectorArn, fromNetworkConnectorAttributes)
- Construct-time validation (subnets, security groups, name)
- Token-safety for unresolved values
- Unit tests (20 passing)
- Integration tests (2, both deployed successfully)
- README documentation

sim: https://t.corp.amazon.com/P459402297
@licjun licjun force-pushed the feat/lambda-network-connector-l2 branch from 49b9b4c to 2e447bc Compare July 7, 2026 22:51
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 7, 2026
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/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants