AdriƔn Mouly
08/29/2021, 9:55 PMApi
construct?
Found that documentation shows this example, but HOW we do it with CDK?
aws apigatewayv2 update-stage \
--api-id a1b2c3d4 \
--stage-name dev \
--route-settings '{"GET /pets":{"ThrottlingBurstLimit":100,"ThrottlingRateLimit":2000}}'
Found this on CDK, but this is for GW v1 š© .
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.ThrottleSettings.htmlFrank
const api = new sst.Api(..);
const cfnStage = api.defaultStage.node.defaultChild;
cfnStage.routeSettings = { ... };
Frank
AdriƔn Mouly
08/29/2021, 11:52 PMAdriƔn Mouly
08/29/2021, 11:52 PMAdriƔn Mouly
08/29/2021, 11:54 PMAdriƔn Mouly
08/30/2021, 12:00 AMconst cfnStage = api.httpApi.defaultStage?.node.defaultChild;
AdriƔn Mouly
08/30/2021, 12:01 AMconst cfnStage = api.httpApi.defaultStage?.node.defaultChild as CfnStage;
cfnStage.routeSettings = {
throttlingBurstLimit: 10,
throttlingRateLimit: 100,
};
AdriƔn Mouly
08/30/2021, 12:02 AMAdriƔn Mouly
08/30/2021, 12:13 AMAdriƔn Mouly
08/30/2021, 12:25 AMProperty validation failure: [Value of property {/RouteSettings/throttlingBurstLimit} does not match type {Object}, Value of property {/RouteSettings/throttlingRateLimit} does not match type {Object}]
Frank
cfnStage
has defaultRouteSettings
and routeSettings
AdriƔn Mouly
08/30/2021, 1:39 AMFrank
cfnStage.defaultRouteSettings = {
throttlingBurstLimit: 10,
throttlingRateLimit: 100,
};
AdriƔn Mouly
08/30/2021, 1:40 AMconst cfnStage = api.httpApi.defaultStage?.node.defaultChild as CfnStage;
cfnStage.defaultRouteSettings = {
throttlingBurstLimit: 100,
throttlingRateLimit: 50,
};
AdriƔn Mouly
08/30/2021, 1:40 AMas
the type is not recognized.Frank
as
is required for TSAdriƔn Mouly
08/30/2021, 1:40 AMAdriƔn Mouly
08/30/2021, 1:41 AMAdriƔn Mouly
08/30/2021, 1:42 AMAdriƔn Mouly
08/30/2021, 1:48 AMAdriƔn Mouly
08/30/2021, 1:48 AMFrank
AdriƔn Mouly
08/30/2021, 5:05 AMAdriƔn Mouly
08/30/2021, 5:05 AMFrank
new Api(this, "Api", {
defaultThrottlingRateLimit: 2000,
defaultThrottlingBurstLimit: 100,
routes: {
"GET /notes": "list.main",
"POST /notes": "create.main",
},
});