AWS Credentials
Overview
PyBritive provides four ways to deliver temporary AWS credentials to your tooling. Each mode suits a different workflow — from one-off terminal sessions to fully automated CLI integrations.
What you’ll learn:
- How to export AWS credentials as environment variables
- How to write credentials directly to the AWS credentials file
- How to configure
credential_processso the AWS CLI fetches credentials automatically - How to open the AWS console using temporary programmatic credentials
- How to auto-renew credentials before they expire
Before You Begin
- PyBritive installed and authenticated — see Getting Started
- AWS CLI installed — run
aws --versionto check - At least one AWS profile available for checkout — see Listing Your Access
Note: Profile names in this tutorial are from the Britive demo tenant. Replace them with your own profile names from
pybritive ls profiles.
Get AWS Credentials
Export credentials as environment variables
The env mode outputs temporary AWS credentials as shell export statements. Use eval to load them directly into your current terminal session.
Linux/macOS:
eval $(pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode env)Verify the credentials are active:
aws sts get-caller-identityWindows Command Prompt:
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode env-wincmdWindows PowerShell:
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode env-winpsCredentials set via environment variables are active only for the current terminal session. Close the terminal or check in to remove them.
Write credentials to the AWS credentials file
The integrate mode writes temporary credentials directly to ~/.aws/credentials, making them available to the AWS CLI and any tool that reads the standard credentials file.
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode integrateTo write to a non-default credentials file:
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode integrate \
--aws-credentials-file ~/.aws/credentials-britiveVerify the credentials were written:
aws sts get-caller-identityConfigure credential_process for automatic credentials
credential_process is an AWS CLI feature that delegates credential fetching to an external command. Configuring PyBritive as your credential_process means the AWS CLI automatically calls PyBritive to retrieve fresh credentials whenever it needs them — no manual checkout required.
Set up a profile alias
First create an alias for the profile you want to automate. Aliases reduce latency and simplify the config entry:
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --alias s3-adminConfigure ~/.aws/config
Add a profile entry to ~/.aws/config using pybritive-aws-cred-process (a lightweight helper that reduces credential retrieval latency by approximately 50%):
[profile s3-admin]
credential_process=pybritive-aws-cred-process --profile s3-admin
region=us-east-1You can also use the full profile path instead of an alias:
[profile s3-admin]
credential_process=pybritive-aws-cred-process --profile "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin"
region=us-east-1Use the profile
Any AWS CLI command that references this profile will automatically fetch fresh credentials from Britive:
aws s3 ls --profile s3-adminYou can also set it as your default profile for the session:
export AWS_PROFILE=s3-admin
aws s3 lsCheck out console access
The console mode checks out console access for the profile rather than programmatic credentials. Once checked out, the console button becomes available in the Britive UI where you can click it to launch the AWS console.
pybritive checkout "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --mode consoleTo launch the AWS console, log in to the Britive UI, navigate to your checked out profiles, and click the console button.
When you are done, check in the console access:
pybritive checkin "AWS SE Organization/696226360299 (se-demo)/S3 Bucket Admin" --consoleAuto-renew expiring credentials
The --force-renew flag checks whether your current credentials expire within a specified number of minutes. If they do, PyBritive automatically checks in and issues fresh credentials.
pybritive checkout s3-admin --mode integrate --force-renew 15This is useful in long-running scripts where you want to ensure credentials remain valid without manual intervention.
Troubleshoot
| Symptom | Cause | Fix |
|---|---|---|
aws: command not found | AWS CLI not installed | Install the AWS CLI before using these modes |
Unable to locate credentials | env variables not loaded | Use eval $(pybritive checkout ... --mode env) not just printing them |
credential_process returns no credentials | Alias not found | Re-run the checkout with --alias to recreate the alias |
| Console opens but shows access denied | Profile lacks console permissions | Contact your Britive administrator |
| Credentials expire mid-script | --force-renew not set | Add --force-renew 15 to your checkout command |
ValueError: no checked out profile found | Session already expired or previously checked in | The profile is no longer active — run pybritive checkout again to start a new session |
Next Steps
- GCP Credentials — authenticate to GCP using
gcloudauthandgcloudauthexecmodes - Approval Workflows — automate access requests for profiles that require approval