Amazon DynamoDB - Part2
Amazon Cloud Concepts Learning --> Day21
DynamoDB Capacity Unit Consumption
For Read Operations
One read unit is needed for a strongly consistent read request of an item up to 4 KB.
One-half read unit is needed for an eventually consistent read request of an item up to 4 KB.
Two read units are needed for a transactional read request for an item up to 4 KB.
Below list explains how read units are used in DynamoDB read operations:
GetItem – reads a single item from a table
Query – reads multiple items that have same partition key
Scan – reads all items in a table
BatchGetItem – reads up to 100 items from one or more tables
For Write Operations
Below list explains how write units are used in DynamoDB write operations:
PutItem – writes a single item to a table
UpdateItem – modifies a single item to a table
DeleteItem – removes a single item to a table
BatchWriteItem – writes up to 25 items to one or more tables
DynamoDB Throughput Capacity
The way a table's capacity is controlled depends on its throughput capacity mode. Additionally, throughput capacity affects how much you pay for reading and writing to and from your tables. There are types of capacity modes
On-Demand Mode
DynamoDB on-demand, a serverless billing solution, can handle millions of queries per second.
Pay-per-request pricing for read and write requests is available with DynamoDB on-demand, allowing you to only pay for what you need.
This type of mode is preferred when your application has bursty or unpredictable traffic that is hard to guess.
Provisioned Mode
You may define how many reads and writes per second your application needs in provisioned mode.
Even if you do not use all the allocated capacity, you will still be charged for the throughput capacity.
The hourly read and write capacity that you have allocated will determine how much you are charged.
This type of mode is preferred where you have predictable traffic or limited short-term bursts of traffic.
Global Tables
A global table consists of one or more replica tables that are all under the ownership of the same AWS account.
A single DynamoDB table that serves as a component of a global database is known as a replica table, or simply replica. A set of identical data objects are stored in each replica. There can only be one replica table per AWS Region for each global table.
Amazon DynamoDB global tables provide a fully managed solution for deploying a multi-region, multi-master database.
DynamoDB global tables are ideal for massively scaled applications, with globally dispersed users.
DynamoDB global tables employ a "last writer wins" reconciliation between concurrent changes, where DynamoDB tries its best to identify the last writer, to guarantee eventual consistency.
Global Tables decrease latency in addition to boosting availability in the event of a regional outage as your user will retrieve data from the nearest table replica.
DynamoDB Accelerator (DAX)
Fully managed, highly available in-memory cache for DynamoDB, known as Amazon DynamoDB Accelerator (DAX), can increase speed by up to 10 times.
Even at millions of queries per second, performance is improved from milliseconds to microseconds.
DynamoDB tables can benefit from in-memory acceleration with the managed service DAX.
Offers cluster administration, data population, and controlled cache invalidation. Performance for READ requests is enhanced by DAX (not writes).
Application logic does not need to be changed because DAX is compatible with already-existing DynamoDB API calls.
Perfect for workloads that are read-heavy and bursty, such gaming, auction apps, and retail websites that are running deals or promotions.
Depending on the instance type you choose, pricing is per node-hour used.
Provide your DAX cluster with a minimum of three nodes, then arrange the nodes across many Availability Zones within a Region to get high availability for your application.
Two approaches are available for DAX cluster scaling
Horizontal Scaling- Cluster's read replicas are added. Up to 10 read replicas may be supported by a single DAX cluster, and replicas can be added or removed at any time while the cluster is operational.
Vertical Scaling - Many node kinds can be chosen. Bigger nodes allow the cluster to hold more data in memory, which lowers cache misses and boosts the speed of the application.
DynamoDB Auto Scaling
To dynamically modify allocated throughput capacity on your behalf in response to actual traffic patterns, DynamoDB auto scaling makes advantage of the AWS Application Auto Scaling service.
This allows a global secondary index or table to enhance its provided read and write capacity without limiting to accommodate spikes in demand.
Application Auto Scaling reduces throughput when workload drops, saving you money on unused provided capacity.
DynamoDB Security
Uses an AWS Key Management Service (AWS KMS) controlled encryption key for DynamoDB to secure your data while it is at rest.
Only when you create a new DynamoDB table can you enable encryption at rest.
Encryption at rest cannot be turned off once it is activated.
Identity-based policies are supported by DynamoDB.
Resource-based policies are not supported by DynamoDB.
Additional Resources
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ServiceQuotas.html
https://aws.amazon.com/dynamodb/faqs/
"Thank you for reading! If you found this blog helpful, don't forget to subscribe and follow for more insightful content. Your support keeps me motivated to bring you valuable insights. Stay updated and never miss out on our latest posts. Feel free to leave comments or suggestions for future topics. Happy learning!"
https://awslearner.hashnode.dev/amazon-web-services-via-category
Subscribe to my newsletter
Read articles from Utkarsh Rastogi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Utkarsh Rastogi
Utkarsh Rastogi
👨💻 AWS Cloud Engineer | Around 6 years of Corporate Experience | Driving Innovation in Cloud Solutions 🔧 Day-to-Day Tasks: Specialize in creating AWS infrastructure for Migration Projects. Leveraging services such as S3, SNS, SQS, IAM, Lambda, System Manager, Kinesis, OpenSearch, Cognito, Storage Gateway, Cloud Watch, API Gateway, AWS Event Scheduler, Secret Manager, ECS, Application Load Balancer, VPC among others. Additionally, I excel in crafting Splunk Dashboards and implementing alerting mechanisms for Cloud Watch logs to monitor failures. My approach involves constructing AWS infrastructure using the Serverless framework and Cloud Formation templates, while automating tasks through Boto3 (Python Scripting) Lambdas. 🎯 Passion: I am deeply passionate about continuously learning new technologies and eagerly anticipate the transformative impact of cloud computing on the tech landscape. 📧 Connect: Feel free to reach out to me at awslearningoals@gmail.com. Let's connect and explore potential collaborations! https://www.linkedin.com/in/rastogiutkarsh/