Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit eb4de24

Browse files
committed
Update read
1 parent 54d9d16 commit eb4de24

File tree

1 file changed

+96
-2
lines changed

1 file changed

+96
-2
lines changed

README.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,96 @@
1-
# DynamoDBAutoscaleLambda
2-
Autoscale DynamoDB using Lambda
1+
dynamodb-lambda-autoscale
2+
=========================
3+
Autoscale AWS DynamoDB using an AWS Lambda function
4+
5+
DynamoDB does not currently have an official way of autoscaling the capacity throughput for reads and writes.
6+
7+
Features
8+
--------
9+
10+
- 5 minute setup process
11+
- Serverless design
12+
- Flexible code over configuration style
13+
- Autoscale table and global secondary indexes
14+
- Autoscale multiple tables
15+
- Optimised performance using concurrent queries
16+
- Statistics via 'measured'
17+
- AWS credential configuration via 'dotenv'
18+
- Optimised lambda package via 'webpack'
19+
- ES7 code
20+
21+
Setup
22+
-----
23+
24+
1. Build and package the code
25+
1. Fork the repo
26+
2. Clone your fork
27+
3. Create a new file in the root folder called 'config.env.production'
28+
4. Put your AWS credentials into the file in the following format
29+
~~~~
30+
AWS_ACCESS_KEY_ID="###################"
31+
AWS_SECRET_ACCESS_KEY="###############"
32+
~~~~
33+
3. Run 'npm install'
34+
4. Run 'npm run build'
35+
5. Verify this has created a 'dist.zip' file
36+
6. Optionally, run a local test by running 'npm run start'
37+
2. Create an AWS Policy and Role
38+
1. Create a policy called 'DynamoDBLambdaAutoscale'
39+
2. Use the following content to give access to dynamoDB, cloudwatch and lambda logging
40+
~~~~
41+
{
42+
"Version": "2012-10-17",
43+
"Statement": [
44+
{
45+
"Action": [
46+
"dynamodb:ListTables",
47+
"dynamodb:DescribeTable",
48+
"dynamodb:UpdateTable",
49+
"cloudwatch:GetMetricStatistics",
50+
"logs:CreateLogGroup",
51+
"logs:CreateLogStream",
52+
"logs:PutLogEvents"
53+
],
54+
"Effect": "Allow",
55+
"Resource": "*"
56+
}
57+
]
58+
}
59+
~~~~
60+
3. Create a role called 'DynamoDBLambdaAutoscale'
61+
4. Attach the newly created policy to the role
62+
3. Create a AWS Lambda function
63+
1. Skip the pre defined functions step
64+
2. Set the name to 'DynamoDBLambdaAutoscale'
65+
3. Set the runtime to 'Node.js 4.3'
66+
4. Select upload a zip file and select 'dist.zip' which you created earlier
67+
5. Set the handler to 'index.handler'
68+
6. Set the Role to 'DynamoDBLambdaAutoscale'
69+
7. Set the Memory to the highest value to give the best performance
70+
8. Set the Timeout to 5 seconds (higher possibly depending on the amount of tables you have)
71+
9. Once the function is created, attach a 'scheduled event' event source and make it run every minute
72+
73+
License
74+
-------
75+
76+
The MIT License (MIT)
77+
78+
Copyright (c) 2016 for dynamodb-lambda-autoscale
79+
80+
Permission is hereby granted, free of charge, to any person obtaining a copy
81+
of this software and associated documentation files (the "Software"), to deal
82+
in the Software without restriction, including without limitation the rights
83+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
84+
copies of the Software, and to permit persons to whom the Software is
85+
furnished to do so, subject to the following conditions:
86+
87+
The above copyright notice and this permission notice shall be included in all
88+
copies or substantial portions of the Software.
89+
90+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
93+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
95+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
96+
SOFTWARE.

0 commit comments

Comments
 (0)