Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Created November 30, 2021 05:58
Show Gist options
  • Save heiwa4126/c93c557b16d10dc5da03ef22e121b951 to your computer and use it in GitHub Desktop.
Save heiwa4126/c93c557b16d10dc5da03ef22e121b951 to your computer and use it in GitHub Desktop.
USER1=Former21 # ←ここを好きなユーザ名に変えてください
aws iam create-user --user-name $USER1
aws iam attach-user-policy --user-name $USER1 --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess
aws iam create-access-key --user-name $USER1
@heiwa4126
Copy link
Author

AWSのテナントに読み込み専用のAPI用ユーザを作成するときに、ポータルのUIから作ると結構めんどくさいので(特にReadOnlyAccessが一番下でなかなか出てこない)、これをAWS CloudShellから実行すると楽。

最後に以下のようなJSONが表示されるので、

{
    "AccessKey": {
        "UserName": "Former21",
        "AccessKeyId": "AKXXXXXXXXXXXXXXXXXX",
        "Status": "Active",
        "SecretAccessKey": "XXXXxXXXxxxXXXXxxxXXXXXXXxxxXXXxXxXXXXXXX",
        "CreateDate": "2021-13-57T05:67:89+00:00"
    }
}

AccessKeyIdとSecretAccessKeyをメモしておく。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment