RDS/Aurora/ElastiCache Flashcards

1
Q

What is AWS RDS? What does it support?

A

Relational Database Service that uses SQL.
Runs on EC2 instances so you must choose instance type
Usually for OLTP (Online Transaction Processing)

Supports: "MO' SPAM"
MySQL
PostgreSQL
Maria
Oracle
SQL Server
Aurora
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why would I use RDS instead of EBS?

A
RDS is managed:
     • provisions/patches
     • backups, restore
     • monitoring dashboards
     • read replicas
     • Multi-AZ for DR
     • maintenance windows for upgrades
     • scaling vertical & horizontal
     • storage backed by EBS (gp or io)

Can NOT SSH into instances.

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

Describe an RDS backup

A
  • Automatically enabled.
  • Daily full backup during maintenance window (you choose when)
  • Transaction logs backed up every 5 minutes
  • you can restore to any point in time from oldest to 5 min ago.
  • 7 days retention (up to 35 days)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe an RDS snapshot

A
  • manually triggered by user
  • retention as long as you want
  • backs up the entire instance
  • will interrupt I/O if only 1 instance or if SQL-Server
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is RDS Auto Scaling?

A

RDS will automatically increase storage when you are running out of space. Limitations:
• free storage < 10% allocated storage (90% full)
• low-storage for at least 5 mins
• 6 hours since last modification

You have to set a Maximum Storage Threshold.

Great for unpredictable workloads

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

What is an RDS Read Replica? What are the characteristics?

A

A copy of your database for read-only.

  • Up to 5 replicas
  • within AZ, across AZ, cross-region
  • Async (eventually consistent)
  • applications have to update the connection string to use read replicas.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the cost to move RDS data from one AZ to another?

A

Usually, there is a cost to move data across AZs, often waived for MANAGED services.

For RDS if it’s in the same region, then it’s free.

Cross-REGION has cost.

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

What is RDS Multi-AZ?

A
  • RDS in AZ1 is replicated SYNChronously to a standby DB in AZ2 (any change happens in both to be accepted).
  • Only 1 DNS name so if #1 fails there is automatic failover to #2. No need to change the connection string in your app.

For Disaster Recovery (DR).

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

Can you set up an RDS Read Replica as Multi-AZ for DR?

A

Yes.

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

How do you go from single AZ to Multi-AZ RDS?

A

Click “modify” on the db.
There is NO downtime.

Behind the scenes, it creates a snapshot of #1, copies to #2, then synchronizes between them.

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

My RDS database is not encrypted. How do I encrypt its replicas?

A

You cannot. Encryption has to be defined at launch. If the master is not encrypted, the replicas cannot be either. The read replica will always have the same encryption as the primary.

You can’t disable encryption for your db either.

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

How is at-rest encryption handled in RDS?

A

AWS KMS (AES-256). No performance impact.

For Oracle, SQLServer you can use Transparent Data Encryption (TDE) - may have performance impact.

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

How is in-flight encryption handled in RDS?

A

SSL

To enforce SSL:
• PostgreSQL: rds.force_ssl=1 in the RDS Console parameter group.
• MySQL use command: GRANT USAGE ON . TO……REQUIRE SSL.

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

I have an unencrypted RDS database. How do I encrypt it?

A
Create a snapshot.
Copy the snapshot and enable encryption.
Restore the db from the copy.
Migrate applications to the new db
Delete the old db.

The new one will have a NEW ENDPOINT.

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

Describe RDS network security. Where do DBs live? How do you control access?

A

DBs are deployed in a PRIVATE subnet.

Security is controlled by security groups, i.e. security groups control which IP or security group can communicate with RDS.

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

How do you handle Access Management in RDS?

A
  • IAM policies control who can MANAGE the DB (through RDS API, i.e. RDS Service)
  • To log in to the DB, traditional username/password that is managed in the DB.
  • For MySQL/PostgreSQL you can use IAM-based Databse Authentication to log in. (no password, just auth token that you get from RDS Service - lasts 15 mins)
    • this is good for managing users centrally instead of in the db
    • network in/out encrypted using SSL
    • you can leverage IAM roles and EC2 instance profiles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

When you create a read replica for RDS, what KMS key will it use?

A

If in the same region as the primary then SAME key.

If not, then new key.

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

Can you restore an unencrypted backup/snapshot to an encrypted DB instance?

A

No

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

What flavors does Amazon Aurora support?

A

PostgreSQL and MySQL

20
Q

Why would you choose Aurora over RDS?

A
  • Cloud-optimized, 3-5x performance improvement
  • Storage grows automatically up to 125TB per db instance
  • up to 15 replicas (except MySQL), faster replication (only 1 master)
  • Instantaneous failover, super high availability
  • costs 20% more but is more efficient
  • Support cross-region replication
  • “Backtrack” without using backups
21
Q

How does Aurora maintain high availability?

A
  • 6 replicas across 3 AZs
  • self-healing with peer-to-peer replication
  • storage striped across 100s of volumes
  • continuous backup to S3

• you can have cross-REGION cluster with scaling and failover with MySQL

22
Q

How does Aurora work?

A

• master and replicas have shared storage volume that auto-expands

  • Has write endpoint always pointing to master.
  • endpoint auto directs to new master in DR.

• reader endpoint connects to all replicas. With autoscaling no need to update endpoints in applications. Handles load balancing.

23
Q

How does Aurora security compare to RDS security?

A

It’s the same. Same engines.

24
Q

What is an Aurora custom endpoint?

A

You can assign a custom endpoint to run on specific replicas (e.g. ones that are larger and more powerful).

If you do this then you would not use the reader endpoint anymore. You’d set up a bunch of custom endpoints.

25
Q

What is Aurora Serverless?

A

On demand Automated scaling, instantiation based on actual usage. It’s not running all the time, it’s waiting for traffic and then gets instantiated.

Router fleet controls connections coming in, connects to a warm pool of capacity.

Pay per second (can be cheaper that way).
Does NOT support read REPLICAS or public IPs
Access only through VPC or DirectConnect, not VPN

Good for infrequent, intermittent, unpredictable workloads.

26
Q

What if you want immediate failover on the master node in Aurora?

A

Use Multi-Master for MySQL. Every node does read/write instead of promoting a replica to master.

Up to 4 nodes. NOT cross-region.

27
Q

How does Global Aurora work?

A

You can have cross-region read replicas
OR
Global Database:
• 1 primary region with up to 5 read-only regions
• up to 16 replicas per secondary region
• DR promotion to another region < 1 minute

28
Q

How can I add Machine Learning predictions to my applications via SQL?

A

Use Aurora integrated with SageMaker(ML) or Comprehend(sentient analysis.)

Good for fraud detection, ad targeting, sentiment analysis, product recommendations

29
Q

What are some things you can NOT do with RDS?

A
  • Any flavor of SQL that is not on the list

* Anything where you need root access to the OS (patching, installing tools, etc.)

30
Q

What is ElastiCache?

A

RDS is to Relational Databases as
ElastiCache is to Redis/Memcached

  • in memory db
  • key/value store
  • ElastiCache nodes run on EC2 (need to choose instance type)

• can be used in front of dbs like RDS or DynamoDB

31
Q

Why would you want to use a cache for your DB? What is the downside to ElastiCache?

A
  • High performance, low latency
  • Helps make your application stateless by keeping session data
  • Reduces workload on DB

Downside: heavy code changes are required in your app

32
Q

What is the difference between Redis and Memcached?

A
Redis works a lot like RDS, high availability: 
     • multi-AZ with Auto-failover
     • read replicas, data durability 
     • backup/restore
     • for complex data types
Memcached:
     • multi-node for partitioning of data (sharding)
     • no high availability, encryption
     • Non-persistent, no backup/restore
     • multi-threaded architecture !!!
     • for simple data types
33
Q

How do you handle authentication in ElastiCache (Redis and Memcached)?

A

NO IAM authentication.
IAM policies only for API level (create, delete cache, etc.)

Redis:
• create Redis cluster and set password/token.
• supports SSL for in-flight encryption

Memcached:
• SASL-based authentication

34
Q

A company is designing a banking portal that uses Amazon ElastiCache for Redis as its distributed session management component. Since the other Cloud Engineers in your department have access to your ElastiCache cluster, you have to secure the session data in the portal by requiring them to enter a password before they are granted permission to execute Redis commands.

As the Solutions Architect, which of the following should you do to meet the above requirement?

A

Use Redis AUTH by creating a new cluster with transit encryption enabled, and auth-token enabled.

35
Q

What are 3 patterns for loading data into ElastiCache?

A

LazyLoading (data can become stale)

Write through: no stale data, updated on every write

Session store: store session data using TTL(time to live) features

36
Q

I have a game that requires a real-time leaderboard. How can I achieve it?

A

Use Redis Sorted Sets.

37
Q

You have migrated the MySQL database from on-premises to RDS. You have a lot of applications and developers interacting with your database. Each developer has an IAM user in the company’s AWS account. What is a suitable approach to give access to developers to the MySQL RDS DB instance instead of creating a DB user for each one?

A

Enable IAM Database Authentication

38
Q

What are some common use cases for ElastiCache?

A

Web session store
Database caching (for popular queries)
Leaderboards (Redis)
Streaming data dashboards (e.g. sensor data)

39
Q

How do you scale in Memcached vs. Redis?

A

Memcached:
• add nodes to a cluster
• scale the node vertically (make EC2 bigger), but you have to create a new cluster manually

Redis - cluster mode DISABLED:
• add replica or change node type (creates new cluster)

Redis - cluster mode ENABLED:

 1) Online resharding - add/remove shards, vertical scaling to change node type
 2) Offline resharding - add/remove shards, change node type or upgrade engine
40
Q

An online shopping platform is hosted on an Auto Scaling group of Spot EC2 instances and uses Amazon Aurora PostgreSQL as its database. There is a requirement to optimize your database workloads in your cluster where you have to direct the write operations of the production traffic to your high-capacity instances and point the reporting queries sent by your internal staff to the low-capacity instances.

What is the most suitable configuration for your application as well as your Aurora database cluster to achieve this requirement?

A

Create a custom endpoint for each requirement.

41
Q

There are a lot of outages in the Availability Zone of your RDS database instance to the point that you have lost access to the database. What could you do to prevent losing access to your database in case that this event happens again?

A

Enable Multi-AZ failover.

42
Q

A retail website has intermittent, sporadic, and unpredictable transactional workloads throughout the day that are hard to predict. The website is currently hosted on-premises and is slated to be migrated to AWS. A new relational database is needed that autoscales capacity to meet the needs of the application’s peak load and scales back down when the surge of activity is over.

What is the MOST cost-effective and suitable database setup in this scenario?

A

Aurora Serverless cluster, then set min/max for the cluster.

43
Q

A Forex trading platform, which frequently processes and stores global financial data every minute, is hosted in your on-premises data center and uses an Oracle database. Due to a recent cooling problem in their data center, the company urgently needs to migrate their infrastructure to AWS to improve the performance of their applications. As the Solutions Architect, you are responsible in ensuring that the database is properly migrated and should remain available in case of database server failure in the future.

What is the most suitable solution to meet the requirement?

A

Oracle db in RDS with Multi-AZ deployments.

44
Q

A Solutions Architect needs to set up a relational database and come up with a disaster recovery plan to mitigate multi-region failure. The solution requires a Recovery Point Objective (RPO) of 1 second and a Recovery Time Objective (RTO) of less than 1 minute.

What can fulfill this requirement?

A

Aurora Global Database

45
Q

A financial application is composed of an Auto Scaling group of EC2 instances, an Application Load Balancer, and a MySQL RDS instance in a Multi-AZ Deployments configuration. To protect the confidential data of your customers, you have to ensure that your RDS database can only be accessed using the profile credentials specific to your EC2 instances via an authentication token.

As the Solutions Architect of the company, what should you do to meet the above requirement?

A

Enable IAM DB Authentication

46
Q

An accounting application uses an RDS database configured with Multi-AZ deployments to improve availability. What would happen to RDS if the primary database instance fails?

A

When failing over, Amazon RDS simply flips the canonical name record (CNAME) for your DB instance to point at the standby, which is in turn promoted to become the new primary