BedrockAgentCoreControl / Client / create_gateway_rate_limit

create_gateway_rate_limit

BedrockAgentCoreControl.Client.create_gateway_rate_limit(**kwargs)

Creates a rate limit for a gateway. Rate limits define throttling rules for each dimension that control request rates, token consumption rates, and concurrent connections through the gateway.

See also: AWS API Documentation

Request Syntax

response = client.create_gateway_rate_limit(
    gatewayIdentifier='string',
    clientToken='string',
    rateLimitId='string',
    description='string',
    dimensionKeys=[
        'string',
    ],
    entries=[
        {
            'dimensions': {
                'string': 'string'
            },
            'requests': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ],
            'tokens': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ],
            'connections': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ]
        },
    ]
)
Parameters:
  • gatewayIdentifier (string) –

    [REQUIRED]

    The unique identifier of the gateway to create the rate limit for.

  • clientToken (string) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don’t specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn’t return an error. For more information, see Ensuring idempotency.

    This field is autopopulated if not provided.

  • rateLimitId (string) – Optional customer-defined limit ID. If not provided, system generates one.

  • description (string) – Optional human-readable description for this limit.

  • dimensionKeys (list) –

    [REQUIRED]

    Ordered list of dimension names defining the scope of this limit. Unique per gateway — no two limits can share the same dimensionKeys.

    • (string) –

      A dimension key specifying the scope dimension for rate limiting. Allowed values: “targetName”, “toolName”, “qualifiedModelId”, or context-path expressions: “$.context.iam.principal”, “$.context.iam.sourceIdentity”, “$.context.jwt.” where is a JWT claim name (e.g., “$.context.jwt.sub”). Validated server-side to enforce allowed prefixes and patterns.

  • entries (list) –

    [REQUIRED]

    Rule entries mapping dimension values to rate configurations.

    • (dict) –

      A single rule entry within a limit, mapping dimension values to rate configurations

      • dimensions (dict) – [REQUIRED]

        Map of dimension name to dimension value, matching the parent limit’s dimensionKeys. Keys must exactly match the dimensionKeys. Values may be “” as a wildcard. “” may only appear at trailing positions (based on dimensionKeys ordering).

        • (string) –

          A dimension key specifying the scope dimension for rate limiting. Allowed values: “targetName”, “toolName”, “qualifiedModelId”, or context-path expressions: “$.context.iam.principal”, “$.context.iam.sourceIdentity”, “$.context.jwt.” where is a JWT claim name (e.g., “$.context.jwt.sub”). Validated server-side to enforce allowed prefixes and patterns.

          • (string) –

            A dimension value in a rule entry (exact value or “*” wildcard)

      • requests (list) –

        Request rate limits (RPS or RPM). Limited to 1 entry for now.

        • (dict) –

          Rate configuration for a metric (requests or tokens)

          • rate (float) – [REQUIRED]

            The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

          • period (string) – [REQUIRED]

            Time period for rate limiting

      • tokens (list) –

        Token rate limits (TPM). Limited to 1 entry for now. — P1

        • (dict) –

          Rate configuration for a metric (requests or tokens)

          • rate (float) – [REQUIRED]

            The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

          • period (string) – [REQUIRED]

            Time period for rate limiting

      • connections (list) –

        Connection rate limits (per second only). Limited to 1 entry for now. — P2

        • (dict) –

          Rate configuration for a metric (requests or tokens)

          • rate (float) – [REQUIRED]

            The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

          • period (string) – [REQUIRED]

            Time period for rate limiting

Return type:

dict

Returns:

Response Syntax

{
    'rateLimitId': 'string',
    'gatewayIdentifier': 'string',
    'description': 'string',
    'dimensionKeys': [
        'string',
    ],
    'entries': [
        {
            'dimensions': {
                'string': 'string'
            },
            'requests': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ],
            'tokens': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ],
            'connections': [
                {
                    'rate': 123.0,
                    'period': 'second'|'minute'
                },
            ]
        },
    ],
    'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING',
    'createdAt': datetime(2015, 1, 1),
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    Shared fields for GatewayRateLimit responses

    • rateLimitId (string) –

      Limit identifier. Optional on Create (system-generates if not provided by customer). Always present in responses.

    • gatewayIdentifier (string) –

      The unique identifier of the gateway.

    • description (string) –

      Optional human-readable description for this limit.

    • dimensionKeys (list) –

      Ordered list of dimension key names defining the scope of a limit

      • (string) –

        A dimension key specifying the scope dimension for rate limiting. Allowed values: “targetName”, “toolName”, “qualifiedModelId”, or context-path expressions: “$.context.iam.principal”, “$.context.iam.sourceIdentity”, “$.context.jwt.” where is a JWT claim name (e.g., “$.context.jwt.sub”). Validated server-side to enforce allowed prefixes and patterns.

    • entries (list) –

      List of rule entries within a limit

      • (dict) –

        A single rule entry within a limit, mapping dimension values to rate configurations

        • dimensions (dict) –

          Map of dimension name to dimension value, matching the parent limit’s dimensionKeys. Keys must exactly match the dimensionKeys. Values may be “” as a wildcard. “” may only appear at trailing positions (based on dimensionKeys ordering).

          • (string) –

            A dimension key specifying the scope dimension for rate limiting. Allowed values: “targetName”, “toolName”, “qualifiedModelId”, or context-path expressions: “$.context.iam.principal”, “$.context.iam.sourceIdentity”, “$.context.jwt.” where is a JWT claim name (e.g., “$.context.jwt.sub”). Validated server-side to enforce allowed prefixes and patterns.

            • (string) –

              A dimension value in a rule entry (exact value or “*” wildcard)

        • requests (list) –

          Request rate limits (RPS or RPM). Limited to 1 entry for now.

          • (dict) –

            Rate configuration for a metric (requests or tokens)

            • rate (float) –

              The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

            • period (string) –

              Time period for rate limiting

        • tokens (list) –

          Token rate limits (TPM). Limited to 1 entry for now. — P1

          • (dict) –

            Rate configuration for a metric (requests or tokens)

            • rate (float) –

              The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

            • period (string) –

              Time period for rate limiting

        • connections (list) –

          Connection rate limits (per second only). Limited to 1 entry for now. — P2

          • (dict) –

            Rate configuration for a metric (requests or tokens)

            • rate (float) –

              The rate value for the limit. For request limits, this is the number of requests allowed per period. For token limits, this is the number of tokens allowed per period. For connection limits, this is the number of concurrent connections allowed.

            • period (string) –

              Time period for rate limiting

    • status (string) –

      Status of a gateway limit

    • createdAt (datetime) –

      The timestamp when the rate limit was created.

    • updatedAt (datetime) –

      The timestamp when the rate limit was last updated.

Exceptions

  • BedrockAgentCoreControl.Client.exceptions.ServiceQuotaExceededException

  • BedrockAgentCoreControl.Client.exceptions.ConflictException

  • BedrockAgentCoreControl.Client.exceptions.ValidationException

  • BedrockAgentCoreControl.Client.exceptions.AccessDeniedException

  • BedrockAgentCoreControl.Client.exceptions.ResourceNotFoundException

  • BedrockAgentCoreControl.Client.exceptions.ThrottlingException

  • BedrockAgentCoreControl.Client.exceptions.InternalServerException