aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

[apigateway] Allow importing existing VpcLink resources

Open rigsbyt opened this issue 7 years ago • 9 comments

Currently VPC links can only be created, existing VPC links cannot be referred to from CDK code. I propose that VpcLink exposes a .fromVpcLinkId static function or similar so that one can refer to existing VpcLinks.

Use Case

We have an Elasticsearch domain in our VPC along with a corresponding VPC link to access it. These are configured by Terraform so our stacks need to refer to the VPC link by ID.

In order to avoid falling back to Cfn* for my entire API gateway, I am currently faking a VpcLink object with the vpcLinkId property. This is very fragile and seems like it could easily be broken by an update. I would feel much more comfortable using a supported CDK function in order to refer to an existing VPC link.

  • [ ] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

rigsbyt avatar Sep 20 '19 16:09 rigsbyt

+1

sgrinich-98point6 avatar Sep 23 '19 16:09 sgrinich-98point6

I agree with you. In most cases, we will integrate the already created VPCLink with API Gateway.

The low-level integration provided by AWS CDK is AWS::ApiGatewayV2::Integration, which currently cannot specify VPC_LINK for ConnectionType. AWS CDK does not achieve this use case.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-integration.html#aws-resource-apigatewayv2-integration-properties

cm-wada-yusuke avatar Jan 14 '20 08:01 cm-wada-yusuke

+1

This feature is crucial for our future automated api deployment (we are using api gateway v1). At the moment it seems that the only way to do this is to manually change the settings in the console after the stack is deployed. Is there a known workaround? I was looking at https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CfnIntegrationV2.html but this class is deprecated.

Any help is appreciated :)

ghost avatar Apr 02 '20 08:04 ghost

@MKROS & @cm-wada-yusuke - Unfortunately we have not built any support for APIGatewayV2 at this point, so this isn't coming anytime soon. Please upvote our tracking issue if you'd like to see this - https://github.com/aws/aws-cdk/issues/6830

@rigsbyt - I assumed you opened this asking for the ability to import VpcLink for APIGatewayV1. Is that the case, or are you actually looking VpcLink for APIGatewayV2 instead?

nija-at avatar Apr 02 '20 08:04 nija-at

@rigsbyt - I assumed you opened this asking for the ability to import VpcLink for APIGatewayV1. Is that the case, or are you actually looking VpcLink for APIGatewayV2 instead?

Yes, for now :). We do actively need this for APIGateway v1, and will eventually need it for v2 as well.

rigsbyt avatar Apr 02 '20 17:04 rigsbyt

@rigsbyt - I am interested in your current solution because the missing vpc link is the last fragment I need to get api deployment fully automated. Could you share your solution? Thanks!

ghost avatar Apr 04 '20 10:04 ghost

any news about this implementation?

salsa2k avatar Apr 23 '20 13:04 salsa2k

Thanks for all your interest. This has not been worked on yet, but we can review and merge PR if anyone is interested in contributing.

nija-at avatar Apr 23 '20 13:04 nija-at

Is it possible to achieve this by using cdk core Fn.import to get vpnlink Id and then use it in the api gateway stack

VarunJohar avatar May 01 '20 22:05 VarunJohar