Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to configure API gateway endpoint rate/burst limit #1183

Closed
konrad-garus opened this issue May 24, 2016 · 12 comments

Comments

@konrad-garus
Copy link

commented May 24, 2016

It would be nice if Serverless allowed me to tweak API Gateway method settings such as rate and burst limit. The defaults can be too high for some applications, and account-wide settings are too coarse-grained.

While we're at it, it may be beneficial (and not much more work) to support other settings, listed under methodSettings in createStage callback here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/APIGateway.html#createStage-property.

It seems that the implementation would have to follow up the deploy with a number of PATCH requests (one for each parameter).

@kylecordes

This comment has been minimized.

Copy link

commented May 24, 2016

+1 on this.

@flomotlik

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2016

@konrad-garus do you know if thats possible to set through Cloudformation? I could see this as an extension in our new V1 services and to be set through Cloudformation.

@flomotlik

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2016

As we now have full support of Cloudformation and custom resources you should be able to set this in cloud formation (in case this is already exposed)

@flomotlik flomotlik closed this Aug 5, 2016

@jthomerson

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2017

@flomotlik is there a documented way to configure throttling in the serverless.yml file? Since the API Gateway resource is created for you by Serverless, I don't see anything documented about how to add this information to the CloudFormation resource that Serverless creates for you.

@pmuens

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

@jthomerson there's nothing documented about throttling yet but you should be able to use the resources section in serverless.yml to add the corresponding UsagePlan CloudFormation resource: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html

Here's a link to the docs for the resources section: https://serverless.com/framework/docs/providers/aws/guide/resources/

@Siyfion

This comment has been minimized.

Copy link

commented Jun 21, 2017

@jthomerson Isn't that something quite different though? There seems to be two different throttle controls, one as you state is Usage Plan, which (I think?) controls the users of the API Keys generated in the API Gateway settings.

But there is also a "Default Method Throttling" in the API Stage Settings itself, my understanding is that these don't relate to API Key users, but simply, anyone using the API endpoint.

@HyperBrain

This comment has been minimized.

Copy link
Member

commented Jun 21, 2017

Yes. It's two different things - the APIKey usage plans offer an own configuration (throttling etc.) that is only applied for api keys that belong to that usage plan.

The other configuration (the one you referred to) is a configuration of the API stage, that means that a deployed API stage can be configured to have CW logs/metrics enabled, throttling set to specific values, etc. Currently the global API stage settings cannot be set with Serverless, but I'll add it to my plugin in the next version (see my comment here: #3715 (comment)) which will be released soon.

@Siyfion

This comment has been minimized.

Copy link

commented Jun 21, 2017

@HyperBrain Ah, that's exactly what I thought (glad to know I'm along the right lines!).

And fantastic to see that a solution is already underway and an-end in sight! Great work.

@jthomerson

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2017

@Siyfion as @HyperBrain explained, what I was referring to was the method settings throttling. The stage can have a default method settings (see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-methodsettings).

As shown in the GUI:

default-method-throttling

@zommerfelds

This comment has been minimized.

Copy link

commented Sep 6, 2018

Can someone point to a documented way to set the rate and burst values (not using Usage Plan)? I don't mind if it's in CloudFormation, but it needs to be documented by Serverless because the API Gateway is created by Serverless and this requires to modify an existing hidden resource. Thanks!

@dblackhall-tyro

This comment has been minimized.

Copy link

commented Jan 21, 2019

For anyone looking how to do this, I was able to use this plugin: https://www.npmjs.com/package/serverless-api-stage

@hamletrp

This comment has been minimized.

Copy link

commented Aug 16, 2019

Hi Mr. @dblackhall-tyro,
Thank you for sharing about this plugin, could you please also share your setup in the yml file, showing how you did it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.