Databases

Database 101

  1. Relational Database:
    1. Relational Database types:
      1. SQL Server
      2. Oracle
      3. MySQL Server
      4. Postgres SQL Server
      5. Aurora
      6. Maria DB
  2. Non-Relational Database (NoSQL) :
    1. Non-Relational Database types : DynamoDB
  3. Data warehousing service Redshift- for OLAP transactions
  4. ElasticCache
    1. ElasticCache supports Memcached and Redis.
  5. Database Migration Service: Managed service to migrate production database to AWS.

RDS

  1. Database Backups: RDS creates
    Storage volume snapshots take the backup of entire database instance not the individual databases.
    1. Automated Backup:
      1. Enabled by default.
      2. Takes a full snapshot daily and stores transaction logs throughout the day. Retention period 1-35 days. To recover the database first restore from backup and apply transaction logs.
      3. You can do point in time restore within the retention period
      4. Backups are stored in S3. You get free storage space equal to the size of database in S3
      5. Backups are taken in a defined window. Storage I/O may be suspended while taking backup and you may experience latency.
    2. Database Snapshots
      1. Done manually
      2. Stored even after the RDS instance is deleted.
  2. DB Snapshots actions available
    1. Restore snapshot :
    2. Migrate snapshot to another database engine
    3. Copy snapshot to different region
    4. Share snapshot
  3. Encryption :
    1. Supported for MySQL,Oracle,SQL Server, PostgreSQL and MariaDB
    2. Encrypted using AWS KMS
    3. Once RDS is encrypted all the following will be encrypted.
      1. Data stored at rest
      2. Automated backups
      3. Read replicas
      4. Snapshots
    4. Existing DB instances cannot be encrypted. To encrypt existing databases create new instance with encryption enabled and migrate data
  4. Multi-AZ
    1. Multi-AZ is for DR. It is not for performance improvement.
    2. Copy of a DB instance (Standby Instance) in another AZ. DB instance will be continuously replicated and AWS handles the replication. If primary instance fails AWS RDS will automatically failover to standby
  5. Read Replica
    1. Read Replica is for performance improvement.
    2. Creates exact copy of DB instance and the replica is read only. Uses Asynchronous replication.
    3. Supported DBs
      1. MySQL Server. Replication in second region is supported
      2. PostgreSQL.
      3. Maria DB. Replication in second region is supported.
    4. Must have automatic backups on to deploy read replicas
    5. Up to 5 read replicas of any database
    6. Can have read replicas to read replicas
    7. If DB is in Multi-AZ deployment, read replicas can be created for source DB only.
    8. Read replicas can be promoted to their own database. This breaks replication.
    9. Read replica
  6. Scaling Database: RDS – vertical scaling and requires down time. Dynamo DB – Horizontal scaling without downtime

Dynamo DB – No SQL Database

  1. Fully managed database.
  2. Supports both document and key-value data models
  3. Stored on SSD storage
  4. Spread across 3 geographically separated datacenters
  5. Supported Consistency
    1. Eventually Consistent Reads (Default): Consistent across all copies reached within a second. Best Read performance
    2. Strongly Consistent Reads: Read request DynamoDB returns a response with most up-to-date data.
  6. Throughput capacity
    1. Dynamo DB 1 Write capacity unit handles 1 Write per second
    2. Dynamo DB 1 Read capacity unit handles 1 Read per second
    3. You can buy Provisioned Throughput Capacity or Reserved Throughput capacity
  7. Pricing depends on
    1. Throughput capacity
      1. Provisioned Write throughput $0.0065 per hour for every 10 units
      2. Provisioned Read throughput $0.0065 per hour for every 50 units
    2. Storage Cost : $0.25 per Gig per month
  8. DynamoDB is schema less you create Table, not DB. You create items in table. Item is a row in the table.
  9. You can instantly scale Provisioned Capacity

Redshift – Data warehouse

  1. OLAP :
  2. Database warehousing databases use different type of architecture from database perspective and infrastructure layer
  3. An Amazon Redshift data warehouse is a collection of computing resources called nodes, which are organized into a group called a cluster.
  4. Redshift configuration
    1. Single node
    2. Multinode
      1. Leader node: The leader node receives queries from client applications, parses the queries, and develops query execution plans. The leader node then coordinates the parallel execution of these plans with the compute nodes, aggregates the intermediate results from these nodes, and finally returns the results back to the client applications
      2. Compute node: Compute nodes execute the query execution plans and transmit data among themselves to serve these queries. The intermediate results are sent back to the leader node for aggregation before being sent back to the client applications.
  5. Redshift 10x faster
    1. Columnar Data Storage:
    2. Advanced compression
    3. Massively Parallel Processing
  6. Redshift pricing
    1. Compute node hours
    2. Backup
    3. Data transfer
  7. Redshift Security
    1. In transit: Encrypted using SSL
    2. At Rest : Encrypted using AES-256
    3. Key Management can be done either by AWS or Customer
      1. AWS : By default , AWS does the key management
      2. Customer: Manage own keys through
        1. AWS KMS
        2. Customer HSM
  8. Availability : Available in only 1AZ. Can restore snapshots to another AZ

ElasticCache

  1. In memory cache service. Significantly improves performance for read-heavy application workloads
  2. Types of ElasticCache
    1. Memcached
    2. Redis
  3. Exam Tip
    1. ElasticCache : Database is read heavy and not prone to frequent changing
    2. Redis : DB is feeling stress because of OLAP transactions

Aurora

  1. MySQL compatible relational database that runs only on AWS infrastructure.
  2. Scaling
    1. 10Gb – 64Tb in 10Gb increments
    2. Up to 32vCPUs
    3. Up to 244Gb Ram
    4. Requires downtime to scale
  3. Availability
    1. Data is contained in minimum 3 Availability Zones and 2 Copies in each zone. Min. 6 Copies of data
    2. Designed to handle loss of 2 copies for write availability and 3 copies of read availability
    3. Aurora storage is self-healing
  4. Replicas
    1. Aurora replicas (Upto 15) . Automatic failover
    2. MySQL read replicas (Upto 5). Manual failover

 

Security Best Practices
S3
No tags for this post.

Leave a Comment