Skip to content

Instantly share code, notes, and snippets.

View math280h's full-sized avatar
:shipit:
I code.... I think...

Mathias V. Nielsen math280h

:shipit:
I code.... I think...
View GitHub Profile
@math280h
math280h / delete_iam_user.sh
Created February 7, 2022 17:56 — forked from kgmoore431/delete_iam_user.sh
Delete an IAM user with AWS CLI
#!/bin/bash
profile="$1"
user_name="$2"
echo "Removing user: ${user_name}"
echo "Deleting Access Keys:"
keys=("$(aws iam list-access-keys --user-name "${user_name}" --profile "${profile}" | jq -r '.AccessKeyMetadata[] | .AccessKeyId')")
if [[ "${#keys}" -gt "0" ]]; then