I am trying to run a copy command to copy some data from a s3 bucket in account A to redshift in account B. I have created two different IAM roles, one for s3 in account A and one for redshift in account B. I have attached the IAM role to redshift cluster and also added the same as a trust entity for the s3 role.
Here is the trust policy for s3 IAM role :
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<redshiftAccountId>:root"
},
"Action": "sts:AssumeRole"
}
]
}
Below is the inline policy for redshift IAM role :
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"rds-db:connect",
"redshift:GetClusterCredentials",
"redshift:JoinGroup",
"redshift:CreateClusterUser"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::<s3AccountId>:role/<s3Role>"
}
]
}
Everytime i run the copy command, i get the following error :
ERROR: User arn:aws:redshift:<redshiftAccountRegion>:<redshiftAccountId>:dbuser:<redshift-cluster>/<database-user> is not authorized to assume IAM Role arn:aws:iam::<redshiftAccountid>:role/<redshift-role>,arn:aws:iam::<s3AccountId>:role/<s3Role>