aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
90 stars 76 forks source link

Throttling API traffic in AppSync/API Gateway #938

Open eettaa opened 1 year ago

eettaa commented 1 year ago

Hi! I'm trying to add throttling limits to my AppySync and API Gateway instances set up via the Amplify CLI. Basically configuring usage plans as describe here.

1) Is there a way to do this natively through the Amplify CLI? 2) If not, is there a way to do this by manually updating the cloudformation templates in the amplify/ directory? I've done this in the past with lambdas, which have a VC'ed cloudformation template. However amplify/backend/api/appsyncApiName/ does not appear to have a non-build/ cloudformation template I can confidently augment. Neither does amplify/backend/api/apiGatewayName/

Thanks!!

Which Category is your question related to? api Amplify CLI Version 10

You can use amplify -v to check the amplify cli version on your system

What AWS Services are you utilizing? Appsync, API Gateway Provide additional details e.g. code snippets. Be sure to remove any sensitive data.

ykethan commented 1 year ago

Hey, thank you for reaching out. Usage plans is unsupported workflow. The feature would be valuable for API category, I will be marking this as feature feature.

Additionally, I was able to able to set the set the throttling rate limit for a REST API on a stage level using the API override functionality. Please refer to https://docs.amplify.aws/cli/restapi/override/ for additional information on API override.

API override example:

export function override(resources: AmplifyApiRestResourceStackTemplate) {
    resources.deploymentResource.stageDescription= {
        throttlingRateLimit: 1,
    }
}

output on the API console after a push.

image