Skip to content

(aws-apigatewayv2-alpha): Set route throttling with HttpStage #19626

@TkinterinShanghai

Description

@TkinterinShanghai

What is the problem?

Unlike the module aws_apigateway where I would just do

const api = new apigateway.RestApi(this, 'hello-api');
const plan = api.addUsagePlan('UsagePlan', {
  name: 'Easy',
  throttle: {
    rateLimit: 10,
    burstLimit: 2
  }
});

there doesnt seem to be an equivalent way of doing this in aws-apigatewayv2-alpha.

Reproduction Steps

I created an HTTP Api

export class APIConstruct extends Construct {
  public api: HttpApi;
  constructor(scope: Construct, id: idType, authorizer: HttpUserPoolAuthorizer) {
    super(scope, id);
    const throtting = new UsagePlan(this, "Throttling", {
      throttle: { burstLimit: 999, rateLimit: 99 },
    });
    this.api = new HttpApi(this, id, {
      apiName: id,
      defaultAuthorizer: authorizer,
    });
  }
}

and tried to just add throttling in the same scope, hoping that it would automatically apply to the only api gateway specified

const throtting = new UsagePlan(this, "TypiRateLimiting", { throttle: { burstLimit: 999, rateLimit: 99 } });

What did you expect to happen?

Have a method .addUsagePlan on the Http Api class or having a field in props that allows me to link the UsagePlan to the Api.

What actually happened?

Throttling was not configured for Api

CDK CLI Version

2.17.0

Framework Version

No response

Node.js Version

16.12

OS

Windows

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Labels

@aws-cdk/aws-apigatewayv2Related to Amazon API Gateway v2effort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions