Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
AWS Certified Developer - Associate Guide - Second Edition

You're reading from  AWS Certified Developer - Associate Guide - Second Edition

Product type Book
Published in Jun 2019
Publisher Packt
ISBN-13 9781789617313
Pages 812 pages
Edition 2nd Edition
Languages
Authors (2):
Vipul Tankariya Vipul Tankariya
Profile icon Vipul Tankariya
Bhavin Parmar Bhavin Parmar
Profile icon Bhavin Parmar
View More author details

Table of Contents (30) Chapters

Preface 1. Overview of AWS Certified Developer - Associate Certification 2. Understanding the Fundamentals of Amazon Web Services 3. Identity and Access Management (IAM) 4. Virtual Private Clouds 5. Getting Started with Elastic Compute Cloud (EC2) 6. Handling Application Traffic with ELB 7. Monitoring with CloudWatch 8. Simple Storage Service, Glacier, and CloudFront 9. Other AWS Storage Options 10. AWS Relational Database Service 11. AWS DynamoDB - A NoSQL Database Service 12. Amazon Simple Queue Service (SQS) 13. Simple Notification Service (SNS) 14. AWS Simple Workflow Service (SWF) 15. CloudFormation Overview 16. Understanding Elastic Beanstalk 17. Overview of AWS Lambda 18. Key Management Services 19. Working with AWS Kinesis 20. Working with AWS CodeBuild 21. Getting Started with AWS CodeDeploy 22. Working with AWS CodePipeline 23. CI/CD on AWS 24. Serverless Computing 25. Amazon Route 53 26. ElastiCache Overview 27. Mock Tests 28. Assessments 29. Another Book You May Enjoy

AWS Relational Database Service

AWS Relational Database Service (RDS) is a fully managed relational database service from Amazon. RDS makes it easier for enterprises and developers who want to use a relational database in the cloud without investing a lot of time and resources in managing the environment. AWS RDS supports six database engines—Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle, and Microsoft SQL Server. It provides easy-to-use, cost-effective, and scalable relational databases in the cloud.

The following topics will be covered in the chapter:

  • Introducing RDS
  • RDS engine types
  • Creating an Amazon RDS MySQL DB instance
  • Monitoring RDS instances
  • Creating a snapshot
  • Restoring a DB from a snapshot
  • Changing an RDS instance type
  • Amazon RDS and VPC
  • Connecting to an Amazon RDS DB instance
  • RDS best practices

Introducing RDS

We have already seen what RDS in the introduction of this chapter and how it is useful. The advantages of Amazon RDS are as follows:

  • It's a fully managed service that automatically manages backups, software and OS patching, automatic failover, and recovery.
  • It also allows us to take a manual backup of the database as a snapshot. Snapshots of a database can be used to restore a database as and when required.
  • RDS provides fine-grained access control with the help of AWS IAM.

AWS RDS does not provide root access to the RDS instance. In short, RDS does not allow the user to access the underlined host OS. That means that you cannot log into the server operating system. It also confines access to certain system procedures and tables that may require advanced privileges.

After launching RDS in its service offerings, AWS was not providing an option to stop an RDS...

Amazon RDS components

The Amazon RDS components are detailed in the following subsections.

DB instances

Each Amazon RDS engine can create an instance with at least one database in it. Each instance can have multiple user-created databases. Database names must be unique to an AWS account and are called DB instance identifiers. Each DB instance is a building block and an isolated environment in the cloud. These databases can be accessed using the same tools that are used to access standalone databases hosted in a data center. On top of standard tools, AWS RDS instances can also be accessed by the AWS Management Console, the API, and the CLI.

Each DB engine has its own version. With the help of a DB parameter group, DB engine...

RDS engine types

Amazon RDS supports six DB engine types—Amazon Aurora, MySQL, MariaDB, Microsoft SQL Server, Oracle, and PostgreSQL. The following table helps us to understand the connecting port and protocol for each of these DB instances:

Amazon RDS engine types

Default port

Protocol

Aurora DB

3306

TCP

MariaDB

3306

TCP

Microsoft SQL

1433

TCP

MySQL

3306

TCP

Oracle

1521

TCP

PostgreSQL

5432

TCP

The Amazon RDS engine for Microsoft SQL Server and Oracle supports two licensing models: license included and Bring Your Own License (BYOL). If you are already invested in purchasing licenses for such databases, it can also be used as a BYOL with Amazon RDS to minimize monthly billing.

Supported instance types may vary for each Amazon RDS engine.
...

Creating an Amazon RDS MySQL DB instance

Amazon RDS MySQL DB instances can be created using the Amazon Management Console, CLIs, or APIs, and the steps are as follows:

  1. Log into the AWS Management Console with the appropriate user privileges and go to the Amazon RDS dashboard.
  2. Select Create database, as shown:
Select Create database
  1. Select the engine type as MySQL, as shown:
Select the Amazon RDS engine type as MySQL

The Only enable options eligible for RDS Free Usage Tier option is only allowed during the first year of the free tier, such as t2.micro single-AZ instance, as shown:

Optionally, select Only enable options eligible for RDS Free Usage Tier
  1. Select the Production - MySQL use case to have multi-AZ deployment or Dev/Test - MySQL, as shown. It is also suggested that you switch to Amazon Aurora, as it is seamlessly compatible with MySQL:
Select Amazon RDS MySQL...

Monitoring RDS instances

Once an Amazon RDS instance is created as per the present need, it is very important to observe its performance with constantly changing business requirements and application loads. It is possible to monitor the instance's CPU utilization, DB connections, free storage space, free memory, and many other parameters. It helps to identify bottlenecks and will also give you the opportunity to minimize monthly billing by reducing the resource size if it is underutilized.

An alarm can be configured to take action at a specified threshold. For example, if CPU usage is above 70% for a specified consecutive time period, then send SNS notifications to the DBA. Such an alarm can be created either from the CloudWatch dashboard or from the Amazon RDS dashboard.

To create a CloudWatch alarm from the Amazon RDS dashboard, perform the following steps:

  1. Go to the Amazon...

Creating a snapshot

A snapshot is a frozen image of the DB instance's storage volume. It helps to restore a database to a particular point in time. Usually, point-in-time recovery is performed when a database is corrupted or by mistake some data has been dropped (that is, deleted), to bring a database back to the last healthy state. At the time of creating an Amazon RDS instance, a daily snapshot schedule has already been configured, but it may sometimes be required to take a manual snapshot of the DB instance before performing any maintenance tasks on the database. A snapshot will back up an entire DB instance including all databases, tables, and other resources existing on it.

Creating a snapshot for a multi-AZ DB instance doesn't bring many performance implications, but taking a snapshot for a single-AZ DB instance may suspend DB I/O, for a few seconds to minutes...

Restoring a DB from a snapshot

A snapshot can only be restored by creating a new instance. You cannot restore a snapshot to an existing instance. While restoring the snapshot to a new RDS instance, you can have a different storage volume type from the one used in the snapshot.

Creating an RDS DB instance from a snapshot automatically attaches a default parameter group and security group to it. Once a DB instance is created, it is possible to change the attached parameter group and security group for that instance. By restoring a snapshot, the same option group associated with the snapshot will get associated to the newly created RDS DB instance. Option groups are platform-specific—VPC or EC2-Classic.

Creating an RDS DB instance inside a particular VPC will link a used option group with that particular VPC. It means that when the snapshot is created for that DB instance...

Changing an RDS instance type

An RDS instance type is generally changed to accommodate additional resource requirements or to downgrade an existing instance type that is underutilized. To change the instance type, perform the following steps:

  1. Select the desired Amazon RDS instance to change type and click on Modify as shown:
Select Modify to change the Amazon RDS instance configuration
  1. From the list of RDS DB instances, select the desired instance to modify the instance type and select Modify from the instance's Actions drop-down menu.
  1. Modifying a DB instance does not only allow us to change the DB instance type; it also allows us to change many other parameters that are provided at the time of creating a DB instance, such as subnet group, security group, and many more options. At the end of the parameters that can be changed, an option is available to apply changes...

Amazon RDS and VPC

Before 2013, AWS supported EC2-Classic. All AWS accounts created after December 4, 2013 only support EC2-VPC. If an AWS account only supports EC2-VPC, then a default VPC is created in each region and a default subnet in each AZ. Default subnets are public in nature. To meet enterprise requirements, it is possible to create a custom VPC and subnet. This custom VPC and subnet can have a custom CIDR range and can also decide which subnet can be public and which one can be private. When an AWS account only supports EC2-VPC and it has no custom VPC created, then Amazon RDS DB instances are created inside a default VPC.

Amazon RDS DB instances can also be launched into a custom VPC just like EC2 instances. Amazon RDS DB instances have the same functionality in terms of performance, maintenance, upgrading, recovery, and failover detection capability, irrespective of...

Connecting to an Amazon RDS DB instance

Once the Amazon RDS DB instance is created, you can connect to it to perform read/write operations as well as day-to-day maintenance activities. Before connecting to the DB instance, ensure that the port to connect with the DB instance is allowed in the firewall or security group. Also, ensure that the source IP from where you need to connect to the DB instance is allowed in the security group. This topic describes how you can connect to various RDS DB instances with different database engine types.

Connecting to an Amazon Aurora DB cluster

Aurora DB clusters consist of a primary instance and an Aurora Replica. A separate endpoint is available for the primary instance, Aurora Read instance...

RDS best practices

RDS best practices are as follows:

  • Create an individual AWS IAM user to perform DBA tasks. Grant the minimum privileges required to perform day-to-day tasks. Remove unused access key and secret key. Have a strong password policy and rotate the password periodically.
  • Before creating an RDS instance, identify Amazon RDS essential characteristics to be specified such as VPC, security group, failover or Read Replica requirement, the region and AZs to use, and storage and backup requirements.
  • Before creating an RDS instance, it is recommended that you create a DB options group and DB parameter group.
  • Monitor Amazon RDS instance resources, such as CPU, memory, and storage, to avoid performance bottlenecks.
  • It is recommended that you keep some extra buffer in memory and a storage volume while choosing RDS instance types.
  • It is recommended that you test your environment...

Summary

  • An RDS is a fully managed relational database service.
  • An RDS provides fine-grained access control with the help of AWS IAM.
  • An RDS does not allow the user to access the underlined host operating system.
  • You can stop and start any RDS database engine.
  • You can stop and start an RDS instance irrespective of whether it is in single-AZ or multi-AZ, except for SQL Server. SQL Server RDS in multi-AZ cannot be stopped.
  • An RDS instance can be stopped for a maximum of seven consecutive days. After seven days, the instance is automatically restarted.
  • RDS supports the Aurora, MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server database engines.
  • You can create a Read Replica for an RDS instances.
  • Read Replica can be created for Aurora, MySQL, PostgreSQL, MariaDB, and Oracle RDS database instances.
  • Amazon Aurora is a MySQL-and PostgreSQL-compatible, fully managed RDBMS.
  • MariaDB is...
lock icon The rest of the chapter is locked
You have been reading a chapter from
AWS Certified Developer - Associate Guide - Second Edition
Published in: Jun 2019 Publisher: Packt ISBN-13: 9781789617313
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.
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}