Cloud Platforms
Amazon Bedrock
Call Anthropic models on Amazon Bedrock through your Verdictan gateway. The gateway signs each request with AWS credentials from its own host, and your application calls the gateway with its application token.
This provider supports Anthropic models only. Your application can use the OpenAI Chat Completions or Responses format, or the Anthropic Messages format. The gateway sends every request to the Bedrock InvokeModel API in the Anthropic Messages format.
Before you start
- A working gateway from the quickstart.
- An AWS region, and the Bedrock ID of one Anthropic model that you can use in that region.
- AWS credentials on the gateway host that can invoke that model.
- The gateway startup command, and a separate application token for test requests.
Configure the provider
pack:
name: aws-bedrock-integration
version: 1.0.0
enabled: true
policies:
chain:
- prompt-injection
providers:
targets:
- id: bedrock-anthropic
provider: aws-bedrock
provider_type: aws-bedrock
model: "anthropic.replace-with-model-id"
bedrock_model_family: anthropic_messages
aws_region: us-east-1
base_url: https://bedrock-runtime.us-east-1.amazonaws.comEach field has a fixed rule:
| Field | Rule |
|---|---|
provider | Exactly aws-bedrock. The gateway rejects aliases such as bedrock. |
provider_type | aws-bedrock. verdictan policy lint checks the other Bedrock fields only when this field is set. |
model | Must contain anthropic.. |
bedrock_model_family | anthropic_messages, the only value. |
aws_region | Required. The gateway does not read AWS_REGION or AWS_DEFAULT_REGION. |
base_url | Required. Use https://bedrock-runtime.<aws_region>.amazonaws.com. An amazonaws.com host for another region is rejected. |
aws_access_key_env, aws_secret_key_env | Optional. The names of the environment variables that hold the AWS access key ID and the secret access key. Set both fields or neither. |
aws_session_token_env | Optional. The name of the environment variable that holds an AWS session token. It needs the other two fields. |
aws_profile | Optional. A named profile for the AWS default credential chain. |
The target has no secret_key_ref. The gateway does not use secret_key_ref or api_key_prefix for this provider, and verdictan policy lint warns when secret_key_ref is set. The gateway signs each request with AWS Signature Version 4 for the host bedrock-runtime.<aws_region>.amazonaws.com. It calls /model/<model>/invoke, or /model/<model>/invoke-with-response-stream for streaming requests.
AWS credentials
The gateway gets AWS credentials in this order:
- The variables that
aws_access_key_envandaws_secret_key_envname, with the variable thataws_session_token_envnames when that field is set. AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYfrom the gateway environment, withAWS_SESSION_TOKENwhen it is set.- If neither of the two variables is set, the AWS SDK default credential chain for
aws_region. Setaws_profileon the target to use a named profile.
When the target sets the credential fields, the gateway uses only those variables. If one of them is not set or is empty, the request fails. If only one of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY is set, the request also fails. The gateway resolves credentials for each request, so verdictan config validate does not test them.
Use the credential fields when targets on one gateway need different AWS credentials. Use names with the VERDICTAN_ prefix:
aws_access_key_env: VERDICTAN_BEDROCK_ACCESS_KEY_ID
aws_secret_key_env: VERDICTAN_BEDROCK_SECRET_ACCESS_KEYStart and verify
You can deploy this file with CLI 0.1.14 or later instead of the Console step below. The AWS credentials must remain available to the gateway. Check In sync, then test the configured Bedrock model.
With the quickstart in Docker, follow the container steps instead of steps 1 to 3.
-
In the gateway terminal, set AWS credentials (add
AWS_SESSION_TOKENfor temporary credentials), then check the file.policy lintchecks the policy pack and the Bedrock fields, andconfig validatechecks the provider target fields. On a host with an attached AWS role or a configured profile, skip the exports.export AWS_ACCESS_KEY_ID="replace-with-access-key-id" export AWS_SECRET_ACCESS_KEY="replace-with-secret-access-key" verdictan policy lint --file policy-config.yaml verdictan config validate --file policy-config.yaml -
Restart the test gateway with the AWS credentials in its environment.
-
In Configurations in the Console, create or edit the test agent's configuration. Import the file and select Next. Under Deploy to agent, select the test agent. Select Deploy and confirm the gateway count. Wait about 30 seconds for the configuration pull. Use the signed request below to check the deployment.
-
In a second terminal, send a request for the configured model:
export VERDICTAN_CLIENT_TOKEN="<application-token>" curl --fail-with-body http://127.0.0.1:41002/v1/chat/completions \ -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \ -H "Content-Type: application/json" \ -d '{"model":"anthropic.replace-with-model-id","max_tokens":128,"messages":[{"role":"user","content":"Reply with Hello."}]}'
choices[0].message.content contains the reply. A reply proves the whole path: application token, AWS credentials, signature, region, and model access. The request appears in History when capture is on, or in the delivered events.
Supported requests
| Request | Support |
|---|---|
| Chat Completions | Yes. Translated to the Anthropic Messages format. Streaming and tools work. |
| Responses | Yes. Translated to the Anthropic Messages format. Send input as a string, or as messages with text content. |
| Messages | Yes. Streams come back in the Anthropic event format. |
| Image and PDF input | Yes, as Chat Completions image_url parts or PDF document blocks |
response_format with json_object or json_schema, parallel_tool_calls: true, strict tools, extended thinking, anthropic-beta headers | No. The gateway rejects the request with HTTP 422 before it calls Bedrock. |
| Embeddings, non-Anthropic models | No |
All three supported request families go through your policy chain.
The gateway translates requests in the same way as for the Anthropic provider, with the same limits. It also sets anthropic_version to bedrock-2023-05-31 in the request body. For streaming requests, it decodes the Bedrock event stream into server-sent events.
Failure behavior
| Problem | Result or cause |
|---|---|
Lint reports provider 'bedrock' must use exact provider id 'aws-bedrock' | provider is an alias. Set it to aws-bedrock. |
Lint or config validate names aws_region, bedrock_model_family, or an Anthropic model id | A required field is missing, or model does not contain anthropic.. |
Lint or config validate reports that the base_url host must match aws_region | base_url names another region. |
config validate reports base_url is required | Add base_url. |
Lint or config validate reports set aws_access_key_env and aws_secret_key_env together | The target sets only one of the two fields, or sets aws_session_token_env without them. |
Lint reports secret_key_ref is not used | Remove secret_key_ref from the target. |
502 with provider_auth_failed and which is not set or empty | A variable that a credential field names is not set on the gateway host. |
502 with provider_auth_failed and found only one of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY | Set both variables, or neither to use the default credential chain. |
502 with provider_auth_failed and AWS credential resolution failed | The default credential chain found no credentials. Check the profile, role, or environment of the gateway host. |
401 from the gateway | The application token is not active. |
422 with runtime.structured_output.unsupported_feature, runtime.tooling.unsupported_feature, or runtime.beta_header.unsupported | The request uses a feature from the last rows of Supported requests. |
| Bedrock returns an error status | The client gets the same status with code upstream_provider_error and the message Upstream provider returned HTTP <status>. The Bedrock error body is not returned. Check IAM permissions, model access, and the region. If another target is eligible, some errors move the request to that target first. |
| A stream stops with an error | Bedrock sent an exception event, such as a throttling or validation error, during the stream. |
Limits
- Model IDs, regions, prices, quotas, and permissions are in the Amazon Bedrock documentation.
- One target serves one model in one region. Add a target for each model or region.
- If the Bedrock call fails with a rate limit, a server error, an authentication error, or a transport error, the gateway tries the next eligible target. Provider attempts and fallback has the rules.
- A listener on a non-loopback address needs TLS and network controls.
Next steps
- Anthropic: request translation details and the direct Anthropic API.
- Cloud Provider Configuration:
aws_region,aws_profile, and other cloud fields. - Runtime Request Families: request families and their policy stages.