Skip to content

Conversation

@minjcho
Copy link

@minjcho minjcho commented Jan 16, 2026

Issue: #9670

Description of changes:

  • Add a new output format, --format fish, to aws configure export-credentials.
  • Fish shell does not support export VAR=value; it uses set -gx VAR value.
This change lets Fish users apply exported credentials directly without extra conversion.

Usage:

aws configure export-credentials --format fish | source

Example output:

set -gx AWS_ACCESS_KEY_ID AKIAIOSFODNN7EXAMPLE
set -gx AWS_SECRET_ACCESS_KEY wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
set -gx AWS_SESSION_TOKEN token
set -gx AWS_CREDENTIAL_EXPIRATION 2023-01-01T00:00:00Z

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copilot AI review requested due to automatic review settings January 16, 2026 07:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds Fish shell support to the aws configure export-credentials command, allowing Fish shell users to export AWS credentials in a format compatible with their shell.

Changes:

  • Added a new FishShellFormatter class that outputs credentials using Fish shell's set -gx syntax
  • Updated the SUPPORTED_FORMATS dictionary to include the new Fish formatter
  • Added comprehensive unit tests for the Fish shell formatter covering both static and temporary credentials

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
awscli/customizations/configure/exportcreds.py Implements FishShellFormatter class and registers it in SUPPORTED_FORMATS
tests/unit/customizations/configure/test_exportcreds.py Adds test cases for FishShellFormatter with expected output formats

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

'Display credentials as Fish shell environment variables: '
'``set -gx AWS_ACCESS_KEY_ID EXAMPLE``'
)
_VAR_FORMAT = 'set -gx {var_name} {var_value}'
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Fish shell formatter should quote the variable value to handle credentials that may contain special characters (spaces, quotes, etc.). Similar to PowerShell's approach, the format should be 'set -gx {var_name} "{var_value}"' to ensure values with spaces or special characters are properly handled. While AWS credential values rarely contain such characters, session tokens could potentially include them, and proper quoting ensures robustness.

Suggested change
_VAR_FORMAT = 'set -gx {var_name} {var_value}'
_VAR_FORMAT = 'set -gx {var_name} "{var_value}"'

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +124
'set -gx AWS_ACCESS_KEY_ID access_key\n'
'set -gx AWS_SECRET_ACCESS_KEY secret_key\n'
),
(
'set -gx AWS_ACCESS_KEY_ID access_key\n'
'set -gx AWS_SECRET_ACCESS_KEY secret_key\n'
'set -gx AWS_SESSION_TOKEN token\n'
'set -gx AWS_CREDENTIAL_EXPIRATION 2023-01-01T00:00:00Z\n'
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected test output should include quotes around the values to match the corrected Fish shell format. The format should be 'set -gx AWS_ACCESS_KEY_ID "access_key"' instead of 'set -gx AWS_ACCESS_KEY_ID access_key' to properly handle values with special characters.

Suggested change
'set -gx AWS_ACCESS_KEY_ID access_key\n'
'set -gx AWS_SECRET_ACCESS_KEY secret_key\n'
),
(
'set -gx AWS_ACCESS_KEY_ID access_key\n'
'set -gx AWS_SECRET_ACCESS_KEY secret_key\n'
'set -gx AWS_SESSION_TOKEN token\n'
'set -gx AWS_CREDENTIAL_EXPIRATION 2023-01-01T00:00:00Z\n'
'set -gx AWS_ACCESS_KEY_ID "access_key"\n'
'set -gx AWS_SECRET_ACCESS_KEY "secret_key"\n'
),
(
'set -gx AWS_ACCESS_KEY_ID "access_key"\n'
'set -gx AWS_SECRET_ACCESS_KEY "secret_key"\n'
'set -gx AWS_SESSION_TOKEN "token"\n'
'set -gx AWS_CREDENTIAL_EXPIRATION "2023-01-01T00:00:00Z"\n'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant