To set your throttling limits, you can assign them to the throttle
property of your UsagePlan. Here's an example:
const restApi: RestApi = myRestApi; // Assuming you already have this
const res = api.root.addResource('res');
const method = res.addMethod('GET');
const methodThrottle:ThrottlingPerMethod = {
method: method,
throttle: {
rateLimit: 50,
burstLimit: 50
}
}
const usagePlan = new UsagePlan(this, "MyUsagePlan", {
description: "UsagePlan for my API",
apiStages: [{
api: restApi,
stage: restApi.DeploymentStage,
throttle: [methodThrottle] // per method limit
}],
throttle: maxThrottlingLimit, // maximum limit
});
For a shorter example, you can refer to the UsagePlanPerApiStage official documentation.