LambdaCore / Client / create_network_connector

create_network_connector

LambdaCore.Client.create_network_connector(**kwargs)

Creates a network connector that enables Lambda compute resources to route outbound traffic through your Amazon VPC. The network connector provisions elastic network interfaces (ENIs) in the subnets you specify, providing a managed network path to private resources such as databases, caches, and internal APIs.

This operation is asynchronous. The network connector starts in PENDING state while ENIs are provisioned in your VPC (provisioning typically takes up to 10 minutes). Use GetNetworkConnector to poll the connector state until it reaches ACTIVE. Once active, you can attach the connector to Lambda MicroVMs at run time using the egressNetworkConnectors parameter on RunMicroVm.

This operation is idempotent when you provide a ClientToken — if you retry a request that completed successfully using the same client token, the operation returns the existing connector without creating a duplicate.

See also: AWS API Documentation

Request Syntax

response = client.create_network_connector(
    Name='string',
    Configuration={
        'VpcEgressConfiguration': {
            'SubnetIds': [
                'string',
            ],
            'SecurityGroupIds': [
                'string',
            ],
            'NetworkProtocol': 'IPv4'|'DualStack',
            'AssociatedComputeResourceTypes': [
                'MicroVm',
            ]
        }
    },
    OperatorRole='string',
    ClientToken='string',
    Tags={
        'string': 'string'
    }
)
Parameters:
  • Name (string) –

    [REQUIRED]

    A unique name for the network connector within your account and Region. You can use the name to identify the connector in subsequent API calls.

  • Configuration (dict) –

    [REQUIRED]

    The network configuration for the connector. Specify a VpcEgressConfiguration to enable outbound traffic routing through your VPC.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: VpcEgressConfiguration.

    • VpcEgressConfiguration (dict) –

      Configuration for a VPC egress network connector. Specifies the subnets, security groups, and network protocol for routing outbound traffic through your VPC.

      • SubnetIds (list) –

        The IDs of the VPC subnets where Lambda provisions elastic network interfaces (ENIs). Specify 1 to 16 subnets. All subnets must be in the same VPC.

        • (string) –

      • SecurityGroupIds (list) –

        The IDs of the VPC security groups to attach to the ENIs. Specify 0 to 5 security groups. All security groups must be in the same VPC as the subnets.

        • (string) –

      • NetworkProtocol (string) –

        The network protocol for the connector. Specify IPv4 for IPv4-only networking, or DualStack for both IPv4 and IPv6.

      • AssociatedComputeResourceTypes (list) –

        The types of Lambda compute resources that can use this connector. Currently, only MicroVm is supported.

        • (string) –

  • OperatorRole (string) – The ARN of the IAM role that Lambda assumes to manage elastic network interfaces in your VPC. This role must have permissions for ec2:CreateNetworkInterface, ec2:DeleteNetworkInterface, and related describe operations.

  • ClientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request with the same client token, the API returns the existing connector without creating a duplicate.

    This field is autopopulated if not provided.

  • Tags (dict) –

    A map of key-value pairs to associate with the network connector for organization, cost allocation, or access control.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'Arn': 'string',
    'Name': 'string',
    'Id': 'string',
    'Configuration': {
        'VpcEgressConfiguration': {
            'SubnetIds': [
                'string',
            ],
            'SecurityGroupIds': [
                'string',
            ],
            'NetworkProtocol': 'IPv4'|'DualStack',
            'AssociatedComputeResourceTypes': [
                'MicroVm',
            ]
        }
    },
    'OperatorRole': 'string',
    'State': 'PENDING'|'ACTIVE'|'INACTIVE'|'FAILED'|'DELETING'|'DELETE_FAILED'
}

Response Structure

  • (dict) –

    • Arn (string) –

      The Amazon Resource Name (ARN) of the network connector.

    • Name (string) –

      The name of the network connector.

    • Id (string) –

      The unique identifier for a network connector, assigned by the service at creation time

    • Configuration (dict) –

      The network configuration of the connector, including VPC subnets and security groups.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: VpcEgressConfiguration. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • VpcEgressConfiguration (dict) –

        Configuration for a VPC egress network connector. Specifies the subnets, security groups, and network protocol for routing outbound traffic through your VPC.

        • SubnetIds (list) –

          The IDs of the VPC subnets where Lambda provisions elastic network interfaces (ENIs). Specify 1 to 16 subnets. All subnets must be in the same VPC.

          • (string) –

        • SecurityGroupIds (list) –

          The IDs of the VPC security groups to attach to the ENIs. Specify 0 to 5 security groups. All security groups must be in the same VPC as the subnets.

          • (string) –

        • NetworkProtocol (string) –

          The network protocol for the connector. Specify IPv4 for IPv4-only networking, or DualStack for both IPv4 and IPv6.

        • AssociatedComputeResourceTypes (list) –

          The types of Lambda compute resources that can use this connector. Currently, only MicroVm is supported.

          • (string) –

    • OperatorRole (string) –

      The ARN of the IAM role that Lambda uses to manage the underlying ENI resources for this connector.

    • State (string) –

      The current state of the network connector.

Exceptions

  • LambdaCore.Client.exceptions.InvalidParameterValueException

  • LambdaCore.Client.exceptions.ResourceConflictException

  • LambdaCore.Client.exceptions.NetworkConnectorLimitExceededException

  • LambdaCore.Client.exceptions.ServiceException

  • LambdaCore.Client.exceptions.TooManyRequestsException