Skip to content

Instantly share code, notes, and snippets.

@maimai-swap
Last active August 29, 2015 14:18
Show Gist options
  • Save maimai-swap/59d42901988e30a6408c to your computer and use it in GitHub Desktop.
Save maimai-swap/59d42901988e30a6408c to your computer and use it in GitHub Desktop.
aws cli でのiamユーザー作成 ref: http://qiita.com/maimai-swap/items/749642b54160443e6a1f
AWS_PROFILE_NAME=test # 作りたいところのプロフィール名
USER_NAME=test-user # ユーザー名
PASSWORD=iD8Bkcd4-JrxUXQ5v # 初期パスワード
GROUP_NAME=developer # グループ名 先にiamで作っとく必要あります。
aws iam create-user \
--user-name $USER_NAME \
--path / \
--profile $AWS_PROFILE_NAME
{
"User": {
"UserName": "ユーザー名",
"Path": "/",
"CreateDate": "2015-04-03T04:00:19.899Z",
"UserId": "文字列",
"Arn": "arn:aws:iam::AWSアカウントID:user/ユーザー名"
}
}
aws iam create-login-profile \
--user-name $USER_NAME \
--password $PASSWORD \
--password-reset-required \
--profile $AWS_PROFILE_NAME
{
"LoginProfile": {
"UserName": "ユーザー名",
"CreateDate": "2015-04-03T04:00:21.142Z",
"PasswordResetRequired": true
}
}
aws iam add-user-to-group \
--group-name $GROUP_NAME \
--user-name $USER_NAME \
--profile $AWS_PROFILE_NAME
aws iam create-access-key \
--user-name $USER_NAME \
--profile $AWS_PROFILE_NAME
{
"AccessKey": {
"UserName": "ユーザー名",
"Status": "Active",
"CreateDate": "2015-04-03T04:10:43.927Z",
"SecretAccessKey": "シークレットキー",
"AccessKeyId": "アクセスキー"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment