AWS+CLIを使ってIAMユーザーを作成しよう
1.IAMユーザーを定義するjsonファイルを作成する
echo "{ "Path": "/", "UserName": "test-user", "Tags": [ { "Key": "Name", "Value": "cli-test" } ] }" > create-user.json
2.jsonを読み込んでIAMユーザを作成
aws iam create-user --cli-input-json "file://create-user.json"
3.ポリシー用のjsonを作成
echo "{ "UserName": "test-user", "PolicyArn": "arn:aws:iam::aws:policy/AdministratorAccess" }" > iam_user_policy.json
4.ユーザーにポリシーを付与
aws iam attach-user-policy --cli-input-json "file://iam_user_policy.json"
5.ユーザー確認
aws iam get-user --user-name test-user