How to truncate a Redshift-serverless table by Temporary credentials?

0

Hi, I connect to the Redshift-serverless with the latest boto3 with temporary credentials. I saw the page below and only set WorkgroupName, Database and Sql, without DbUser. https://dev.classmethod.jp/articles/quicksight-folder-group/

In this situation, the truncate operation failed with a error; "Error": "ERROR: must be owner of relation <table name>".

I think temporary user doesn't have the grant to do. I see the temporary user-ish in the redshift by 'select * from pg_user;'.

IAMR:****** usesuper=false

When I used a redshift cluster, I set DbUser=admin who has a grant (usesuper=true) to be able to truncate the table. How should I do to truncate a table in Redshift serverless?

Thanks,

feita há 2 anos924 visualizações
1 Resposta
2
Resposta aceita

Hi Michihiro Ota,

Yes currently and unfortunately we cannot specify the DbUser or the DbGroup in the Redshift Serverless GetCredentials. For the moment, there isn't any database access auto grant mechanism for the IAMR prefix users. At present, I see the following two possible methods for serverless:

  • If you are using JDBC connection with IAM and you want to specify a custom DbUser or DbGroup, then the following connection string can be used jdbc:redshift:iam://redshift-serverless-<name>:aws-region/<database-name>. You can find more information on the following link https://docs.aws.amazon.com/redshift/latest/mgmt/serverless-migration.html (the Connecting using IAM with dbUser and dbGroup section)
  • The other way is to create a role in Redshift, give it the required permissions and then grant it to the IAMR:****** using the normal syntax grant role <role_name> to 'IAMR:*****'; If you want the IAMR user to be a constant value then you can add the RedshiftDbUser tag in the Tags tab of your IAM role and give a value.

Thanks,

AWS
ESPECIALISTA
Ziad
respondido há 2 anos
AWS
ESPECIALISTA
avaliado há 2 anos
  • Hi Ziad, Thank you for your swift reply. I made a role in Redshift and grant the role to 'IAMR:*****'. And it works! Thank you!

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas