As a cloud-native developer, you have written a web service for your company. You have used Oracle Cloud Infrastructure (OCI) API Gateway service to expose the HTTP backend. However, your security team has suggested that your web service should handle Distributed Denial-of-Service (DDoS) attack. You are time-constrained and you need to make sure that this is implemented as soon as possible.
What should you do in this scenario?
Having created an API gateway and deployed one or more APIs on it, you'll typically want tolimit the rate at which front-end clients can make requests to back-end services. For example, to:
- maintain high availability and fair use of resources by protecting back ends from being overwhelmed by too many requests
- prevent denial-of-service attacks
- constrain costs of resource consumption
- restrict usage of APIs by your customers' users in order to monetize APIs
You apply a rate limit globally to all routes in an API deployment specification.
If a request is denied because the rate limit has been exceeded, the response header specifies when the request can be retried.
You can add a rate-limiting request policy to an API deployment specification by:
using the Console
editing a JSON file
{
'requestPolicies': {
'rateLimiting': {
'rateKey': 'CLIENT_IP',
'rateInRequestsPerSecond': 10
}
},
'routes': [
{
'path': '/hello',
'methods': ['GET'],
'backend': {
'type': 'ORACLE_FUNCTIONS_BACKEND',
'functionId': 'ocid1.fnfunc.oc1.phx.aaaaaaaaab______xmq'
}
}
]
}
Currently there are no comments in this discussion, be the first to comment!