Skip to content

AWS STS

The aws-sts lease backend calls AWS STS AssumeRole to create short-lived AWS credentials from a long-lived IAM user or role.

Configuration

toml
[leases.aws]
type = "aws-sts"
region = "us-east-1"
role_arn = "arn:aws:iam::123456789012:role/dev-role"
duration = "1h"
FieldRequiredDescription
regionYesAWS region for STS endpoint
role_arnYesARN of the IAM role to assume
profileNoAWS profile name (from ~/.aws/config)
endpointNoCustom STS endpoint URL (for LocalStack, etc.)
durationNoLease duration (e.g., "1h", "30m"; default: "15m")

Prerequisites

The backend needs AWS credentials to call sts:AssumeRole. Before creating a lease, fnox checks that at least one of these is available:

  1. AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY environment variables (plus AWS_SESSION_TOKEN for temporary credentials)
  2. AWS_PROFILE or AWS_SSO_SESSION environment variables, or the profile config field
  3. ~/.aws/credentials or ~/.aws/config files

The AWS SDK's default credential chain then decides which of them is used. If none are found, fnox prints:

text
AWS credentials not found. Run 'aws sso login' or set AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY.

Credentials produced

Environment VariableDescription
AWS_ACCESS_KEY_IDTemporary access key
AWS_SECRET_ACCESS_KEYTemporary secret key
AWS_SESSION_TOKENSession token

These replace any long-lived credentials in the subprocess environment.

Limits

  • Max duration: 12 hours (the role's own maximum session duration is configured in IAM and may be lower)
  • Revocation: No-op — credentials expire automatically via AWS TTL

Examples

With stored credentials

toml
[providers.op]
type = "1password"
vault = "Development"

[secrets]
AWS_ACCESS_KEY_ID = { provider = "op", value = "AWS IAM/access key", env = false }
AWS_SECRET_ACCESS_KEY = { provider = "op", value = "AWS IAM/secret key", env = false }

[leases.aws]
type = "aws-sts"
region = "us-east-1"
role_arn = "arn:aws:iam::123456789012:role/dev-role"
duration = "1h"
bash
fnox exec -- aws s3 ls

With interactive prompting

toml
[leases.aws]
type = "aws-sts"
region = "us-east-1"
role_arn = "arn:aws:iam::123456789012:role/dev-role"
duration = "1h"
bash
fnox lease create aws -i

With SSO

If you use AWS SSO, no stored credentials are needed — just log in first:

bash
aws sso login --profile my-sso-profile

# Select the same profile used for login
AWS_PROFILE=my-sso-profile fnox exec -- aws s3 ls

See also

MIT LicenseCopyright © 2026jdx.dev