I am trying to run queries on AWS Glue Data Catalog as a Federated user from Python script in Lambda, but I am facing the issues:
- The first issue - I cannot find appropriate way to connect as Federated user from Lambda. I only found boto3 code to connect with Redshift Serverless DB:
result = client_redshift.execute_statement(Database=database, WorkgroupName=workgroup, Sql=query_str)
- The second issue - as documentation mentioned the only way to run query on AWS Glue Data Catalog DB in Redshift Serverless is via Federated user with granted IAM Role, but when I try to grant role to my Lambda, I am getting error that Lambda role doesn't exist.
ERROR: user "IAMR:lambda-role" does not exist
- The query that I am using to grant permission is this one - from the documentation:
GRANT USAGE ON DATABASE awsdatacatalog TO "IAMR:lambda-role";