Managing the account service role with the API
| Intended audience: Amazon Quick Administrators and Amazon Quick developers |
Amazon Quick Sight uses an Amazon Identity and Access Management (IAM) service role to access Amazon resources on behalf of your account. Use the following API operations to inspect the account's service role and select a customer-managed role:
-
DescribeResourcePermissions returns the current role type and, for a customer-managed role, its Amazon Resource Name (ARN).
-
UpdateResourcePermissions selects a customer-managed role. You can switch from a service-managed role to a customer-managed role, or replace one customer-managed role with another.
Call both operations in the Amazon Web Services Region where your Amazon Quick Sight account is registered (the home Region).
Prerequisites
Before you update the service role, prepare a customer-managed IAM role that meets these requirements:
-
The role is in the same Amazon account as your Amazon Quick Sight account.
-
The trust policy allows the
quicksight.amazonaws.comservice principal to callsts:AssumeRole. -
The role has permissions policies that allow access to the Amazon resources that your account uses.
For role setup instructions, see Passing IAM roles to Quick.
The IAM identity that calls the API needs these permissions:
-
quicksight:DescribeResourcePermissionsto inspect the configuration. -
quicksight:UpdateResourcePermissionsto update the configuration. -
iam:PassRoleon the customer-managed role that you select. This permission is required for every Update request. For more information, see Grant a user permissions to pass a role to an Amazon service in the IAM User Guide.
For features that use session tags, also allow sts:TagSession in
the role trust policy. If you later add or remove this permission, call
UpdateResourcePermissions again with the same role ARN to refresh the
stored session-tag capability.
Use an Amazon CLI or SDK version that includes both operations.
Inspecting the current service role
To inspect the account service role
-
Run the following Amazon CLI command. Replace
111122223333with your Amazon Web Services account ID andus-east-1with your home Region.aws quicksight describe-resource-permissions \ --aws-account-id111122223333\ --regionus-east-1For example, an account that uses a service-managed role returns a response similar to the following:
{ "Status": 200, "RoleType": "QUICKSIGHT_MANAGED", "RequestId": "00000000-0000-4000-8000-000000000000" } -
Check
RoleTypein the response:QUICKSIGHT_MANAGED-
Amazon Quick Sight manages the role.
CUSTOMER_MANAGED-
You manage the role and its permissions. The response also contains
CustomerManagedRoleArn.
Selecting a customer-managed service role
Both RoleType and CustomerManagedRoleArn are required.
The only supported role type for this operation is
CUSTOMER_MANAGED.
To select a customer-managed service role
-
Run the following Amazon CLI command. Replace
111122223333with your Amazon Web Services account ID,arn:aws-cn:iam::111122223333:role/QuickSightServiceRolewith your prepared role ARN, andus-east-1with your home Region.aws quicksight update-resource-permissions \ --aws-account-id111122223333\ --role-type CUSTOMER_MANAGED \ --customer-managed-role-arnarn:aws-cn:iam::111122223333:role/QuickSightServiceRole\ --regionus-east-1A successful response returns the selected role type and ARN:
{ "Status": 200, "RoleType": "CUSTOMER_MANAGED", "CustomerManagedRoleArn": "arn:aws-cn:iam::111122223333:role/QuickSightServiceRole", "RequestId": "00000000-0000-4000-8000-000000000000" } -
Run
describe-resource-permissionsagain with your account ID and home Region:aws quicksight describe-resource-permissions \ --aws-account-id111122223333\ --regionus-east-1Verify that
RoleTypeisCUSTOMER_MANAGEDandCustomerManagedRoleArnmatches the role that you selected.
To replace this role with another customer-managed role, repeat the procedure with the replacement role ARN.
Verify that the selected role allows access to the resources that your data sources need. Updating the configuration does not attach permissions policies to the role.
You can't use UpdateResourcePermissions to switch back to a
service-managed role. To make that change, use the Quick console's
Amazon resource permissions settings. For instructions to open these settings,
see Accessing Amazon
resources.