Last active
September 8, 2025 12:51
-
-
Save hermannolafs/6f65d8a5f07d342e84ed4c5c89d27869 to your computer and use it in GitHub Desktop.
Fish functions with AWK sprinkles for AWS cli shit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ecr_profile_login -d "ECR docker login using current profile" | |
| aws ecr get-login-password | docker login --username AWS --password-stdin (aws sts get-caller-identity --query Account --output text).dkr.ecr.(aws configure get region).amazonaws.com | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function switch_aws_profile -d "sets \$AWS_PROFILE from available profiles" | |
| set -l profile_choice ( | |
| awk -F '[][]' '/^\[profile / { | |
| profile_name = $2; | |
| sub(/^profile /, "", profile_name); | |
| print profile_name; | |
| } END { | |
| print "UNSET"; | |
| }' ~/.aws/config | fzf) | |
| test -n "$profile_choice"; or return | |
| if test "$profile_choice" = "UNSET" | |
| set -e AWS_PROFILE | |
| echo "AWS_PROFILE unset" | |
| return | |
| end | |
| set -gx AWS_PROFILE "$profile_choice" | |
| echo "AWS_PROFILE=$AWS_PROFILE" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment