Unless I am missing something, I do not see a way to remove users in bulk from AWS Quicksight Console and AWS Quicksight CLI.
I have written the below python script to parse usernames in quicksightuser.json
(output of AWS CLI list-user
command) into a list object UserListRay
of usernames. And then iterate through the list object and run the delete-user
AWS CLI command.
The problem is, there is an API response terminal prompt (with status code and request ID) from executing delete-user
AWS CLI command in the terminal. And this prompt is breaking the loop, only the first iterative variable gets passed into the CLI command.
Is there a way to suppress the API response prompt in the terminal? Or is there an easier way to simply delete users in bulk form console or using AWS CLI command or shell scripts?
import os
import json
with open('/Users/QuicksightBulkDeleteUsers/quicksightuser.json') as f:
contents = json.load(f)
UserListRaw = contents.get('UserList', [])
UsersList = []
for a in range(len(UserListRaw)):
UsersList.append(UserListRaw[a]["UserName"])
for username in UsersList:
os.system("aws quicksight delete-user --aws-account-id 444444444444 --namespace default --user-name '{}'".format(username))
- AWS quicksight console
- AWS quicksight CLI command