Files
floci/docs/services/bedrock.md
T
Niels Kootstra 30db535f2e feat(bedrock): list and get foundation models and system-defined inference profiles (#7675)
* feat(bedrock): list and get foundation models and system-defined inference profiles

fix(bedrock): resolve only ARNs that name the catalog resource in the calling Region, and report on-demand inference only where a model is served in-Region

fix(bedrock): accept SPEECH and VIDEO output modalities and refuse an unserved model with ValidationException

fix(bedrock): report enum violations and read the model catalog through the shared helpers

An invalid ListFoundationModels or ListInferenceProfiles enum value now
answers with the "1 validation error detected:" prefix AWS sends and
lists the allowed values in the model's order.

* fix(bedrock): answer an unresolvable model or profile identifier with the error AWS returns

GetFoundationModel answers an unknown model id or an ARN that names no
foundation model in the calling Region with ValidationException.
GetInferenceProfile answers an ARN of another service or without an
account with ValidationException, and one of another account with
AccessDeniedException; one of another Region stays ResourceNotFoundException.
2026-11-08 05:02:41 -04:00

11 KiB

Amazon Bedrock (control plane)

Protocol: REST-JSON Endpoint: http://localhost:4566/guardrails, /foundation-models, /inference-profiles (SigV4 service bedrock)

This page covers the Bedrock control plane. Model invocation is a separate service that shares the same signing name: see Bedrock Runtime.

Supported Actions

Action Description
CreateGuardrail Create a guardrail; returns the DRAFT version, READY immediately
GetGuardrail Read a guardrail by id or ARN, at DRAFT or a numbered guardrailVersion
UpdateGuardrail Replace the DRAFT configuration
CreateGuardrailVersion Snapshot the DRAFT under the next numerical version
DeleteGuardrail Delete one numerical version, or the guardrail and all its versions
ListGuardrails List every guardrail's DRAFT, or every version of one guardrail
ListFoundationModels List the catalog's foundation models served in the calling Region, filtered by provider and output modality
GetFoundationModel Read one foundation model by id or ARN
ListInferenceProfiles List the system-defined inference profiles the calling Region can use, with type, maxResults and nextToken
GetInferenceProfile Read one system-defined inference profile by id or ARN, with its destination Regions
PutResourcePolicy Attach a resource-based policy to a guardrail or a guardrail profile (POST /resource-policy)
GetResourcePolicy Read the resource-based policy of a guardrail or a guardrail profile
DeleteResourcePolicy Remove the resource-based policy of a guardrail or a guardrail profile
TagResource Tag a guardrail (POST /tagResource)
UntagResource Remove tags from a guardrail (POST /untagResource)
ListTagsForResource List a guardrail's tags (POST /listTagsForResource)

Guardrails are versioned. The working copy is DRAFT, and GetGuardrail without a guardrailVersion query parameter returns it. CreateGuardrailVersion copies the current DRAFT to 1, 2 and so on. Those snapshots are immutable, because UpdateGuardrail only ever writes DRAFT.

GuardrailStatus is READY from the first read, so aws_bedrock_guardrail's status poll completes without a transition. Policy blocks are submitted as the *Config shapes (topicPolicyConfig, contentPolicyConfig and the rest) and read back under their unsuffixed names (topicPolicy.topics, contentPolicy.filters), matching the AWS model.

ListGuardrails returns one DRAFT summary per guardrail. Passing guardrailIdentifier returns every version of that one guardrail instead. Both forms honour maxResults and nextToken.

DeleteGuardrail takes a GuardrailNumericalVersion, so a version query parameter of DRAFT is rejected with ValidationException. Omit the parameter to delete the guardrail and all of its versions.

Both an id (abc123def456) and a full ARN are accepted wherever the API takes a guardrailIdentifier or a resourceARN.

The three tag actions require a full ARN to match the stored guardrail ARN exactly, including partition, service, Region, account, and resource type. An ARN that only shares the guardrail ID returns ResourceNotFoundException (HTTP 404) without changing tags. The existing bare-ID form remains accepted.

kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn, which is only ever the full key ARN, so every accepted form is resolved through KMS to that one shape. A key that does not exist, is disabled, or is pending deletion is rejected with ValidationException.

The AWS model's length constraints are enforced: name is 1 to 50 characters matching [0-9a-zA-Z-_]+, description is 1 to 200, and blockedInputMessaging and blockedOutputsMessaging are 1 to 500 each. A value outside those bounds is rejected with ValidationException.

The model's tag limits are enforced as well. A TagList holds at most 200 items on one request, and a longer array is rejected with ValidationException. A guardrail holds at most 50 tags, counted over the tags already on it together with the tags in the current request, so CreateGuardrail and TagResource both raise TooManyTagsException once the resulting total would pass 50. Replacing the value of a tag key the guardrail already carries does not add to that total.

A resource-based policy is attached to a guardrail or a system-defined guardrail profile by its full ARN. The policy is held to the restricted language the Bedrock user guide documents, and anything else is rejected with ValidationException: it is one JSON object of 1 to 20480 characters with nothing after it, every statement is an Allow on the ARN the policy is attached to, its actions are bedrock:ApplyGuardrail and bedrock:GetGuardrail (only bedrock:ApplyGuardrail on a guardrail profile), and its principal is either the account root ({"AWS": "arn:aws:iam::<account>:root"} and no other principal) or * under a StringEquals condition on aws:PrincipalOrgID. The only conditions accepted are that one and ForAnyValue:StringLike on aws:PrincipalOrgPaths, each with a string or an array of strings. The policy is stored as given; it is not evaluated against callers.

A guardrail's policy lives on the guardrail. GetResourcePolicy on a guardrail with no policy returns a response without resourcePolicy, and deleting the guardrail deletes its policy. An ARN that names no guardrail of the caller's account and Region returns ResourceNotFoundException. A guardrail profile has one ARN per destination Region, and its policy is stored under the Region whose endpoint received PutResourcePolicy, as AWS stores it, so the same profile ARN can hold a different policy in each calling Region. GetResourcePolicy on a profile ARN that holds no policy in the calling Region returns the empty policy {}. A profile ARN of another account or partition returns ResourceNotFoundException; whether the profile's Region is a destination of the calling Region is not checked.

With IAM enforcement on, PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy are authorized as bedrock:PutResourcePolicy, bedrock:GetResourcePolicy and bedrock:DeleteResourcePolicy on the ARN the request names.

Guardrails are listed by the Resource Groups Tagging API (resource type bedrock:guardrail) and Resource Explorer with their own tags, and TagResources / UntagResources there change those tags, as TagResource and UntagResource do.

Foundation models and inference profiles

ListFoundationModels, GetFoundationModel, ListInferenceProfiles and GetInferenceProfile read a fixed catalog, bedrock/model-catalog.yaml. It is a seed rather than a mirror of AWS: a few real models (Amazon Nova Micro and Nova Lite, Titan Text Embeddings V2, Llama 3.1 8B Instruct and Claude Sonnet 4.5) with the modalities, streaming support, lifecycle status and Regional availability their model cards publish, and their US and EU system-defined inference profiles.

The answers depend on the calling Region, as on AWS:

  • A model is listed when its card shows it served in that Region, or when one of its inference profiles can be called from it. GetFoundationModel answers a catalog model the Region does not serve, an unknown model id, and an ARN that does not name a foundation model in the calling Region and partition with ValidationException, as AWS does.
  • byOutputModality accepts SPEECH and VIDEO as well as the published TEXT, IMAGE and EMBEDDING, as AWS does. No catalog model produces speech or video, so those filters return an empty list.
  • An inference profile is listed only in its source Regions, and its models are the foundation models in the destination Regions the card gives for the calling Region, so us.amazon.nova-lite-v1:0 called from us-west-1 routes to four Regions and from us-east-1 to three. GetInferenceProfile on a profile the Region cannot use returns ResourceNotFoundException.
  • inferenceTypesSupported is ON_DEMAND only where the model is served in the Region itself, and empty where it is reachable only through an inference profile, so byInferenceType=ON_DEMAND leaves those out.
  • modelArn is arn:<partition>:bedrock:<region>::foundation-model/<modelId>, and inferenceProfileArn carries the calling Region and account. GetInferenceProfile answers an ARN of another service or without an account with ValidationException, one of another account with AccessDeniedException, and one of another Region, partition or resource type with ResourceNotFoundException.
  • The error codes and statuses follow AWS; the message text is Floci's own.

Deviations: models that are not in the catalog are not listed, provisioned throughput is never reported, and customizationsSupported is always empty, so byCustomizationType and byInferenceType=PROVISIONED return no models. Application inference profiles cannot be created yet, so type=APPLICATION returns an empty list. ListInferenceProfiles pages up to 1000 profiles; maxResults outside 1 to 1000 is rejected with ValidationException.

Not implemented

The rest of the Bedrock control plane is absent rather than stubbed, because emulating it faithfully would require behaviour Floci has no way to model:

  • Custom model, model customization, model import and distillation jobs. These depend on real training runs.
  • Model evaluation and evaluation jobs. These depend on real inference.
  • Provisioned throughput, application inference profiles and prompt routers. These describe real capacity reservations and routing.
  • Model invocation logging, batch inference and async invoke. These are data-plane operations backed by real model execution.

Configuration

Variable Default Description
FLOCI_SERVICES_BEDROCK_ENABLED true Enable or disable the service

Examples

export AWS_ENDPOINT_URL=http://localhost:4566

aws bedrock create-guardrail \
  --name my-guardrail \
  --blocked-input-messaging "Blocked." \
  --blocked-outputs-messaging "Blocked." \
  --content-policy-config '{"filtersConfig":[{"type":"HATE","inputStrength":"HIGH","outputStrength":"HIGH"}]}'

aws bedrock get-guardrail --guardrail-identifier abc123def456

aws bedrock create-guardrail-version --guardrail-identifier abc123def456

aws bedrock list-guardrails

aws bedrock tag-resource \
  --resource-arn arn:aws:bedrock:us-east-1:000000000000:guardrail/abc123def456 \
  --tags key=team,value=ai

aws bedrock put-resource-policy \
  --resource-arn arn:aws:bedrock:us-east-1:000000000000:guardrail/abc123def456 \
  --resource-policy '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::000000000000:root"},"Action":["bedrock:ApplyGuardrail","bedrock:GetGuardrail"],"Resource":"arn:aws:bedrock:us-east-1:000000000000:guardrail/abc123def456"}]}'

aws bedrock get-resource-policy \
  --resource-arn arn:aws:bedrock:us-east-1:000000000000:guardrail/abc123def456

aws bedrock delete-guardrail --guardrail-identifier abc123def456

aws bedrock list-foundation-models --by-output-modality EMBEDDING

aws bedrock list-inference-profiles --type-equals SYSTEM_DEFINED

aws bedrock get-inference-profile --inference-profile-identifier us.amazon.nova-lite-v1:0