Last active
October 14, 2017 10:15
-
-
Save sandeepkunkunuru/1023d9f4a2594e33b5c6cd06a0a6a011 to your computer and use it in GitHub Desktop.
awless : User Creation
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
#!/usr/bin/env bash | |
set -ex | |
AWS_DEFAULT_REGION=xxxx | |
AWS_DEFAULT_PROFILE=xxxx | |
awless config set aws.region ${AWS_DEFAULT_REGION} | |
awless config set aws.profile ${AWS_DEFAULT_PROFILE} | |
SCRIPT_HOME=/home/xxx/scripts/awless | |
DATA_HOME=/home/xxx/cloud/data | |
function join_by { local IFS="$1"; shift; echo "$*"; } |
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
create user name={name} | |
create accesskey user={name} | |
attach user name={name} group={group} | |
create loginprofile username={name} password={password} |
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
#!/usr/bin/env bash | |
source ../env.sh | |
declare -a users=() | |
declare -a groups=() | |
## now loop through the above array | |
for i in ${!users[*]}; do | |
echo "Creating user account for ---> ${users[${i}]} " | |
random_string=`tr -cd '[:alnum:]' < /dev/urandom | fold -w20 | head -n1` | |
awless run ${SCRIPT_HOME}/users.aws name=${users[${i}]} group=${groups[${i}]} password=${random_string} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment