Replies: 2 comments
-
Another problem I noticed when using the |
Beta Was this translation helpful? Give feedback.
-
Hi, When you use fromXxxx() method to lookup or reference a resource, you essentially create a pointer or reference to that resource which is not actually created or managed by CDK so CDK can't update it or attach a role to it unless this resource is created by CDK. Your Implementation IssuesThe problems you've encountered with
Proposed SolutionCreate a new CustomResource like
Implementation ApproachThe construct would internally use the AWS APIs: With proper error handling and state management that This is technically possible, but you'll need to write a CustomResource like that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature
I import an RDS instance into my CDK stack via
rds.DatabaseInstance.fromLookup
, and I want to add a role to it for theS3_INTEGRATION
feature, so the RDS can upload files to S3. There is currently no built-in way to achieve this.Use Case
We run nightly data exports in Oracle RDS. The exports generate a file in a directory. We need to move this file to S3 for further processing. To upload from RDS to S3, a feature role must be added. This is currently extremely difficult to achieve through CDK when the RDS has been imported into the stack.
Proposed Solution
No response
Other Information
I have tried to implement this using
AwsCustomResource
but I got stuck on something that I would describe as "permission race condition". Take a look at the code first:This works just fine when I create or destroy the custom resource. But the issue is with updates. Let's say I change the role passed into the construct, thus the role ARN changes. This causes the
PolicyStatement
to update first, and then theonUpdate
action is executed. TheonUpdate
succeeds and returns a new physical ID, so the framework then callsonDelete
for the old resource. However, theonDelete
fails, because the policy has been changed and no longer contains the permissions to execute theonDelete
action for the old resource. Hence why I called this a "permission race condition".I do not see an obvious way how to work around this issue. Any help would be appreciated if there is a neat trick to make this work, before a proper built-in construct is added for this.
Acknowledgements
AWS CDK Library version (aws-cdk-lib)
[email protected]
AWS CDK CLI version
2.1024.0 (build 8be6aad)
Environment details (OS name and version, etc.)
Win11 Arm64
Beta Was this translation helpful? Give feedback.
All reactions