AWS credential process helper
Knox is a powerful utility designed to simplify and streamline the management of AWS credentials. Whether you're frequently switching between different AWS profiles or handling credential issuance in an SSO environment, Knox provides a straightforward CLI tool to manage these tasks effortlessly.
Key features include:
- Profile Management: Commands like
knox select
,knox last-used
, andknox clean
make it easy to navigate and manipulate your AWS credentials. - Seamless Configuration Handling: Knox reads your
~/.aws/config
file to get configured SSO sessions and saves used role credentials into~/.aws/knox
for future use. - SSM Session Management: The
knox connect
command simplifies the process of starting an SSM session with an EC2 instance. This feature is particularly useful for users who frequently SSH into EC2 instances using SSM Session Manager. With Knox, you can easily switch between different AWS profiles and start an interactive session with a specific instance using a single command.
Knox helps maintain efficient and secure AWS credential management, making it an invaluable tool for your development, staging, and production environments.
Debian
curl -sL -o ./aws-knox_3.2.0_amd64.deb https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox_3.2.0_amd64.deb
sudo dpkg -i ./aws-knox_3.2.0_amd64.deb
rm ./aws-knox_3.2.0_amd64.deb
curl -sL -o ./aws-knox_3.2.0_arm64.deb https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox_3.2.0_arm64.deb
sudo dpkg -i ./aws-knox_3.2.0_arm64.deb
rm ./aws-knox_3.2.0_arm64.deb
Red Hat
rpm -i https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox-3.2.0-1.aarch64.rpm
rpm -i https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox-3.2.0-1.x86_64.rpm
Alpine
curl -sL -o ./aws-knox_3.2.0_aarch64.apk https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox_3.2.0_aarch64.apk
apk add --allow-untrusted ./aws-knox_3.2.0_aarch64.apk
rm ./aws-knox_3.2.0_aarch64.apk
curl -sL -o ./aws-knox_3.2.0_x86_64.apk https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox_3.2.0_x86_64.apk
apk add --allow-untrusted ./aws-knox_3.2.0_x86_64.apk
rm ./aws-knox_3.2.0_x86_64.apk
Arch
curl -sL -o ./aws-knox-3.2.0-1-aarch64.pkg.tar.zst https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox-3.2.0-1-aarch64.pkg.tar.zst
sudo pacman -U ./aws-knox-3.2.0-1-aarch64.pkg.tar.zst
rm ./aws-knox-3.2.0-1-aarch64.pkg.tar.zst
curl -sL -o ./aws-knox-3.2.0-1-x86_64.pkg.tar.zst https://github.com/null93/aws-knox/releases/download/3.2.0/aws-knox-3.2.0-1-x86_64.pkg.tar.zst
sudo pacman -U ./aws-knox-3.2.0-1-x86_64.pkg.tar.zst
rm ./aws-knox-3.2.0-1-x86_64.pkg.tar.zst
Recommended configuration for ~/.aws/config
, feel free to swap out the commands to suit your needs:
[default]
region = us-east-1
output = json
credential_process = knox select
[profile last]
region = us-east-1
output = json
credential_process = knox last-used
[sso-session development-sso]
sso_region = us-east-1
sso_registration_scopes = sso:account:access
sso_start_url = https://d-2222222222.awsapps.com/start
[sso-session staging-sso]
sso_region = us-east-1
sso_registration_scopes = sso:account:access
sso_start_url = https://d-1111111111.awsapps.com/start
[sso-session production-sso]
sso_region = us-east-1
sso_registration_scopes = sso:account:access
sso_start_url = https://d-0000000000.awsapps.com/start
The Knox config file is located at ~/.aws/knox/config.yaml
. Below are the configuration options available:
Default value is 0
(root).
Default user ID for SSM sessions initiated with the knox connect
command.
Default value is 10
.
Maximum number of items to display when listing profiles or options.
Default value is false
.
When selecting credentials, specifies whether to default to showing the cached role credentials first.
Default value is {}
.
Account aliases for AWS accounts. Key is the account ID, and value is the account alias.
Default value is ["Instance Type", "Private IP", "Public IP", "Name"]
.
Specify "Instance Type", "Private IP", or "Public IP" to display when selecting an instance. All other values are extracted from tags.
Default value is "fuzzy"
.
You can specify "fuzzy"
for fuzzy search. All other values will be treated as "exact"
.