Skip to content

feat: aws helpers in zshrc - #8

Open
body-clock wants to merge 1 commit into
mainfrom
feat/zsh-aws-helpers
Open

body-clock wants to merge 1 commit into
mainfrom
feat/zsh-aws-helpers

Conversation

@body-clock

@body-clock body-clock commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner
  • aws-profile [name] — print or set AWS_PROFILE, so switching identity mid-session does not need a hand-typed export.
  • aws-whoami — sts get-caller-identity in yaml, to confirm which identity a profile actually resolves to before touching anything.
  • source ~/.cdl-ssm-util/session-zsh-snippet.sh — session helper that ships with the cdl-ssm-util checkout.

Review notes

  • One thing changed while staging this: the alias was written in the space form, alias aws-whoami "aws --output yaml sts get-caller-identity", which zsh rejects — the definition exits 1 and no alias is created (zsh -f -c 'alias foo "echo hi"'; echo $? → 1; alias foo prints nothing). It is alias aws-whoami="..." here, verified with alias aws-whoami after sourcing the file. Push back if the space form was deliberate.
  • ~/.cdl-ssm-util is not a stow package in this repo, so the source line is a hard dependency on a directory that only exists on this machine: on a fresh machine zsh reports a missing file at startup. Left as written — say the word and I will guard it with [[ -f ... ]].

Verification

zsh -n clean; sourcing zsh/.zshrc into a zsh -c gives aws-profile as a function, prints an empty value when AWS_PROFILE is unset, sets and prints it otherwise.

Overlap with an open PR

Open PR #2 also edits zsh/.zshrc (sources ~/.config/fzf/tinted.sh just above the p10k block this PR works below). Different lines, but close enough that the second one to land will want a rebase.

- aws-profile [name]: print or set AWS_PROFILE, so switching identity mid
  session does not need a hand-typed export line.
- aws-whoami: sts get-caller-identity in yaml, to confirm which identity a
  profile actually resolves to before touching anything.
- source ~/.cdl-ssm-util/session-zsh-snippet.sh: session helper that ships with
  the cdl-ssm-util checkout.

Depends on ~/.cdl-ssm-util existing. It is not a stow package in this repo, so
on a machine without that checkout zsh reports a missing file at startup.

The alias was written in the space form (`alias aws-whoami "..."`), which zsh
rejects: the definition exits 1 and no alias is created. It is `name="value"`
here, verified with `alias aws-whoami` after sourcing.
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