- Run queries in Redshift to compute exposure and metrics.
- Store assignment data as Parquet files in S3, and then load them into Redshift.
- Administrators who want to set up Confidence for their organization
Before You Begin
- You need to have a Confidence account.
- You need to have a AWS account.
- You need to have permissions to create S3 buckets, IAM users and roles, and manage Redshift instances.
Terraform Scripts
Terraform scripts are available to create the S3 bucket, IAM user and role described in the steps below. If you are using Terraform, then after you have applied the Terraform Configuration, you can skip directly to step Step 3.Step 1: Create a S3 Bucket
To load assignment data, Confidence first copies Parquet files to a S3 bucket, and then triggers load jobs to copy these into Redshift.- Go to the S3 console, click Create bucket.
- Give it a name, and put it in the same AWS region as you have your Redshift instance in.
Step 2: Create the Confidence IAM role
Now you need to create an IAM role that Confidence can assume with the correct permissions. Two options for authentication are available. Either Confidence can use a regular AWS access key and secret to authenticate as an IAM User and then assume the role, or it can use AssumeRoleWithWebIdentity to authenticate without having to store any credentials, by using a Google service account as the trusted entity.AssumeRoleWithWebIdentity is usually preferable, but sometimes it might interfere with other settings such as custom identity providers.
In those cases, you may need the credentials-based approach.
Do either step 2a or 2b depending on what approach you choose.
Step 2a: Setup the Trust policy for AssumeRoleWithWebIdentity
- Go to the IAM console, click Roles and Create role
- Select “Custom trust policy” as the trusted entity type.
- In the text field, paste the following JSON snippet, replacing
<service_account_id>with the unique service account ID you are using to authenticate from the Confidence side. You can find the ID in theYour Service Account IDbox that is part of the configure data warehouse form for Redshift.
- Click next, and don’t select any of the predefined permissions. Confidence adds its own inline policy that is more restrictive than the built-in policies.
- Input a name for the role, for example,
confidence-role, and then click Create role.
Step 2b: Setup the Trust Policy with an IAM User
- Go to the IAM console, click Users and Create user
- Give the user a name and create it.
- Go to the user details and generate an access key and secret for the user. Keep the access key and secret for later when you configure the warehouse in Confidence.
- Go to the IAM console, click Roles and Create role
- Select “Custom trust policy” as the “Trusted entity” type.
- In the text field, paste the following JSON snippet, replacing
<user_arn>with the ARN of the user you created in step 2 above (there is a button to copy the ARN on the user page).
Step 2c: Setup the IAM Role Policy
- Find the role you created earlier and select it, then click the Add permission dropdown list and then Create inline policy
- Switch the policy editor to JSON, and then paste the following snippet, replacing the place holders with the name of the S3 bucket you created, your AWS region, AWS account ID and the Redshift cluster name.
- Give the policy a name, click Next and Create policy to attach it to the role.
Step 3: Associate the IAM Role with the Redshift cluster
Now you need to give the Confidence IAM role permissions to run load jobs.- Go to the Redshift cluster you want to use in the AWS console.
- Go to the Properties tab, scroll down to the Cluster permissions, click Manage IAM roles and then Associate IAM role.
- In the dialog that comes up, the role you created in the earlier step should show up. Select the role and click Associate IAM roles.
Step 4: Create the Redshift Database and Schema
- Open the query editor for the Redshift cluster you are using.
- Create a Confidence database to keep the data separate from the rest of your data. Then switch the query editor to use that database.
- The Confidence database creates and stores a schema to contain the tables. Confidence creates a user corresponding to the IAM role, and grant access to write to this schema for the IAM role. You can copy the SQL with the information pre-filled by clicking the
Copy SQLbutton.
The role name here is not the ARN, just the name (
role-name rather than
arn:aws:iam::191394936087:role/role-name).The CREATE USER command may fail with “user already exists” if someone has
logged in with that user, if so ignore the error and continue.
Step 5a: Configure a Metrics Data Warehouse
- Go to the Confidence App.
- On the bottom of the left sidebar, select Admin > Connections > Metrics Data Warehouse.
- Select Redshift.
- Enter the details from the earlier setup steps.
- Click Save.
Step 5b: Configure a Flag Applied Connector
For Confidence to be able to store assignment data in Redshift, you need to set up a connector between Confidence and Redshift.Assignment data is information on which users were assigned to which variants
in the experiments you run. Assignment data goes into exposure calculations.
Metrics use exposure to calculate results in your tests.
- Go to the Confidence App.
- On the bottom of the left sidebar, select Admin > Connections > Flag Applied.
- Click Create
- Select Redshift as destination.
- Enter the details from the earlier setup steps.
- Click Save.
Step 5c: Configure an Assignment Table
For Confidence to use the stored assignment table, you need to set up an assignment table that reads from the Redshift table. You first need to create an entity, which represents the thing you’re experimenting on, like your users. To do so, follow these steps:Navigate to the Redshift connection
On the bottom of the left sidebar, select Admin > Connections > Flag Applied and select the Redshift connection you created.
Create or select an entity
Create a new entity or select an existing entity. Entities are the things you’re experimenting on, like your users. Enter
User and specify the data type of the identifier that identifies the entity. For example, if you have a UUID that identifies your users, your primary key type is a String.Enter assignment table name
Enter a name for the assignment table, such as
flag_applied. This name should typically match the name you used in step 5b. Confidence can then read assignments from the destination table of your flag assignments.
