Introduction to Cloud Databases
Tags: aws, cloud, database
Published: 2021-03-02 14:07:39

<!-- wp:paragraph -->
<p>I spent over a couple of weeks reading <strong>about data, big data, database, Relational database, Non-Relational database, <strong>Amazon Relational Database Service (RDS)</strong>, <strong><strong>Amazon Dynamo Databas</strong></strong>e.</strong> I have started by explaining what do you mean by data and big data.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>What do you mean by data?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Data is raw information. For example, your daily consumption of coffee. It is raw information about the amount of coffee you have consumed, but if you analyze it and gain insights from it.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>The brand of coffee you drink</li><li>At what time do you prefer to drink coffee</li><li>How much sugar do you put into the coffee</li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="http://www.e-cartouche.ch/content_reg/cartouche/webservice/en/image/wms.jpg" alt=""/><figcaption>Credits: http://www.e-cartouche.ch/content_reg/cartouche/webservice/en/image/wms.jpg</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>What do you mean by Big Data?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Big data can be described in terms of data management challenges that  due to increasing volume, velocity and variety of data  cannot be solved with traditional databases. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Some have defined big data as an amount of data that exceeds a petabyte one million gigabytes.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>While there are plenty of definitions for big data, most of them include the concept of what’s commonly known as “four V’s” of big data, </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>Volume</strong>: Volumes of data that can reach unprecedented heights in fact. The challenge with data volume is not so much storage as it is how to identify relevant data within gigantic data sets and make good use of it.</li><li><strong>Velocity</strong>: Some data will come in in real-time, whereas other will come in fits and starts, sent to us in batches. The challenge for data scientists is to find ways to collect, process, and make use of huge amounts of data as it comes in.</li><li><strong>Variety</strong>: Data comes in different forms. <ol><li><em>Structured</em> data is that which can be organized neatly within the columns of a database. This type of data is relatively easy to enter, store, query, and analyze. </li><li><em>Unstructured</em> data is more difficult to sort and extract value from. Examples of unstructured data include emails, social media posts, word-processing documents; audio, video and photo files; web pages, and more.</li></ol></li><li><strong>Veracity</strong>: Quality of the collected data. If source data is not correct, analyses will be worthless.</li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://www.ibmbigdatahub.com/sites/default/files/infographic_file/4-Vs-of-big-data.jpg" alt=""/><figcaption>Credits: https://www.ibmbigdatahub.com/sites/default/files/infographic_file/4-Vs-of-big-data.jpg</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>For more information on Big Data, </strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><a rel="noreferrer noopener" href="https://aws.amazon.com/big-data/what-is-big-data/" target="_blank">https://aws.amazon.com/big-data/what-is-big-data/</a></li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>What do you mean by a database?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A database is any type of mechanism used for storing, managing, and retrieving information. It is a repository or collection of data. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A database’s implementation and how data is structured will determine how well an application will perform as it scales. There are two primary types of databases, relational and non-relational.&nbsp;&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Relational databases(SQL databases): they use the Structured Query Language to manage information storage and retrieval. </li><li>Non-relational databases(NoSQL databases): NoSQL databases are often distributed databases where data is stored on multiple computers or nodes.</li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://d1.awsstatic.com/Startups/StartupPageAssets/how-to-choose-a-database-1.12737182f86dcb29938f211ad303d63ab7bdf29a.png" alt=""/><figcaption>Credits: https://d1.awsstatic.com/Startups/StartupPageAssets/how-to-choose-a-database-1.12737182f86dcb29938f211ad303d63ab7bdf29a.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Each database type is optimized to support a specific type of workload.&nbsp;&nbsp;Matching an application with the appropriate database type is essential for highly performant and cost-efficient operation.  </strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>While it is possible to make a general-purpose database manage just about any type of workload, it will not scale as demand increases.&nbsp;The reasons this is important are,</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>The cloud has the promise of agility.&nbsp; That is, being able to respond to changes in a business environment as they happen.&nbsp;This includes the ability to grow as needed and it’s called scalability. <ol><li>It is done by partitioning tables, indexes into smaller pieces in order to manage and access the data at finer level. </li></ol></li><li>Another promise of the cloud is elasticity.&nbsp; That is, it’s great to be able to scale up to meet demand but, elasticity allows for the opposite to happen.&nbsp; When demand decreases, so does the scale and its related expenses. <strong>Who wants to pay for idle resources?</strong></li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://www.redswitches.com/hs-fs/hubfs/scaling-image.jpg?width=790&amp;name=scaling-image.jpg" alt=""/><figcaption>Credits: https://www.redswitches.com/hs-fs/hubfs/scaling-image.jpg?width=790&amp;name=scaling-image.jpg</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>It’s important for application developers to examine the data and consider its size, shape, and computational requirements for processing and analysis.&nbsp; </strong>These three things determine what type of database is needed for a particular application to allow for scalability and elasticity.&nbsp;&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>The two primary workload types are operational and analytical</strong>,</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Online Transactional Processing applications (OLTP): A transaction is a record of an exchange.&nbsp;OLTP is centered around a set of common business processes that is regular, repeatable, and durable.&nbsp;<ol><li><strong>OLTP, are usually powered by relational databases. The data is highly structured, controlled, and predictable.</strong></li></ol></li><li>Online Analytics Processing applications (OLAP) are run as needed for things like business intelligence workloads and data analysis.&nbsp;<ol><li>The goal is to gain insight.&nbsp; Workloads are often Retrospective, Streaming, and Predictive. </li><li><strong>OLAP, are often powered on the backend using non-relational databases</strong>. The workloads are unpredictable, and the output is used to answer questions about the unknown.</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="has-text-align-center"><strong><em>Relational Database:</em></strong></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>They provide an efficient, intuitive, and flexible way to store and report on highly-structured data.&nbsp;&nbsp;These structures, called schemas, are defined before any data can be entered into the database.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Once a schema has been defined, database administrators and programmers work backward from these requirements to define how data will be stored inside the database. Schema changes to existing databases are expensive in terms of time and compute power. &nbsp; It also has a risk of corrupting data and breaking existing reports.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://programmerprodigycode.files.wordpress.com/2020/12/201fb-iu.gif" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Data integrity is of particular concern in a relational database, there are a number of constraints that ensure the data contained in tables is reliable and accurate.</strong> These reliability features commonly referred to as <strong><em>ACID</em></strong> transactions,</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Atomicity refers to the elements that make up a single database transaction.&nbsp; A transaction could have multiple parts.&nbsp; It is treated as a single unit that either succeeds completely or fails completely.</li><li>Consistency refers to the database’s state.&nbsp; Transactions must take the database from one valid state to another valid state.</li><li>Isolation prevents one transaction from interfering with another.</li><li>Durability ensures that data changes become permanent once the transaction is committed to the database.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Data in a relational database must be kept in a known and stable state.&nbsp;&nbsp;</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Relational database engines have built-in features for securing and protecting data but planning and effort are required to properly implement them.&nbsp;These features include user authentication, authorization, and audit logging.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>As part of the structure, data stored in relational databases is highly normalized.&nbsp; Normalization is a process where information is organized efficiently and consistently before storing it.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2974} -->
<figure class="wp-block-image"><img src="https://programmerprodigycode.files.wordpress.com/2020/12/image-79.jpg?w=620" alt="" class="wp-image-2974"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Relational databases are not partition tolerant.&nbsp; A data partition, in this case, refers to the disk.&nbsp; Adding another disk would be like creating a second copy of the database.&nbsp;Because of this complexity, most of the time relational databases are scaled vertically.&nbsp;&nbsp;</strong></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>1.<strong>Amazon Relational Database Service (RDS):</strong></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>It is a relational database service that provides a simple way to provision, create, and scale a relational database within&nbsp;AWS. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It's a managed service, which takes many of the mundane administrative operations out of your hands, and it's instead managed by AWS, such as backups and the patching of both the underlying operating system in addition to the database engine software that you select.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Amazon RDS allows you to select from a range of different database engines. </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>MySQL: considered the number one open source relational database management system. </li><li>MariaDB: community-developed fork of MySQL. </li><li>PostgreSQL: the preferred open source database. </li><li>Amazon Aurora is AWS's own fork of MySQL, which provides ultrafast processing and availability, as it has its own cloud-native database engine. </li><li>The Oracle database is a common platform in corporate environments. </li><li> SQL Server, it is a Microsoft database with a number of different licensing options.</li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://webscoot.io/wp-content/uploads/2019/07/rds-vs-ec2-mysql-1024x412.jpg" alt=""/><figcaption>Credits: https://webscoot.io/wp-content/uploads/2019/07/rds-vs-ec2-mysql-1024x412.jpg</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In addition to so many different database engines, you also have a wide choice when it comes to selecting which compute instance you'd like to run your database on. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You can deploy your RDS instance in a single availability zone. However, if high availability and resiliency is of importance when it comes to your database, then you might want to consider a feature known as Multi AZ. When Multi AZ is configured, a secondary RDS instance is deployed within a different availability zone within the same region as the primary instance.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://docs.amazonaws.cn/en_us/AmazonRDS/latest/UserGuide/images/con-multi-AZ.png" alt=""/><figcaption>Credits: https://docs.amazonaws.cn/en_us/AmazonRDS/latest/UserGuide/images/con-multi-AZ.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>When it comes to scaling your storage, you can use a feature called storage autoscaling. </strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>MySQL, PostgreSQL, MariaDB, Oracle, and SQL Server all use Elastic Block Store, EBS volumes, for both data and log storage.  <ol><li>The database engines that use EBS support general purpose SSD storage, provisioned IOPS SSD storage, and magnetic storage.</li></ol></li><li>Amazon Aurora uses a shared cluster storage architecture and does not use EBS. <ol><li>Aurora doesn't use EBS and instead uses a shared cluster storage architecture which is managed by the service itself.</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You can also perform manual backups anytime you need to, which are known as snapshots. Aurora database, you can also use a feature called backtrack, and this allows you to go back in time on the database to recover from an error or incident without having to perform a restore or create another database cluster.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"textAlign":"center"} -->
<h2 class="has-text-align-center"><strong><em>Non Relational Database:</em></strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>While relational databases are highly-structured repositories of information, non-relational databases do not use a fixed table structure. They are schema-less.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Since it doesn’t use a predefined schema that is enforced by a database engine, a non-relational database can use structured, semi-structured, and unstructured data without difficulty.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","width":587,"height":241,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://www.flyingmachinestudios.com/assets/images/posts/datomic/schemaless.png" alt="" width="587" height="241"/><figcaption>Credits: https://www.flyingmachinestudios.com/assets/images/posts/datomic/schemaless.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>NoSQL databases are popular with developers because they do not require an upfront schema design; they are able to build code without waiting for a database to be designed and built.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong><em>NoSQL databases, in general, share a few basic characteristics.&nbsp;&nbsp;</em></strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Most NoSQL databases access data using their own Application Programming Interface, API.&nbsp; However, some NoSQL databases use a subset of SQL for data management.</li><li>Schemas can be created dynamically as data is accessed or embedded into the data itself.</li><li>NoSQL databases have a reputation for being more flexible with the data they can accept and support agile and DevOps philosophies.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>NoSQL databases are often run in clusters of computing nodes. Data is partitioned across multiple computers so that each computer can perform a specific task independently of the others. Each node performs its task without having to share CPU, memory, or storage with other nodes. <strong>This is known as a shared-nothing architecture</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Most NoSQL databases relax ACID constraints found in relational databases.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>NoSQL solutions were developed around the purpose of providing high availability and scalability in a distributed environment. To do this, either consistency or durability has to be sacrificed according to CAP theorem.&nbsp; </p>
<!-- /wp:paragraph -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://www.researchgate.net/profile/David-Lee-164/publication/323309389/figure/fig2/AS:596430729261057@1519211575897/CAP-theorem-concept-5-II-WHY-YOU-NEED-NOSQL-The-first-reason-to-use-NoSQL-is-because.png" alt=""/><figcaption>Credits: https://www.researchgate.net/profile/David-Lee-164/publication/323309389/figure/fig2/AS:596430729261057@1519211575897/CAP-theorem-concept-5-II-WHY-YOU-NEED-NOSQL-The-first-reason-to-use-NoSQL-is-because.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>By relaxing consistency, distributed systems can be highly available and durable.</strong>&nbsp;Using a NoSQL approach, inconsistent data is expected.&nbsp; There’s no problem as long as it’s recognized and managed appropriately. Currently, there is no standard query language that is supported by all NoSQL databases.&nbsp;&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong><em>NoSQL databases are a family of non-relational databases that include</em></strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>Key-Value databases</strong> are the simplest NoSQL data stores to use from an API perspective. Using a RESTful API, a client can get the value for the key, put a value for a key, or delete a key from the data store.&nbsp; <ol><li>They can be used for storing user session data or storing shopping cart data. Examples include Redis and Memcached.</li></ol></li><li><strong>Document Store Database </strong>is a database that uses a document-oriented model to store information.&nbsp; Each document contains semi-structured data that can be queried. Essentially, the schema for the data is built into the document, itself, and can change as needed.&nbsp;<ol><li>It's written in  JavaScript Object Notation(JSON),&nbsp;what makes this different than a key-key value store is that, for some of the values, there are nested key-value pairs that can be indexed and retrieved.  </li><li>They can be used for E-commerce Platforms or Blogging platform data. Examples include Mongo DB.</li></ol></li><li><strong>Graph Store</strong> Graph databases store and analyze the relationships between things. Graph databases can visualize people in terms of a social network but they can also be used to see how systems and processes are connected. <ol><li>It has two primary components, Vertices(Nodes) and Edges(Relationship. Every vertice and edge has a unique identifier. </li><li>They can be used for Network operation data or Social networking data. Examples include Amazon Neptune.</li></ol></li><li><strong>Column Data Stores</strong> is a database in which data is stored in cells grouped in columns of data rather than as rows of data. Columns are logically grouped into column families. <ol><li>They can be used for Content Management Systems or Blogging platform data. Examples include Apache Hadoop and Cassandra. </li></ol></li><li><strong>ElastiCache</strong> is an in-memory store.&nbsp; The primary use case for an in-memory store is caching. A cache improves database performance by serving often requested data from memory instead of from a disk or from a memory-intensive calculation.&nbsp;</li><li><strong>Timestream</strong> is a Time Series database.&nbsp; Time series databases answer questions about trends and events.&nbsp; While it is a type of key-value store with the time as the key, a time series database looks at ranges of data points to calculate answers.</li><li><strong>Quantum Ledger Database</strong> is a ledger database.&nbsp; A ledger database uses cryptographic controls to ensure that the data stored is immutable.&nbsp; Records are not edited.&nbsp; Instead, when information changes, new versions of the record are created.&nbsp; It also uses a blockchain to ensure data integrity.&nbsp; When a hash is created to verify data integrity it uses the data along with the hash from the previous record.&nbsp; If the chain is tampered with, the chain will be broken.</li><li><strong>Elasicsearch</strong> Service is a search database.&nbsp; Search databases create indexes to help people find important information.&nbsp; Web searching is a common application but searching is also done in product catalogs, enterprise documentation, and in content management systems.</li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":853,"height":445,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="http://awsprocert.com/wp-content/uploads/sites/2/2019/04/11_AWS_Purpose-built_Database_Types-1.png" alt="" width="853" height="445"/><figcaption>Credits: http://awsprocert.com/wp-content/uploads/sites/2/2019/04/11_AWS_Purpose-built_Database_Types-1.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Scaling a NoSQL database is easier and less expensive than scaling a relational database because the scaling is horizontal instead of vertical. NoSQL databases generally trade consistency for performance and scalability.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>With most NoSQL databases, it's possible for data to be inconsistent; a query might return old or stale data. You might hear this phenomenon described as being eventually consistent.&nbsp; Over time, data that is spread across storage nodes will replicate and become consistent. What makes this behavior acceptable is that developers can anticipate this eventual consistency and allow for it.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://cloud.google.com/datastore/docs/articles/images/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/eventual-consistency.png" alt=""/><figcaption>Credits: https://cloud.google.com/datastore/docs/articles/images/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/eventual-consistency.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4>1.Amazon Dynamo DB:</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Amazon DynamoDB is a NoSQL database, which means that it doesn't use the common Structured Query Language, SQL. It falls into a category of databases known as key-value stores. </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Amazon DynamoDB is designed to be used for ultra high performance, which could be maintained at any scale with single-digit latency. </li><li>DynamoDB is also a fully managed service, taking many of the day-to-day administration operations out of your hands, giving you more time to focus on the business logic of your database. </li><li>The creation of a DynamoDB database is very easy. All you have to do is set up your tables and configure the level of provision throughput that each table should have. </li><li>You are charged for the total amount of throughput that you configure for your tables plus the total amount of storage space used by your data.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>In its simplest form, you can just provide a table name and a primary key, which is used to partition data across hosts for scalability and availability. You can then accept any remaining defaults and create your database, it's as simple as that. </strong></p>
<!-- /wp:paragraph -->

<!-- wp:embed {"url":"https://awscomputeblogimages.s3-us-west-2.amazonaws.com/IoTBackend_Picture2.png","type":"rich","providerNameSlug":"embed","className":""} -->
<figure class="wp-block-embed is-type-rich is-provider-embed wp-block-embed-embed"><div class="wp-block-embed__wrapper">
https://awscomputeblogimages.s3-us-west-2.amazonaws.com/IoTBackend_Picture2.png
</div><figcaption>Credits:https://awscomputeblogimages.s3-us-west-2.amazonaws.com/IoTBackend_Picture2.png</figcaption></figure>
<!-- /wp:embed -->

<!-- wp:paragraph -->
<p>The default option provides no secondary index. However, you can add them here if required. DynamoDB lets you create additional indexes so that you can run queries to search your data by other attributes. If you've worked with relational databases, you've probably used indexes with those, but there are a couple of big differences in how indexes operate in DynamoDB.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Each query can only use one index. If you want to query and match on two different columns, you need to create an index that can do that properly. </li><li>When you write your queries, you need to specify exactly which index should be used for each query. It's not like a relational database that has a query analyzer, which can decide which indexes to use for our query. </li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>DynamoDB has two different kinds of secondary indexes, </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>global indexes let you query across the entire table to find any record that matches a particular value </li><li>local secondary indexes can only help find data within a single partition key.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>When you create a table in DynamoDB, you need to tell AWS how much capacity you want to reserve for the table. You don't need to do this for disk space as DynamoDB will automatically allocate more space for your table as it grows. However, you do need to reserve capacity for input and output for reads and writes. Amazon charges you based on the number of read capacity units and write capacity units that you allocate. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://d2908q01vomqb2.cloudfront.net/887309d048beef83ad3eabf2a79a64a389ab1c9f/2017/02/15/PartitionKey.png" alt=""/><figcaption>Credits: https://d2908q01vomqb2.cloudfront.net/887309d048beef83ad3eabf2a79a64a389ab1c9f/2017/02/15/PartitionKey.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>By default, when you create a table in the AWS Console, Amazon will configure your table with five read capacity units and five write capacity units. There are two modes that you can choose from, provisioned and on-demand. </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>Provisioned mode</strong> allows you to provision set read and writes allowed against your database per second by your application and is measured in capacity units, RCUs for reads and WCUs for writes. Depending on the transaction, each action will use one or more RCUs or WCUs. Provisioned mode is used generally when you have a predicted and forecasted workload of traffic. </li><li><strong>On-demand mode</strong> does not provision any RCUs or WCUs, instead they are scaled on demand. The downside is that it is not as cost effective as provisioned. This mode is generally used if you do not know how much workload you are expected to experience. Over time, you are likely to get more of an understanding of load and you can change your mode across to provisioned.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Through the use of the key management service, KMS, you are able to select either a customer managed or AWS managed CMK to use for the encryption of your table instead of the default keys used by DynamoDB. </strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Some of the advantages of DynamoDB</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li> It's fully managed by AWS, you don't have to worry about backups or redundancy.</li><li>DynamoDB tables are schema less so you don't have to define the exact data model in advance.</li><li>DynamoDB is designed to be highly available and your data is automatically replicated across three different availability zones within a geographic region. </li><li>DynamoDB is designed to be fast, read and writes take just a few milliseconds to complete and DynamoDB will be fast no matter how large your table grows, unlike relational database, which can slow down as the table gets large. </li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Downsides to using DynamoDB too.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Your data is automatically replicated. Three copies are stored in three different availability zones and that replication usually happens quickly in milliseconds, but sometimes it can take longer and this is known as <strong>eventual consistency. </strong>This happens transparently and many operations will make sure that they're always working on the latest copy of your data, but there are certain kinds of queries and table scans that may return older versions of data before the most recent copy. </li><li>DynamoDB's queries aren't as flexible as what you can do with SQL. If you are used to writing advanced queries with joins and groupings and summaries, you won't be able to do that with DynamoDB. You'll have to do more of the computation in your application code. </li><li>Although DynamoDB performance can scale up as your needs grow, your performance is limited to the amount of read and write throughput that you've provisioned for each table. If you expect a spike of the database use, you'll need to provision more throughput in advance or database requests will fail you can adjust throughput at any time and it only takes a couple of minutes to adjust. </li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://d1.awsstatic.com/elasticache/Databases@2x.9af8c5139aca45f82e5aa0aecb5a7bcc5072921e.png" alt=""/><figcaption>Credits: https://d1.awsstatic.com/elasticache/Databases@2x.9af8c5139aca45f82e5aa0aecb5a7bcc5072921e.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Let me know where i could improve at?</p>
<!-- /wp:paragraph -->

<!-- wp:jetpack/contact-form {"subject":"New feedback received from your website","to":"kakabisht07@gmail.com"} -->
<!-- wp:jetpack/field-email {"required":true} /-->

<!-- wp:jetpack/field-textarea {"label":"How could i improve?"} /-->

<!-- wp:jetpack/button {"element":"button","text":"Send Feedback","textColor":"black","backgroundColor":"light-gray","className":"is-style-outline"} /-->
<!-- /wp:jetpack/contact-form -->