Skip to content

Commit

Permalink
feat(dynamodb): global tables version 2019.11.21
Browse files Browse the repository at this point in the history
Add support for global tables version 2019.11.21.

Version 2019.11.21 (current) of global tables enables to dynamically add new
replica tables from a table populated with data. It is more efficient and
consumes less write capacity than version 2017.11.29.

Uses the custom resource provider framework (async) to update the table
(`onEvent`) and check for replica creation (`isComplete`).

Tables no longer have to be created in separate "regional" stacks and then
"glued" together with a custom resource as in `@aws-cdk/aws-dynamodb-global`.
This means that a separate module is no longer justified.

Deprecate `@aws-cdk/aws-dynamodb-global`: it uses version 2017.11.29 and the API
and custom resource implementation for version 2019.11.21 is much cleaner.

See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html

Closes aws#5752
  • Loading branch information
jogold committed Jan 15, 2020
1 parent d5632ea commit 159c27a
Show file tree
Hide file tree
Showing 25 changed files with 668 additions and 1,144 deletions.
37 changes: 3 additions & 34 deletions packages/@aws-cdk/aws-dynamodb-global/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,11 @@

---

![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
![Stability: Deprecated](https://img.shields.io/badge/stability-Deprecated-critical.svg?style=for-the-badge)

> **This is a _developer preview_ (public beta) module. Releases might lack important features and might have
> future breaking changes.**
>
> This API is still under active development and subject to non-backward
> compatible changes or removal in any future version. Use of the API is not recommended in production
> environments. Experimental APIs are not subject to the Semantic Versioning model.
> This API may emit warnings. Backward compatibility is not guaranteed.
---
<!--END STABILITY BANNER-->

Global Tables builds upon DynamoDB’s global footprint to provide you with a fully managed, multi-region, and multi-master database that provides fast, local, read and write performance for massively scaled, global applications. Global Tables replicates your Amazon DynamoDB tables automatically across your choice of AWS regions.

Here is a minimal deployable Global DynamoDB tables definition:

```typescript
import { AttributeType } from '@aws-cdk/aws-dynamodb';
import { GlobalTable } from '@aws-cdk/aws-dynamodb-global';
import { App } from '@aws-cdk/core';

const app = new App();
new GlobalTable(app, 'globdynamodb', {
partitionKey: { name: 'hashKey', type: AttributeType.String },
tableName: 'GlobalTable',
regions: [ "us-east-1", "us-east-2", "us-west-2" ]
});
app.synth();
```

## Implementation Notes
AWS Global DynamoDB Tables is an odd case currently. The way this package works -

* Creates a DynamoDB table in a separate stack in each `DynamoDBGlobalStackProps.region` specified
* Deploys a CFN Custom Resource to your stack's specified region that calls a lambda that runs the aws cli which calls `createGlobalTable()`

### Notes

GlobalTable() will set `dynamoProps.stream` to be `NEW_AND_OLD_IMAGES` since this is a required attribute for AWS Global DynamoDB tables to work. The package will throw an error if any other `stream` specification is set in `DynamoDBGlobalStackProps`.
This module has been deprecated. Use `@aws-cdk/aws-dynamodb.Table` with `replicaRegions` instead.
Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 159c27a

Please sign in to comment.