> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon Bedrock Control

> Client-mode REST API connectors for Amazon Bedrock: triage alarms and summarize shift logs with the Converse API, create Titan embeddings with InvokeModel, count tokens, screen text with a guardrail, and list foundation models and inference profiles, all with a Bedrock API key

Technical Preview

## Overview

Client-mode REST API connectors for Amazon Bedrock: triage alarms and summarize shift logs with the Converse API, create Titan embeddings with InvokeModel, count tokens, screen text with a guardrail, and list foundation models and inference profiles, all with a Bedrock API key.

This is one of the templates in the Amazon Bedrock REST API app (`amazon-bedrock`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).

> [!NOTE]
>
> Not yet verified against the live vendor API: No Amazon Bedrock API key (or IAM credentials for SigV4) on the factory box. Needs an AWS account with Bedrock model access enabled in the chosen region (e.g. eu-west-1: Amazon Nova Lite via eu. inference profile + Titan Text Embeddings V2), a Bedrock API key (long-term ABSK... or short-term), and optionally a guardrail id for ApplyGuardrail. Then run BEDROCK\_API\_KEY=... python3 smoke\_bedrock.py.

## Auth

Amazon Bedrock API key as Authorization: Bearer \{value.json.api\_key} (long-term ABSK..., short-term bedrock-api-key-...). Hub secret suggested AWS\_BEARER\_TOKEN\_BEDROCK + GET SECRET. Alternative: AWS SigV4 (service bedrock) computed outside the broker, documented in comments. Never commit keys.

Auth headers used by the template: `Authorization: Bearer {value.json.api_key}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Amazon Bedrock Control connector | no |
| `BaseUrl` | string | Amazon Bedrock Control base URL without trailing slash (e.g. [https://bedrock.eu-west-1.amazonaws.com](https://bedrock.eu-west-1.amazonaws.com)) | yes |

`BASE_ADDRESS` default: `https://bedrock.eu-west-1.amazonaws.com`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `ListFoundationModels` | GET | `/foundation-models?byOutputModality={value.json.output_modality}&byProvider={value.json.provider}` | `ai/bedrock/foundation-model/list` | `ai/bedrock/foundation-model/list/response` | `api_key`, `output_modality`, `provider` |
| `GetFoundationModel` | GET | `/foundation-models/{value.json.model_id}` | `ai/bedrock/foundation-model/get` | `ai/bedrock/foundation-model/get/response` | `api_key`, `model_id` |
| `ListInferenceProfiles` | GET | `/inference-profiles?maxResults={value.json.max_results}&type={value.json.type}` | `ai/bedrock/inference-profile/list` | `ai/bedrock/inference-profile/list/response` | `api_key`, `max_results`, `type` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode AMAZON_BEDROCK_CONTROL"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE AmazonBedrockControl WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://bedrock.eu-west-1.amazonaws.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT ListFoundationModels
        WITH SOURCE_TOPIC "ai/bedrock/foundation-model/list"
        WITH DESTINATION_TOPIC "ai/bedrock/foundation-model/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/foundation-models?byOutputModality={value.json.output_modality}&byProvider={value.json.provider}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT GetFoundationModel
        WITH SOURCE_TOPIC "ai/bedrock/foundation-model/get"
        WITH DESTINATION_TOPIC "ai/bedrock/foundation-model/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/foundation-models/{value.json.model_id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ListInferenceProfiles
        WITH SOURCE_TOPIC "ai/bedrock/inference-profile/list"
        WITH DESTINATION_TOPIC "ai/bedrock/inference-profile/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/inference-profiles?maxResults={value.json.max_results}&type={value.json.type}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

## Usage example

Call `ListFoundationModels` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'ai/bedrock/foundation-model/list/response' &
mosquitto_pub -t 'ai/bedrock/foundation-model/list' -m '{"api_key": "<api_key>", "output_modality": "<output_modality>", "provider": "<provider>"}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.