aws2-wrap
raw JSON → 1.4.0 verified Fri May 01 auth: no python
A wrapper for executing a command with AWS CLI v2 and SSO. Current version 1.4.0, requires Python >=3.8. Released irregularly as needed.
pip install aws2-wrap Common errors
error ModuleNotFoundError: No module named 'aws2-wrap' ↓
cause The package is not installed or installed in a different environment.
fix
Run
pip install aws2-wrap in the correct Python environment. error aws2-wrap: error: argument --profile: expected one argument ↓
cause Missing profile argument when using CLI tool.
fix
Use
aws2-wrap --profile <profile-name> <command> or use the Python API with profile parameter. error The SSO session associated with this profile is invalid. Please run 'aws sso login'. ↓
cause The SSO token is expired or not cached.
fix
Run
aws sso login --profile <profile-name> and try again. Warnings
gotcha The AWS CLI v2 must be installed and in PATH. aws2-wrap does not bundle it. ↓
fix Install AWS CLI v2 separately via official instructions.
gotcha The profile must already have valid SSO credentials cached (e.g., from `aws sso login`). ↓
fix Run `aws sso login --profile <profile-name>` before using aws2-wrap.
deprecated The previous CLI-style usage via `aws2-wrap` command may be removed or changed in future versions. Prefer the Python API. ↓
fix Use `from aws2-wrap import Aws2Wrap` instead of calling the command-line tool.
Imports
- Aws2Wrap
from aws2-wrap import Aws2Wrap - ProcessError
from aws2-wrap import ProcessError
Quickstart
from aws2-wrap import Aws2Wrap
# Use with AWS SSO profile
aws = Aws2Wrap(profile='my-sso-profile')
# Execute an AWS CLI command
result = aws.run(['s3', 'ls'])
print(result.stdout)