Skip to content
v2.276.0

VpcEgressConfiguration Struct Added in v2.276.0 ​

Configuration for a connector that gives the compute egress into a VPC.

Example ​

ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';

declare const vpc: ec2.Vpc;
declare const code: lambda.WebFunctionCode;

const securityGroup = new ec2.SecurityGroup(this, 'EgressSecurityGroup', { vpc });

const connector = new lambda.NetworkConnector(this, 'Egress', {
  configuration: lambda.NetworkConnectorConfiguration.vpcEgress({
    computeType: lambda.NetworkConnectorComputeType.WEB_FUNCTION,
    vpc,
    vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
    securityGroups: [securityGroup],
  }),
});

new lambda.WebFunction(this, 'MyWebFunction', {
  code,
  runtime: lambda.WebFunctionRuntime.NODEJS_24_X,
  defaultEndpointAuth: lambda.WebFunctionAuthType.IAM_AUTH,
  egressNetworkConnector: connector,
});

Properties ​

The Lambda compute resource type this connector serves.

The compute type cannot be changed after the connector is created.

networkProtocoloptionalNetworkConnectorProtocolnetwork_protocoloptionalNetworkConnectorProtocolnetworkProtocoloptionalNetworkConnectorProtocolNetworkProtocoloptionalNetworkConnectorProtocolNetworkProtocoloptionalNetworkConnectorProtocol= NetworkConnectorProtocol.IPV4#
The IP protocol the network interfaces use.

The protocol cannot be changed after the connector is created.

securityGroupsISecurityGroupRef[]security_groupstyping.List[ISecurityGroupRef]securityGroupsList<ISecurityGroupRef>SecurityGroupsISecurityGroupRef[]SecurityGroups*[]ISecurityGroupRefrequired#
The security groups to attach to the network interfaces.
notes

Between 1 and 5 security groups, in the same VPC as the subnets. At least one is required, so the interfaces never fall back to the VPC's default security group. The connector only initiates connections, so inbound rules are irrelevant; the outbound rules decide what the compute can reach.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC to create network interfaces in.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#
Which subnets of the VPC to create network interfaces in.

Default: the VPC's default selection: its private subnets, if it has any

The selection must yield between 1 and 16 subnets.