IdentityStoreユーザー名"ichi"を削除します。
手順に必要な設定値を変数に格納をします。
リージョンを指定します。
環境変数の設定: export AWS_DEFAULT_REGION='ap-northeast-1'
環境変数の設定:
export AWS_DEFAULT_REGION='ap-northeast-1'
一時ファイルを指定します。
変数の設定: DIR_TMP="${HOME}/environment/tmp-handson-cli-iic" 変数の設定: FILE_TMP="${DIR_TMP}/handson-cli-iic-user.tmp" \ && echo ${FILE_TMP} 結果(例): ${HOME}/environment/tmp-handson-cli-iic/handson-cli-iic-user.tmp
変数の設定:
DIR_TMP="${HOME}/environment/tmp-handson-cli-iic"
FILE_TMP="${DIR_TMP}/handson-cli-iic-user.tmp" \ && echo ${FILE_TMP}
結果(例):
${HOME}/environment/tmp-handson-cli-iic/handson-cli-iic-user.tmp
一時ファイルをドットコマンドで読み込みます。
コマンド: . ${FILE_TMP}
コマンド:
. ${FILE_TMP}
IdentityStoreユーザー名を指定します。
変数の設定: IDENTITYSTORE_USER_NAME="${USER_NAME}" \ && echo ${IDENTITYSTORE_USER_NAME} 結果(例): ichi
IDENTITYSTORE_USER_NAME="${USER_NAME}" \ && echo ${IDENTITYSTORE_USER_NAME}
ichi
各変数に正しい設定値が格納されていることを確認します。
変数の確認: cat << END # 0. AWS_DEFAULT_REGION:"ap-northeast-1" AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" # 1. IDENTITYSTORE_USER_NAME:"ichi" IDENTITYSTORE_USER_NAME="${IDENTITYSTORE_USER_NAME}" END
変数の確認:
cat << END # 0. AWS_DEFAULT_REGION:"ap-northeast-1" AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" # 1. IDENTITYSTORE_USER_NAME:"ichi" IDENTITYSTORE_USER_NAME="${IDENTITYSTORE_USER_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
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_user_id=$( \ aws identitystore get-user-id \ --identity-store-id ${sso_admin_identity_store_id} \ --alternate-identifier "{\"UniqueAttribute\":{\"AttributePath\":\"userName\",\"AttributeValue\":\"${IDENTITYSTORE_USER_NAME}\"}}" \ --query 'UserId' \ --output text \ ) \ && echo ${identitystore_user_id} 結果(例): xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
identitystore_user_id=$( \ aws identitystore get-user-id \ --identity-store-id ${sso_admin_identity_store_id} \ --alternate-identifier "{\"UniqueAttribute\":{\"AttributePath\":\"userName\",\"AttributeValue\":\"${IDENTITYSTORE_USER_NAME}\"}}" \ --query 'UserId' \ --output text \ ) \ && echo ${identitystore_user_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_user_id:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" identitystore_user_id="${identitystore_user_id}" END コマンド: aws identitystore delete-user \ --identity-store-id ${sso_admin_identity_store_id} \ --user-id ${identitystore_user_id} 結果(例): (出力なし)
cat << END # sso_admin_identity_store_id:"d-xxxxxxxxxx" sso_admin_identity_store_id="${sso_admin_identity_store_id}" # identitystore_user_id:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" identitystore_user_id="${identitystore_user_id}" END
aws identitystore delete-user \ --identity-store-id ${sso_admin_identity_store_id} \ --user-id ${identitystore_user_id}
(出力なし)
「IdentityStoreユーザー名"ichi"が存在しない。」ことを確認します。
コマンド: ! aws identitystore get-user-id \ --identity-store-id ${sso_admin_identity_store_id} \ --alternate-identifier "{\"UniqueAttribute\":{\"AttributePath\":\"userName\",\"AttributeValue\":\"${IDENTITYSTORE_USER_NAME}\"}}" \ --query 'UserId' \ --output text 結果(例): An error occurred (ResourceNotFoundException) when calling the GetUserId operation: USER not found.
! aws identitystore get-user-id \ --identity-store-id ${sso_admin_identity_store_id} \ --alternate-identifier "{\"UniqueAttribute\":{\"AttributePath\":\"userName\",\"AttributeValue\":\"${IDENTITYSTORE_USER_NAME}\"}}" \ --query 'UserId' \ --output text
An error occurred (ResourceNotFoundException) when calling the GetUserId operation: USER not found.
IAM Identity Centerダッシュボード ( https://console.aws.amazon.com/singlesignon/home )にアクセスします。
左ペイン "ユーザー"をクリックします。
検索フォームにユーザー名"ichi"を入力します。
ユーザー名"ichi"が表示されなければ正常です。