AWS Cloud Practitioner: Databases 101

In this short series, I outline the notes that I took while preparing for the AWS Cloud Practitioner exam.

These are my personal notes that I have made while working through the A Cloud Guru exam practitioner course. They are in no way official notes from AWS.

I would advise you that if you do use my notes to help you revise for this exam, that you use them as a supplement to the most recent information in the White PapersExam Guide and go over your knowledge with practice exam papers.

Previous notes within this blog series:

Databases 101

Relational Databases
Relational databases are like a traditional spreadsheet.

Contents are:

  • Databases
  • Tables
  • Rows
  • Fields (Columns). These are fixed amounts and when one is added, it affects all rows.

The relational database in AWS is called RDS

6 different types of relational database within RDS:

  • SQL Server
  • Oracle
  • MySQL Server
  • PostgresQL
  • Aurora (Amazon’s own)
  • MariaDB

RDS has two key features:

  • Multi AZ – for disaster recovery
  • Read Replicas – copies of production db for performance. EC2 instances are set up to read from the read replicas rather than production db.

Multi-AZ vs Read Replicas

Multi-AZs
EC2 instance has a connection string to the RDS database. When you have a primary and secondary db set up, Amazon auto points to primary db. If the primary db goes down, this will automatically failover to the secondary db in a different AZ without you having to change the connection string.

Read Replicas
EC2 instances have a connection string that writes to primary db. By default, the writes are replicated to the Read Replicas. If you lose your primary db, the system will just go down.

However, you can set the EC2 instance to do all writes to the primary db and all reads from the Read Replicas (can be up to 5 copies of Read Replicas). This increases performance as there are multiple sources to read from.

Non-Relational Databases

Contents are:

  • Collection = table
  • Document = row
  • Key Value pairs = fields

In format e.g.


{
“Id”: “254834638972375902e4rfthn4jkth4n23ot4h30t”,
“Firstname”: “John”,
“Surname”: ”Smith”,
“Age”: “23”,
“Address”: [
{ “Street”: “21 Jump Street”,
“Suburb”: “Richmond” }
]
}

  • Can be nested or flat
  • Columns in table can vary but it won’t affect the other rows in the db
  • Amazon’s non-relational db is called DynamoDB

Online Transaction Processing (OLTP) vs Online Analytics Processing (OLAP)

OLTP runs different queries than OLAP insert or pulls up a row data to a db
OLAP Pulls in large numbers of records.

What is Data Warehousing?

  • Redshift for Business Intelligence or Data Warehousing
  • To pull in very large and complex data sets
  • Usually used by management to do queries on data e.g. current performance vs targets
  • Doesn’t impact primary db so better for performance
  • Use different architecture from a database perspective and infrastructure layer
  • Amazon’s Data Warehouse Solution is Redshift

What is ElastiCache?

  • ElastiCache to speed up performance of existing databases (frequent, identical queries).
  • A web service that makes it easy to deploy, operate, and scale an in-memory cache in the cloud
  • Improves performance of web apps from fast, managed, in-memory caches, instead of relying entirely on slower disk-based databases.
  • Caching the most common queries

Two types of AWS open-source in memory caching engines:

  • Memcached (pronounced M-cache-d)
  • Redis

Provisioning an RDS Instance

  • Provision an RDS Instance
  • Open MySQL Port to Web-DMZ SG
  • Create an EC2 Instance
  • Install WordPress Using Boot Strap Script
  • Register the EC2 Instance to the Target Group
  • Updated WordPress to the DNS name of ALB
  • Take a Snapshot

Provision an RDS Instance
Creation of a database takes about 10 minutes

Install WordPress Using Bootstrap Script
Once WordPress has been installed onto your EC2 instance, you need to set up WordPress by adding the correct settings that you entered when setting up the instance. The db name, username and passwords should be what you entered on EC2. However, you need to get the db host from the RDS database.

To do this:

  1. Go to RDS in AWS
  2. Go to Databases
  3. Under Connectivity, copy the Endpoint and paste that into the WordPress screen

After entering this, you need to add in the wp-config file. To do this, ssh into the EC2 instance and create the wp-config.php file (don’t forget to sudo su!).
Paste in the text that’s shown to you on the WordPress installation screen.
Once you have created it, continue on the WordPress installation screen.

In Settings of the WordPress website, you should change the url of the website to a load balancer DNS entry so that if the EC2 instance goes down, then the website will fail over to the other instance (providing two instances or an instance and an image has been set up behind the load balancer).

Remember for the exam!
RDS has 2 key features:
Multi-AZ for disaster recovery
Read Replicas for Performance

Use Launch configurations to create auto scaling group to make a fault tolerate website

Leave a Comment

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

Scroll to Top