Skip to content

Redshift snapshot sharing to another account to restore - IAM Role issues on database

0

Hello there ! I have a situation that I couldn't find anything else online. Basically, I have two AWS accounts, where I have two Redshift clusters. On prod, I have an old dc2.large node and on dev, I'm using serverless, just to note this out - reason was that we stopped using dev, and now there's a necessity for it again.

What I did, was take the latest snapshot from production and share it with the dev account. From the dev account, I restored that snapshot to the existing namespace I have.

That worked, and I can see the data but some queries give me the following error

ERROR: exception name : UnauthorizedException, error type : 138, message: Invalid IAM Role ARN: arn:aws:iam::PROD_ACCOUNTrole/prod-glue-datalake-role. Role needs to be owned by the same account with cluster, should retry : 0 Detail: ----------------------------------------------- error: exception name : UnauthorizedException, error type : 138, message: Invalid IAM Role ARN: arn:aws:iam::PROD_ACCOUNT:role/prod-glue-datalake-role. Role needs to be owned by the same account with cluster, should retry : 0 code: 30000 context: query: -1[child_sequence:1] location: xen_aws_credentials_mgr.cpp:861 process: padbmaster [pid=1073987862] ----------------------------------------------- [ErrorId: 1-694af534-47ee964569b0ac7c6fd5bc5d]

I understand that it is trying to use the prod role, but I have the dev role applied to the cluster and I see it. What could it be ?

asked a year ago215 views

1 Answer
0

The error you're encountering is related to IAM roles referenced within your Redshift database objects that were carried over from the production snapshot. When you restore a snapshot from one account to another, any database objects (like tables, views, or stored procedures) that reference IAM roles from the source account will still contain those references, but they won't work in the destination account.

This specific error occurs because some database objects in your restored database are trying to use the IAM role "prod-glue-datalake-role" from your production account, but that role doesn't exist in your development account. As the error states, "Role needs to be owned by the same account with cluster."

To resolve this issue, you need to:

  1. Identify which database objects are referencing the production IAM role. These could be external schemas, stored procedures, or other objects that were created with references to the production role.

  2. Create an equivalent IAM role in your development account with similar permissions to what the production role had.

  3. Update the database objects in your development Redshift to use the new development account role instead of the production role.

For external schemas specifically, you would use an ALTER SCHEMA command to update the role. For other objects, you might need to recreate them with the correct role references.

When restoring a snapshot across accounts, you need to ensure that any IAM roles referenced by database objects are recreated in the destination account with appropriate permissions, and then update the database objects to use these new roles.
Sources
Sharing a snapshot - Amazon Redshift
Using identity-based policies (IAM policies) for Amazon Redshift - Amazon Redshift

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.