'How to attach iam role to existing redshift cluster using aws cdk code

I know that we can add iam role using manage policy in permissions of redshift cluster, but I want to write code instead of using console.

I'm trying to attach a iam role to a existing redshift cluster means created before. So I want cdk code to attach an iam user to a existing cluster.(I want it in typescript)



Solution 1:[1]

I just had the same problem last week. So right now it is not possible to add a role to an existing Redshift-Cluster that is not written in CDK. You can import the redshiftcluster by attribute, but you can't add a role to it. You can create the role in AWS CDK and attach it manually to the cluster. Otherwise create a new cluster in aws cdk and there you can add the role via code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Müller