mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-13 09:42:27 +00:00
[shell-common] Add profile display name to awslogin/logout command
This commit is contained in:
@@ -98,13 +98,28 @@ function awslogin() {
|
|||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
echo "AWS login successful. Credentials exported."
|
echo "AWS login successful. Credentials exported."
|
||||||
|
export AWS_PROFILE_ACTIVE="$profile"
|
||||||
|
if [[ -n "$profile" ]]; then
|
||||||
|
export AWS_PROFILE_DISPLAY="[aws: $profile]"
|
||||||
|
else
|
||||||
|
export AWS_PROFILE_DISPLAY=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function awslogout() {
|
||||||
|
unset AWS_PROFILE_ACTIVE
|
||||||
|
unset AWS_ACCESS_KEY_ID
|
||||||
|
unset AWS_SECRET_ACCESS_KEY
|
||||||
|
unset AWS_SESSION_TOKEN
|
||||||
|
export AWS_PROFILE_DISPLAY=""
|
||||||
|
echo "AWS profile and credentials cleared."
|
||||||
}
|
}
|
||||||
|
|
||||||
# easy access to SSH
|
# easy access to SSH
|
||||||
function awsssh() {
|
function awsssh() {
|
||||||
local profile=""
|
local profile=""
|
||||||
local region=""
|
local region=""
|
||||||
local username="ec2-user"
|
local username="ansible"
|
||||||
local search=""
|
local search=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
|||||||
Reference in New Issue
Block a user