Skip to content

Instantly share code, notes, and snippets.

@sk-t3ch
Created January 26, 2022 11:23
Show Gist options
  • Save sk-t3ch/2a47f353a57fa2bc8ba42abf72aeceb7 to your computer and use it in GitHub Desktop.
Save sk-t3ch/2a47f353a57fa2bc8ba42abf72aeceb7 to your computer and use it in GitHub Desktop.
Share QuickSight Analysis to a different user with Boto3.
import boto3
AWS_SECRET_ACCESS_KEY="***"
AWS_ACCESS_KEY_ID="***"
AWS_ACCOUNT_ID="***"
client = boto3.client('quicksight', aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
# find your namespace
client.list_namespaces(AwsAccountId=AWS_ACCOUNT_ID,)
# find your user ARN
client.list_users(AwsAccountId=AWS_ACCOUNT_ID, Namespace='default')
# find the analysis id you want to update
client.list_analyses(AwsAccountId=AWS_ACCOUNT_ID)
# update permissions after which you'll be able to see in QS
response = client.update_analysis_permissions(
AwsAccountId=AWS_ACCOUNT_ID,
AnalysisId='**select from above***',
GrantPermissions=[
{
'Principal': '**your user***',
'Actions': [
'quicksight:RestoreAnalysis',
'quicksight:UpdateAnalysisPermissions',
'quicksight:DeleteAnalysis', 'quicksight:QueryAnalysis', 'quicksight:DescribeAnalysisPermissions', 'quicksight:DescribeAnalysis', 'quicksight:UpdateAnalysis'
]
},
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment