ハンズオン(簡易版): IAM Identity Center基礎

クリーンアップ3. IdentityStoreグループの削除 (handson-cli-iic-group)

手順の目的

IdentityStoreグループ名"handson-cli-iic-group"を削除します。

設定値の指定

手順に必要な設定値を変数に格納をします。

0. リージョン

リージョンを指定します。

環境変数の設定:

export AWS_DEFAULT_REGION='ap-northeast-1'

1. IdentityStoreグループ表示名

IdentityStoreグループの表示名を指定します。

変数の設定:

IDENTITYSTORE_GROUP_DISPLAY_NAME='handson-cli-iic-group'

設定値の確認

各変数に正しい設定値が格納されていることを確認します。

変数の確認:

cat << END

  # 0. AWS_DEFAULT_REGION:"ap-northeast-1"
       AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}"

  # 1. IDENTITYSTORE_GROUP_DISPLAY_NAME:"handson-cli-iic-group"
       IDENTITYSTORE_GROUP_DISPLAY_NAME="${IDENTITYSTORE_GROUP_DISPLAY_NAME}"

END

各変数について、上の行と下の行の値の内容もしくは形式が同じであることを確認します。 もし異なる場合は、それぞれの手順番号に戻って変数の設定を行います。

処理の実行

IdentityStore IDを取得します。

コマンド:

sso_admin_identity_store_id=$( \
  aws sso-admin list-instances \
    --query "Instances[].IdentityStoreId" \
    --output text \
) \
  && echo ${sso_admin_identity_store_id}

結果(例):

d-xxxxxxxxxx

IdentityStoreグループのIDを取得します。

コマンド:

identitystore_group_id=$( \
  aws identitystore get-group-id \
    --identity-store-id ${sso_admin_identity_store_id} \
    --alternate-identifier "{\"UniqueAttribute\":{\"AttributePath\":\"displayName\",\"AttributeValue\":\"${IDENTITYSTORE_GROUP_DISPLAY_NAME}\"}}" \
  --query "GroupId" \
  --output text \
) \
  && echo ${identitystore_group_id}

結果(例):

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

IdentityStoreグループの削除

IdentityStoreグループを削除します。

変数の確認:

cat << END

  # sso_admin_identity_store_id:"d-xxxxxxxxxx"
    sso_admin_identity_store_id="${sso_admin_identity_store_id}"
  # identitystore_group_id:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    identitystore_group_id="${identitystore_group_id}"

END

コマンド:

aws identitystore delete-group \
  --identity-store-id ${sso_admin_identity_store_id} \
  --group-id ${identitystore_group_id}

結果(例):

(出力なし)

完了確認

「IdentityStoreグループ名"handson-cli-iic-group"が存在しない。」ことを確認します。

コマンド:

aws identitystore list-groups \
  --identity-store-id ${sso_admin_identity_store_id} \
  --query "Groups[?DisplayName == \`${IDENTITYSTORE_GROUP_DISPLAY_NAME}\`].DisplayName" \
  --output text

結果(例):

(出力なし)

手順の完了

(参考) マネジメントコンソールの確認

  • IAM Identity Centerダッシュボード ( https://console.aws.amazon.com/singlesignon/home )にアクセスします。

  • 左ペイン "グループ"をクリックします。

  • 検索フォームにグループ名"handson-cli-iic-group"を入力します。

  • グループ名"handson-cli-iic-group"が表示されなければ正常です。