Created
September 29, 2020 02:28
-
-
Save neilkuan/f1351b899b334699b67abdb62e21340a to your computer and use it in GitHub Desktop.
Use AWS CLI to create Super User , so fast !!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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