Skip to content

Handling Alternative Service Names for AWS SigV4

Overview

This documentation outlines the process to handle scenarios where AWS service names differ from the detected service name in AWS Signature Version 4 (SigV4). This is particularly relevant for services like Bedrock, which require an alternative service name override due to inconsistencies in the default derivation from the URL.

Background

AWS SigV4 usually derives the service name directly from the URL of the endpoint. For example:

  • DynamoDB: The service name is dynamodb derived from https://dynamodb.eu-central-1.amazonaws.com/.

However, for Bedrock and its related endpoints:

  • The service name for both https://bedrock.eu-central-1.amazonaws.com/ and https://bedrock-runtime.eu-central-1.amazonaws.com/ must be overridden as bedrock.

Implementation

To address this, an advanced parameter in the connector configuration allows overriding the service name. The updated configuration ensures compatibility with Bedrock and similar services requiring manual specification of the service name.

Overview

Configuration Example

Connector config:

For the Bedrock example, the following URL is used:

https://bedrock-runtime.eu-central-1.amazonaws.com/

SigV4 Header Configuration:

The override parameter explicitly sets the service name to bedrock, regardless of the endpoint URL.

Payload and Usage

Example Payload:

A POST request to Bedrock with the overridden service name might look like:

{
    "anthropic_version": "bedrock-2023-05-31",
    "max_tokens": 1024,
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What is the capital of India?"
                }
            ]
        }
    ]
}

Expected Result:

{
    "role": "assistant",
    "stop_sequence": null,
    "usage": {
        "output_tokens": 216,
        "input_tokens": 14
    },
    "stop_reason": "end_turn",
    "model": "claude-3-5-sonnet-20240620",
    "id": "msg_bdrk_01QzMGNS8yAxykrpTnE1UExT",
    "type": "message",
    "content": [
        {
            "text": "The capital of India is New Delhi.\n\nNew Delhi is
            located in the northern part of India and serves as the seat of the
            Indian government. It is part of the larger metropolitan area known
            as the National Capital Territory of Delhi (NCT).\n\nSome key
            points about New Delhi:\n\n1. It became the capital of India in
            1911 when the British moved the capital from Calcutta (now
            Kolkata).\n\n2. It was designed by British architects Sir Edwin
            Lutyens and Sir Herbert Baker.\n\n3. New Delhi houses important
            government buildings, including the Parliament House, Rashtrapati
            Bhavan (Presidential Palace), and various ministries.\n\n4. It is
            distinct from Old Delhi, which was the capital of Islamic India
            between the 17th and 19th centuries.\n\n5. New Delhi is known for
            its wide, tree-lined boulevards and numerous historical monuments
            and cultural sites.\n\nAs the capital, New Delhi plays a crucial
            role in India's politics, administration, and international
            relations.",
            "type": "text"
        }
    ]       
}