{"id":132,"date":"2020-06-24T21:43:14","date_gmt":"2020-06-24T21:43:14","guid":{"rendered":"http:\/\/blog.codeandtech.com\/blog\/?p=132"},"modified":"2020-06-24T21:43:14","modified_gmt":"2020-06-24T21:43:14","slug":"aws-database-purpose-built","status":"publish","type":"post","link":"https:\/\/blog.codeandtech.com\/blog\/2020\/06\/24\/aws-database-purpose-built\/","title":{"rendered":"AWS Database (Purpose Built)"},"content":{"rendered":"\n<p>AWS offers many purpose built Databases. Note this is an immense wide topic. Thought of writing this for my own refresher.<\/p>\n\n\n\n<p><strong>AWS RDS &#8211; Relational Database<\/strong>:<br>&#8211; data is actually relation, ACID (atomic, consistent, integrity, durable) compliant<br>&#8211; referential integrity<br>&#8211; static and unchanging<br>&#8211; ubiquitous &#8211; easy and available in many flavors. can handle different types of workloads<br>&#8211; RDS read replicas for 6\/6 DB engines available<br>ex: shopper to read history. query from read db instead of main db<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Anti pattern: lot of loads can run but are not good for JSon object or if there is no well defined schema<\/code><\/pre>\n\n\n\n<p><strong>DynamoDB &#8211; NO SQL<\/strong><br>&#8211; fully managed, multi region<br>&#8211; multi primary, no SQL<br>&#8211; built in security backup and restore<br>low latency key baseeed query. fast performance handle throughput maintaining consistency<br>&#8211; ex: product desc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for Hot data -  \n    DAX Caching - DAX - items to cache in a matter of microseconds \n    reduces response times of eventually consistent read workloads from single digit milliseconds to microseconds\n    devs need not modify their app logic\n\n    Elasticache for redis and ElasticCache for MemChached<\/code><\/pre>\n\n\n\n<p><strong>Amazon Redshift <\/strong>&#8211; Dataware House<br>for cold data &#8211; for analytics, columnar database services help<br>columnar storage tech in order to improve I\/O efficiency and parallelized queries across multiple nodes for fast query performance<br>Analytics, trend monitoring and gaming insights to know what&#8217;s ging on in the system<br>ex: daily report,allow pulling from datalake<br>use standard SQL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>- AQUA - Advanced query accelerated cache. that does substantial share of data processsing in place on the cache,\n  enabling Redshift to run upto 10x faster<\/code><\/pre>\n\n\n\n<p>Other options\/flavors are<br>financial requirements, doc storage reqruiement or mobile game specific community<\/p>\n\n\n\n<p>Below are some more purpose built database services options available in AWS<\/p>\n\n\n\n<p><strong>Amazon QLDB <\/strong>&#8211; ledger database transparent cryptographically verifiable transaction log. Immutable<br>when you need to keep track of financial activity in an organization<\/p>\n\n\n\n<p><strong>Amazon Document DB for MongoDB<\/strong> for storage of JSON &#8211; fault tolerant, self healing storage that supports automatic data scaling<br>allows customer to scale from 10GB all the way upto 64TB per database cluster<\/p>\n\n\n\n<p><strong>Amazon Neptune<\/strong> &#8211; Graph &#8211; database option<br>Propert Graph and W3C&#8217;s RDF along with respective query<br>ex: Games &#8211; connectivity between each player<br>Supports Apache TinkerPop Gremlin and SPARQL<\/p>\n\n\n\n<p><strong>Amazon Keyspaces &#8211; AWS Managed Cassandra compatible service<\/strong><br>if customer needs wide column key store &#8211;<br>automatically supports three replicas that can be distributed across different AZs<\/p>\n\n\n\n<p><strong>Amazon Timestream<\/strong> &#8211; Timeseries database. need to analyze billions\/trillions of data<br>ex: user activity log. ex: trivago<br>automates rollups, retention, tiering and compression of data<br>ex: from device sensors constantly<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>Data patterns<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-read heavy\n    lot of incoming data. more query processing on that. there is a read contention\/querying due to lot of records\n    querying over and over again\n    Option - materialized view is a database object \n\n-micro service\n    avoid sharing data between micro services\n\n- break monolith into small domains which could be microservice or a collection of microservices\n\n- isolate bounded context - part of domain driven design - back your data based on functionality\n\n- Event sourcing and CQRS (command query responsibilty seggregation)\n    changig the parts of the app to define which is responsible of reading vs writing\n\n- SAGA Pattern - sequence of events that happen in a Distributed transactions\n    orchestrate\/choreograph using orchestrators like step functions to coordinate activities to perform\/trigger a transactional boundary to commit\/rollback across distributed design\n    only works when we can embrace eventual consistency<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>AWS Database Migrations<\/strong><\/p>\n\n\n\n<p>Consider a source (on prem) &#8211;&gt; RDS \/ EC2 migration. <\/p>\n\n\n\n<p><strong>Types of migration<\/strong><\/p>\n\n\n\n<ul><li>like to like (homogenous) &#8211; moving between database instances using the same db tech<\/li><li>like to unlike (heterogenous) &#8211; migratnig to a completely different database technology<\/li><\/ul>\n\n\n\n<p><strong>Options available for migration<\/strong><\/p>\n\n\n\n<ul><li>DMS &#8211; Database management service<\/li><li>third party<\/li><li>partner<\/li><li>backup and restore<\/li><\/ul>\n\n\n\n<p>for like to like &#8211; DMS uses replication instance and keeps the source available\/online. DB engines are compatible<\/p>\n\n\n\n<p>for like to unlike pattern &#8211; <strong>SCT (Schema conversion tool) + DMS<\/strong> can help<br>if the datastructure are not same they need to be converted to a compatible type<br>ex: once-off migration, source to target, consolidate databases, dev and test<\/p>\n\n\n\n<p><strong>Snowball edge:<\/strong><br>if the bandwidth, infrastructure is not available, snowball edge can be used to copy the data into S3 and can be migrated<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS offers many purpose built Databases. Note this is an immense wide topic. Thought of writing this for my own refresher. AWS RDS &#8211; Relational Database:&#8211; data is actually relation, ACID (atomic, consistent, integrity, durable) compliant&#8211; referential integrity&#8211; static and unchanging&#8211; ubiquitous &#8211; easy and available in many flavors. can handle different types of workloads&#8211; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.codeandtech.com\/blog\/2020\/06\/24\/aws-database-purpose-built\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AWS Database (Purpose Built)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/132"}],"collection":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":2,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}