Skip to content

Commit 0b55d1b

Browse files
author
Imran
committed
started adding some tests
1 parent 5004845 commit 0b55d1b

File tree

7 files changed

+1611
-0
lines changed

7 files changed

+1611
-0
lines changed

.eslintrc

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true,
5+
"mocha": true
6+
},
7+
"extends": "eslint:recommended",
8+
"parserOptions": {
9+
"ecmaVersion": 2017
10+
},
11+
"rules": {
12+
"indent": [
13+
"error",
14+
2
15+
],
16+
"linebreak-style": [
17+
"error",
18+
"unix"
19+
],
20+
"quotes": [
21+
"error",
22+
"single"
23+
],
24+
"semi": [
25+
"error",
26+
"always"
27+
],
28+
"no-unused-vars": [
29+
"error"
30+
],
31+
"prefer-const": [
32+
"error",
33+
{
34+
"destructuring": "all"
35+
}
36+
],
37+
"no-console": "off"
38+
}
39+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.serverless

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Serverless Create DynamoDB Global Tables For CF Stack
2+
3+
A Serverless v1.x plugin that will add a global table and replica region for all tables deployed in a serverless stack.
4+
5+
DynamoDB currently imposes some strict limitations when [creating global tables](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables_reqs_bestpractices.html):
6+
- The table provisioning settings must match for each regional table
7+
- The table names must match
8+
- Streams must be enabled
9+
- All tables must be empty
10+
11+
The plugin handles these limitation by leaving table creation / deletion to your serverles stack resources and only adding and removing tables from a replication group as the corresponfing stack resource is added and removed in each region. All tables in the stack will be added to global replication.
12+
13+
## Install
14+
15+
```sh
16+
$ npm install serverless-create-dynamodb-global-tables-for-cf-stack --save-dev
17+
```
18+
19+
Add the plugin to your `serverless.yml` file:
20+
21+
```yml
22+
plugins:
23+
- serverless-create-dynamodb-global-tables-for-cf-stack
24+
```
25+
26+
## Usage
27+
28+
Simply deploy your stack to each region you wish to add to the replication group. Remove your stack from each region that you no longer want in replication.
29+
30+
```sh
31+
serverless deploy --region us-east-1
32+
serverless deploy --region eu-west-1
33+
```
34+
35+
When you add/remove table resources from your serverless stack they will also be added/removed from global replication but you will need to redeploy your stack to each region.

0 commit comments

Comments
 (0)