- Newest
- Most votes
- Most comments
When working with Amazon Redshift Serverless workgroups in AWS CDK, you need to use the correct attribute to reference the workgroup ARN. For a CfnWorkgroup object, the correct attribute to access the ARN is attrWorkgroupArn.
Based on your code, you're trying to use workgroup.attrWorkgroupArn, but getting an AttributeError. This is because in CDK, CloudFormation resources expose their attributes with a specific naming pattern.
For Redshift Serverless workgroups, you should use:
workgroup_arn = workgroup.ref
Or alternatively:
workgroup_arn = workgroup.attr_workgroup_arn
The attr_workgroup_arn follows the CDK's Python naming convention for CloudFormation attributes (camelCase converted to snake_case).
When creating IAM policies that need to reference the workgroup ARN, you should use this attribute to ensure the correct ARN format is used. This is particularly important for permissions like redshift-serverless:GetCredentials and redshift-serverless:GetWorkgroup which require the workgroup ARN as a resource.
Remember that Amazon Redshift Serverless workgroups are collections of compute resources that allow you to isolate and control resources for different workloads or users. Properly referencing the workgroup ARN is essential for setting up the correct IAM permissions to interact with these resources.
Sources
RedshiftServerlessConfiguration - Amazon Bedrock
Workgroup - Amazon Redshift Serverless
Workgroups - Amazon Redshift
Workgroups and namespaces - Amazon Redshift
Relevant content
asked a year ago
asked a year ago
asked a year ago
asked a year ago
- AWS OFFICIALUpdated 2 years ago
