Class GatewayVpcEndpointOptions
Options to add a gateway endpoint to a VPC.
Inheritance
System.Object
GatewayVpcEndpointOptions
Implements
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class GatewayVpcEndpointOptions : Object, IGatewayVpcEndpointOptions
Syntax (vb)
Public Class GatewayVpcEndpointOptions
Inherits Object
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() |
Properties
Service | The service to use for this gateway VPC endpoint. |
Subnets | Where to add endpoint routing. |
Constructors
GatewayVpcEndpointOptions()
public GatewayVpcEndpointOptions()
Properties
Service
The service to use for this gateway VPC endpoint.
public IGatewayVpcEndpointService Service { get; set; }
Property Value
Subnets
Where to add endpoint routing.
public ISubnetSelection[] Subnets { get; set; }
Property Value
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 } }
});