-
1. Overview
- Fully Managed, Highly available with replication across 3 AZ
- NoSQL database: Not a regional database
- Scales to massive workloads, distributed database
- Millions of requests per seconds, trillions of row, 100s of TB of storage
- Fast and consistent in performance (low latency on retrieval)
- Integrated with IAM for security, authorization, and administration
- Enables event-driven programming with DynamoDB Streams
- Low cost and auto-scaling capabilities
2. Properties
- DynamoDB is made of tables
- Already Database available, No creation of a database
- Each table has a primary key (must be decided at creation time)
- Each table can have an infinite number of items (=rows)
- Each item(= row) has attributes (can be added over time - can be null)
- The maximum size of an item is 400KB
- Data types supported are:
- Scala Types: String, Number, Binary, Boolean, Null
- Document Types: List, Map
- Set Types: String Set, Number Set, Binary Set
2.1 Provisioned Throughput
- The table must have provisioned read and write capacity units
- Read Capacity Units (RCU): throughput for reads ($0.00013 per RCU)
- 1 RCU = 1 strongly consistent read of 4 KB per second
- Write Capacity Units (WCU): throughput for writes ($0.00054 per WCU)
- 1 WCU = 1 write of 1 KB per second
- Option to set up auto-scaling of throughput to meet demand
- Throughput can be exceeded temporarily using "burst credit"
- If burst credit is empty, you'll get a ProvisionedThroughputException
- It's then advised to do an exponential back-off retry
2.2 DanamoDB Accelerator (DAX)
- Seamless cache for DynamoDB, no application rewrite
- Writes go through DAX to DynamoDB
- Microsecond latency for cached reads & queries
- Solves the Hot Key problem (too many reads)
- 5 minutes TTL for cache by default
- Up to 10 nodes in the cluster
- Multi-AZ (3 nodes minimum recommended for production)
- Secure (Encryption at rest with KMS, VPC, IAM, CloudTail, and etc)
2.3 DynamoDB Streams
- Changes in DynamoDB (Create, Update, Delete) can end up in a DynamoDB Stream)
- This stream can be read by AWS Lambda and we can then do:
- React to changes in real-time (welcome email to new users)
- Analytics
- Create derivative tables/views
- Insert into ElasticSearch
- Could implement cross-region replication using Streams
- Stream has 24 hours of data retention
2.4 Other Features
- Transactions (new from Nov 2018)
- All or nothing type of operations
- Coordinated Insert, Update & Delete across multiple tables
- Include Up to 10 unique items or up to 4MB of data
- On-Demand (new from Nov 2018)
- No capacity planning needed (WCU / RCU) - scales automatically
- 2.5 times more expensive than provisioned capacity (use with care)
- Helpful when spikes are un-predictable or the application is very low throughput
2.5 Security
- VPC Endpoints available to access DynamoDB without internet
- Access fully controlled by IAM
- Encryption at rest using KMS
- Encryption in transit using SSL/TLS
2.6 Backup and Restore feature available
- Point in time restore like RDS
- No performance impact
2.7 Global Tables (Cross-region replication)
- Multi-region, fully replicated, high performance
- Active replication, Many regions
- Must enable DyanmoDB Streams before
- Useful for low latency, Disaster Recovery(DR) purposes
2.8 Capacity planning
- Planned capacity: provision WCU & RCU, can enable auto-scaling
- On-demand capacity: get unlimited WCU & RCU, no throttle, more expensive
2.9 Other features
- Amazon DMS can be used to migrate to DynamoDB (from Mongo, Oracle, MySQL, S3, and etc)
- You can launch a local DynamoDB on your computer for development purposes
3. Application
3.1 Serverless Web Apps
Build powerful web applications that automatically scale up and down. You don't need to maintain servers, and your applications have automated high availability.
3.2 Mobile Backends
Use DynamoDB and AWS AppSync to build interactive mobile and web apps with real-time updates, offline data access, and data sync with built-in conflict resolution.
3.3 Microservices(MSA)
Build flexible and reusable microservices using DynamoDB as a serverless data store for consistent and fast performance.
4. Reference
github.com/aws-samples/lambda-refarch-webapp
github.com/aws-samples/aws-mobile-appsync-chat-starter-angular
github.com/aws-samples/lambda-refarch-streamprocessing
aws.amazon.com/ko/blogs/korea/near-zero-downtime-migration-from-mysql-to-dynamodb/
'Cloud > AWS' 카테고리의 다른 글
Lambda (0) 2021.03.09 Choosing the right database on AWS (0) 2021.03.08 Simple Storage Service (S3) (0) 2020.11.24 CloudFront (0) 2020.11.24 ElasticBeanStalk (0) 2020.08.02