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
    • This is AWS Relational Database Services (RDS). This includes:
      • Aurora MySQL
      • Aurora PostgreSQL
      • Oracle
      • SQL Server
      • MySQL
      • PostgreSQL
      • MariaDB

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 databasesRelational databases
Have one line per recordStore 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 worksheetTables 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
  • High-availability solutions
    • Clustering vs Standby instance
ClusteringStandby Instances
Multiple servers (instances)Multiple servers (instances)
One database with replicationOne database with replication
Increases availabilityIncreases recoverability
Automatic failoverNo automatic failover
Increased costsReduced costs
  • Single AZ deployment vs Multiple AZ deployment
Single AZ deploymentMultiple AZs deployment
One instanceMultiple instances
One AZMultiple AZs
One regionOne region
No storage replicationReplicated storage
Reduced costsIncreased 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
      • 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
      • Aurora replicas
        • Up to 15 Aurora replicas
          • Automatic failover
      • 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
      • 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

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
    • Read consistency types
      • Eventual consistent read
        • Can delay by a few seconds
        • Cost less
      • Strongly consistent reads
        • Delay in only milliseconds
        • Cost more
    • 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
    • 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.

Categories: AWS

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *