Aws-cdk: [apigateway] Allow importing existing VpcLink resources

Created on 20 Sep 2019  路  9Comments  路  Source: aws/aws-cdk

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

@aws-cdaws-apigateway efforsmall feature-request good first issue in-progress

Most helpful comment

any news about this implementation?

All 9 comments

+1

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

+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 :)

@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?

@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 - 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!

any news about this implementation?

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v-do picture v-do  路  3Comments

Kent1 picture Kent1  路  3Comments

EduardTheThird picture EduardTheThird  路  3Comments

mirazmamun picture mirazmamun  路  3Comments

peterdeme picture peterdeme  路  3Comments