Bedrock
Introduction
Section titled “Introduction”Bedrock is a fully managed service provided by Amazon Web Services (AWS) that makes foundation models from various LLM providers accessible via an API.
LocalStack allows you to use the Bedrock APIs to test and develop AI-powered applications in your local environment.
The supported APIs are available on the API coverage section for Bedrock and Bedrock Runtime, which provides information on the extent of Bedrock’s integration with LocalStack.
Getting started
Section titled “Getting started”This guide is designed for users new to AWS Bedrock and assumes basic knowledge of the AWS CLI and our lstk aws command.
Start your LocalStack container using your preferred method with or without pre-warming the Bedrock engine. We will demonstrate how to use Bedrock by following these steps:
- Listing available foundation models
- Invoking a model for inference
- Using the conversation API
- Using batch processing
Pre-warming the Bedrock engine
Section titled “Pre-warming the Bedrock engine”By default, Bedrock uses mock mode and does not contact an inference server until you configure one.
In proxy mode, LocalStack initializes the configured OpenAI-compatible endpoint on the first bedrock-runtime request.
Set BEDROCK_PREWARM to initialize that backend when LocalStack starts instead.
List available foundation models
Section titled “List available foundation models”You can view all available foundation models using the ListFoundationModels API.
This will show you which models are available on AWS Bedrock.
Run the following command:
lstk aws bedrock list-foundation-modelsInvoke a model
Section titled “Invoke a model”You can use the InvokeModel API to send requests to a specific model.
In this example, we selected the Llama 3 model to process a simple prompt.
In proxy mode, the model used for emulation depends on your configuration.
With an external endpoint, LocalStack uses the request model ID unless you set BEDROCK_DEFAULT_MODEL.
With the deprecated managed Ollama container, the model is defined by BEDROCK_DEFAULT_MODEL.
Run the following command:
lstk aws bedrock-runtime invoke-model \ --model-id "meta.llama3-8b-instruct-v1:0" \ --body '{ "prompt": "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\nSay Hello!\n<|eot_id|>\n<|start_header_id|>assistant<|end_header_id|>", "max_gen_len": 2, "temperature": 0.9 }' --cli-binary-format raw-in-base64-out outfile.txtThe output will be available in the outfile.txt.
Use the conversation API
Section titled “Use the conversation API”Bedrock provides a higher-level conversation API that makes it easier to maintain context in a chat-like interaction using the Converse API.
You can specify both system prompts and user messages.
Run the following command:
lstk aws bedrock-runtime converse \ --model-id "meta.llama3-8b-instruct-v1:0" \ --messages '[{ "role": "user", "content": [{ "text": "Say Hello!" }] }]' \ --system '[{ "text": "You'\''re a chatbot that can only say '\''Hello!'\''" }]'Model Invocation Batch Processing
Section titled “Model Invocation Batch Processing”Bedrock offers the feature to handle large batches of model invocation requests defined in S3 buckets using the CreateModelInvocationJob API.
First, you need to create a JSONL file named batch_input.jsonl that contains all your prompts:
{"prompt": "Tell me a quick fact about Vienna.", "max_tokens": 50, "temperature": 0.5}{"prompt": "Tell me a quick fact about Zurich.", "max_tokens": 50, "temperature": 0.5}{"prompt": "Tell me a quick fact about Las Vegas.", "max_tokens": 50, "temperature": 0.5}Then, you need to define buckets for the input as well as the output and upload the file in the input bucket:
lstk aws s3 mb s3://in-bucketlstk aws s3 cp batch_input.jsonl s3://in-bucketlstk aws s3 mb s3://out-bucketAfterwards you can run the invocation job like this:
lstk aws bedrock create-model-invocation-job \ --job-name "my-batch-job" \ --model-id "mistral.mistral-small-2402-v1:0" \ --role-arn "arn:aws:iam::123456789012:role/MyBatchInferenceRole" \ --input-data-config '{"s3InputDataConfig": {"s3Uri": "s3://in-bucket"}}' \ --output-data-config '{"s3OutputDataConfig": {"s3Uri": "s3://out-bucket"}}'{ "jobArn": "arn:aws:bedrock:us-east-1:000000000000:model-invocation-job/12345678"}The results will be at the S3 URL s3://out-bucket/12345678/batch_input.jsonl.out
Inference modes
Section titled “Inference modes”Set the BEDROCK_INFERENCE_MODE configuration option to choose how LocalStack answers InvokeModel and Converse requests:
mock(default) returns random text without contacting an inference endpoint, starting an Ollama container, or downloading a model. Use this mode to test integrations in continuous integration (CI) environments or on machines without Docker when the generated text itself does not matter. Embedding requests for the supported families return a vector derived from the input text.proxysends inference requests toBEDROCK_INFERENCE_ENDPOINT. A configured endpoint impliesproxy. Starting the LocalStack-managed Ollama container withBEDROCK_INFERENCE_MODE=proxyand no endpoint is deprecated and will be removed in a future release. Prefer an OpenAI-compatible model server for real inference.presetreturns a response you store for an exact prompt. See Preset responses.
Any other value prevents the Bedrock provider from starting.
Mock responses
Section titled “Mock responses”Mock mode returns up to 32 random words and shortens the response to the request’s maximum token budget. It approximates token usage by counting each whitespace-separated word as one token in the input and output. It ignores stop sequences.
Converse returns a Converse API response.
For InvokeModel, the response shape depends on the model ID:
- Anthropic Messages (
anthropic.*), Meta Llama (meta.*), and Mistral text completion (mistral.*) use their model family’s native response shape. - GPT-OSS (
openai.gpt-oss-*), Qwen (qwen.*), Gemma (google.*), Nemotron (nvidia.*), MiniMax (minimax.*), GLM (zai.*), Kimi (moonshot.*), DeepSeek (deepseek.*), and Palmyra (writer.*) use the OpenAI chat-completion response shape. - Amazon Nova and model IDs without a dedicated mock response shape, such as
ollama.smollm2:360m, use a Converse-style JSON body withoutput,stopReason, andusagefields.
Preset responses
Section titled “Preset responses”Preset mode returns a response you configure for an exact prompt.
Start LocalStack with LOCALSTACK_BEDROCK_INFERENCE_MODE=preset, then store a prompt:
curl -X PUT http://localhost:4566/_aws/bedrock/presets \ -H 'Content-Type: application/json' \ -d '{"prompt": "Say hello.", "response": "Hello!"}'A matching Converse request returns that response:
lstk aws bedrock-runtime converse \ --model-id meta.llama3-8b-instruct-v1:0 \ --messages '[{ "role": "user", "content": [{ "text": "Say hello." }] }]' \ --query 'output.message.content[0].text' \ --output textHello!For a chat request, LocalStack joins the system text and the message text with spaces, in that order, and matches that string.
An unmatched prompt returns No preset response configured for this prompt.
Delete the preset with:
curl -X DELETE http://localhost:4566/_aws/bedrock/presets \ -H 'Content-Type: application/json' \ -d '{"prompt": "Say hello."}'Both calls return HTTP 204. Presets are kept in memory, shared across models, accounts, and regions, and are gone when LocalStack stops.
Available models
Section titled “Available models”For real inference, point LocalStack at an OpenAI-compatible model server and use model IDs that server lists.
You can also define models directly in the request by setting the model-id parameter to ollama.<model-id>.
For example, if you want to access deepseek-r1 on a connected Ollama server:
lstk aws bedrock-runtime converse \ --model-id "ollama.deepseek-r1" \ --messages '[{ "role": "user", "content": [{ "text": "Say Hello!" }] }]'Text embeddings
Section titled “Text embeddings”LocalStack answers InvokeModel with embeddings for these families:
- Amazon Titan Text Embeddings V2 (
amazon.titan-embed-text-v2:0), with 256, 512, or 1024 dimensions - Amazon Titan Text Embeddings V1 (
amazon.titan-embed-text-v1andamazon.titan-embed-g1-text-02), with 1536 dimensions - Cohere Embed v3 (
cohere.embed-english-v3andcohere.embed-multilingual-v3), with 1024 dimensions
Any other embedding model fails with LocalStack is currently not able to support embeddings with '<model-id>'.
The managed Ollama container does not serve embedding models.
In mock mode, the same text returns the same vector. Titan Text Embeddings V2 returns one vector of the requested size:
lstk aws bedrock-runtime invoke-model \ --model-id amazon.titan-embed-text-v2:0 \ --body '{"inputText": "LocalStack emulates AWS on your machine", "dimensions": 256}' \ --cli-binary-format raw-in-base64-out titan.jsonjq '{inputTextTokenCount, dimensions: (.embedding | length)}' titan.json{ "inputTextTokenCount": 6, "dimensions": 256}Cohere Embed v3 returns one vector per text:
lstk aws bedrock-runtime invoke-model \ --model-id cohere.embed-english-v3 \ --body '{"texts": ["hello world", "goodbye world"], "input_type": "search_document"}' \ --cli-binary-format raw-in-base64-out cohere.jsonjq '{response_type, texts, vectors: [.embeddings[] | length]}' cohere.json{ "response_type": "embeddings_floats", "texts": ["hello world", "goodbye world"], "vectors": [1024, 1024]}With an OpenAI-compatible server, set BEDROCK_DEFAULT_EMBEDDING_MODEL to the identifier that server lists, including its tag, such as all-minilm:latest.
LocalStack resizes the server’s vectors to the Bedrock model’s dimension.
OpenAI-compatible model servers
Section titled “OpenAI-compatible model servers”Set BEDROCK_INFERENCE_ENDPOINT to the base URL of an OpenAI-compatible server such as Ollama, LM Studio, llama.cpp, vLLM, or mlx-lm.
The URL can include a trailing /v1.
LocalStack uses the server’s /v1/models and /v1/chat/completions endpoints instead of mock responses or the deprecated managed Ollama container.
The server must be available when Bedrock initializes, either during pre-warming or on the first runtime request.
For servers that require authentication, set BEDROCK_INFERENCE_API_KEY; LocalStack sends it as a bearer token to model-listing and inference requests.
By default, LocalStack uses the model ID from the request and requires the server to list that model.
The ollama. prefix is removed before model lookup.
Set BEDROCK_DEFAULT_MODEL to override every chat request with one model, which is useful when an application sends Bedrock model IDs that the server does not provide.
Set BEDROCK_DEFAULT_EMBEDDING_MODEL the same way for embedding requests.
LocalStack does not fall back to another listed model.
Model IDs must match /v1/models exactly, such as an Ollama tag like llama3.2:3b or an LM Studio identifier like qwen2.5-7b-instruct.
When LocalStack runs in Docker, use an address that the container can reach:
LOCALSTACK_BEDROCK_INFERENCE_ENDPOINT=http://host.docker.internal:11434 \LOCALSTACK_BEDROCK_DEFAULT_MODEL=llama3.2:3b \lstk startOllama uses port 11434 by default and LM Studio commonly uses port 1234.
When LocalStack runs as a host process, use localhost.
On Linux, configure the server to listen on all interfaces, for example with OLLAMA_HOST=0.0.0.0 or LM Studio’s Serve on Local Network option, and use an address that resolves from the LocalStack container.
BEDROCK_REQUEST_TIMEOUT controls the inference timeout and defaults to 600 seconds.
The deprecated BEDROCK_PULL_MODELS and BEDROCK_DOCKER_FLAGS options have no effect with an external endpoint because LocalStack does not manage the server or its models.
OpenAI
Section titled “OpenAI”LocalStack can forward Bedrock Runtime requests (InvokeModel, Converse, ConverseStream) and embedding requests to OpenAI’s API.
Requests are billed to your OpenAI account.
- Create an API key in the OpenAI dashboard.
- Start LocalStack with the OpenAI endpoint, your key, and the model to use:
LOCALSTACK_BEDROCK_INFERENCE_ENDPOINT=https://api.openai.com/v1 \LOCALSTACK_BEDROCK_INFERENCE_API_KEY=<your-openai-api-key> \LOCALSTACK_BEDROCK_DEFAULT_MODEL=gpt-4.1-mini \lstk startIf you also call Bedrock embedding models, such as Titan Embeddings, set BEDROCK_DEFAULT_EMBEDDING_MODEL to an OpenAI embedding model, for example text-embedding-3-small.
Otherwise embedding requests fail because OpenAI does not serve Bedrock embedding model IDs.
LOCALSTACK_BEDROCK_INFERENCE_ENDPOINT=https://api.openai.com/v1 \LOCALSTACK_BEDROCK_INFERENCE_API_KEY=<your-openai-api-key> \LOCALSTACK_BEDROCK_DEFAULT_MODEL=gpt-4.1-mini \LOCALSTACK_BEDROCK_DEFAULT_EMBEDDING_MODEL=text-embedding-3-small \lstk start- Send requests as usual.
Whatever Bedrock model ID you pass, chat requests are answered by
BEDROCK_DEFAULT_MODEL:
lstk aws bedrock-runtime converse \ --model-id "amazon.nova-pro-v1:0" \ --messages '[{"role": "user", "content": [{"text": "Say Hello!"}]}]'Some OpenAI models, especially reasoning models such as the gpt-5 family, do not accept every inference parameter, for example temperature, topP, or stopSequences.
When the endpoint host is exactly api.openai.com, LocalStack drops a parameter the model refuses and retries the request so the call succeeds, but that setting has no effect.
A proxy in front of OpenAI under another host, such as Azure OpenAI or LiteLLM, has to handle these parameters itself.
OpenRouter
Section titled “OpenRouter”Configure the OpenRouter endpoint, API key, and a model listed by OpenRouter:
LOCALSTACK_BEDROCK_INFERENCE_ENDPOINT=https://openrouter.ai/api/v1 \LOCALSTACK_BEDROCK_INFERENCE_API_KEY=your-api-key \LOCALSTACK_BEDROCK_DEFAULT_MODEL=amazon/nova-micro-v1 \lstk startBEDROCK_DEFAULT_MODEL sends every request to the configured OpenRouter model.
Alternatively, omit the default and use an OpenRouter model ID per request with the ollama. prefix, such as ollama.amazon/nova-micro-v1.
LocalStack does not translate Bedrock model IDs to OpenRouter model IDs.
Apple Foundation Models
Section titled “Apple Foundation Models”Apple Foundation Models require an Apple silicon Mac with the fm CLI, Apple Intelligence enabled, and the on-device model downloaded.
Accept the Foundation Models license once:
sudo fm licenseStart the server and keep it running while LocalStack is active:
fm serve --host 0.0.0.0 --port 1976The --host 0.0.0.0 option is required when LocalStack runs in Docker because the container reaches the Mac through host.docker.internal.
Configure LocalStack to map every Bedrock model ID to the single Apple model named system:
LOCALSTACK_BEDROCK_INFERENCE_ENDPOINT=http://host.docker.internal:1976 \LOCALSTACK_BEDROCK_DEFAULT_MODEL=system \lstk startUse http://localhost:1976 when LocalStack runs as a host process.
Container runtimes without host.docker.internal need an address for the Mac that resolves from the container.
Apple’s server has the following limitations:
stopSequencesare not supported, andConversereturns aValidationExceptionwhen they are provided.- Apple model safety guardrail violations and prompts that exceed the context window return an
InternalServerExceptionwith the server’s error text. - Only text input is supported.
For startup errors:
BEDROCK_INFERENCE_ENDPOINT=... is not reachablecan indicate that the server is stopped, uses a different address or port, or cannot be reached through the container network.does not look like an OpenAI-compatible servercan indicate a wrong URL, another process on the configured port, or an incompatible response from/v1/models.- To inspect the Apple server directly, request its
/healthendpoint. If it returns"available": false, enable Apple Intelligence and wait for the model download to finish.
Troubleshooting
Section titled “Troubleshooting”Users of Docker Desktop on macOS or Windows might run into the issue of Bedrock becoming unresponsive after some usage. A common reason for that is insufficient storage or memory space in the Docker Desktop VM. To resolve this issue you can increase those amounts directly in Docker Desktop or clean up unused artifacts with the Docker CLI like this
docker system pruneYou could also try to use a model with lower requirements. To achieve that you can search for models in the Ollama Models library with a low parameter count or smaller size.
Limitations
Section titled “Limitations”- Embedding models other than the families in Text embeddings are not supported.
- The managed Ollama container does not serve embedding models.
API Coverage
Section titled “API Coverage”6 of 108 operations implemented
Available from the Ultimate plan. Licensing details
Find an API
Search the full operation list, then sort the table to compare current support.
Loading operations…
| Verified on Kubernetes | ||
|---|---|---|
| Loading operations… | ||
Complete static API list All 108 operations and their current support status
| Operation | Status |
|---|---|
| BatchDeleteAdvancedPromptOptimizationJob | Not implemented |
| BatchDeleteEvaluationJob | Not implemented |
| CancelAutomatedReasoningPolicyBuildWorkflow | Not implemented |
| CreateAdvancedPromptOptimizationJob | Not implemented |
| CreateAutomatedReasoningPolicy | Not implemented |
| CreateAutomatedReasoningPolicyTestCase | Not implemented |
| CreateAutomatedReasoningPolicyVersion | Not implemented |
| CreateCustomModel | Not implemented |
| CreateCustomModelDeployment | Not implemented |
| CreateEvaluationJob | Not implemented |
| CreateFoundationModelAgreement | Not implemented |
| CreateGuardrail | Not implemented |
| CreateGuardrailVersion | Not implemented |
| CreateInferenceProfile | Not implemented |
| CreateMarketplaceModelEndpoint | Not implemented |
| CreateModelCopyJob | Not implemented |
| CreateModelCustomizationJob | Not implemented |
| CreateModelImportJob | Not implemented |
| CreateModelInvocationJob | Implemented |
| CreatePromptRouter | Not implemented |
| CreateProvisionedModelThroughput | Not implemented |
| DeleteAutomatedReasoningPolicy | Not implemented |
| DeleteAutomatedReasoningPolicyBuildWorkflow | Not implemented |
| DeleteAutomatedReasoningPolicyTestCase | Not implemented |
| DeleteCustomModel | Not implemented |
| DeleteCustomModelDeployment | Not implemented |
| DeleteEnforcedGuardrailConfiguration | Not implemented |
| DeleteFoundationModelAgreement | Not implemented |
| DeleteGuardrail | Not implemented |
| DeleteImportedModel | Not implemented |
| DeleteInferenceProfile | Not implemented |
| DeleteMarketplaceModelEndpoint | Not implemented |
| DeleteModelInvocationLoggingConfiguration | Not implemented |
| DeletePromptRouter | Not implemented |
| DeleteProvisionedModelThroughput | Not implemented |
| DeleteResourcePolicy | Not implemented |
| DeregisterMarketplaceModelEndpoint | Not implemented |
| ExportAutomatedReasoningPolicyVersion | Not implemented |
| GetAccountDataRetention | Not implemented |
| GetAdvancedPromptOptimizationJob | Not implemented |
| GetAutomatedReasoningPolicy | Not implemented |
| GetAutomatedReasoningPolicyAnnotations | Not implemented |
| GetAutomatedReasoningPolicyBuildWorkflow | Not implemented |
| GetAutomatedReasoningPolicyBuildWorkflowResultAssets | Not implemented |
| GetAutomatedReasoningPolicyNextScenario | Not implemented |
| GetAutomatedReasoningPolicyTestCase | Not implemented |
| GetAutomatedReasoningPolicyTestResult | Not implemented |
| GetCustomModel | Not implemented |
| GetCustomModelDeployment | Not implemented |
| GetEvaluationJob | Not implemented |
| GetFoundationModel | Implemented |
| GetFoundationModelAvailability | Not implemented |
| GetGuardrail | Not implemented |
| GetImportedModel | Not implemented |
| GetInferenceProfile | Not implemented |
| GetMarketplaceModelEndpoint | Not implemented |
| GetModelCopyJob | Not implemented |
| GetModelCustomizationJob | Not implemented |
| GetModelImportJob | Not implemented |
| GetModelInvocationJob | Implemented |
| GetModelInvocationLoggingConfiguration | Not implemented |
| GetPromptRouter | Not implemented |
| GetProvisionedModelThroughput | Not implemented |
| GetResourcePolicy | Not implemented |
| GetUseCaseForModelAccess | Not implemented |
| ListAdvancedPromptOptimizationJobs | Not implemented |
| ListAutomatedReasoningPolicies | Not implemented |
| ListAutomatedReasoningPolicyBuildWorkflows | Not implemented |
| ListAutomatedReasoningPolicyTestCases | Not implemented |
| ListAutomatedReasoningPolicyTestResults | Not implemented |
| ListCustomModelDeployments | Not implemented |
| ListCustomModels | Not implemented |
| ListEnforcedGuardrailsConfiguration | Not implemented |
| ListEvaluationJobs | Not implemented |
| ListFoundationModelAgreementOffers | Not implemented |
| ListFoundationModels | Implemented |
| ListGuardrails | Not implemented |
| ListImportedModels | Not implemented |
| ListInferenceProfiles | Not implemented |
| ListMarketplaceModelEndpoints | Not implemented |
| ListModelCopyJobs | Not implemented |
| ListModelCustomizationJobs | Not implemented |
| ListModelImportJobs | Not implemented |
| ListModelInvocationJobs | Implemented |
| ListPromptRouters | Not implemented |
| ListProvisionedModelThroughputs | Not implemented |
| ListTagsForResource | Not implemented |
| PutAccountDataRetention | Not implemented |
| PutEnforcedGuardrailConfiguration | Not implemented |
| PutModelInvocationLoggingConfiguration | Not implemented |
| PutResourcePolicy | Not implemented |
| PutUseCaseForModelAccess | Not implemented |
| RegisterMarketplaceModelEndpoint | Not implemented |
| StartAutomatedReasoningPolicyBuildWorkflow | Not implemented |
| StartAutomatedReasoningPolicyTestWorkflow | Not implemented |
| StopAdvancedPromptOptimizationJob | Not implemented |
| StopEvaluationJob | Not implemented |
| StopModelCustomizationJob | Not implemented |
| StopModelInvocationJob | Implemented |
| TagResource | Not implemented |
| UntagResource | Not implemented |
| UpdateAutomatedReasoningPolicy | Not implemented |
| UpdateAutomatedReasoningPolicyAnnotations | Not implemented |
| UpdateAutomatedReasoningPolicyTestCase | Not implemented |
| UpdateCustomModelDeployment | Not implemented |
| UpdateGuardrail | Not implemented |
| UpdateMarketplaceModelEndpoint | Not implemented |
| UpdateProvisionedModelThroughput | Not implemented |
API Coverage (Bedrock Runtime)
Section titled “API Coverage (Bedrock Runtime)”3 of 11 operations implemented
Available from the Ultimate plan. Licensing details
Find an API
Search the full operation list, then sort the table to compare current support.
Loading operations…
| Verified on Kubernetes | ||
|---|---|---|
| Loading operations… | ||
Complete static API list All 11 operations and their current support status
| Operation | Status |
|---|---|
| ApplyGuardrail | Not implemented |
| Converse | Implemented |
| ConverseStream | Not implemented |
| CountTokens | Not implemented |
| GetAsyncInvoke | Not implemented |
| InvokeGuardrailChecks | Not implemented |
| InvokeModel | Implemented |
| InvokeModelWithBidirectionalStream | Implemented |
| InvokeModelWithResponseStream | Not implemented |
| ListAsyncInvokes | Not implemented |
| StartAsyncInvoke | Not implemented |