Last active
January 17, 2019 11:11
-
-
Save chrisguitarguy/49be555e1870e815ee991ff45ca5d637 to your computer and use it in GitHub Desktop.
Cross Account Redshift UNLOAD/COPY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowS3", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::{REDSHIFT_ACCOUNT_ID}:root" | |
}, | |
"Action": [ | |
"s3:PutObject", | |
"s3:ListBucket", | |
"s3:GetObject", | |
"s3:DeleteObject" | |
], | |
"Resource": [ | |
"arn:aws:s3:::CHANGEME/*", | |
"arn:aws:s3:::CHANGEME" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowS3", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::{REDSHIFT_ACCOUNT_ID}:role/{ROLE_NAME}" | |
}, | |
"Action": [ | |
"s3:PutObject", | |
"s3:ListBucket", | |
"s3:GetObject", | |
"s3:DeleteObject" | |
], | |
"Resource": [ | |
"arn:aws:s3:::CHANGEME/*", | |
"arn:aws:s3:::CHANGEME" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowS3", | |
"Effect": "Allow", | |
"Action": "s3:*", | |
"Resource": [ | |
"arn:aws:s3:::CHANGEME/*", | |
"arn:aws:s3:::CHANGEME" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowRedshiftAssume", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "redshift.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNLOAD ('SELECT 1') | |
TO 's3://CHANGEME/prefix-' | |
CREDENTIALS 'aws_iam_role=arn:aws:iam::{REDSHIFT_ACCOUNT_ID}:role/{ROLE_NAME}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment