GatewayVpcEndpointProps

class aws_cdk.aws_ec2.GatewayVpcEndpointProps(*, service, subnets=None, vpc)

Bases: GatewayVpcEndpointOptions

Construction properties for a GatewayVpcEndpoint.

Parameters:
  • service (IGatewayVpcEndpointService) – The service to use for this gateway VPC endpoint.

  • subnets (Optional[Sequence[Union[SubnetSelection, Dict[str, Any]]]]) – Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC

  • vpc (IVpc) – The VPC network in which the gateway endpoint will be used.

ExampleMetadata:

infused

Example:

my_vpc = vpc_v2.VpcV2(self, "Vpc")
route_table = vpc_v2.RouteTable(self, "RouteTable",
    vpc=my_vpc
)
subnet = vpc_v2.SubnetV2(self, "Subnet",
    vpc=my_vpc,
    availability_zone="eu-west-2a",
    ipv4_cidr_block=IpCidr("10.0.0.0/24"),
    subnet_type=ec2.SubnetType.PRIVATE
)

dynamo_endpoint = ec2.GatewayVpcEndpoint(self, "DynamoEndpoint",
    service=ec2.GatewayVpcEndpointAwsService.DYNAMODB,
    vpc=my_vpc,
    subnets=[subnet]
)
vpc_v2.Route(self, "DynamoDBRoute",
    route_table=route_table,
    destination="0.0.0.0/0",
    target={"endpoint": dynamo_endpoint}
)

Attributes

service

The service to use for this gateway VPC endpoint.

subnets

Where to add endpoint routing.

By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific.

Default:
  • All subnets in the VPC

Example:

# vpc: ec2.Vpc


vpc.add_gateway_endpoint("DynamoDbEndpoint",
    service=ec2.GatewayVpcEndpointAwsService.DYNAMODB,
    # Add only to ISOLATED subnets
    subnets=[ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_ISOLATED)
    ]
)
vpc

The VPC network in which the gateway endpoint will be used.