Skip to content

Instantly share code, notes, and snippets.

View pilasguru's full-sized avatar

Rodolfo Pilas pilasguru

View GitHub Profile
@pilasguru
pilasguru / delete_iam_user.sh
Created August 25, 2018 19:19 — forked from kgmoore431/delete_iam_user.sh
Delete an IAM user with AWS CLI
#!/bin/bash
user_name="$1"
echo "Removing user: ${user_name}"
echo "Deleting Access Keys:"
keys=("$(aws iam list-access-keys --user-name "${user_name}" | jq -r '.AccessKeyMetadata[] | .AccessKeyId')")
if [[ "${#keys}" -gt "0" ]]; then
# shellcheck disable=SC2068