Files
query-orchestration/cmd/auth_related/mfa/creation.script.examples/delete.all.sh
T
Jay Brown 6dccf494f8 Merged in feature/permit-policy-cleanup (pull request #210)
cleanup permit policies and correct documentation

* docs

* policy cleanup

* refactor

* Merge remote-tracking branch 'origin/feature/permit-policy-cleanup' into feature/permit-policy-cleanup

* docs and edits
2026-02-19 20:22:59 +00:00

40 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# this script is untested
AWS_REGION="us-east-2"
AWS_PROFILE="aarete"
# set the domain prefix to delete here
DOMAIN_PREFIX="aarete-mfa-test"
USER_POOL_ID=$(aws cognito-idp describe-user-pool-domain \
--region "$AWS_REGION" \
--profile "$AWS_PROFILE" \
--domain "$DOMAIN_PREFIX" \
--query 'DomainDescription.UserPoolId' \
--output text)
if [ -z "$USER_POOL_ID" ]; then
echo "User pool not found for domain $DOMAIN_PREFIX. Exiting."
exit 1
fi
echo "User pool id to delete is $USER_POOL_ID."
echo "Deleting domain $DOMAIN_PREFIX from user pool $USER_POOL_ID..."
aws cognito-idp delete-user-pool-domain \
--region "$AWS_REGION" \
--profile "$AWS_PROFILE" \
--user-pool-id "$USER_POOL_ID" \
--domain "$DOMAIN_PREFIX"
echo "Waiting 30 seconds for domain deletion..."
sleep 30
echo "Deleting user pool $USER_POOL_ID..."
aws cognito-idp delete-user-pool \
--region "$AWS_REGION" \
--profile "$AWS_PROFILE" \
--user-pool-id "$USER_POOL_ID"
echo "Deletion complete. All resources cleaned up."