Skip to content

Commit dedcccb

Browse files
authored
(enhancement): Remove unnecessary LF permissions from tests infra (#1605)
1 parent b7b0d5f commit dedcccb

File tree

2 files changed

+4
-32
lines changed

2 files changed

+4
-32
lines changed

CONTRIBUTING_COMMON_ERRORS.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,3 @@ brew install unixodbc
111111
```
112112

113113
-----
114-
115-
## CloudFormation Deployment
116-
117-
### Error Message
118-
119-
During the deployment of `aws-sdk-pandas-databases`, the creation of the resource `CodeBuildTestRoleLFPermissions` fails with
120-
121-
```
122-
Resource does not exist or requester is not authorized to access requested permissions. (Service: AWSLakeFormation; Status Code: 400; Error Code: AccessDeniedException; Request ID: 14a26718-ee4e-49f2-a7ca-d308e49485f8; Proxy: null)
123-
```
124-
125-
### Solution
126-
127-
The IAM role used to deploy the CloudForation stack does not have permissions to assign permissions in AWS Lake Formation. The quickest solution is to find the IAM role and set it as an admin in Lake Formation.
128-
129-
In order to find the role:
130-
1. Navigate to the CloudFormation console in your account
131-
1. Select the `aws-sdk-pandas-databases` stack which failed to deploy
132-
1. Under the "Stack info" tab, find the value for "IAM role". The name of the role should be in the following format: `arn:aws:iam::{ACCOUNT_ID}:role/cdk-{UUID}-cfn-exec-role-{ACCOUNT_ID}-{REGION}`

test_infra/stacks/databases_stack.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from aws_cdk import aws_glue_alpha as glue
66
from aws_cdk import aws_iam as iam
77
from aws_cdk import aws_kms as kms
8-
from aws_cdk import aws_lakeformation as lf
98
from aws_cdk import aws_neptune_alpha as neptune
109
from aws_cdk import aws_rds as rds
1110
from aws_cdk import aws_redshift_alpha as redshift
@@ -217,19 +216,11 @@ def _setup_redshift(self) -> None:
217216
),
218217
},
219218
)
220-
lf.CfnPermissions(
219+
ssm.StringParameter(
221220
self,
222-
"CodeBuildTestRoleLFPermissions",
223-
data_lake_principal=lf.CfnPermissions.DataLakePrincipalProperty(
224-
data_lake_principal_identifier=redshift_role.role_arn
225-
),
226-
resource=lf.CfnPermissions.ResourceProperty(
227-
table_resource=lf.CfnPermissions.TableResourceProperty(
228-
database_name="aws_sdk_pandas",
229-
table_wildcard={}, # type: ignore
230-
)
231-
),
232-
permissions=["SELECT", "ALTER", "DESCRIBE", "DROP", "DELETE", "INSERT"],
221+
"redshift-role-arn-parameter",
222+
parameter_name="/SDKPandas/IAM/RedshiftRoleArn",
223+
string_value=redshift_role.role_arn,
233224
)
234225
redshift.ClusterSubnetGroup(
235226
self,

0 commit comments

Comments
 (0)