Module 8 - Database Services
Module 8 - Database Services
services
Introduction to database services of AWS
• AWS offers a wide range of database services to fit your application requirements. These database
services are fully managed and can be launched in minutes with just a few clicks.
AWS Offerings
• Amazon RDS
• Amazon Redshift
Key-value
Key-value databases are optimized to store and retrieve key-value pairs in large
volumes and in milliseconds, without the performance overhead and scale
limitations of relational databases.
AWS Offerings
• Amazon DynamoDB
In-memory
In-memory databases are used for applications that require real time access to
data. By storing data directly in memory, these databases provide microsecond
latency where millisecond latency is not enough
AWS Offerings:
• Amazon ElastiCache for Redis
• Amazon ElastiCache for Memcached
Relational Database Services
Introduction to Amazon RDS
• Easy to set up, operate, and scale a relational database in the cloud.
• Provides cost-efficient and resizable capacity while automating time-consuming administration tasks
such as hardware provisioning, database setup, patching and backups.
• Makes to focus on your applications so you can give them the fast performance, high availability,
security and compatibility they need.
• RDS is an Online Transaction Processing (OLTP) type of database (INSERT, UPDATE, DELETE)
• Primary use case is a transactional database (rather than analytical)
Benefits
Easy to administer
Highly scalable
Available and durable
Fast
Secure
Inexpensive
Different types of database engines supported in AWS RDS
• MySQL
• Maria DB
• PostgreSQL
• Oracle
• Microsoft SQL Server DB engines
• Amazon Aurora
Multi-AZ Deployment
- You can encrypt your Amazon RDS DB instances and snapshots at rest by enabling the encryption
option for your Amazon RDS DB instances. Data that is encrypted at rest includes the underlying
storage for a DB instances, its automated backups, Read Replicas, and snapshots.
- You can’t disable encryption on an encrypted DB
- You can not enable encryption for an existing, un-encrypted database instance, but there is an
alternate way
- Create a snapshot of the DB
- Copy the snapshot and choose to encrypt it during the copy process
- Restore the encrypted copy into a New DB
Amazon Aurora
- Amazon Aurora is a relational database management system (RDBMS) built for the cloud with full
MySQL and PostgreSQL compatibility
- Provides built-in security, continuous backups, serverless compute, up to 15 read replicas,
automated multi-Region replication, and integrations with other AWS services
- Up to 5x the throughput of MySQL
and 3x the throughput of
PostgreSQL
- With Amazon Aurora Serverless,
you can run your database in the
cloud without managing any
database instances
Alternative to Amazon RDS
If your use case isn’t supported on RDS, you can run databases on Amazon EC2.
- You can run any database you like with full control and ultimate flexibility.
- You must manage everything like backups, redundancy, patching and scaling.
- Good option if you require a database not yet supported by RDS, such as IBM DB2 or SAP HANA.
- Good option if it is not feasible to migrate to AWS-managed database.
Dynamo DB
- Fast, flexible NoSQL database service for single-digit millisecond performance at any scale
- Lets you offload the administrative burdens of operating and scaling a distributed database
Use cases
Customers
⁻ Nike
⁻ Samsung
⁻ Netflix
Tables
- Dynamo DB supports both Eventual Consistency (default) and Strong Consistency models
- When you read data from a Dynamo DB table, the response might not reflect the results of a recently
completed write operation
- Best read throughput
- Consistency across all copies is reached in 1 second
- A read returns a result that reflects all writes that received a successful response prior to the read
- Users/Applications reading from Dynamo DB tables can specify in their requests if they want strong
consistency, otherwise it will be eventually consistent reads (default)
- So the application will dictate what is required, Strong, Eventual, or both
Read Capacity Units
- One read capacity unit represents one strongly consistent read per second, or two eventually
consistent reads per second for an item up to 4KB in size
- If you need to read an item that is larger than 4 KB, Dynamo DB will need to consume additional read
capacity units
- The total number of read capacity units required depends on the item size, and whether you want an
eventually consistent or strongly consistent read.
- One write capacity unit represents one write per second for an item up to 1 KB in size
- If you need to write an item that is larger than 1 KB, Dynamo DB will need to consume additional write
capacity units
- The total number of write capacity units required depends on the item size.
Weather Application basic architecture
DynamoDB Global Tables
- Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for
Amazon DynamoDB that delivers up to a 10 times performance improvement – from milliseconds to
microseconds – even at millions of requests per second
- You can launch a DAX cluster in your virtual network and control access to the
cluster by using Amazon VPC security groups
- Just like DynamoDB, DAX is fully managed
ElastiCache
AWS Elastic Cache
Amazon ElastiCache is a fully managed, Redis and Memcached-compatible service delivering real-
time, cost-optimized performance for modern applications.
Elastic Cache Strategies – Lazy loading
- As the name implies, lazy loading is a caching strategy that loads data into the cache only when
necessary
- Whenever your application requests data, it first makes the request to the ElastiCache cache
- If the data exists in the cache and is current, ElastiCache returns the data to your application
- If the data doesn't exist in
the cache or has expired,
your application requests the
data from your data store
- Your data store then returns
the data to your application
- Your application next writes
the data received from the
store to the cache. This way,
it can be more quickly
retrieved the next time it's
requested
Elastic Cache Strategies – Write through
- A cluster is a collection of one or more nodes using the same caching engine (Memcached or Redis)
- Redis and Memcached are the two most popular in-memory key-value data stores. Memcached is
designed for simplicity while Redis offers a rich set of features that make it effective for a wide range
of use cases. Understand the differences between the two engines to decide which solution better
meets your needs
Choosing between Redis and Memcached
Sub-millisecond latency
Both Redis and Memcached support sub-millisecond response times. By storing data in-memory they
can read data more quickly than disk based databases.
Data partitioning
Both Redis and Memcached allow you to distribute your data among multiple nodes. This allows you to
scale out to better handle more data when demand grows.
Multithreaded architecture
Since Memcached is multithreaded, it can make use of multiple processing cores. This means that you
can handle more operations by scaling up compute capacity.
Snapshots
With Redis you can keep your data on disk with a point in time snapshot which can be used for archiving
or recovery
Replication
Redis lets you create multiple replicas of a Redis primary. This allows you to scale
database reads and to have highly available clusters
Pub/Sub
Redis supports Pub/Sub messaging with pattern matching which you can use for
high performance chat rooms, real-time comment streams, social media feeds, and
server intercommunication.
Database Migration service
- AWS Database Migration Service helps you migrate databases to AWS quickly and securely
- At a basic level, AWS DMS is a server in the AWS Cloud that runs replication software
- You create a source and target connection to tell AWS DMS where to extract from and load to
- Then you schedule a task that runs on this server to move your data
- AWS DMS creates the tables and associated primary keys if they don't exist on the target
- You can create the target tables yourself if you prefer.
⁻ Supports homogeneous migrations such as Oracle to Oracle, as well as heterogeneous migrations
between different database platforms, such as Oracle or Microsoft SQL Server to Amazon Aurora
Benefits
⁻ Simple to use
⁻ Minimal downtime
⁻ Supports widely used databases
⁻ Low cost
⁻ Fast and easy to setup
⁻ Reliable
1. What is a Database
2. What is RDBMS
3. Define RDS
4. Different types of Database engines supported in RDS
5. What is Multi-AZ deployment
6. Define Database Read-replicas
7. Define Dynamo DB & how it is different from RDS
8. What are Data-items and Attributes in a Dynamo-DB table
9. What is the maximum size of an Dynamo DB table and how many data-items can be stored in a table
10.What is Eventual consistency and Strong consistency reads
11.What is Dynamo DB Accelerator
12.What is Elastic Cache
13.What are the Elastic Cache engines supported in AWS
14.What is Database Migration service