How garak scans AWS Bedrock foundation models
A team that hosts or consumes AWS Bedrock models and needs independent vulnerability testing before release can point garak at them directly. garak's Bedrock generator, selected with --target_type bedrock, sends probe prompts to a Bedrock model ID or alias through the Converse API, so the same request shape is used whichever model family is under test. DeployOpen plans and runs these scans inside the client's own AWS accounts, and the scope, target models and deliverables are agreed in writing before any work starts.
The generator reads the BEDROCK_API_KEY environment variable for authentication and BEDROCK_REGION for the AWS region, which defaults to us-east-1 if unset. Before the first run, confirm that the region you set actually serves the model you intend to test, since model availability varies by region. The generator supports Anthropic Claude, Meta Llama, Amazon Titan, AI21 Labs, Cohere and Mistral AI model families, so a scan plan should list each target model ID explicitly and record the region it was run in. Teams testing reasoning models should also note that garak v0.15.0 added support for them in the Bedrock generator, so older runs may not be comparable with newer ones. Check the garak releases page for the version you install.
Cost is the part teams most often underestimate. Bedrock is billed pay-per-token, and each garak probe generates many prompts, with five generations per prompt by default. Each run therefore consumes input and output tokens on every model under test, and the total depends on the probes chosen, the number of models and any reruns. Ask the scoping conversation to produce a probe list, an estimated token count per model and a rerun budget, and confirm current Bedrock pricing for your region and models with AWS before approving the plan.
What you need before the first Bedrock scan
A Bedrock scan depends on four things lining up: a working garak install, credentials the scan host can use, a region where the model is available, and a network path to the Bedrock endpoint. Confirm each one before you plan probe runs, because a failure in any of them looks like a generator error mid-scan.
Python 3.11 and garak from PyPI
garak is a command-line tool installed from PyPI with pip, and the PyPI package requires Python 3.11 or newer. Check the interpreter version on the scan host first, then install garak into a virtual environment so its dependencies stay separate from system Python. garak is developed on Linux and macOS, so if your scan host runs another operating system, test the install on a non-production machine before the first real run.
garak on PyPIBedrock API key in BEDROCK_API_KEY
The Bedrock generator reads the key from the BEDROCK_API_KEY environment variable, so keep it out of config files and shell history. Decide who issues the key and which AWS account it belongs to, because scan traffic and its charges land in that account. Use a key scoped to the account and models you intend to test, and rotate it on the schedule your security team already applies to other service credentials.
Region set with BEDROCK_REGION
Set BEDROCK_REGION to the AWS region where the model is offered and where your access is enabled. If the variable is not set, garak uses a default of us-east-1, which may not match the region where your models are available. Confirm the region in the AWS console before the first run, since a model that exists in one region can be absent in another.
Model access enabled in the account
Enabling access to the chosen foundation model is a separate step from having a key and a region. Confirm in the AWS console, for the account in use, that access to the exact model ID or alias you plan to pass with --target_type bedrock is granted. The steps and their location in the console can change, so verify them in the console rather than relying on any written sequence.
Egress from the scan host to Bedrock
The scan host needs outbound HTTPS access to the regional Bedrock runtime endpoint for the region you set. Behind a corporate proxy, firewall or private network path, add that route before the scan, or every attempt will fail as a connection error rather than a model result. Confirm the required endpoints and any VPC or proxy settings with your network team and AWS documentation for your setup.
Platform and budget owner agreed
garak's maintainers describe it as a free tool, but every probe attempt is a model call billed by Bedrock on a pay-per-token basis in the account that holds the key. Name the owner of that account and agree a rough token ceiling for the first run. Confirm current Bedrock pricing for your chosen model in the AWS pricing pages before you plan the number of generations per prompt.
Configure the garak Bedrock generator step by step
This sequence takes you from a clean install to a full Bedrock scan, with a check at each stage so you can confirm the generator reaches your chosen model before you spend time and tokens on a large probe run.
Install garak and confirm the Python version
Install garak from PyPI with pip into a virtual environment on a Linux or macOS host. The PyPI package requires Python 3.11 or newer, so confirm the interpreter version first. garak is developed on Linux and macOS, so validate the install on the same platform your scans will run from. Done means the garak command starts and prints its help text without import errors.
Export the Bedrock API key
Set the BEDROCK_API_KEY environment variable in the shell or service account that will run the scan. Keep the key out of shell history, scripts committed to source control and report files. Your cloud or security team should own how the key is issued, scoped and rotated, and should confirm that the key can invoke the models you plan to test. Done means the variable is visible in the scanning session, and you have not printed its value to a log.
Set the Bedrock region
Set BEDROCK_REGION to the AWS region where your approved Bedrock models are enabled. If you do not set it, garak uses us-east-1 by default. Confirm in the AWS console or with your platform team that the model you intend to test is available in that region, because a model enabled in one region may not be enabled in another. Done means the region variable matches the region where the model access was granted.
Confirm the Bedrock model ID or alias
Choose the Bedrock model ID or alias you will pass to garak with --target_type bedrock. Check the exact string against the model catalog for your account and region, since small differences in version suffixes will cause the call to fail. Record the model family as well, because the generator supports Anthropic Claude, Meta Llama, Amazon Titan, AI21 Labs, Cohere and Mistral AI models through the Converse API. Done means you have a written model identifier that matches what your account can invoke.
Run a single-probe smoke test
Run one lightweight probe against the chosen model, for example with a single probe module selected by name, so you test connectivity and authentication without a full scan. A successful run produces a JSONL report in the garak run directory and a garak.log entry showing the generator call completed. If the call fails, read the error in garak.log before changing anything else, since credential, region and model ID mistakes produce different messages. Done means the JSONL report contains at least one attempt record with a model response.
Review the smoke test output
Open the JSONL report and confirm that each attempt has a prompt, a generated output and an evaluation result from the detector. Check that the model ID recorded in the run matches the model you meant to test. Open garak.log again and confirm the run was appended rather than overwritten, since the log continues across runs. Done means you can trace one attempt from prompt to evaluation, which confirms the pipeline works before you commit to a large run.
Run the full scan
Launch the full probe selection against the same model identifier, region and environment variables you validated in the smoke test. Keep the run settings in a saved configuration so the scan can be repeated. Note that garak makes 5 generations per prompt by default, so the number of Bedrock calls and the token spend grow with the probe set and the generation count. Done means the run completes, the JSONL report and HTML digest exist, and the garak.log entry records the run.
Which Bedrock model families garak supports
garak's Bedrock generator supports six model families: Anthropic Claude, Meta Llama, Amazon Titan, AI21 Labs, Cohere and Mistral AI. All of them are called through the Converse API, so garak sends the same request shape whichever family you target. That matters for scan design. You can keep one probe set, one generation count and one report format while swapping the target, and the results across families are comparable at the level of the request and response handling. The generator itself is selected with --target_type bedrock, and the model is identified by its Bedrock model ID or an alias, so the model ID is the value you change between runs.
A shared request shape does not mean every target is interchangeable. Model IDs differ between families and between versions within a family, regional availability varies, and each model must be enabled for your account before any call succeeds. Before you plan a comparison, confirm each target in your own account and region: check that the model ID resolves, that model access has been granted, and that the model is offered in the BEDROCK_REGION you set. Record the exact model ID in your run notes, because a failed or substituted target will otherwise look like a finding. Confirm these details in the Bedrock console and the current garak README rather than assuming them from the family name.
garak v0.15.0 added support for reasoning models to the Bedrock generator, according to the garak releases page. If your comparison includes a reasoning model, check that your garak version is at or above that release and that the model's output format is handled as you expect in the first test run. Reasoning output can change what a detector sees, so inspect a few raw attempts in the JSONL report before trusting pass and fail rates. Treat the family list as a starting point and confirm current coverage against the garak version you install.
How a probe travels from garak to a Bedrock model
The scan starts on the garak CLI on a host inside your network, which loads the selected probes and their detectors. The Bedrock generator then sends each prompt through the Converse API to the chosen region, and the model reply returns to the detectors on the same host. Each attempt and its evaluation are written to the JSONL report, and the run is logged to garak.log. The boundary to check is the crossing from your scan host to the AWS Bedrock endpoint, because that is where prompts and responses leave your network.
Probe prompts cross the trust boundary to Bedrock, and replies return to local detectors and reports.
Mapping garak settings to Bedrock resources
This table pairs each garak setting used for a Bedrock scan with the AWS resource or artifact it corresponds to. Read it before a first run so the target type, credential, region and model identifier all point at the account and model you intend to test.
| garak setting | Bedrock counterpart | What to confirm |
|---|---|---|
| --target_type bedrock | Bedrock generator, which calls models through the Converse API | Confirm your garak version includes the Bedrock generator and that it reaches the models you plan to test. |
| Model ID or alias | Foundation model identifier enabled in your account | Confirm the exact model ID in the Bedrock console for your region, since aliases may map to different versions over time. |
| BEDROCK_API_KEY | Credential issued for calls to Bedrock from your account | Confirm which key type your account issues and which IAM principal or policy it is tied to before using it. |
| BEDROCK_REGION | AWS region where the model is enabled for your account | Confirm the model is available in the region set here, since the default is us-east-1 and other regions may differ. |
| Probe run and generations | Billable model invocations, one per attempt against the model | Confirm expected invocation counts with your cost owner before starting, because each attempt is charged per token. |
| JSONL report | Evidence record of every attempt and its evaluation, stored in your evidence store | Confirm where reports are written, who can read them and how long your retention policy keeps them. |
| garak.log | Debugging log continued across runs, kept with the scan record | Confirm it does not capture data you are not permitted to retain, since it may record run details. |
Securing the Bedrock key, scan host and reports
A garak run against Bedrock needs three things protected: the API key that authorizes model calls, the host that sends prompts, and the output files that record what the models said. Each carries a different risk, and the controls below address them separately. Review them with your security team before the first scan.
Keep the key out of shell history
The Bedrock generator reads BEDROCK_API_KEY from the environment, so the key has to reach the scan host somehow. Avoid typing it inline on the command line, where it can persist in shell history, and avoid writing it into a config file that gets committed to source control. Pull it at runtime from your secrets manager, export it only for the session, and confirm that your scan host's shell does not record it. Ask who else can read that host's environment or process list.
Scope the key to model invocation
Give the scanning identity permission to invoke the Bedrock models you intend to test and nothing broader, such as model customization, billing administration or unrelated AWS services. Confirm with your cloud team which IAM policy or key type applies to your Bedrock setup, since the exact policy names depend on how your account is configured. Ask for a short written list of the actions the key holds, and check it in your account before the scan starts.
Restrict the scan host's egress
The scan host needs outbound access to the Bedrock endpoint in the configured region, and little else. Limit egress to that regional endpoint through firewall rules, security groups or a proxy, so a compromised or misconfigured run cannot send prompts or data to unapproved destinations. Confirm the region with BEDROCK_REGION (default us-east-1) and make sure the rule matches it. Log the outbound connections for the duration of the engagement.
Limit read access to reports and logs
Each run writes a JSONL report of every attempt and a garak.log file that continues across runs. Both contain model outputs, and some outputs may include sensitive content the probes elicited, so treat them as sensitive data. Restrict file permissions to the engagement team, decide where they are stored and how long they are kept, and confirm that copies in shared drives or tickets follow the same rule.
Rotate the key after the engagement
Once the scan and retest are complete, revoke or rotate the Bedrock key and remove it from the scan host, including any cached copies in the environment or the secrets manager's temporary exports. Record the rotation date with the engagement close-out. Ask your cloud team to confirm that no other system uses the same key before revoking it, so the rotation does not break a production workload.
Planning probe runs against pay-per-token pricing
Probe volume sets how many prompts garak sends to the model. Every probe contributes prompts, and every prompt is a billable request that returns billable output tokens. A broad run across many probe families therefore costs more than a targeted run, even on the same model.
- Count prompts before running: Use garak's list options to see which probes a selection will load, then estimate prompt volume from the probe list rather than guessing.
- Select by exposure: Choose probe families that match what the application does, such as prompt injection for an agent that reads external documents or data leakage for a system with private records.
- Keep the default harness in mind: The default probewise harness runs each probe with its recommended detectors, so the set of probes chosen determines the work done.
- Split broad scans: Run a wide scan as separate, scheduled batches so a spend problem stops one batch rather than the whole program.
Before approving a full run, confirm the exact probe list and its prompt count with the team that will pay the bill.
garak makes 5 generations per prompt by default and marks a probe as FAIL when any attempt produces undesirable output. Each extra generation is another billed request, so the generations setting multiplies the cost of every probe in the run. Reducing it is the most direct lever, but it changes how sensitive the result is.
- Know the default multiplier: At the default of 5 generations, each prompt produces five model responses, so output token charges can grow faster than the prompt count suggests.
- Lower generations for smoke tests: A reduced setting is suitable for checking configuration and measuring token use, not for a final pass/fail judgment.
- Keep the final setting documented: Record the generation count in the run configuration so that later runs are compared on the same basis.
- Account for output length: Models that return long answers increase output token charges, so verbose models cost more per generation.
Ask the team whether a lower generation count is acceptable for each run type, and record the decision with the results.
Model choice changes the per-token rate and often the verbosity of responses. Bedrock hosts several model families through the Converse API, and prices differ by model and by token type. The same probe plan can cost materially different amounts on two models, so the model should be chosen as part of the budget, not after it.
- Check current pricing per model: Look up input and output token rates for the exact model ID in the AWS pricing pages, since rates change and differ by provider and region.
- Compare candidates on a smoke test: Run the same small probe set against two candidate models and compare measured token use before committing to one.
- Include reasoning models: garak v0.15.0 added support for reasoning models to the Bedrock generator, and reasoning models can produce more output tokens, so measure them separately.
- Plan for model changes: Re-check pricing and re-run the smoke test when a model ID or version changes, because a model swap can change the cost of a recurring scan.
Before a full run, confirm the model ID, its current rates and the expected token use with the AWS account owner.
A smoke test runs a small, representative slice of the planned scan and measures what it actually consumes. It replaces estimates with observed token counts from the account's own traffic. It also surfaces configuration problems, such as a wrong region or model ID, before they waste a full run.
- Pick a representative slice: Include a few probes from each family in scope, with the production generation count, so the sample reflects the full run.
- Record token counts: Capture input and output tokens for each run in your own log, and calculate spend using the current AWS rates for the model.
- Check the report: Confirm that the JSONL report and garak.log contain the expected attempts before scaling up.
- Extrapolate with care: Scale the smoke test figures to the full probe list, and note that refusals and long responses can make the sample unrepresentative.
When the smoke test is complete, share the measured token use and the cost calculation with the budget owner before approving the full scan.
Budget controls keep a scan within the spend the organization approved. They work at the level of the AWS account, the scan configuration and the schedule. Because garak does not set Bedrock spend limits for you, the controls are the responsibility of the team that operates the account.
- Set account-level alerts: Configure AWS billing alerts for the account that runs the scans, so unexpected spend is visible early.
- Scope credentials: Use a dedicated API key or role for scanning, with access limited to the approved model IDs and region, so runs cannot reach other workloads.
- Schedule runs deliberately: Keep scheduled rescans to the agreed frequency and probe set, and review the cost after each change to the configuration.
- Ask for a quote on recurring work: Request a written scope that lists the probe set, generation count, model IDs, run frequency and the team responsible for monitoring spend.
Confirm with the AWS account administrator which alerts, limits and credential scopes are available in the organization's account setup.
Common Bedrock scan failures and their fixes
This table lists the failures most likely to stop a garak scan of a Bedrock model, with the usual cause, the check to run and the fix for each. Work down the rows in order, since the first two checks rule out most setup problems before you look at account settings.
| Failure | Likely cause and check | Fix |
|---|---|---|
| Missing or wrong BEDROCK_API_KEY | The variable is unset in the shell that runs garak, or it holds a key from another account or environment. Run echo on the variable in the same session before scanning. | Export BEDROCK_API_KEY in the scan session or your secrets store, then rerun. Confirm with your AWS administrator which credential the scan should use. |
| Region mismatch | BEDROCK_REGION is unset (garak defaults to us-east-1) while the model is enabled in another region. Compare the region in your console with the value garak uses. | Set BEDROCK_REGION to a region where the model is enabled. Confirm model availability per region with AWS, since this depends on your account setup. |
| Model ID or alias not found | The --target_type bedrock run uses an ID or alias that does not match the model's identifier in your region, or the model version has changed. Check the model ID in the Bedrock console or with AWS CLI listing commands. | Copy the exact model ID for your region into the run. Pin the version you tested so later scans compare the same model. |
| Model access not granted | The model family is not enabled for the account, so requests fail even with a valid key and correct region. Check the model access page in the Bedrock console for the account. | Request or enable access for the model in the account. Access approval and any terms acceptance are AWS account settings, so confirm them with AWS or your account owner. |
| Network block from the scan host | Egress from the scan host to the regional Bedrock endpoint is blocked by a firewall, proxy or private network policy. Test reachability from that host, not from your laptop. | Allow outbound HTTPS to the Bedrock endpoint for your region, or route through an approved proxy. Confirm the required endpoints and any VPC endpoint setup with AWS and your network team. |
| Reasoning model output parsing issues | Scans of reasoning models on releases before v0.15.0 may show garbled or unscored responses because those releases did not support reasoning models in the Bedrock generator. Check your garak version with garak --version. | Upgrade to v0.15.0 or later, as noted in the NVIDIA/garak releases, then rerun the scan. Keep the earlier report so you can explain score changes after the upgrade. |
| Throttling or quota errors mid-run | Many parallel attempts exceed request limits set for the account or model. Look for throttling errors in garak.log. | Reduce parallelism and plan the run size against your account quotas. Quota values are set by AWS, so confirm them in your account before scheduling large runs. |
Questions buyers ask before scanning Bedrock models
Is garak free to use for scanning Bedrock models?
Yes. garak is licensed under the Apache 2.0 license and the maintainers describe it as a free tool, so the software itself carries no license fee. The cost of a scan is what you pay AWS for Bedrock inference, plus the people time to plan, run and review the work. Confirm the license terms in the project repository before you adopt it, and check with your legal team whether your internal policy has any extra requirements for open-source tools. Bedrock charges are separate from garak and depend on the models you call and the volume of tokens exchanged during the run.
How long does a garak scan against Bedrock take?
Duration depends on the number of probes selected, the number of generations per prompt, the rate limits on your Bedrock account and the response time of the chosen model. garak makes 5 generations per prompt by default, so a broad probe set multiplies the request count quickly. Parallelism and throttling settings also change wall-clock time. Before you commit to a window, run a small probe subset against the target model, measure the request rate it sustains, and extrapolate from that measured run rather than from a generic estimate.
What drives the Bedrock token bill for a garak run?
Bedrock bills per token for most foundation models, so your cost follows the tokens sent and returned. The main drivers are:
- The number of probes and prompts in the selected set
- The 5 default generations per prompt, or whatever count you configure
- The length of each probe prompt and the length of each model response
- Reasoning models, which can return longer outputs than standard chat models
- Retries caused by throttling or transient errors
Ask AWS for current per-token pricing for each model in your region, and ask your team to estimate token totals from a pilot run. Pricing changes over time, so do not treat a figure from a blog post as current.
Can our own team run garak against Bedrock without outside help?
Yes, if your engineers can install a Python package, manage API credentials and read JSONL reports. garak is a command-line tool installed from PyPI with pip, and the package requires Python 3.11 or newer. The Bedrock generator uses --target_type bedrock with a model ID or alias, reads BEDROCK_API_KEY, and uses BEDROCK_REGION, which defaults to us-east-1. The harder work is deciding which probes match your application, interpreting failures, setting up repeatable configurations and keeping results comparable across releases. Teams that lack that capacity often bring in a partner for planning and review.
What do our AWS and security teams need to provide?
Your AWS team needs to confirm which Bedrock models are enabled in the target account and region, and which IAM or API key path the scanning host uses. Your security team should agree on the scope of testing, the approved hosts for running scans, where the garak.log debugging file and JSONL reports are stored, and who may read them, since reports contain prompts and model outputs. Plan for change approval if the scan will run against production-facing model configurations. Confirm with AWS the current authentication options for the Bedrock API, because the setting names in this guide reflect the garak documentation rather than an AWS policy review.
Does DeployOpen issue audit reports for Bedrock scans?
No. DeployOpen does not issue audit reports, attestations or certifications. Independent auditors and certification bodies do that work. What DeployOpen can do is prepare systems, controls and evidence for your assessment, such as documented scan configurations, reproducible run records, scope statements and findings with fixes and retests. Ask your auditor which evidence format they accept before you define the deliverables, so the scan output fits the assessment rather than being reworked after the fact.
Which parts of a Bedrock scan can DeployOpen take on?
Most engagements are fixed-scope, so scope, deliverables and timelines are agreed in writing before work starts. A typical scope for this topic could include setting up the scanning environment, defining the probe set against your use case, running the probes, reviewing failures and preparing a findings report. Ongoing scheduled rescans or upgrades can be arranged as a retainer. Your quote follows from that written scope, and DeployOpen does not publish a price list, so ask for the scope items that drive the quote and the assumptions behind them.
When to run the scan in-house and when to hire help
Run the Bedrock scan in-house when someone on your team already operates garak, has a working Python 3.11 or newer environment, and holds an AWS identity with permission to invoke the Bedrock models you need in the region you have chosen. In that case the work is mostly configuration: setting BEDROCK_API_KEY and BEDROCK_REGION, choosing a model ID, and running --target_type bedrock. The person who owns those settings should also own the report. Each run writes a JSONL report and a garak.log file that accumulates across runs, so an internal owner needs a place to keep both and a habit of recording which garak version and model identifier produced each result. If your team already has these skills and a clear owner, an internal scan is a reasonable first step.
Consider a partner when the scan has to answer a specific question for a security review. Choosing probes that match your application's use case, such as a customer-facing assistant handling account data or an internal tool with document access, is a judgment call that benefits from prior experience with the probe families. Partners can also package the output into evidence a reviewer will accept, including the run settings, model and region, garak version, and an explanation of what was and was not tested. A fixed-scope engagement, with scope, deliverables and timing agreed in writing before work starts, suits a one-off review with a known date. Ask any provider what they will deliver beyond raw reports, who runs the probes against your account, and how credentials and the Bedrock usage they generate will be handled.
How DeployOpen scopes and delivers Bedrock scans
DeployOpen approaches garak scans of AWS Bedrock models as a fixed-scope piece of work agreed in writing before anything runs. The engagement covers which Bedrock models and regions are in scope, how garak is configured and run from your environment, and what evidence the scan produces for your security and compliance teams.
How we scope
- Confirm which Bedrock model IDs or aliases, model families and regions are in scope for testing.
- Agree the probe set, generation count and run budget against your pay-per-token Bedrock pricing.
- Document how AWS credentials, the BEDROCK_API_KEY value and region settings will be stored and rotated.
How we build
- Install garak in a Python 3.11 or newer environment inside your infrastructure and verify the Bedrock generator connects.
- Write repeatable run configurations so each scan uses the same target type, probes and detectors.
- Run a small pilot against one model to confirm cost, rate limits and report output before the full scan.
How we hand over
- Deliver the JSONL reports, garak.log files and a written summary of failed probes and their failure rates.
- Document the exact garak version, configuration files and model identifiers used for every run.
- Walk your engineering and security teams through how to read results and rerun the scan later.
How we support
- Offer ongoing support, garak upgrades and recurring scans as a retainer when you need them.
- Retest after your team changes prompts, guardrails or model versions so results remain comparable.
- Review new garak releases against your run configuration before you move to a newer version.

