# Module 8: Databases # Section 1: Amazon Realtional Database Service (RDS) ## Unmnagade vs managed services ### Unmanaged managed by you: * Scaling * Fault tolerance * Availability More fine-tune control ### Managed built in the service: * Scaling * Fault tolerance * Availability Requires less configuration ## Challenges of relational databases * Server maintenance and energy footprint * Software installation and patches * Database backups and high availability * Limits on scalability * Data security * OS installation and patches ## Amazon RDS :::danger Managed services that sets up and operates a relational database in the cloud ::: ## Managed services responsabilities You manage * App opti AWS manages: * OS installation and patches * Databse software installation and patches * Database backups * High availability * Scaling * Power and racking and stacking servers * Server maintenance ## Amazon RDS DB instances ![](https://i.imgur.com/VKWG2cP.png) ## Amazon RDS in a VPC ![](https://i.imgur.com/3rZrzcR.png) * Select IP address range * Subnets * Configure routing and access control list ## High availability with Multi-AZ deployement ### 1 ![](https://i.imgur.com/F6BPAb1.png) * Automatically generates a standby copy in another AZ within the same VPC * Enhanced availability ### 2 ![](https://i.imgur.com/aKG41lT.png) :::warning If the main database instance fails, Amazon RDS automatically brings the standby instance online. ::: ## Amazon RDS read replicas Features * Offers asynchronous replication * Can be promoted to master if needed Functionality * Use for read-heavy database workloads * Offload read queries ## Use cases ![](https://i.imgur.com/NipofB0.png) ## When to Use Amazon RDS |Use Amazon RDS when your app requires|Do not use Amazon RDS when your app requires| |-|-| |Complex transactions or complex queries|Massive read/write rates| |A medium to high query or write rate (Up to 30,000 IOPS)|Sharding due to high data size or throughput demands| |No more than a single worker node or shard|Simple GET or PUT requests and queries that a NoSQL database can handle| |High durability|Relational database managemnet (RDBMS) customization| ## Amazon RDS: Clock-hour billing and db characteristics Clock-hour billing * Resources incur charges when running Databas characteristics * Physical capacity * Engine * Size * Memory class ## Amazon RDS: DB purchase type and multiple DB instances DB purcharse type * On-demand isntances * Compute capacity by the hour * Reserved Instance * Low, one-time, upfront paymenent for db instances that are reserved with a 1-year or 3-year term Number of DB instances * Provision multiple DB instance to handle peak loads ## Amazon RDS storage Provisioned storage * No charge * Bakcup storage up to 100% of db storage for an active db * Charge (*GB/month*) * Backup storage for terminated DB instances Additional storage * Charge (*GB/month*) * Backup storage in addition to provisioned storage ## Amazon RDS: Deployement type and data transfer Requests * The number of input and output requests that are made to the db Deployement type - storage and I/O vary, depending on whether you deploy to * Single AZ * Multiple AZ Data transfer * No charge for inbound data transfer * Tiered charges for outbound data transfer # Section 2: Amazon DynamoDB ## Realtion vs non-relation DB ![](https://i.imgur.com/Odb7clA.png) ## What is Amazon DynamoDB ? :::info Fast and flexibe NoSQL db service for any scale ::: * NoSQL db tables * Can be scaled * Create tables and add items * Global tables * Automatically replicates choices across AWS regions * Virtually unlimited storage * Items can have differing attributes * Don't have to migrate schema * Low-latency queries * Scalable read/write throughput * Store data accross multiples facilities * fault-toleratn architecture * stored in SSDs * encrypt data at rest * set time to live * Automatically partitions data ## Amazon DynamoDB core components * Tables, itmes and attributes * DynamoDB supports 2 different kinds of primary keys * Partition key * Sort key ## Items in a table must have a key ![](https://i.imgur.com/XPCdhL0.png) # Section 3: Amazon Redshift ## Amazon Redshift :::info Fast, fully managed data warehouse, simple and cost-effective to analyze data using SQL and business intellignec tools. ::: ## Introduction to Amazon Redshift ![](https://i.imgur.com/Uy8L1TQ.png) * Fast and fully-managed data warehouse * Pay for what you use * Complex analytics queries * Parallel processing * Only seconds ## Parallel processing architecture ![](https://i.imgur.com/CSX2p5Z.png) ## Automation and scaling Automate * manage * monitor * scale :::warning Security is built-in with encryption of data. ::: ## Compatibility * Supports standard SQL * Connect with SQL clients * Java connectivity * Open DB connectivity * Interact direclty with AWS CLI or management console ## Amazon Redshift use cases * Enterprise data warehouse (EDW) * Migrate at a pace that customers are comfortable with * Experiment without large upfront cost or commitment * Respond faster to business needs * Big data * Low price point for small customers * Managed service for ease of deployment and maintenance * Focus more on data and less on database management * SaaS * Scale the data warehouse capacity as demand grows * Add analytic functionality to app * Reduce hardware and software costs # Section 4: Amazon Aurora :::info MySQL and PostreSQL compatible relational db built for the cloud. ::: * Enterprise-class relational db * Compatible with MySQL or PostgreSQL * Automate time-consuming tasks (such as provisioning, patching, backup, recovery, failure detection and repair) * Can reduce db costs ## Amazon Aurora service benefits * Fast and available * Managed service * Simple * Pay-as-you-go * Compatible ## High availability * Storing multiple copies through different AZ * Data backed up to Amazon S3 * Use up to 15 read replica ## Resilient design * Instant crash recovery * Does not need to replay the redo log * Do it on every read operation * Removes the buffer cache from the db process # Wrap-up Which of the following is a fully managed NoSQL db service ? 1. Amazon RDS 2. Amazon DynamoDB 3. Amazon Aurora 4. Amazon Redshift :::spoiler Answer Keywords: * NoSQL Answer: 2. :::