question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-apigatewayv2): add routes to imported httpapi (IHttpApi)

See original GitHub issue

Allow routes to be added to an existing HttpApi. Currently this is not an option

Use Case

We currently have an api gateway connected to an alb via vpclink on the default route and are slowly peeling off services and converting them to lambdas. This is easily done by defining explicit routes for our services as we move them over. The problem is that these new services are built and managed in their own cdk projects (deployed via codepipeline cdk stacks in their projects) but since the api gateway is defined elsewhere it needs to be imported to add the routes.

It looks like the only option we have currently would be to move all rest service stacks into the project the api gateway is in but this will quickly lead to a bloated and inefficient build/deploy process

Proposed Solution

allow routes to be added on IHttpApi or provide some other way to import an existing gateway and add routes

      const api = HttpApi.fromHttpApiAttributes(this, 'gateway', {
           httpApiId: 'myGateway',
       });

       api.addRoutes({
           path,
           methods,
           integration,
       });
  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:28
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
nija-atcommented, Jan 7, 2021

Thanks for filing this request.

In the meantime, you can achieve this by using our lower level constructs, specifically CfnRoute.

6reactions
brandon-kyle-baileycommented, Jun 29, 2022

+2 months later. Any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

class HttpApi (construct) · AWS CDK
Returns a string representation of this construct. static fromHttpApiAttributes(scope, id, attrs) , Import an existing HTTP API into this CDK app.
Read more >
Working with routes for HTTP APIs - Amazon API Gateway
Routes direct incoming API requests to backend resources. Routes consist of two parts: an HTTP method and a resource path—for example, GET /pets...
Read more >
aws-cdk/aws-apigatewayv2 module - AWS Documentation
To add the default WebSocket routes supported by API Gateway ( $connect , $disconnect and $default ), configure them as part of api...
Read more >
class HttpRoute (construct) · AWS CDK
Route class that creates the Route for API Gateway HTTP API. ... as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; declare const httpApi: apigatewayv2.
Read more >
AWS::ApiGatewayV2::Route - AWS CloudFormation
The AWS::ApiGatewayV2::Route resource creates a route for an API. ... For HTTP APIs, valid values are NONE for open access, JWT for using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found