AWS Database Design
- Database types
- Hosted services – hosted in AWS services are managed by AWS
- Relational
- Non-relational (NoSQL)
- Custom instance installs
- In this case, we create databases from scratch and use our license
- We are accomplishing Bring Your Own License (BYOL)
- Hosted services – hosted in AWS services are managed by AWS
- Hosted services
- This is AWS Relational Database Services (RDS). This includes:
- Aurora MySQL
- Aurora PostgreSQL
- Oracle
- SQL Server
- MySQL
- PostgreSQL
- MariaDB
- This is AWS Relational Database Services (RDS). This includes:
Pro Tip: Maximum retention date for RDS is 35 days. Also, setting the retention date to 0 (zero) means disabling backup.
- Custom instance installs
- You need to install the instance
- Then install the appropriate database service
- Flat File databases vs Relational databases
Flat File databases | Relational databases |
Have one line per record | Store portions of the data in designated tables. For example, Name, Products, etc |
Doesn’t contain multiple tables. For example, an Excel spreadsheet with just one worksheet | Tables are related based on a unique identifier |
- NoSQL (more info about NoSQL click here)
- It’s a document-based database
- DynamoDB is a NoSQL service
- Relational Databases (RDB)
- Uses multiple tables that are related to one another
- Tables are linked based on primary keys and foreign keys
- Database hosting methods are:
- EC2 Instance-based
- Launch an instance
- Install the database
- Open the appropriate ports in security groups
- Connect to the database
- AWS Service-based
- Launch the database
- Connect to the database
- EC2 Instance-based
- High-availability solutions
- Clustering vs Standby instance
Clustering | Standby Instances |
Multiple servers (instances) | Multiple servers (instances) |
One database with replication | One database with replication |
Increases availability | Increases recoverability |
Automatic failover | No automatic failover |
Increased costs | Reduced costs |
- Single AZ deployment vs Multiple AZ deployment
Single AZ deployment | Multiple AZs deployment |
One instance | Multiple instances |
One AZ | Multiple AZs |
One region | One region |
No storage replication | Replicated storage |
Reduced costs | Increased costs |
- Scalability solutions
- Can increase capacity through:
- Storage
- Processing
- Network operations
- Throughput
- How to change the instance?
- Change the type/class
- Auto Scaling is not supported in RDS
- Aurora
- Created by Amazon
- It’s a relational DB
- Optimized for Online Transaction Processing (OLTP)
- Very fast writes
- MySQL-compatible database system
- Increased performance over MySQL
- Scaling Aurora
- Initial 10 GB, scaling in 10 GB increments
- Max 64 TB
- Compute resources
- Max 32 CPUs
- Max 244 GiB RAM
- Initial 10 GB, scaling in 10 GB increments
- Aurora availability
- Availability defaults
- 2 DB copies in each AZ
- Minimum of 3 AZs
- Write capabilities
- Continues with up to two copies lost
- Read capability
- Continues with up to three copies lost
- Availability defaults
- Aurora replicas
- Up to 15 Aurora replicas
- Automatic failover
- Up to 15 Aurora replicas
- It is MySQL compatible
- Redshift
- Data warehouse database (warehouses are bringing data from multiple sources to one place)
- Optimized for Online Analytical Processing (OLAP)
- AWS managed
- Pricing
- Entry point of $0.25/hr
- 1,000 per TB/yr
- Single node
- 160 GB
- Multiple nodes
- Leader node
- Connections and queries
- Compute node
- Store data and execute queries and calculations
- Leader node
- Redshift security
- SSL transit encryption
- AES-256 storage encryption
- Keys managed through AWS Key Management
- Availability
- Operates in one AZ
- Snapshots can be restored to new AZs
- Can increase capacity through:
Pro Tip: In OLTP if you lose your data, it cannot be recoverable that’s why it needs more AZs for backup. However, in OLAP data is created from another source in the data warehouse therefore you can create data from the source. The criticality of data is very high in the OLTP database solution.
- DynamoDB
- It’s a NoSQL database service
- Provides special features
- Millisecond latency at any scale
- Very very fast read/write
- Stored on SSD
- Spread across 3 distinct data centers
- Millisecond latency at any scale
- Read consistency types
- Eventual consistent read
- Can delay by a few seconds
- Cost less
- Strongly consistent reads
- Delay in only milliseconds
- Cost more
- Eventual consistent read
- Pricing
- Storage
- $0.25/GB per month
- Throughput
- Write – billed per hour for every 10 units
- Read – billed per hour for every 50 units
- 1 unit equals 1 write per second
- Storage
- You never create a database in DynamoDB, you only create tables
Bonus Tip: The perfect example of DynamoDB is your smartphone because mobile applications tend to send and receive little information to servers to make important decisions based on that information. For example, during games, you get certain ads after completing a level and need to watch those ads before continuing the game. based on the click of those ads’ software decide which ads you like or which you don’t. they need to act very fast so in order to proceed with those they require DynamoDB.
Pro Tip: Always use DNS perimeter to connect to the database because IP can change for failover database but DNS remains the same.
0 Comments