본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Rate Limiting 정책 구성 레퍼런스

원문 보기 위키 갱신

Rate Limiting 정책 구성 레퍼런스 (Rate Limiting Policy Configuration Reference)

이 문서는 Kong의 Rate Limiting 정책에서 설정할 수 있는 구성 옵션을 스키마 형태로 정리한 레퍼런스예요. 분·시간·월 단위 요청 제한 값과 카운터 동기화 주기를 뜻하는 sync_rate, 제한 정보를 담을 header_name 같은 기본 속성을 하나씩 살펴볼 수 있어요. Redis 연결에 필요한 timeout이나 사용자 인증, AWS·Azure·GCP 같은 클라우드 제공자 인증 옵션까지 설명해 주니까 정책을 구성할 때 바로 참고하면 돼요

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "sync_rate": {
          "type": "number",
          "description": "How often to sync counter data to the central data store. A value of -1 results in synchronous behavior.",
          "default": -1
        },
        "minute": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per minute."
        },
        "hour": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per hour."
        },
        "month": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per month."
        },
        "header_name": {
          "type": "string",
          "description": "A string representing an HTTP header name."
        },
        "redis": {
          "type": "object",
          "properties": {
            "timeout": {
              "type": "integer",
              "maximum": 2147483646,
              "minimum": 0,
              "description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
              "default": 2000
            },
            "username": {
              "type": "string",
              "description": "Username to use for Redis connections. If undefined, ACL authentication won't be performed. This requires Redis v6.0.0+. To be compatible with Redis v5.x.y, you can set it to `default`.",
              "x-referenceable": true
            },
            "cloud_authentication": {
              "type": "object",
              "properties": {
                "auth_provider": {
                  "type": "string",
                  "enum": [
                    "aws",
                    "azure",
                    "gcp"
                  ],
                  "description": "Auth providers to be used to authenticate to a Cloud Provider's Redis instance.",
                  "x-referenceable": true
                },
                "aws_cache_name": {
                  "type": "string",
                  "description": "The name of the AWS Elasticache cluster when `auth_provider` is set to `aws`.",
                  "x-referenceable": true
                },
                "aws_region": {
                  "type": "string",
                  "description": "The region of the AWS ElastiCache cluster when `auth_provider` is set to `aws`.",
                  "x-referenceable": true
                },
                "aws_is_serverless": {
                  "type": "boolean",
                  "description": "This flag specifies whether the cluster is serverless when auth_provider is set to `aws`.",
                  "default": true
                },
                "aws_secret_access_key": {
                  "type": "string",
                  "description": "AWS Secret Access Key to be used for authentication when `auth_provider` is set to `aws`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "aws_assume_role_arn": {
                  "type": "string",
                  "description": "The ARN of the IAM role to assume for generating ElastiCache IAM authentication tokens.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "gcp_service_account_json": {
                  "type": "string",
                  "description": "GCP Service Account JSON to be used for authentication when `auth_provider` is set to `gcp`.",
                  "x-encrypted": true,
                  "x-referenceable": true
                },
                "azure_client_secret": {
                  "type": "string",
                  "description": "Azure Client Secret to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "aws_access_key_id": {
                  "type": "string",
                  "description": "AWS Access Key ID to be used for authentication when `auth_provider` is set to `aws`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "aws_role_session_name": {
                  "type": "string",
                  "description": "The session name for the temporary credentials when assuming the IAM role.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "azure_client_id": {
                  "type": "string",
                  "description": "Azure Client ID to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                },
                "azure_tenant_id": {
                  "type": "string",
                  "description": "Azure Tenant ID to be used for authentication when `auth_provider` is set to `azure`.",
                  "x-referenceable": true,
                  "x-encrypted": true
                }
              },
              "description": "Cloud auth related configs for connecting to a Cloud Provider's Redis instance."
            },
            "database": {
              "type": "integer",
              "description": "Database to use for the Redis connection when using the `redis` strategy",
              "default": 0
            },
            "ssl": {
              "type": "boolean",
              "description": "If set to true, uses SSL to connect to Redis.",
              "default": false
            },
            "ssl_verify": {
              "type": "boolean",
              "description": "If set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure `lua_ssl_trusted_certificate` in `kong.conf` to specify the CA (or server) certificate used by your Redis server. You may also need to configure `lua_ssl_verify_depth` accordingly.",
              "default": true
            },
            "server_name": {
              "type": "string",
              "description": "A string representing an SNI (server name indication) value for TLS.",
              "x-referenceable": true
            },
            "host": {
              "type": "string",
              "description": "A string representing a host name, such as example.com.",
              "x-referenceable": true
            },
            "port": {
              "type": "integer",
              "maximum": 65535,
              "minimum": 0,
              "description": "An integer representing a port number between 0 and 65535, inclusive.",
              "default": 6379,
              "x-referenceable": true
            },
            "password": {
              "type": "string",
              "description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
              "x-encrypted": true,
              "x-referenceable": true
            }
          },
          "description": "Redis configuration"
        },
        "hide_client_headers": {
          "type": "boolean",
          "description": "Optionally hide informative response headers.",
          "default": false
        },
        "second": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per second."
        },
        "limit_by": {
          "type": "string",
          "enum": [
            "consumer",
            "consumer-group",
            "credential",
            "header",
            "ip",
            "path",
            "service"
          ],
          "description": "The entity that is used when aggregating the limits.",
          "default": "consumer"
        },
        "path": {
          "type": "string",
          "description": "A string representing a URL path, such as /path/to/resource. Must start with a forward slash (/) and must not contain empty segments (i.e., two consecutive forward slashes)."
        },
        "year": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per year."
        },
        "error_code": {
          "type": "number",
          "description": "Set a custom error code to return when the rate limit is exceeded.",
          "default": 429
        },
        "day": {
          "type": "number",
          "description": "The number of HTTP requests that can be made per day."
        },
        "policy": {
          "type": "string",
          "enum": [
            "cluster",
            "local",
            "redis"
          ],
          "description": "The rate-limiting policies to use for retrieving and incrementing the limits.",
          "default": "local"
        },
        "fault_tolerant": {
          "type": "boolean",
          "description": "A boolean value that determines if the requests should be proxied even if Kong has troubles connecting a third-party data store. If `true`, requests will be proxied anyway, effectively disabling the rate-limiting function until the data store is working again. If `false`, then the clients will see `500` errors.",
          "default": true
        },
        "error_message": {
          "type": "string",
          "description": "Set a custom error message to return when the rate limit is exceeded.",
          "default": "API rate limit exceeded"
        }
      }
    }
  }
}

관련 리소스

더 알아보기 (Learn more)

  • AI Gateway에서 Rate Limiting 정책을 실제로 활용하는 방법을 자세히 알아봐요 — AI Rate Limiting Advanced Policy
  • Rate Limiting 설정이 담기는 AI Policy 엔티티의 구조와 역할을 이해하는 데 도움이 돼요 — AI Policy entity
  • 소비자별 제한 정책 적용과 연결되는 AI Consumer 엔티티를 함께 확인해 봐요 — AI Consumer entity