Skip to content

Instantly share code, notes, and snippets.

@Pelirrojo
Created October 30, 2024 14:28
Show Gist options
  • Save Pelirrojo/8a9dbac5298d8ec527915c2b6386a382 to your computer and use it in GitHub Desktop.
Save Pelirrojo/8a9dbac5298d8ec527915c2b6386a382 to your computer and use it in GitHub Desktop.
Phase 3: Fine-Tuning | Implement Request Throttling in API Gateway
# A vantablack friday: How to be prepared to stop DDoS Attacks after Halloween
# https://blog.evereven.tech
# Get API GW IDs and stage names
aws apigateway get-rest-apis --query 'items[*].[id,name]' --output json
> [
> [
> "abc123xyz",
> "my-api"
> ]
> ]
aws apigateway get-stages --rest-api-id <API-ID> --query 'item[*].[stageName]' --output json
> [
> ["prod"],
> ["dev"],
> ["test"]
> ]
# Apply throttling (replace [API-ID] & [STAGE])
aws apigateway update-stage \
--rest-api-id [API-ID] \
--stage-name [STAGE] \
--patch-operations \
op='replace',path='/throttling/rateLimit',value='50' \
op='replace',path='/throttling/burstLimit',value='100'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment