Show / Hide Table of Contents

Class GatewayVpcEndpointOptions

Options to add a gateway endpoint to a VPC.

Inheritance
object
GatewayVpcEndpointOptions
Implements
IGatewayVpcEndpointOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class GatewayVpcEndpointOptions : IGatewayVpcEndpointOptions
Syntax (vb)
Public Class GatewayVpcEndpointOptions Implements IGatewayVpcEndpointOptions
Remarks

ExampleMetadata: lit=aws-ec2/test/integ.vpc-endpoint.lit.ts infused

Examples
// Add gateway endpoints when creating the VPC
            var vpc = new Vpc(this, "MyVpc", new VpcProps {
                GatewayEndpoints = new Dictionary<string, GatewayVpcEndpointOptions> {
                    { "S3", new GatewayVpcEndpointOptions {
                        Service = GatewayVpcEndpointAwsService.S3
                    } }
                }
            });

            // Alternatively gateway endpoints can be added on the VPC
            var dynamoDbEndpoint = vpc.AddGatewayEndpoint("DynamoDbEndpoint", new GatewayVpcEndpointOptions {
                Service = GatewayVpcEndpointAwsService.DYNAMODB
            });

            // This allows to customize the endpoint policy
            dynamoDbEndpoint.AddToPolicy(
            new PolicyStatement(new PolicyStatementProps {  // Restrict to listing and describing tables
                Principals = new [] { new AnyPrincipal() },
                Actions = new [] { "dynamodb:DescribeTable", "dynamodb:ListTables" },
                Resources = new [] { "*" } }));

            // Add an interface endpoint
            vpc.AddInterfaceEndpoint("EcrDockerEndpoint", new InterfaceVpcEndpointOptions {
                Service = InterfaceVpcEndpointAwsService.ECR_DOCKER
            });

Synopsis

Constructors

GatewayVpcEndpointOptions()

Options to add a gateway endpoint to a VPC.

Properties

Service

The service to use for this gateway VPC endpoint.

Subnets

Where to add endpoint routing.

Constructors

GatewayVpcEndpointOptions()

Options to add a gateway endpoint to a VPC.

public GatewayVpcEndpointOptions()
Remarks

ExampleMetadata: lit=aws-ec2/test/integ.vpc-endpoint.lit.ts infused

Examples
// Add gateway endpoints when creating the VPC
            var vpc = new Vpc(this, "MyVpc", new VpcProps {
                GatewayEndpoints = new Dictionary<string, GatewayVpcEndpointOptions> {
                    { "S3", new GatewayVpcEndpointOptions {
                        Service = GatewayVpcEndpointAwsService.S3
                    } }
                }
            });

            // Alternatively gateway endpoints can be added on the VPC
            var dynamoDbEndpoint = vpc.AddGatewayEndpoint("DynamoDbEndpoint", new GatewayVpcEndpointOptions {
                Service = GatewayVpcEndpointAwsService.DYNAMODB
            });

            // This allows to customize the endpoint policy
            dynamoDbEndpoint.AddToPolicy(
            new PolicyStatement(new PolicyStatementProps {  // Restrict to listing and describing tables
                Principals = new [] { new AnyPrincipal() },
                Actions = new [] { "dynamodb:DescribeTable", "dynamodb:ListTables" },
                Resources = new [] { "*" } }));

            // Add an interface endpoint
            vpc.AddInterfaceEndpoint("EcrDockerEndpoint", new InterfaceVpcEndpointOptions {
                Service = InterfaceVpcEndpointAwsService.ECR_DOCKER
            });

Properties

Service

The service to use for this gateway VPC endpoint.

public IGatewayVpcEndpointService Service { get; set; }
Property Value

IGatewayVpcEndpointService

Remarks

ExampleMetadata: lit=aws-ec2/test/integ.vpc-endpoint.lit.ts infused

Subnets

Where to add endpoint routing.

public ISubnetSelection[]? Subnets { get; set; }
Property Value

ISubnetSelection[]

Remarks

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

Examples
Vpc vpc;


             vpc.AddGatewayEndpoint("DynamoDbEndpoint", new GatewayVpcEndpointOptions {
                 Service = GatewayVpcEndpointAwsService.DYNAMODB,
                 // Add only to ISOLATED subnets
                 Subnets = new [] { new SubnetSelection { SubnetType = SubnetType.PRIVATE_ISOLATED } }
             });

Implements

IGatewayVpcEndpointOptions
Back to top Generated by DocFX