Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # 1. Creates an IAM user account in AWS
  2. # 2. Randomly generates a password for the account using apg
  3. # 3. Adds the user to the Administrators group
  4. # 4. Creates a login profile for the user (set password and set flag to force user to reset password upon initial logon)
  5.  
  6. #!/bin/bash
  7.  
  8. if [ $# -eq 0 ]; then
  9. echo "Usage: $0 <username>"
  10. exit 1
  11. fi
  12.  
  13. USERNAME=$1
  14.  
  15. #Generate random password
  16. PASSWD=$(apg -n 1 -m 12 -x 12 -M SNCL -c cl_seed -a 1)
  17.  
  18. aws iam create-user --user-name $USERNAME
  19. aws iam add-user-to-group --group-name Administrators --user-name $USERNAME
  20. aws iam create-login-profile --user-name $USERNAME --password $PASSWD --password-reset-required
  21.  
  22. echo Password: $PASSWD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement