処理の実行
IAMインスタンスプロファイルのパスを取得します。
コマンド:
iam_instance_profile_path=$( \
aws iam get-instance-profile \
--instance-profile-name ${IAM_INSTANCE_PROFILE_NAME} \
--query 'InstanceProfile.Path' \
--output text \
) \
&& echo ${iam_instance_profile_path}
結果(例):
IAMインスタンスプロファイルを削除します。
変数の確認
cat << END
# IAM_INSTANCE_PROFILE_NAME:"handson-cloud9-instance-profile"
IAM_INSTANCE_PROFILE_NAME="${IAM_INSTANCE_PROFILE_NAME}"
END
コマンド:
aws iam delete-instance-profile \
--instance-profile-name ${IAM_INSTANCE_PROFILE_NAME}
結果(例):
完了確認
「IAMインスタンスプロファイル"handson-cloud9-instance-profile"が存在する。」ことを確認します。
コマンド:
aws iam list-instance-profiles \
--path-prefix "${IAM_INSTANCE_PROFILE_PATH}" \
--query "InstanceProfiles[?InstanceProfileName == \`${IAM_INSTANCE_PROFILE_NAME}\`].InstanceProfileName" \
--output text
結果(例):