Skip to content

Commit

Permalink
feat(dynamodb): Implement importing existing dynamodb table.
Browse files Browse the repository at this point in the history
Closes #3895.
  • Loading branch information
zxkane committed Dec 24, 2019
1 parent 83be3c6 commit 05448d5
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 112 deletions.
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-dynamodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ const table = new dynamodb.Table(this, 'Table', {
});
```

### Importing existing tables

To import an existing table into your CDK application, use the `Table.fromTableName` or `Table.fromTableArn`
factory method. This method accepts table name or table ARN which describes the properties of an already
existing table:

```ts
const table = Table.fromTableArn(this, 'ImportedTable', 'arn:aws:dynamodb:us-east-1:111111111:table/my-table');
// now you can just call methods on the table
table.grantReadWriteData(user);
```

### Keys

When a table is defined, you must define it's schema using the `partitionKey`
Expand Down
Loading

0 comments on commit 05448d5

Please sign in to comment.