Skip to content
v2.274.0

VpcEndpointService L2 construct ​

A VPC endpoint service.

Example ​

ts
declare const networkLoadBalancer: elbv2.NetworkLoadBalancer;

new ec2.VpcEndpointService(this, 'EndpointService', {
  vpcEndpointServiceLoadBalancers: [networkLoadBalancer],
  // Support both IPv4 and IPv6 connections to the endpoint service
  supportedIpAddressTypes: [
    ec2.IpAddressType.IPV4,
    ec2.IpAddressType.IPV6,
  ],
});
python
# network_load_balancer: elbv2.NetworkLoadBalancer


ec2.VpcEndpointService(self, "EndpointService",
    vpc_endpoint_service_load_balancers=[network_load_balancer],
    # Support both IPv4 and IPv6 connections to the endpoint service
    supported_ip_address_types=[ec2.IpAddressType.IPV4, ec2.IpAddressType.IPV6
    ]
)
java
NetworkLoadBalancer networkLoadBalancer;


VpcEndpointService.Builder.create(this, "EndpointService")
        .vpcEndpointServiceLoadBalancers(List.of(networkLoadBalancer))
        // Support both IPv4 and IPv6 connections to the endpoint service
        .supportedIpAddressTypes(List.of(IpAddressType.IPV4, IpAddressType.IPV6))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
NetworkLoadBalancer networkLoadBalancer;


new VpcEndpointService(this, "EndpointService", new VpcEndpointServiceProps {
    VpcEndpointServiceLoadBalancers = new [] { networkLoadBalancer },
    // Support both IPv4 and IPv6 connections to the endpoint service
    SupportedIpAddressTypes = new [] { IpAddressType.IPV4, IpAddressType.IPV6 }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var networkLoadBalancer NetworkLoadBalancer


ec2.NewVpcEndpointService(this, jsii.String("EndpointService"), &VpcEndpointServiceProps{
	VpcEndpointServiceLoadBalancers: []IVpcEndpointServiceLoadBalancer{
		networkLoadBalancer,
	},
	// Support both IPv4 and IPv6 connections to the endpoint service
	SupportedIpAddressTypes: []IpAddressType{
		ec2.IpAddressType_IPV4,
		ec2.IpAddressType_IPV6,
	},
})

Initializer ​

ts
new VpcEndpointService(scope: Construct, id: string, props: VpcEndpointServiceProps)
python
VpcEndpointService(scope: Construct, id: str, props: VpcEndpointServiceProps)
java
new VpcEndpointService(Construct scope, String id, VpcEndpointServiceProps props)
csharp
new VpcEndpointService(Construct scope, string id, VpcEndpointServiceProps props)
go
NewVpcEndpointService(Scope Construct, Id *string, Props VpcEndpointServiceProps)

Construct Props ​

acceptanceRequiredbooleanacceptance_requiredboolacceptanceRequiredBooleanAcceptanceRequiredboolAcceptanceRequired*bool= true#
Whether requests from service consumers to connect to the service through an endpoint must be accepted.
allowedPrincipalsArnPrincipal[]allowed_principalstyping.List[ArnPrincipal]allowedPrincipalsList<ArnPrincipal>AllowedPrincipalsArnPrincipal[]AllowedPrincipals*[]ArnPrincipal= no principals#
IAM users, IAM roles, or AWS accounts to allow inbound connections from.

These principals can connect to your service using VPC endpoints. Takes a list of one or more ArnPrincipal.

allowedRegionsstring[]allowed_regionstyping.List[str]allowedRegionsList<String>AllowedRegionsstring[]AllowedRegions*[]*string= the region hosting the service o…#
The Regions from which service consumers can access the service.
default

Default: the region hosting the service only

contributorInsightsbooleancontributor_insightsboolcontributorInsightsBooleanContributorInsightsboolContributorInsights*bool= false#
Indicates whether to enable the built-in Contributor Insights rules provided by AWS PrivateLink.
supportedIpAddressTypesIpAddressType[]supported_ip_address_typestyping.List[IpAddressType]supportedIpAddressTypesList<IpAddressType>SupportedIpAddressTypesIpAddressType[]SupportedIpAddressTypes*[]IpAddressType= No specific IP address types con…#
Specify which IP address types are supported for VPC endpoint service.
default

Default: No specific IP address types configured

vpcEndpointServiceLoadBalancersIVpcEndpointServiceLoadBalancer[]vpc_endpoint_service_load_balancerstyping.List[IVpcEndpointServiceLoadBalancer]vpcEndpointServiceLoadBalancersList<IVpcEndpointServiceLoadBalancer>VpcEndpointServiceLoadBalancersIVpcEndpointServiceLoadBalancer[]VpcEndpointServiceLoadBalancers*[]IVpcEndpointServiceLoadBalancerrequired#
One or more load balancers to host the VPC Endpoint Service.

Properties ​

acceptanceRequiredbooleanacceptance_requiredboolacceptanceRequiredBooleanAcceptanceRequiredboolAcceptanceRequired*boolrequired#
Whether to require manual acceptance of new connections to the service.
allowedPrincipalsArnPrincipal[]allowed_principalstyping.List[ArnPrincipal]allowedPrincipalsList<ArnPrincipal>AllowedPrincipalsArnPrincipal[]AllowedPrincipals*[]ArnPrincipalrequired#
One or more Principal ARNs to allow inbound connections to.
contributorInsightsEnabledbooleancontributor_insights_enabledboolcontributorInsightsEnabledBooleanContributorInsightsEnabledboolContributorInsightsEnabled*bool#
Whether to enable the built-in Contributor Insights rules provided by AWS PrivateLink.
DEFAULT_PREFIXstringdefault_prefixstrDEFAULT_PREFIXStringDEFAULT_PREFIXstringDEFAULT_PREFIX*stringrequiredstatic#
The default value for a VPC Endpoint Service name prefix, useful if you do not have a synthesize-time region literal available (all you have is `{ "Ref": "AWS::Region" }`).
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.
vpcEndpointServiceIdstringvpc_endpoint_service_idstrvpcEndpointServiceIdStringVpcEndpointServiceIdstringVpcEndpointServiceId*stringrequired#
The id of the VPC Endpoint Service, like vpce-svc-xxxxxxxxxxxxxxxx.
vpcEndpointServiceLoadBalancersIVpcEndpointServiceLoadBalancer[]vpc_endpoint_service_load_balancerstyping.List[IVpcEndpointServiceLoadBalancer]vpcEndpointServiceLoadBalancersList<IVpcEndpointServiceLoadBalancer>VpcEndpointServiceLoadBalancersIVpcEndpointServiceLoadBalancer[]VpcEndpointServiceLoadBalancers*[]IVpcEndpointServiceLoadBalancerrequired#
One or more network load balancers to host the service.
vpcEndpointServiceNamestringvpc_endpoint_service_namestrvpcEndpointServiceNameStringVpcEndpointServiceNamestringVpcEndpointServiceName*stringrequired#
The service name of the VPC Endpoint Service that clients use to connect to, like com.amazonaws.vpce.<region>.vpce-svc-xxxxxxxxxxxxxxxx.
vpcEndpointServiceRefVPCEndpointServiceReferencevpc_endpoint_service_refVPCEndpointServiceReferencevpcEndpointServiceRefVPCEndpointServiceReferenceVpcEndpointServiceRefVPCEndpointServiceReferenceVpcEndpointServiceRefVPCEndpointServiceReferencerequired#
A reference to a VPCEndpointService resource.

Methods ​

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).

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.