LoginSignup
1
1

More than 5 years have passed since last update.

[JAWS-UG CLI] Cognito #1 識別子プールの作成

Last updated at Posted at 2015-09-28

前提条件

Cognito (Identity)への権限

  • Cognito (Identity)に対してフル権限があること。

AWS CLIのバージョン

  • 以下のバージョンで動作確認済

    • AWS CLI 1.8.3
コマンド
aws --version
結果(例)
      aws-cli/1.8.3 Python/2.7.5 Darwin/13.4.0

0 準備

0.1. 識別子プール名の決定

変数の設定
COGNITO_IDPOOL_NAME='s3post'

0.2. 結果表示上限の設定

list-identity-poolsコマンドで必須項目のため、設定します。

変数の設定
COGNITO_MAX_RESULT='60'

0.3. 同名の識別子プールの不存在確認

コマンド
aws cognito-identity list-identity-pools \
        --max-results ${COGNITO_MAX_RESULT} \
        --query "IdentityPools[?IdentityPoolName==\`${COGNITO_IDPOOL_NAME}\`].IdentityPoolId" \
        --output text
結果
      (戻り値なし)

1. 識別子プールの作成

1.1. 識別子プールの作成

変数の確認
cat << ETX

        COGNITO_IDPOOL_NAME: ${COGNITO_IDPOOL_NAME} \

ETX
コマンド
aws cognito-identity create-identity-pool \
        --identity-pool-name ${COGNITO_IDPOOL_NAME} \
        --allow-unauthenticated-identities
結果(例)
      {
        "IdentityPoolId": "ap-northeast-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "AllowUnauthenticatedIdentities": true,
        "IdentityPoolName": "s3post"
      }

1.2. 識別子プールIDの取得

コマンド
COGNITO_IDPOOL_ID=$( \
        aws cognito-identity list-identity-pools \
          --max-results ${COGNITO_MAX_RESULT} \
          --query "IdentityPools[?IdentityPoolName==\`${COGNITO_IDPOOL_NAME}\`].IdentityPoolId" --output text ) \
        && echo ${COGNITO_IDPOOL_ID}
結果(例)
      ap-northeast-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

1.3. 識別子プールの確認

コマンド
aws cognito-identity describe-identity-pool \
        --identity-pool-id ${COGNITO_IDPOOL_ID}
結果(例)
      {
        "IdentityPoolId": "ap-northeast-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "AllowUnauthenticatedIdentities": true,
        "IdentityPoolName": "s3post"
      }

完了

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1