Skip to content

Instantly share code, notes, and snippets.

View philvarner's full-sized avatar
💭
creating bugs

Phil Varner philvarner

💭
creating bugs
View GitHub Profile
@jkeifer
jkeifer / set-aws-secrets.sh
Last active September 20, 2023 14:51
Shell function to set/unset AWS session env vars from configured profiles (with SSO support)
set-aws-secrets() {
local profile_name="${1:?"must provide profile name"}"
local creds
creds=$(aws configure export-credentials --profile "${profile_name}")
rc=$?
if [ "${rc}" -eq 255 ]; then
# using sso and not logged in
local sso_session="$(aws configure get sso_session --profile "${profile_name}")"