Scanning AWS Bedrock foundation models with garak

garak's Bedrock generator connects a scan to Bedrock-hosted models through an API key and region setting. This page covers the setup sequence, model families, the Converse API and how to plan probe runs against pay-per-token pricing.

On this page

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 PyPI

Bedrock 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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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 settingBedrock counterpartWhat to confirm
--target_type bedrockBedrock generator, which calls models through the Converse APIConfirm your garak version includes the Bedrock generator and that it reaches the models you plan to test.
Model ID or aliasFoundation model identifier enabled in your accountConfirm the exact model ID in the Bedrock console for your region, since aliases may map to different versions over time.
BEDROCK_API_KEYCredential issued for calls to Bedrock from your accountConfirm which key type your account issues and which IAM principal or policy it is tied to before using it.
BEDROCK_REGIONAWS region where the model is enabled for your accountConfirm the model is available in the region set here, since the default is us-east-1 and other regions may differ.
Probe run and generationsBillable model invocations, one per attempt against the modelConfirm expected invocation counts with your cost owner before starting, because each attempt is charged per token.
JSONL reportEvidence record of every attempt and its evaluation, stored in your evidence storeConfirm where reports are written, who can read them and how long your retention policy keeps them.
garak.logDebugging log continued across runs, kept with the scan recordConfirm 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.

garak README

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.

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.

FailureLikely cause and checkFix
Missing or wrong BEDROCK_API_KEYThe 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 mismatchBEDROCK_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 foundThe --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 grantedThe 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 hostEgress 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 issuesScans 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-runMany 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.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.