InterfaceVpcEndpointOptions Struct
Options to add an interface endpoint to a VPC.
| Source | aws-ec2/lib/vpc-endpoint.ts |
|---|---|
| Type last changed |
Example
// Add gateway endpoints when creating the VPC
const vpc = new ec2.Vpc(this, 'MyVpc', {
gatewayEndpoints: {
S3: {
service: ec2.GatewayVpcEndpointAwsService.S3,
},
},
});
// Alternatively gateway endpoints can be added on the VPC
const dynamoDbEndpoint = vpc.addGatewayEndpoint('DynamoDbEndpoint', {
service: ec2.GatewayVpcEndpointAwsService.DYNAMODB,
});
// This allows to customize the endpoint policy
dynamoDbEndpoint.addToPolicy(
new iam.PolicyStatement({ // Restrict to listing and describing tables
principals: [new iam.AnyPrincipal()],
actions: ['dynamodb:DescribeTable', 'dynamodb:ListTables'],
resources: ['*'],
}));
// Add an interface endpoint
vpc.addInterfaceEndpoint('EcrDockerEndpoint', {
service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER,
// Uncomment the following to allow more fine-grained control over
// who can access the endpoint via the '.connections' object.
// open: false
});
# Add gateway endpoints when creating the VPC
vpc = ec2.Vpc(self, "MyVpc",
gateway_endpoints={
"S3": cdk.aws_ec2.GatewayVpcEndpointOptions(
service=ec2.GatewayVpcEndpointAwsService.S3
)
}
)
# Alternatively gateway endpoints can be added on the VPC
dynamo_db_endpoint = vpc.add_gateway_endpoint("DynamoDbEndpoint",
service=ec2.GatewayVpcEndpointAwsService.DYNAMODB
)
# This allows to customize the endpoint policy
dynamo_db_endpoint.add_to_policy(
iam.PolicyStatement( # Restrict to listing and describing tables
principals=[iam.AnyPrincipal()],
actions=["dynamodb:DescribeTable", "dynamodb:ListTables"],
resources=["*"]))
# Add an interface endpoint
vpc.add_interface_endpoint("EcrDockerEndpoint",
service=ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER
)
// Add gateway endpoints when creating the VPC
Vpc vpc = Vpc.Builder.create(this, "MyVpc")
.gatewayEndpoints(Map.of(
"S3", GatewayVpcEndpointOptions.builder()
.service(GatewayVpcEndpointAwsService.S3)
.build()))
.build();
// Alternatively gateway endpoints can be added on the VPC
GatewayVpcEndpoint dynamoDbEndpoint = vpc.addGatewayEndpoint("DynamoDbEndpoint", GatewayVpcEndpointOptions.builder()
.service(GatewayVpcEndpointAwsService.DYNAMODB)
.build());
// This allows to customize the endpoint policy
dynamoDbEndpoint.addToPolicy(
PolicyStatement.Builder.create() // Restrict to listing and describing tables
.principals(List.of(new AnyPrincipal()))
.actions(List.of("dynamodb:DescribeTable", "dynamodb:ListTables"))
.resources(List.of("*")).build());
// Add an interface endpoint
vpc.addInterfaceEndpoint("EcrDockerEndpoint", InterfaceVpcEndpointOptions.builder()
.service(InterfaceVpcEndpointAwsService.ECR_DOCKER)
.build());
// Install: dotnet add package Amazon.CDK.Lib
// 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
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Add gateway endpoints when creating the VPC
vpc := ec2.NewVpc(this, jsii.String("MyVpc"), &VpcProps{
GatewayEndpoints: map[string]GatewayVpcEndpointOptions{
"S3": &GatewayVpcEndpointOptions{
"service": ec2.GatewayVpcEndpointAwsService_S3(),
},
},
})
// Alternatively gateway endpoints can be added on the VPC
dynamoDbEndpoint := vpc.addGatewayEndpoint(jsii.String("DynamoDbEndpoint"), &GatewayVpcEndpointOptions{
Service: ec2.GatewayVpcEndpointAwsService_DYNAMODB(),
})
// This allows to customize the endpoint policy
dynamoDbEndpoint.AddToPolicy(
iam.NewPolicyStatement(&PolicyStatementProps{
// Restrict to listing and describing tables
Principals: []IPrincipal{
iam.NewAnyPrincipal(),
},
Actions: []*string{
jsii.String("dynamodb:DescribeTable"),
jsii.String("dynamodb:ListTables"),
},
Resources: []*string{
jsii.String("*"),
},
}))
// Add an interface endpoint
vpc.addInterfaceEndpoint(jsii.String("EcrDockerEndpoint"), &InterfaceVpcEndpointOptions{
Service: ec2.InterfaceVpcEndpointAwsService_ECR_DOCKER(),
})
Properties
dnsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypedns_record_ip_typeoptionalVpcEndpointDnsRecordIpTypednsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypeDnsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypeDnsRecordIpTypeoptionalVpcEndpointDnsRecordIpType #Default: not specified
ipAddressTypeoptionalVpcEndpointIpAddressTypeip_address_typeoptionalVpcEndpointIpAddressTypeipAddressTypeoptionalVpcEndpointIpAddressTypeIpAddressTypeoptionalVpcEndpointIpAddressTypeIpAddressTypeoptionalVpcEndpointIpAddressType #Default: not specified
lookupSupportedAzsoptionalbooleanlookup_supported_azsoptionalboollookupSupportedAzsoptionalBooleanLookupSupportedAzsoptionalboolLookupSupportedAzsoptional*bool = false #Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work.
If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range.
privateDnsEnabledoptionalbooleanprivate_dns_enabledoptionalboolprivateDnsEnabledoptionalBooleanPrivateDnsEnabledoptionalboolPrivateDnsEnabledoptional*bool #Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
This allows you to make requests to the service using its default DNS hostname.
privateDnsOnlyForInboundResolverEndpointoptionalVpcEndpointPrivateDnsOnlyForInboundResolverEndpointprivate_dns_only_for_inbound_resolver_endpointoptionalVpcEndpointPrivateDnsOnlyForInboundResolverEndpointprivateDnsOnlyForInboundResolverEndpointoptionalVpcEndpointPrivateDnsOnlyForInboundResolverEndpointPrivateDnsOnlyForInboundResolverEndpointoptionalVpcEndpointPrivateDnsOnlyForInboundResolverEndpointPrivateDnsOnlyForInboundResolverEndpointoptionalVpcEndpointPrivateDnsOnlyForInboundResolverEndpoint #Default: not specified
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup #Default: a new security group is created
serviceIInterfaceVpcEndpointServiceserviceIInterfaceVpcEndpointServiceserviceIInterfaceVpcEndpointServiceServiceIInterfaceVpcEndpointServiceServiceIInterfaceVpcEndpointService required #serviceRegionoptionalstringservice_regionoptionalstrserviceRegionoptionalStringServiceRegionoptionalstringServiceRegionoptional*string #Default: Same region as the interface VPC endpoint
Only needs to be specified for cross-region VPC endpoints.
subnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelection #Default: private subnets
At most one per availability zone.