Skip to content

Instantly share code, notes, and snippets.

@ojacques
Created October 3, 2023 17:03
Show Gist options
  • Save ojacques/7992f17d6a32afd9dabbd3526f305bf4 to your computer and use it in GitHub Desktop.
Save ojacques/7992f17d6a32afd9dabbd3526f305bf4 to your computer and use it in GitHub Desktop.
List and delete all Amazon SageMaker KernelGateway apps which are still running
aws sagemaker list-apps --query "Apps[?AppType=='KernelGateway' && Status=='InService']" | jq -r '.[] | "\(.AppName) \(.DomainId) \(.UserProfileName)"' | while read AppName DomainId UserProfileName; do echo Deleting $AppName for user $UserProfileName ... && aws sagemaker delete-app --domain-id $DomainId --app-type KernelGateway --app-name $AppName --user-profile $UserProfileName; done
@non7top
Copy link

non7top commented Nov 22, 2024

For all apps

aws sagemaker list-apps --query "Apps[?Status=='InService']" | jq -r '.[] | "\(.AppName) \(.DomainId) \(.UserProfileName) \(.AppType)"' | \
while read AppName DomainId UserProfileName AppType; do \
echo Deleting $AppName for user $UserProfileName ... && \
aws sagemaker delete-app --domain-id $DomainId --app-type $AppType --app-name $AppName --user-profile $UserProfileName; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment