I want to create one group for 1000’s of users (Basically, all the Quicksight users of my account, even for the future registered users as well) without adding them manually one by one to the group. Is there a way to that?
The purpose of the above job is to create a dynamic default for one of the dashboards which can be accessed by all the registered users in the account. So, this group mapped with a calculated column that fetches the max month (ex: 09-Sep) and allows all the users to see the current month as a default filter. Thanks in advance
Sorry, QuickSight does not have an feature to automatically add all users (including future users) to a specific group dynamically. However, you can automate this process using AWS Glue or Lambda, combined with the QuickSight API.
Use AWS Glue or Lambda to periodically check for all registered users using the QuickSight API (list_users).
For each user returned by list_users, add them to a predefined specific group using the create_group_membership API call.
Schedule the Glue job or Lambda function to run periodically to ensure that future users are also added to the group automatically.
Example: (Syntax may vary)
import boto3
client = boto3.client('quicksight')
account_id = '<your-account-id>'
namespace = 'default'
group_name = 'your-group-name'
# List all QuickSight users
response = client.list_users(AwsAccountId=account_id, Namespace=namespace)
for user in response['UserList']:
# Add user to the group
client.create_group_membership(
AwsAccountId=account_id,
Namespace=namespace,
GroupName=group_name,
MemberName=user['UserName']
)