Reader small image

You're reading from  AWS Certified Database – Specialty (DBS-C01) Certification Guide

Product typeBook
Published inMay 2022
PublisherPackt
ISBN-139781803243108
Edition1st Edition
Right arrow
Author (1)
Kate Gawron
Kate Gawron
author image
Kate Gawron

Kate Gawron is a full-time senior database consultant and part-time future racing driver. She was a competitor in Formula Woman, and she aspires to become a professional Gran Turismo (GT) racing driver. Away from the racetrack, Kate has worked with Oracle databases for 18 years and AWS for five years. She holds four AWS certifications, including the AWS Certified Database – Specialty certification as well as two professional Oracle qualifications. Kate currently works as a senior database architect, where she works with customers to migrate and refactor their databases to work optimally within the AWS cloud.
Read more about Kate Gawron

Right arrow

Chapter 4: Relational Database Service

In this chapter, we are going to dive deep into AWS Relational Database Service (RDS). RDS is a major topic within the AWS Certified Database – Specialty exam and understanding it will not only greatly improve your preparation for the exam, but also help you understand later chapters, which will cover different database types.

This chapter includes a hands-on lab where we will deploy, configure, and explore an RDS instance, including how we can monitor it. During this section, you will need a VPC with a minimum of two subnets. If you have not completed Chapter 3, Understanding AWS Infrastructure, please ensure you have a VPC that meets the minimum requirements, as detailed here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html.

In this chapter, we're going to cover the following main topics:

  • Overview of RDS
  • Understanding replicas and multi-AZ
  • Configuring backups...

Technical requirements

You will need an AWS account with root access. Everything we will do in this chapter will be available under the Free Tier, which means you can run all the example code without spending any money if your account has only been opened within the last 12 months. You will also need AWS Command-Line Interface (CLI) access. The AWS guide at https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html will explain the steps required, but I will them summarize here:

  1. Create an AWS account if you have not already done so.
  2. Download the latest version of the AWS CLI from https://docs.aws.amazon.com/cli/latest/userguide/welcome-versions.html#welcome-versions-v2.
  3. Create an access key for your administration user at https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started_create-admin-group.html#getting-started_create-admin-group-cli.
  4. Run the aws configure command to set up a profile for your user.

You will also need a VPC that...

Overview of RDS

AWS RDS is a managed database service. What this means is that AWS offers a wrapper around a relational database that manages many of the functions that are normally carried out by a DBA. For example, RDS can take backups by default without the DBA needing to schedule them. RDS aims to reduce the amount of time a DBA spends doing day-to-day administration work, allowing them to focus on areas such as performance tuning.

To use RDS, you need to consider four things:

  • Which database type do I want?
  • How much compute (CPU and memory) do I need?
  • How much storage do I need?
  • Do I need to consider high availability or disaster recovery options?

With that information and the VPC that we built in Chapter 3, Understanding AWS Infrastructure, you can deploy an RDS that's ready to store the data for your application.

To be able to decide on these four questions, first, let's look at what databases RDS supports.

Supported databases

...

Understanding replicas and multi-AZ

Many database deployments require high availability or a failover strategy to meet the recovery point objectives (RPOs) and recovery time objectives (RTOs) of the application. RDS offers two different solutions to meet those requirements:

  • Multi-AZ deployments
  • Read replicas

Both of these technologies offer enhanced protection from a primary database failing and will speed up any database recovery strategy, but they use different methods and have different use cases.

Multi-AZ

In Chapter 3, Understanding AWS Infrastructure, we learned about AWS infrastructure, VPCs, and Availability Zones (AZs). A Multi-AZ deployment is one in which you provision a primary database in one AZ and standby databases in one or more different AZs. The primary and standby databases are kept synchronized either using their native replication technology (Always On for SQL Server, for example) or by using an AWS-specific technology. The syncing process...

Configuring backups and running restores

RDS offers a fully managed backup service that will support the rapid restoration and recovery of your databases. These backups can also be used to support making copies of your database to be used in a different account or region. This is also called cross-region or cross-account cloning. Let's start by looking at RDS automated backups in more depth.

RDS automated backups

AWS manages standard backups for you unless you specifically configure it not to. The backups are taken when the database is running, and they do not cause any downtime. Backups can cause performance overhead as they add additional work to the RDS instance. Due to this, backups are run during backup windows. They are given a default time slot that can be customized if required, typically to avoid peak operating hours. Each RDS instance is allocated the same amount of backup storage as the instance storage, so if you create an RDS instance with 20 GB of storage,...

Maintaining an RDS instance

One of the main benefits of using RDS is that a lot of the normal maintenance tasks a DBA would carry out on-premises are handled for you by RDS. However, there are still some tasks that need to be handled.

Let's look at the most common tasks, starting with how to check database logs.

Checking database logs

It's common for databases to suffer from failures or generate errors that need to be investigated. On-premises, a DBA would look at the database logs stored on the server to start troubleshooting. However, on RDS, since there is no access to the operating system, we need to use a different method to access the logs.

There are three different methods we can use to check the database logs:

  • Use the RDS instance page on the AWS console.
  • Use a SQL query within the RDS instance.
  • Use CloudWatch logs.

CloudWatch is only available if you have enabled it. You can enable CloudWatch log publishing while provisioning the...

Understanding RDS pricing

RDS pricing is dependent on many things that make up its total cost:

  • What instance class are you using and what is its size?
  • Which database engine are you using?
  • Are the license costs included or are you using your own license?
  • How large is the storage that's been allocated?
  • Are you using gp2 or io1 storage?
  • Are you using a multi-AZ deployment or read replicas?

The instance class and its size are often the largest cost of your database. As the instance class increases and you are using more compute, the costs will also increase. The instance class costs increase linearly, so if you double the compute, you'll also double the cost. If you have a performance problem with your database, increasing the instance size can alleviate it but at a great cost. So, before you increase the instance sizing, you should look at other potential ways to improve performance. The instance sizing can also affect the costs of the database...

Deploying an RDS instance

Now that we've learned about RDS and its features, let's deploy an instance to practice and learn how the topics we've covered in this chapter work together. We will be deploying an RDS instance using the MySQL engine. After that, we will take a snapshot and restore it before creating and making changes to a parameter group. We'll be using both the AWS console and the AWS CLI for this.

Provisioning an RDS instance

We'll start by provisioning an RDS MySQL instance. We'll be using the Ohio (us-east-1) region. Let's get started:

  1. Open the AWS console in an internet browser and log in using an account that has the privileges to create and modify an RDS instance.
  2. Navigate to the RDS section.
  3. Click the orange Create database button in the middle of the page:

Figure 4.4 – AWS console

  1. This will open a page where you can enter details about the database you want to create...

Summary

In this chapter, we learned about AWS RDS. We learned what database types are supported, how to deploy and connect to an RDS instance, and how to carry out some common maintenance and configuration tasks. We learned how to use both the AWS console and AWS CLI to interact with our databases.

During the AWS Certified Database – Specialty exam, your knowledge of RDS will be tested heavily with questions around troubleshooting, service limits, upgrade procedures, and sharing snapshots.

In the next chapter, we will learn about Aurora, which is a special version of RDS that was created by AWS. We will continue to use the knowledge we've learned in this chapter to interact with Aurora as it has many similarities to RDS.

Cheat sheet

This cheat sheet summarizes the key points from this chapter:

  • AWS RDS is a managed database service for the MySQL, PostgreSQL, Oracle, SQL Server, and MariaDB relational database engines.
  • RDS uses endpoints for connections so that you do not need to configure your application connection strings after a failover.
  • RDS automates many of the daily administrative functions that are typically carried out by a DBA. These include backups, log rotation, patching the operating system and database, and autoscaling storage.
  • You can take manual backups called snapshots, which can be used to create copies of your database in different regions or a different account if they are shared.
  • RDS supports encryption at rest and can enforce encrypted traffic between the client and the database using SSL/TLS.
  • Using a multi-AZ deployment will greatly reduce any downtime during a database failure, upgrade, or maintenance period that requires the instance to be restarted...

Review

To check your knowledge of this chapter, here are five questions that you should be able to answer. Remember the exam techniques from Chapter 1, AWS Certified Database – Specialty Exam Overview, and remove the incorrect answers first to help yourself:

  1. A customer is developing a new application. Information will be uploaded from a large number of different devices. The customer is concerned about unexpectedly high volumes of data being loaded and exceeding the storage that's been allocated to the database. What steps can they take to simply and cost-effectively solve this issue?
    1. Migrate from RDS to EC2 and turn on autoscaling for the instance's compute.
    2. Use S3 to store the incoming data and build a lambda function to merge the updates to RDS.
    3. Enable storage autoscaling for the RDS instance.
    4. Create a read replica and send the read-only traffic to it.
  2. You are using a new RDS PostgreSQL database. You are unable to connect to the database using pgsql. What...

Further reading

In this chapter, we covered the most common RDS topics. In the AWS Certified Database – Specialty exam, you will be expected to know about and understand how other areas of AWS interact with RDS, which we will cover in more depth later in this book. However, if you wish to have a deeper understanding of KMS and encryption, AWS: Security Best Practices on AWS, is recommended: https://subscription.packtpub.com/book/virtualization_and_cloud/9781789134513/2/ch02lvl1sec19/aws-kms.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
AWS Certified Database – Specialty (DBS-C01) Certification Guide
Published in: May 2022Publisher: PacktISBN-13: 9781803243108
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Kate Gawron

Kate Gawron is a full-time senior database consultant and part-time future racing driver. She was a competitor in Formula Woman, and she aspires to become a professional Gran Turismo (GT) racing driver. Away from the racetrack, Kate has worked with Oracle databases for 18 years and AWS for five years. She holds four AWS certifications, including the AWS Certified Database – Specialty certification as well as two professional Oracle qualifications. Kate currently works as a senior database architect, where she works with customers to migrate and refactor their databases to work optimally within the AWS cloud.
Read more about Kate Gawron