Skip to content
v2.273.0

InterfaceVpcEndpoint L2 construct ​

A interface VPC endpoint.

Example ​

ts
declare const vpc: ec2.Vpc;

new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', {
  vpc,
  service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443),
  subnets: {
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
    availabilityZones: ['us-east-1a', 'us-east-1c']
  }
});
python
# vpc: ec2.Vpc


ec2.InterfaceVpcEndpoint(self, "VPC Endpoint",
    vpc=vpc,
    service=ec2.InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
    subnets=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
        availability_zones=["us-east-1a", "us-east-1c"]
    )
)
java
Vpc vpc;


InterfaceVpcEndpoint.Builder.create(this, "VPC Endpoint")
        .vpc(vpc)
        .service(new InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443))
        .subnets(SubnetSelection.builder()
                .subnetType(SubnetType.PRIVATE_ISOLATED)
                .availabilityZones(List.of("us-east-1a", "us-east-1c"))
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


new InterfaceVpcEndpoint(this, "VPC Endpoint", new InterfaceVpcEndpointProps {
    Vpc = vpc,
    Service = new InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
    Subnets = new SubnetSelection {
        SubnetType = SubnetType.PRIVATE_ISOLATED,
        AvailabilityZones = new [] { "us-east-1a", "us-east-1c" }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


ec2.NewInterfaceVpcEndpoint(this, jsii.String("VPC Endpoint"), &InterfaceVpcEndpointProps{
	Vpc: Vpc,
	Service: ec2.NewInterfaceVpcEndpointService(jsii.String("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc"), jsii.Number(443)),
	Subnets: &SubnetSelection{
		SubnetType: ec2.SubnetType_PRIVATE_ISOLATED,
		AvailabilityZones: []*string{
			jsii.String("us-east-1a"),
			jsii.String("us-east-1c"),
		},
	},
})

Initializer ​

ts
new InterfaceVpcEndpoint(scope: Construct, id: string, props: InterfaceVpcEndpointProps)
python
InterfaceVpcEndpoint(scope: Construct, id: str, props: InterfaceVpcEndpointProps)
java
new InterfaceVpcEndpoint(Construct scope, String id, InterfaceVpcEndpointProps props)
csharp
new InterfaceVpcEndpoint(Construct scope, string id, InterfaceVpcEndpointProps props)
go
NewInterfaceVpcEndpoint(Scope Construct, Id *string, Props InterfaceVpcEndpointProps)

Construct Props ​

dnsRecordIpTypeVpcEndpointDnsRecordIpTypedns_record_ip_typeVpcEndpointDnsRecordIpTypednsRecordIpTypeVpcEndpointDnsRecordIpTypeDnsRecordIpTypeVpcEndpointDnsRecordIpTypeDnsRecordIpTypeVpcEndpointDnsRecordIpType= not specified#
Type of DNS records created for the VPC endpoint.
ipAddressTypeVpcEndpointIpAddressTypeip_address_typeVpcEndpointIpAddressTypeipAddressTypeVpcEndpointIpAddressTypeIpAddressTypeVpcEndpointIpAddressTypeIpAddressTypeVpcEndpointIpAddressType= not specified#
The IP address type for the endpoint.
lookupSupportedAzsbooleanlookup_supported_azsboollookupSupportedAzsBooleanLookupSupportedAzsboolLookupSupportedAzs*bool= false#
Limit to only those availability zones where the endpoint service can be created.

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.

openbooleanopenboolopenBooleanOpenboolOpen*bool= true#
Whether to automatically allow VPC traffic to the endpoint.

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.

privateDnsEnabledbooleanprivate_dns_enabledboolprivateDnsEnabledBooleanPrivateDnsEnabledboolPrivateDnsEnabled*bool= set by the instance of IInterfac…#
Whether to associate a private hosted zone with the specified VPC.

This allows you to make requests to the service using its default DNS hostname.

default

Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService

privateDnsOnlyForInboundResolverEndpointVpcEndpointPrivateDnsOnlyForInboundResolverEndpointprivate_dns_only_for_inbound_resolver_endpointVpcEndpointPrivateDnsOnlyForInboundResolverEndpointprivateDnsOnlyForInboundResolverEndpointVpcEndpointPrivateDnsOnlyForInboundResolverEndpointPrivateDnsOnlyForInboundResolverEndpointVpcEndpointPrivateDnsOnlyForInboundResolverEndpointPrivateDnsOnlyForInboundResolverEndpointVpcEndpointPrivateDnsOnlyForInboundResolverEndpoint= not specified#
Whether to enable private DNS only for inbound endpoints.
securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= a new security group is created#
The security groups to associate with this interface VPC endpoint.
The service to use for this interface VPC endpoint.
serviceRegionstringservice_regionstrserviceRegionStringServiceRegionstringServiceRegion*string= Same region as the interface VPC…#
The region where the VPC endpoint service is located.

Only needs to be specified for cross-region VPC endpoints.

default

Default: Same region as the interface VPC endpoint

subnetsSubnetSelectionsubnetsSubnetSelectionsubnetsSubnetSelectionSubnetsSubnetSelectionSubnetsSubnetSelection= private subnets#
The subnets in which to create an endpoint network interface.

At most one per availability zone.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC network in which the interface endpoint will be used.

Properties ​

connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
Access to network connections.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
vpcEndpointCreationTimestampstringvpc_endpoint_creation_timestampstrvpcEndpointCreationTimestampStringVpcEndpointCreationTimestampstringVpcEndpointCreationTimestamp*stringrequired#
The date and time the interface VPC endpoint was created.
vpcEndpointDnsEntriesstring[]vpc_endpoint_dns_entriestyping.List[str]vpcEndpointDnsEntriesList<String>VpcEndpointDnsEntriesstring[]VpcEndpointDnsEntries*[]*stringrequired#
The DNS entries for the interface VPC endpoint.
notes

Each entry is a combination of the hosted zone ID and the DNS name. The entries are ordered as follows: regional public DNS, zonal public DNS, private DNS, and wildcard DNS. This order is not enforced for AWS Marketplace services.

The following is an example. In the first entry, the hosted zone ID is Z1HUB23UULQXV and the DNS name is vpce-01abc23456de78f9g-12abccd3.ec2.us-east-1.vpce.amazonaws.com.

["Z1HUB23UULQXV:vpce-01abc23456de78f9g-12abccd3.ec2.us-east-1.vpce.amazonaws.com", "Z1HUB23UULQXV:vpce-01abc23456de78f9g-12abccd3-us-east-1a.ec2.us-east-1.vpce.amazonaws.com", "Z1C12344VYDITB0:ec2.us-east-1.amazonaws.com"]

If you update the PrivateDnsEnabled or SubnetIds properties, the DNS entries in the list will change.

vpcEndpointIdstringvpc_endpoint_idstrvpcEndpointIdStringVpcEndpointIdstringVpcEndpointId*stringrequired#
The interface VPC endpoint identifier.
vpcEndpointNetworkInterfaceIdsstring[]vpc_endpoint_network_interface_idstyping.List[str]vpcEndpointNetworkInterfaceIdsList<String>VpcEndpointNetworkInterfaceIdsstring[]VpcEndpointNetworkInterfaceIds*[]*stringrequired#
One or more network interfaces for the interface VPC endpoint.
vpcEndpointRefVPCEndpointReferencevpc_endpoint_refVPCEndpointReferencevpcEndpointRefVPCEndpointReferenceVpcEndpointRefVPCEndpointReferenceVpcEndpointRefVPCEndpointReferencerequired#
A reference to a VPCEndpoint resource.

Methods ​

addToPolicy(statement: PolicyStatement): voiddef add_to_policy(self, statement: PolicyStatement) -> Nonepublic void addToPolicy(PolicyStatement statement)public void AddToPolicy(PolicyStatement statement)func AddToPolicy(Statement PolicyStatement)#
Adds a statement to the policy document of the VPC endpoint. The statement must have a Principal.

Not all interface VPC endpoints support policy. For more information see https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html

1 parameter

Parameters

  • statementstatementstatementstatementStatement — the IAM statement to add.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

fromInterfaceVpcEndpointAttributes(scope: Construct, id: string, attrs: InterfaceVpcEndpointAttributes): IInterfaceVpcEndpoint@staticmethod def from_interface_vpc_endpoint_attributes(scope: Construct, id: str, attrs: InterfaceVpcEndpointAttributes) -> IInterfaceVpcEndpointpublic static IInterfaceVpcEndpoint fromInterfaceVpcEndpointAttributes(Construct scope, String id, InterfaceVpcEndpointAttributes attrs)public static IInterfaceVpcEndpoint FromInterfaceVpcEndpointAttributes(Construct scope, string id, InterfaceVpcEndpointAttributes attrs)func FromInterfaceVpcEndpointAttributes(Scope Construct, Id *string, Attrs InterfaceVpcEndpointAttributes) IInterfaceVpcEndpointstatic#
Imports an existing interface VPC endpoint.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.