aws / aws/aws-cdk

(DynamoDB): Add regionalArns to set of import props for DynamoDB Table

Open
#21,322 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-dynamodb ddb-legacy-table effort/small feature-request p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Not sure what the best approach to this would be, but...

If you create a table with replication regions in one stack and then import that table in another stack, none of the granted permissions in the second stack will allow access to the replicated tables.

I think its a fair question to ask: "How does the second stack know what replication regions exist?"

However, I still think there should be some way to import the table **and** grant access to all replication tables.

Right now I need to do something like this:

```typescript
const importedTable = Table.fromTableAttributes(scope, 'import-table', {
tableName: myTableName,
});

knownReplicationRegions.forEach((region) => {
// @ts-ignore
importedTable.regionalArns.push(
stack.formatArn({
region,
service: 'dynamodb',
resource: 'table',
resourceName: myTableName
})
);
});
```

### Use Case

More easily work with imported tables that have replication regions

### Proposed Solution

Add replication regions to list of supported attributes with importing the table.

Something like:
```typescript
Table.fromTableAttributes(scope, 'control-plane', {
tableName: myTableName,
replicationRegions: knownReplicationRegions
});
```

### Other Information

_No response_

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.31.1

### Environment details (OS name and version, etc.)

MacOS

Contributor guide

Open the contributing guide

Research direction

Start by locating the TypeScript implementation and tests for Table.fromTableAttributes and the table's regionalArns handling. Trace how imported attributes affect permission grants, then add support for supplying replication regions and verify that permissions cover the imported table's replica ARNs.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.