Skip to content

Gateway load balancer - VPC endpoint service does not exist

0

What am I doing wrong here? Using CDK V2 typescript, I am unable to deploy VPC endpoints to use a created endpoint service. I successfully created the endpoint service, pointing to the GWLB as:

   // create vpc endpoint service
   const vpc_endpoint_svc = new ec2.CfnVPCEndpointService(this, 'vpc-endpoint-service', {
     acceptanceRequired: false,
     contributorInsightsEnabled: false,
     gatewayLoadBalancerArns: [vpc_gwlb.ref],
   });

Then i try to create an endpoint as:

   // create vpc endpoint
   const vpc_endpoint_1a = new ec2.CfnVPCEndpoint(this, 'vpc-endpoint-1a', {
    vpcEndpointType: "GatewayLoadBalancer",
    vpcId: vpc.ref,
    serviceName: vpc_endpoint_svc.ref,
    subnetIds: [
      gwlb_1a_sn.ref
    ]
   });

This throws a the following error: Resource handler returned message: "The Vpc Endpoint Service 'vpce-svc-0e55___' does not exist (Service: Ec2, Status Code: 400, Request ID: 0a87f16f-3b8a-493a-8bf9-bd57f2981b71)" (RequestToken: 62d78acd-0c20___, HandlerErrorCode: InvalidRequest)

BUT i can see that endpoint service name in the error DOES exist and can view it on the consule.

Any help appreciated... thanks

1 Answer
0

I suggest adding a dependency logic to your code so that the Interface endpoint wait for the service endpoint to become ready before starting referencing it.

stack.addDependency(stack) (Python: stack.add_dependency(stack) – Can be used to explicitly define dependency order between two stacks. This order is respected by the cdk deploy command when deploying multiple stacks at once.

// Add dependency to ensure the service is created before the endpoint vpc_endpoint_1a.node.addDependency(vpc_endpoint_svc);

AWS
EXPERT

answered 2 years ago

  • Thanks. I did add a dependency:

    "vpc_endpoint_1a.node.addDependency(vpc_endpoint_svc);"

    This made no difference unfortunately

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.