RDS Flashcards

1
Q

RDS allows you to

A

create databases in the cloud that are managed by AWS

  1. Postgres
  2. MySQL
  3. MariaDB
  4. Oracle
  5. Microsoft SQL Server
  6. Aurora (AWS proprietary)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Advantages over using RDS versus deploying DB on EC2

A
  1. automated provisioning
  2. OS patches
  3. coninuous backups and restore to specific timestamp (Point in time restore)
  4. monitoring dashboards
  5. read replicas for improved read performance
  6. multi AZ setup for disaster recovery
  7. maintenance windows for upgrades
  8. scaling capability (vertical and horizontal)
  9. storage backed by EBS (GP2 or IO1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what you can’t do with RDS as opposed to deploying DB on EC2

A

you can’t SSH into your instances

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

RDS Backups

A
  1. are automatically enabled in RDS

2. Automated backups and / or DB Snapshots

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

RDS Automated backups

A
  1. daily full backup for the database - during the maintenance window configured by user
  2. transaction logs are backed up by RDS every 5 minutes
  3. therefore you can restore to any point in time (from oldest backup to 5 mins ago)
  4. 7 days retention (can be increased to 35)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

DB shapshots

A
  1. are manually triggered by user

2. retention of backup for as long as you want

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

if you want to speed up reads from your RDS DB instance

A

You can reduce the load on your primary DB instance by routing read queries from your applications to the read replica.

You can elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RDS Read Replicas how many

A

up to 5 read replicas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

RDS Read Replicas and AZ

A

can be

  1. within AZ
  2. cross AZ
  3. cross Region
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Replication is

A

ASYNC, so reads are eventually consistent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Replica Lag

A

Each Read Replica publishes a Replica Lag metric in Amazon CloudWatch to allow you to see how far it has fallen behind the source DB Instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how to deal with eventual consistency

A

DO NOT send SELECT queries to a read slave if the data needs to be immediately available.

You should structure your application such that all real-time requests hit your master, and all other requests hit one of your read slaves.

For things where you don’t need real-time results, you can fool the user quite well using something like AJAX requests or websockets (websockets is going to make your application a lot more resource friendly as you won’t be hammering your backend servers with multiple AJAX requests).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

why would you promote a replica to stand-alone DB?

A

You can use read replica promotion as a data recovery scheme if the primary DB instance fails.

But be aware of the ramifications and limitations of asynchronous replication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

To promote a replica for data recovery

A
  1. create a read replica and then monitor the primary DB instance for failures.

In the event of a failure, do the following:

  1. Promote the read replica.
  2. Direct database traffic to the promoted DB instance.
  3. Create a replacement read replica with the promoted DB instance as its source.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Replica traffic

A

The primary DB instance is the only copy of the database that can accept both read/write traffic; the read replica can only accept read-only traffic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

use case for RDS read replica

A

you have a production database taking on a normal load

you want to a reporting application to run some analytics

In order to avoid extra load on the main database, you create a read replica and run this new workload on it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Network costs

A

if your main database is in one AZ and your replica - in another one - there will be a network cost for ASYNC replication of the data. Because when the data is transfered between AZs - there is always a price to pay

So to reduce the costs we can place both the main DB and the replica in one AZ, then we are not charged for the transfer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

RDS Mutli AZ purpose

A

disaster recovery in cases of

  1. loss of AZ
  2. loss of network
  3. instance or storage failure

increase availability

but NOT for scalability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

RDS Mutli AZ one DNS name

A

we have a synchronous replica in another AZ. Automatic failover: App is automatically recovered from failure by redirecting traffic to the standby replica.

no manual intervention necessary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

RDS Multi AZ and replicas

A

read replicas can be set up as Multi AZ for Disaster Recovery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

2 types of RDS encryption

A
  1. at rest encryption

2. in-flight encryption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

at rest encryption

A

you can use AWS KMS customer master key (CMK) which is AES-256 encryption (symmetric block)

has to be configured at launch time

You don’t need to modify your database client applications to use encryption. Amazon RDS handles authentication of access and decryption of your data transparently with a minimal impact on performance.

23
Q

at rest encryption - if master not encrypted

A

read replicas cannot be encrypted

24
Q

TDE

A

Transparent Data Encryption is avaialble for Oracle and SQL Server

using TDE and encryption at rest simultaneously might slightly affect the performance of your database. You must manage different keys for each encryption method.

25
Q

in-flight encryption

A

SSL certificates to encrypt data to RDS in flight

provide SSL options with trust certificate when connecting to database

26
Q

in-flight encryption - to enforce SSL for Postgres SQL

A

in AWS RDS console set

rds.force_ssl = I

27
Q

in-flight encryption - to enforce SSL for MySQL

A

within DB

GRANT USAGE ON . TO ‘user’@’%’ REQUIRE SSL

28
Q

KMS (Key management service)

A

To manage the customer master keys (CMKs) used for encrypting and decrypting your Amazon RDS resources

AWS KMS combines secure, highly available hardware and software to provide a key management system scaled for the cloud. Using AWS KMS, you can create CMKs and define the policies that control how these CMKs can be used. AWS KMS supports CloudTrail, so you can audit CMK usage to verify that CMKs are being used appropriately. You can use your CMKs with Amazon RDS and supported AWS services such as Amazon S3, Amazon EBS, and Amazon Redshift.

29
Q

For an Amazon RDS encrypted DB instance, all

A

logs, backups, and snapshots are encrypted.

30
Q

Once you have created an encrypted DB instance,

A

you can’t change the CMK used by that DB instance.

31
Q

If Amazon RDS loses access to the CMK for a DB instance

A

then the encrypted DB instance goes into a terminal state. In this case, you can only restore the DB instance from a backup. We strongly recommend that you always enable backups for encrypted DB instances to guard against the loss of encrypted data in your databases.

32
Q

Snapshots of un-encrypted RDS databases

A

are un-encrypted

33
Q

snapshots of encrypeted RDS databases

A

are encrypted

34
Q

to encrypte an un-encrypted RDS database

A
  1. create a snapshot of the un-encrypted database
  2. copy the snapshot and enable encryption for the snapshot
  3. restore the database from the encrypted snapshot
  4. migrate applications to the new database
  5. delete the old database
35
Q

RDS Security

A
  1. Network Security

2. Access Management

36
Q

RDS Network Security

A
  1. RDS databases are usually deployed within a private subnet, not in a public one
  2. Security groups (same concept as EC2) leverage which IPs can communicate with RDS - so it’s our responsibility to check the inbound rules in DB’S security group (ports, IP, SG)
37
Q

RDS Access Management

A
  1. IAM policies help control who can manage AWS RDS through RDS API
  2. Username and Pwd can be used to login into the DB
  3. IAM-based authentication can be used to login into RDS MySQL and PostgreSQL
38
Q

IAM database athentication works with

A

MySQL and PostgreSQL

you don’t need a PWD, just an authentication token with a lifetime of 15 minutes

39
Q

IAM database athentication - how does it work

A
  1. We have our EC2 security group and EC2 instance. The instance has an IAM role and thanks to it the instance is able to issue an API call to the RDS service to get back an authentication token
  2. on the other end - we have MySQL RDS database in RDS Security Group
  3. The EC2 instance is going to pass the token while connecting to the database and make sure the connection is encrypted
40
Q

IAM database athentication benefits

A
  1. Network in/out must be encrypted using SSL
  2. IAM manages centrally users instead of managing users from within the database (central authorization)
  3. you can leverage IAM roles and EC2 instance profiles for easy integration
41
Q

AWS responsibility regarding your RDS instance

A
  1. no SSH access
  2. no manual DB patching necessary
  3. no manual OS patching
  4. no way to audit the underlying instance
42
Q

My company would like to have a MySQL database internally that is going to be available even in case of a disaster in the AWS Cloud. I should setup

A

Multi AZ

43
Q

Our RDS database struggles to keep up with the demand of the users from our website. Our million users mostly read news, and we don’t post news very often. Which solution is NOT adapted to this problem?

A

RDS Multi AZ

ElastiCache and RDS Read Replicas do indeed help with scaling reads.

44
Q

We have setup read replicas on our RDS database, but our users are complaining that upon updating their social media posts, they do not see the update right away

A

Read Replicas have asynchronous replication and therefore it is likely our users will only observe eventual consistency

45
Q

Which RDS Classic (not Aurora) feature does not require us to change our SQL connection string?

A

Multi AZ keeps the same connection string regardless of which database is up. Read Replicas imply we need to reference them individually in our application as each read replica will have its own DNS name

46
Q

You want to ensure your Redis cluster will always be available

A

enable multi AZ

47
Q

Your application functions on an ASG behind an ALB. Users have to constantly log back in and you’d rather not enable stickiness on your ALB as you fear it will overload some servers. What should you do?

A

Storing Session Data in ElastiCache is a common pattern to ensuring different instances can retrieve your user’s state if needed.

48
Q

One analytics application is currently performing its queries against your main production database. These queries slow down the database which impacts the main user experience. What should you do to improve the situation?

A

Read Replicas will help as our analytics application can now perform queries against it, and these queries won’t impact the main production database.

49
Q

You would like to ensure you have a database available in another region if a disaster happens to your main region. Which database do you recommend?

A

Aurora Global Databases allow you to have cross region replication

50
Q

Your company has a production Node.js application that is using RDS MySQL 5.6 as its data backend. A new application programmed in Java will perform some heavy analytics workload to create a dashboard, on a regular hourly basis. You want to the final solution to minimize costs and have minimal disruption on the production application, what should you do?

A

this will minimize cost because the data won’t have to move across AZ

51
Q

You would like to create a disaster recovery strategy for your RDS PostgreSQL database so that in case of a regional outage, a database can be quickly made available for Read and Write workload in another region. The DR database must be highly available. What do you recommend?

A

create a Read Replica in a different region and enable multi-AZ on the main database

52
Q

You are managing a PostgreSQL database and for security reasons, you would like to ensure users are authenticated using short-lived credentials. What do you suggest doing?

A

Use PostgreSQL for RDS and authenticate using a token obtained through the RDS service

In this case, IAM is leveraged to obtain the RDS service token, so this is the IAM authentication use case.

53
Q

An application is running in production, using an Aurora database as its backend. Your development team would like to run a version of the application in a scaled-down application, but still, be able to perform some heavy workload on a need-basis. Most of the time, the application will be unused. Your CIO has tasked you with helping the team while minimizing costs. What do you suggest?

A

Aurora Serverless