Skip to content

Instantly share code, notes, and snippets.

@neilkuan
Created September 29, 2020 02:28
Show Gist options
  • Save neilkuan/f1351b899b334699b67abdb62e21340a to your computer and use it in GitHub Desktop.
Save neilkuan/f1351b899b334699b67abdb62e21340a to your computer and use it in GitHub Desktop.
Use AWS CLI to create Super User , so fast !!!
#!/bin/bash
set pipefail
if [ $# != 2 ]
then
echo "Please give username and password \n ./init-super-user.sh tempuser 2wsx#EDCv ..."
exit 1
fi
USER_NAME=$1
PASS_WORD=$2
aws iam create-user --user-name $USER_NAME
cat > create-login-profile.json << EOF
{
"UserName": "$USER_NAME",
"Password": "$PASS_WORD",
"PasswordResetRequired": false
}
EOF
aws iam create-login-profile --cli-input-json file://create-login-profile.json
aws iam attach-user-policy --user-name $USER_NAME --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
cat create-login-profile.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment