Amazon Redshift
This article is for data engineers and DevOpsIt walks through giving your Redshift cluster read access to the S3 bucket that holds your data export, and creating the user the ETL service connects as.
Complete the Amazon S3 export first; the ETL service for Redshift loads from that bucket.
1. Policy: Redshift reads the export bucket
This policy lets your Redshift cluster read one S3 bucket.
-
Log in to your AWS account as an administrator.
-
Open the IAM Policies page and click Create policy.
-
Open the JSON tab and paste the policy below, replacing
YourAttributionS3Bucketwith the name of your export bucket in both resource lines:{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:Get*", "s3:List*" ], "Resource": [ "arn:aws:s3:::YourAttributionS3Bucket/*", "arn:aws:s3:::YourAttributionS3Bucket" ] } ] } -
Click Next: Tags, then Next: Review.
-
Name the policy
AttributionS3BucketReadOnlyand click Create policy.
2. Policy: AWS Glue
The loader registers the export files as external tables through AWS Glue. On the same Policies page, create a second policy named AttributionGlue with this JSON:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ATBGluePolicy",
"Effect": "Allow",
"Action": [
"glue:CreateTable",
"glue:CreateDatabase",
"glue:DeleteTable",
"glue:GetTable"
],
"Resource": "*"
}
]
}3. Role: attach both policies to Redshift
- Open the IAM Roles page and click Create role.
- Leave AWS Service selected, choose Redshift under Other services, then Redshift - Customizable, and click Next.
- On Add permissions, select
AttributionS3BucketReadOnlyandAttributionGlue, and click Next. - Name the role
AttributionS3DataLoaderand click Create role. - Open your Redshift cluster, go to the Properties tab, click Associate IAM role, select
AttributionS3DataLoaderand click Associate IAM roles.
4. User and database for the loader
Open the Redshift query editor and run:
CREATE USER attribution WITH PASSWORD 'YOUR_PASSWORD';
CREATE DATABASE attribution WITH OWNER attribution;Choose a strong password; you will enter the same password in the Attribution settings in the next step. If you prefer not to put a plain password in the query, Redshift accepts an MD5 hash, generated like this:
SELECT 'md5' || md5('PLAIN_PASSWORD' || 'attribution');See Redshift's documentation for the role setup in full.
No static IP address to allowAttribution has no fixed IP address. Each run connects from a different, one-off host, so the cluster must be reachable from the internet and its security group cannot be narrowed to an Attribution address. Access is protected by the
attributionuser's password and the IAM role above.
5. Set up the ETL in Attribution
Open Settings → Data Export, choose Amazon Redshift and enter:
- The name of the S3 bucket your export lands in.
- The Redshift server address as
host:port. - Your AWS account ID, the twelve-digit number in the role's ARN.
- The password of the
attributionuser.
Save, and the first load runs after the next daily export. The console links above open the us-east-1 region; switch to your own if the cluster is elsewhere.
Updated 5 days ago
