Skip to content

Instantly share code, notes, and snippets.

@maimai-swap
Last active August 29, 2015 14:17
Show Gist options
  • Save maimai-swap/0378202e6fa651fa0545 to your computer and use it in GitHub Desktop.
Save maimai-swap/0378202e6fa651fa0545 to your computer and use it in GitHub Desktop.
AWS cliでiamユーザー作ってグループに入れる。
#!/bin/sh
# 環境のaws cli profile
AWS_PROFILE_NAME=$1
# 環境のaws cli profileをアカウント名のsuffixにする
AWS_SYSTEM_ID=$AWS_PROFILE_NAME
# ユーザー名
USER_NAME=$2
# パスワード
PASSWORD=$3
# グループ名
GROUP_NAME=$4
aws configure list --profile $AWS_PROFILE_NAME
# aws iam list-groups --profile $AWS_PROFILE_NAME
aws iam create-user --user-name $USER_NAME@$AWS_SYSTEM_ID --path / --profile $AWS_PROFILE_NAME
aws iam create-login-profile --user-name $USER_NAME@$AWS_SYSTEM_ID --password $PASSWORD --password-reset-required --profile $AWS_PROFILE_NAME
aws iam add-user-to-group --group-name $GROUP_NAME --user-name $USER_NAME@$AWS_SYSTEM_ID --profile $AWS_PROFILE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment