Develop Amazon Bedrock Applications Locally Using MiniStack and Ollama
S L Manikanta
Jul 11, 2026 • 6 min read
Developing generative AI applications against cloud hosted Amazon Bedrock can introduce unnecessary friction into the development cycle. Every time you test a prompt, validate JSON parsing, or debug application logic, your application must invoke a remote Bedrock model. That means dealing with AWS infrastructure setup, managing environment configurations, and paying for model invocations even when you’re only trying to verify that your application code behaves correctly.
MiniStack v1.4.0 solves this by providing a free, open-source AWS emulator. By running MiniStack alongside Ollama, you can execute standard Amazon Bedrock API calls through the Boto3 SDK against local open source models. The result is a fast, offline development environment that lets you iterate on your application without cloud provisioning overhead or Bedrock API charges.
MiniStack emulates the Amazon Bedrock Runtime API, allowing existing Boto3 applications to communicate with locally hosted Ollama models with minimal code changes. During local development, MiniStack intercepts Bedrock API requests, translates them into Ollama compatible requests, and converts the responses back into the Bedrock format expected by Boto3. When you’re ready to deploy to AWS, simply remove the local endpoint_url override and your application will communicate with the real Amazon Bedrock service.
1. How MiniStack Emulates Amazon Bedrock
To simulate AWS Bedrock locally, the architecture relies on three components:
- Ollama: The inference engine hosting local open-source models (e.g., Llama 3, Qwen) and exposing an OpenAI-compatible API.
- MiniStack: A full local AWS emulator (an open-source alternative to LocalStack supporting 60+ AWS services). In this architecture, we specifically use its Bedrock proxy feature to intercept API calls on port 4566, translate the AWS-specific JSON payloads to the Ollama format, and reformat the response back into the exact Bedrock wire shape.
- Boto3: The standard Python AWS SDK. It remains entirely unaware that it is communicating with a local proxy instead of the real AWS cloud.
%%{init: {'theme': 'default'}}%%
sequenceDiagram
participant App as Boto3 Application
participant MS as MiniStack (Port 4566)
participant OL as Ollama (Port 11434)
App->>MS: invoke_model(Bedrock Payload)
Note over MS: Translates Bedrock JSON to<br/>OpenAI/Ollama format
MS->>OL: POST /api/chat (Translated Payload)
OL-->>MS: LLM Generation Response
Note over MS: Translates response back to<br/>Bedrock Wire Format
MS-->>App: Bedrock Compatible Response
2. Prerequisites
Before configuring the local environment, ensure the following are installed:
- Python 3.9+
- Ollama Desktop Application (running in the background)
- Required Python dependencies:
pip install boto3 ministack
3. Step-by-Step Implementation Guide
Step 1: Spin Up Your Local Model with Ollama
First, pull the open-source model you intend to test against. For this reference, we use Qwen 2.5 (3-billion parameter version), which is highly performant and lightweight for local testing environments.
Open your terminal and execute:
ollama pull qwen2.5:3b
Tip: Keep Ollama running in the background. By default, the Ollama service binds to
http://127.0.0.1:11434.
Step 2: Start MiniStack with the Proxy Configuration
By default, if MiniStack receives a Bedrock request without a routing destination, it gracefully falls back to deterministic mock responses (e.g., returning [ministack mock generic]).
To connect MiniStack to the real model, pass the MINISTACK_BEDROCK_PROXY_URL environment variable when launching the emulator.
Important for Windows Users: The syntax for setting environment variables depends strictly on your shell.
- Command Prompt (CMD): Do not wrap the URL in quotes. Use
set MINISTACK_BEDROCK_PROXY_URL=http://127.0.0.1:11434- PowerShell: Use
$env:MINISTACK_BEDROCK_PROXY_URL="http://127.0.0.1:11434"- Docker Desktop: If running MiniStack via Docker instead of Pip, use
http://host.docker.internal:11434to allow the container to reach your host network.
Open a new terminal window, configure the environment, and start the emulator:
# Example for macOS / Linux / Windows PowerShell natively
export MINISTACK_BEDROCK_PROXY_URL="http://127.0.0.1:11434"
ministack
You should see the MiniStack startup banner confirming it is listening on port 4566. Leave this terminal process active.
Step 3: Develop with Boto3 Locally
You can now write standard AWS Python code. The only difference between your local testing script and your production code is an override of the endpoint_url to point to MiniStack’s local port. You can also pass dummy AWS credentials.
import boto3
import json
import os
# Use an environment variable to toggle local testing
is_local = os.getenv("TESTING_LOCALLY", "true").lower() == "true"
client_kwargs = {
'service_name': 'bedrock-runtime',
'region_name': 'us-east-1'
}
if is_local:
client_kwargs.update({
'endpoint_url': 'http://127.0.0.1:4566',
'aws_access_key_id': 'test',
'aws_secret_access_key': 'test'
})
bedrock = boto3.client(**client_kwargs)
def run_agent():
body = {
"prompt": "Explain the concept of 'Local-First Development'.",
"temperature": 0.7,
"max_gen_len": 200
}
response = bedrock.invoke_model(
modelId='qwen2.5:3b',
body=json.dumps(body),
contentType='application/json',
accept='application/json'
)
response_body = json.loads(response.get('body').read())
return response_body.get('generation')
if __name__ == "__main__":
print(run_agent())
When you run this script locally, MiniStack intercepts the call, routes it to Ollama, and returns the LLM generation formatted exactly like a real Bedrock response. The same application code will run seamlessly in AWS just by omitting the endpoint_url.
4. What Can You Test Locally?
Routing your Boto3 client through MiniStack enables several critical development workflows without incurring cloud costs:
- Prompt engineering
- Response parsing
- Agent workflows
- Structured outputs
- Function calling
- Retry logic
- Streaming
- Multi-turn conversations
5. Limitations of Local Emulation
While local emulation is incredibly powerful for development, it does not replace proper production integration testing.
Your local Qwen or Llama model will not behave exactly like Claude 3.5 Sonnet hosted on AWS. Local models are excellent for verifying that your code wires up correctly and parses responses accurately, but they cannot validate the subjective quality of the final generative output you expect in production. Local emulation validates application behavior, not model quality. Additionally, local emulation bypasses real AWS IAM permission boundaries, meaning you still need cloud integration tests to verify your execution roles.
6. Frequently Asked Questions (FAQ)
Why not use the Ollama Python client directly?
Using the Ollama client requires writing code against the Ollama API. MiniStack allows applications already built for Amazon Bedrock to continue using the standard Boto3 SDK and Bedrock Runtime API. This means the same application can run locally during development and against Amazon Bedrock in production with minimal configuration changes.
Does MiniStack support streaming responses?
Yes. If your Boto3 code calls invoke_model_with_response_stream, MiniStack proxy handles the translation of Server-Sent Events (SSE) from Ollama back into AWS Bedrock’s binary event stream format.
Can I use models other than Qwen?
Absolutely. You can use any model supported by Ollama (e.g., llama3, mistral, gemma2). Just ensure the model_id in your Boto3 script matches the tag you pulled in Ollama.
What happens if I forget to remove the endpoint_url in production?
Your application will attempt to route traffic to 127.0.0.1:4566 on the production server. To prevent this, never hardcode the endpoint URL; inject it via environment variables only in your local environments.
7. Going to Production
By routing AWS Bedrock requests through MiniStack to Ollama, engineering teams secure a zero-latency sandbox to experiment with prompt engineering, validate JSON parsing logic, and harden Generative AI architectures entirely offline.
Because MiniStack exposes a Bedrock-compatible API, your application code remains the same. Moving to production simply means pointing Boto3 back to the real Amazon Bedrock endpoint and using your normal AWS credentials.
Want to build production-ready AI?
Subscribe to StackMindset to receive actionable systems engineering checklists and code walkthroughs. No spam, only technical insights.
Written by S L Manikanta
AI Engineer specializing in agentic workflows, multi-step LLM validation pipelines, and secure cloud environments. Sharing practical lessons from building software.
Related Articles
Advanced RAG on Azure: Hybrid Search & Re-ranking Implementation
Going beyond basic vector search. A technical guide to implementing Hybrid Search (Keyword + Vector) and Semantic Re-ranking using Azure AI Search and OpenAI.
Mastering Agent Skills: A New Standard for AI Capabilities
An in-depth guide on Agent Skills, exploring how to extend AI agents like Claude with specialized knowledge, workflows, and tools using an open, filesystem-based format.
Claude Code in Action: Building a Next.js App from Scratch Entirely in the Terminal
A fully practical, hands-on masterclass leveraging Anthropic's Claude Code CLI. Learn to autonomously generate complex React components, manage state, and style UIs without leaving your terminal.