flint
flint is a small CLI that issues temporary Amazon Bedrock bearer tokens from an AWS profile. It
works like the assume command from granted.dev, but it issues a Bedrock
API key instead of raw AWS credentials.
eval "$(flint my-profile)"
# AWS_BEARER_TOKEN_BEDROCK is now set; the Bedrock CLI and SDKs read it.
aws bedrock-runtime converse --model-id ... --region us-east-1What flint does
A Bedrock short-term API key is not a server-issued resource. It is a SigV4 query-presigned request
against bedrock.amazonaws.com. flint base64-encodes that request and adds the prefix
bedrock-api-key-. The token comes from the credentials your profile resolves to:
- Resolve credentials through the standard AWS configuration chain (static keys, SSO,
assume-role, environment variables). - SigV4 query-presign the
CallWithBearerTokenaction for your region. - Encode the result into the
bedrock-api-key-...&Version=1token format.
The token inherits the permissions of the resolved principal, is locked to the region flint signed
it for, and is valid for the shortest of three values: --duration, 12 hours, and the time left on
the credentials (with a 5-minute floor). flint makes no privileged “issue key” API call — it
derives the token on the client.
Install
# Homebrew (macOS and Linux)
brew install --cask madstone-tech/tap/flint
# Go
go install github.com/madstone-tech/flint/cmd/flint@latestOr download an archive from GitHub Releases and
put flint on your PATH. Confirm the install with flint --version.
Usage
The default output is a shell export line, so you can use it like assume:
eval "$(flint my-profile)"Other modes:
flint --raw my-profile # print the token only
flint --json my-profile # {"token":...,"region":...,"expires":...}
flint --region us-west-2 my-profile # set the region
flint --duration 1h my-profile # set a shorter lifetime (5m–12h)
flint --exec my-profile -- python app.py # run a command with the token in its environmentWith --exec, flint propagates the child command’s exit code, so it acts as a transparent wrapper.
It keeps the token out of your shell history.
Interactive profile picker
Run flint with no profile argument in an interactive terminal. flint opens a filterable picker
listing the profiles from your ~/.aws/config and ~/.aws/credentials files:
flint # pick a profile, then print the export line
eval "$(flint)" # pick a profile and export the token in one stepType part of a profile name to filter, use the arrow keys to move, Enter to select, and Esc to
cancel. flint draws the picker on stderr, so it never corrupts the token on stdout — eval "$(flint)"
stays safe. Without a terminal (a pipe, a script, or CI), flint skips the picker; give a profile
argument, or flint uses the default credential chain.
Shell integration
Add flint’s helpers to your ~/.bashrc or ~/.zshrc:
eval "$(flint shellenv)"This defines two functions. It does not export a token at shell startup, which would freeze a token for up to 12 hours:
bedrock-auth my-profile # mint a token into the current shell, on demand
bedrock-run my-profile -- python app.py # run a command with the token in its environment onlyList the profiles flint can see with flint profiles (alias ls), one per line.
Verifying a token
flint verify checks a token in two tiers.
The structural check runs offline and makes no AWS call. flint decodes the token and confirms
the bedrock-api-key- prefix, the base64 payload, the &Version=1 suffix, the
bedrock.amazonaws.com host, the SigV4 parameters, the region, and the signature window:
flint --raw my-profile | flint verifystructure: valid
region: us-east-1
action: CallWithBearerToken
issued: 2026-10-29T15:00:00Z
expires: 2026-10-30T03:00:00Z (in 11h59m)The live check adds --live. It calls ListFoundationModels with the token to confirm Bedrock
accepts it. The region must match the region flint signed the token for:
flint --raw my-profile | flint verify --live
# live: accepted by Bedrock (HTTP 200) in us-east-1flint reads the token from the positional argument first, then from piped stdin, then from the
AWS_BEARER_TOKEN_BEDROCK environment variable. verify exits non-zero when the token is invalid,
expired, or rejected, so it works in scripts. flint also detects a long-term Bedrock API key and
reports that it handles short-term tokens only.
Logging and exit codes
flint is quiet by default. Pass --verbose for step-by-step diagnostic logs on stderr, and
--log-format json for machine-readable logs. The logs carry only metadata (profile, region,
expiry, output mode), never the token or any secret, so eval "$(flint --verbose my-profile)"
stays safe.
Commands return stable exit codes, so scripts can branch on a failure:
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | generic error |
| 2 | bad invocation (flags or arguments, or no token to verify) |
| 3 | flint could not resolve credentials or a region |
| 4 | the token is invalid, expired, or rejected |
| 130 | the user cancelled (for example, the picker closed) |
An error prints a one-line message, with a hint: line for the next step where it is useful. When
a profile is not signed in, the hint is aws sso login --profile X.
CLI reference
| Command | Description |
|---|---|
flint [profile] | Issue a token; print a shell export line (the default) |
flint verify [token] | Validate a token structurally, or with --live against Bedrock |
flint profiles (alias ls) | List the discovered AWS profiles |
flint shellenv | Print lazy shell helpers for eval "$(flint shellenv)" |
flint version | Print the build metadata |
Flags on the default command:
| Flag | Description |
|---|---|
--raw | Print the token only |
--json | Print {"token":...,"region":...,"expires":...} |
--region <region> | Set the region (otherwise resolved from the profile) |
--duration <dur> | Set the token lifetime, clamped to 5m–12h |
--exec -- <cmd> | Run a command with the token in its environment |
--verbose | Step-by-step diagnostic logs on stderr |
--log-format <text|json> | Choose the log format |
--version | Print build metadata |
verify flag: --live probes Bedrock with ListFoundationModels to confirm acceptance.
Notes
- The Bedrock SDKs and the AWS CLI read the
AWS_BEARER_TOKEN_BEDROCKenvironment variable. - You cannot refresh or extend a token. When a token expires, generate a new one.
- Store tokens in a safe place and do not log them.
--execkeeps the token out of your shell history.
flint is MIT-licensed and maintained in the madstone-tech GitHub org. For issues and feature requests, visit the GitHub repository.