Amazon Relational Database Service: User Guide
Amazon Relational Database Service: User Guide
Database Service
User Guide
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not
Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or
discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may
or may not be affiliated with, connected to, or sponsored by Amazon.
Amazon Relational Database Service User Guide
Table of Contents
What is Amazon RDS? ........................................................................................................................ 1
Overview ................................................................................................................................... 1
Amazon EC2 and on-premises databases ............................................................................... 1
Amazon RDS and Amazon EC2 ............................................................................................ 2
Amazon RDS Custom for Oracle ........................................................................................... 3
DB instances .............................................................................................................................. 4
DB engines ........................................................................................................................ 4
DB instance classes ............................................................................................................ 4
DB instance storage ............................................................................................................ 4
Amazon Virtual Private Cloud (Amazon VPC) ......................................................................... 5
AWS Regions and Availability Zones ............................................................................................. 5
Security .................................................................................................................................... 5
Monitoring an Amazon RDS DB instance ....................................................................................... 6
How to work with Amazon RDS ................................................................................................... 6
AWS Management Console .................................................................................................. 6
Command line interface ...................................................................................................... 6
Programming with Amazon RDS .......................................................................................... 6
How you are charged for Amazon RDS ......................................................................................... 6
What's next? .............................................................................................................................. 6
Getting started .................................................................................................................. 7
Topics specific to database engines ...................................................................................... 7
DB instances .............................................................................................................................. 8
DB instance classes ................................................................................................................... 10
DB instance class types ..................................................................................................... 10
Supported DB engines ...................................................................................................... 11
Determining DB instance class support in AWS Regions ......................................................... 25
Changing your DB instance class ........................................................................................ 28
Configuring the processor ................................................................................................. 29
Hardware specifications ..................................................................................................... 41
DB instance storage .................................................................................................................. 48
Storage types .................................................................................................................. 48
General Purpose SSD storage ............................................................................................. 48
Provisioned IOPS storage .................................................................................................. 50
Magnetic storage .............................................................................................................. 51
Monitoring storage performance ........................................................................................ 52
Factors that affect storage performance .............................................................................. 52
Regions, Availability Zones, and Local Zones ................................................................................ 55
AWS Regions ................................................................................................................... 55
Availability Zones ............................................................................................................. 58
Local Zones ..................................................................................................................... 58
Multi-AZ deployments ............................................................................................................... 59
Multi-AZ DB instance deployments ..................................................................................... 60
Multi-AZ DB cluster deployments (preview) ......................................................................... 65
DB instance billing for Amazon RDS ......................................................................................... 101
On-Demand DB instances ................................................................................................ 102
Reserved DB instances .................................................................................................... 103
Setting up ..................................................................................................................................... 112
Sign up for AWS .................................................................................................................... 112
Create an IAM user ................................................................................................................. 112
Determine requirements .......................................................................................................... 114
Provide access to your DB instance ........................................................................................... 115
Getting started ............................................................................................................................... 118
Creating a MariaDB DB instance and connecting to a database ..................................................... 118
Creating a MariaDB DB instance ....................................................................................... 118
iii
Amazon Relational Database Service User Guide
iv
Amazon Relational Database Service User Guide
v
Amazon Relational Database Service User Guide
vi
Amazon Relational Database Service User Guide
vii
Amazon Relational Database Service User Guide
viii
Amazon Relational Database Service User Guide
ix
Amazon Relational Database Service User Guide
x
Amazon Relational Database Service User Guide
xi
Amazon Relational Database Service User Guide
xii
Amazon Relational Database Service User Guide
xiii
Amazon Relational Database Service User Guide
xiv
Amazon Relational Database Service User Guide
xv
Amazon Relational Database Service User Guide
xvi
Amazon Relational Database Service User Guide
xvii
Amazon Relational Database Service User Guide
xviii
Amazon Relational Database Service User Guide
Overview
If you are new to AWS products and services, begin learning more with the following resources:
Topics
• Amazon EC2 and on-premises databases (p. 1)
• Amazon RDS and Amazon EC2 (p. 2)
• Amazon RDS Custom for Oracle (p. 3)
When you buy an on-premises server, you get CPU, memory, storage, and IOPS, all bundled together.
With Amazon EC2, these are split apart so that you can scale them independently. If you need more CPU,
less IOPS, or more storage, you can easily allocate them.
For a relational database in an on-premises server, you assume full responsibility for the server,
operating system, and software. For a database on an Amazon EC2 instance, AWS manages the layers
below the operating system. In this way, Amazon EC2 eliminates some of the burden of managing an on-
premises database server.
In the following table, you can find a comparison of the management models for on-premises databases
and Amazon EC2.
1
Amazon Relational Database Service User Guide
Amazon RDS and Amazon EC2
Amazon EC2 isn't a fully managed service. Thus, when you run a database on Amazon EC2, you're
more prone to user errors. For example, when you update the operating system or database software
manually, you might accidentally cause application downtime. You might spend hours checking every
change to identify and fix an issue.
In the following table, you can find a comparison of the management models in Amazon EC2 and
Amazon RDS.
2
Amazon Relational Database Service User Guide
Amazon RDS Custom for Oracle
Amazon RDS provides the following specific advantages over database deployments that aren't fully
managed:
• You can use the database products you are already familiar with: MySQL, MariaDB, PostgreSQL, Oracle,
Microsoft SQL Server.
• Amazon RDS manages backups, software patching, automatic failure detection, and recovery.
• You can turn on automated backups, or manually create your own backup snapshots. You can use
these backups to restore a database. The Amazon RDS restore process works reliably and efficiently.
• You can get high availability with a primary instance and a synchronous secondary instance that you
can fail over to when problems occur. You can also use read replicas to increase read scaling.
• In addition to the security in your database package, you can help control who can access your RDS
databases by using AWS Identity and Access Management (IAM) to define users and permissions. You
can also help protect your databases by putting them in a virtual private cloud (VPC).
You can use the control capabilities of RDS Custom to access and customize the database environment
and operating system for legacy and packaged business applications. Meanwhile, Amazon RDS
automates database administration tasks and operations.
In this deployment model, you can install applications and change configuration settings to suit your
applications. At the same time, you can offload database administration tasks such as provisioning,
scaling, upgrading, and backup to AWS. You can take advantage of the database management benefits
of Amazon RDS, with more control and flexibility.
For Oracle Database, RDS Custom combines the automation of Amazon RDS with the flexibility of
Amazon EC2.
3
Amazon Relational Database Service User Guide
DB instances
With the shared responsibility model of RDS Custom, you get more control than in Amazon RDS, but also
more responsibility. To meet your application and business requirements, you manage everything at or
above the OS layer yourself.
For more information on RDS Custom, see Working with Amazon RDS Custom (p. 660).
DB instances
A DB instance is an isolated database environment in the AWS Cloud. The basic building block of Amazon
RDS is the DB instance.
Your DB instance can contain one or more user-created databases. You can access your DB instance by
using the same tools and applications that you use with a standalone database instance. You can create
and modify a DB instance by using the AWS Command Line Interface, the Amazon RDS API, or the AWS
Management Console.
DB engines
A DB engine is the specific relational database software that runs on your DB instance. Amazon RDS
currently supports the following engines:
• MySQL
• MariaDB
• PostgreSQL
• Oracle
• Microsoft SQL Server
Each DB engine has its own supported features, and each version of a DB engine may include specific
features. Additionally, each DB engine has a set of parameters in a DB parameter group that control the
behavior of the databases that it manages.
DB instance classes
A DB instance class determines the computation and memory capacity of a DB instance. Each instance
type offers different compute, memory, and storage capabilities. For example, db.m6g is a general-
purpose DB instance classes powered by AWS Graviton2 processors.
You can select the DB instance that best meets your needs. If your needs change over time, you can
change DB instances. For information, see DB instance classes (p. 10).
Note
For pricing information on DB instance classes, see the Pricing section of the Amazon RDS
product page.
DB instance storage
Amazon EBS provides durable, block-level storage volumes that you can attach to a running instance. DB
instance storage comes in the following types:
4
Amazon Relational Database Service User Guide
Amazon Virtual Private Cloud (Amazon VPC)
The storage types differ in performance characteristics and price. You can tailor your storage
performance and cost to the needs of your database.
Each DB instance has minimum and maximum storage requirements depending on the storage type and
the database engine it supports. It's important to have sufficient storage so that your databases have
room to grow. Also, sufficient storage makes sure that features for the DB engine have room to write
content or log entries. For more information, see Amazon RDS DB instance storage (p. 48).
Amazon RDS uses Network Time Protocol (NTP) to synchronize the time on DB Instances.
Each AWS Region contains multiple distinct locations called Availability Zones, or AZs. Each Availability
Zone is engineered to be isolated from failures in other Availability Zones. Each is engineered to provide
inexpensive, low-latency network connectivity to other Availability Zones in the same AWS Region. By
launching instances in separate Availability Zones, you can protect your applications from the failure of a
single location. For more information, see Regions, Availability Zones, and Local Zones (p. 55).
You can run your DB instance in several Availability Zones, an option called a Multi-AZ deployment.
When you choose this option, Amazon automatically provisions and maintains a secondary standby
DB instance in a different Availability Zone. Your primary DB instance is synchronously replicated
across Availability Zones to the secondary instance. This approach helps provide data redundancy and
failover support, eliminate I/O freezes, and minimize latency spikes during system backups. For more
information, see Multi-AZ deployments for high availability (p. 59).
Security
A security group controls the access to a DB instance. It does so by allowing access to IP address ranges or
Amazon EC2 instances that you specify.
For more information about security groups, see Security in Amazon RDS (p. 1876).
5
Amazon Relational Database Service User Guide
Monitoring an Amazon RDS DB instance
For application development, we recommend that you use one of the AWS Software Development Kits
(SDKs). The AWS SDKs handle low-level details such as authentication, retry logic, and error handling, so
that you can focus on your application logic. AWS SDKs are available for a wide variety of languages. For
more information, see Tools for Amazon web services .
AWS also provides libraries, sample code, tutorials, and other resources to help you get started more
easily. For more information, see Sample code & libraries.
For Amazon RDS pricing information, see the Amazon RDS product page.
What's next?
The preceding section introduced you to the basic infrastructure components that RDS offers. What
should you do next?
6
Amazon Relational Database Service User Guide
Getting started
Getting started
Create a DB instance using instructions in Getting started with Amazon RDS (p. 118).
7
Amazon Relational Database Service User Guide
DB instances
You can have up to 40 Amazon RDS DB instances, with the following limitations:
• 10 for each SQL Server edition (Enterprise, Standard, Web, and Express) under the "license-included"
model
• 10 for Oracle under the "license-included" model
• 40 for MySQL, MariaDB, or PostgreSQL
• 40 for Oracle under the "bring-your-own-license" (BYOL) licensing model
Note
If your application requires more DB instances, you can request additional DB instances by using
this form.
Each DB instance has a DB instance identifier. This customer-supplied name uniquely identifies the DB
instance when interacting with the Amazon RDS API and AWS CLI commands. The DB instance identifier
must be unique for that customer in an AWS Region.
The identifier is used as part of the DNS hostname allocated to your instance by RDS. For example, if you
specify db1 as the DB instance identifier, then RDS will automatically allocate a DNS endpoint for your
instance, such as db1.123456789012.us-east-1.rds.amazonaws.com, where 123456789012 is the
fixed identifier for a specific region for your account.
Each DB instance supports a database engine. Amazon RDS currently supports MySQL, MariaDB,
PostgreSQL, Oracle, Microsoft SQL Server, and Amazon Aurora database engines.
When creating a DB instance, some database engines require that a database name be specified. A DB
instance can host multiple databases, or a single Oracle database with multiple schemas. The database
name value depends on the database engine:
• For the MySQL and MariaDB database engines, the database name is the name of a database hosted
in your DB instance. Databases hosted by the same DB instance must have a unique name within that
instance.
• For the Oracle database engine, database name is used to set the value of ORACLE_SID, which must be
supplied when connecting to the Oracle RDS instance.
• For the Microsoft SQL Server database engine, database name is not a supported parameter.
• For the PostgreSQL database engine, the database name is the name of a database hosted in your DB
instance. A database name is not required when creating a DB instance. Databases hosted by the same
DB instance must have a unique name within that instance.
Amazon RDS creates a master user account for your DB instance as part of the creation process. This
master user has permissions to create databases and to perform create, delete, select, update, and insert
operations on tables the master user creates. You must set the master user password when you create
a DB instance, but you can change it at any time using the AWS CLI, Amazon RDS API operations, or the
8
Amazon Relational Database Service User Guide
DB instances
AWS Management Console. You can also change the master user password and manage users using
standard SQL commands.
Note
This guide covers non-Aurora Amazon RDS database engines. For information about using
Amazon Aurora, see the Amazon Aurora User Guide.
9
Amazon Relational Database Service User Guide
DB instance classes
DB instance classes
The DB instance class determines the computation and memory capacity of an Amazon RDS DB instance.
The DB instance class you need depends on your processing power and memory requirements.
For more information about instance class pricing, see Amazon RDS pricing.
Topics
• DB instance class types (p. 10)
• Supported DB engines for DB instance classes (p. 11)
• Determining DB instance class support in AWS Regions (p. 25)
• Changing your DB instance class (p. 28)
• Configuring the processor for a DB instance class (p. 29)
• Hardware specifications for DB instance classes (p. 41)
• db.m6g – General-purpose instance classes powered by AWS Graviton2 processors. These deliver
balanced compute, memory, and networking for a broad range a general purpose workloads.
You can modify a DB instance to use one of the DB instance classes powered by AWS Graviton2
processors by completing the same steps as any other DB instance modification.
• db.m5d – Newest generation instance classes that are optimized for low latency, very high random I/O
performance, and high sequential read throughput.
• db.m5 – Latest generation general-purpose instance classes that provide a balance of compute,
memory, and network resources, and are a good choice for many applications. The db.m5 instance
classes provide more computing capacity than the previous db.m4 instance classes. They are powered
by the AWS Nitro System, a combination of dedicated hardware and lightweight hypervisor.
• db.m4 – General-purpose instance classes that provide more computing capacity than the previous
db.m3 instance classes.
• db.m3 – General-purpose instance classes that provide more computing capacity than the previous
db.m1 instance classes.
• db.x2g – Instance classes optimized for memory-intensive applications and powered by AWS
Graviton2 processors. These offer low cost per GiB of memory.
You can modify a DB instance to use one of the DB instance classes powered by AWS Graviton2
processors by completing the same steps as any other DB instance modification.
• db.z1d – Instance classes optimized for memory-intensive applications. These offer both high compute
capacity and a high memory footprint. High frequency z1d instances deliver a sustained all core
frequency of up to 4.0 GHz.
• db.x1e – Instance classes optimized for memory-intensive applications. These offer one of the lowest
price per gibibyte (GiB) of RAM among the DB instance classes and up to 3,904 GiB of DRAM-based
instance memory.
10
Amazon Relational Database Service User Guide
Supported DB engines
• db.x1 – Instance classes optimized for memory-intensive applications. These offer one of the lowest
price per GiB of RAM among the DB instance classes and up to 1,952 GiB of DRAM-based instance
memory.
• db.r6g – Instance classes powered by AWS Graviton2 processors. These are ideal for running memory-
intensive workloads in open-source databases such as MySQL and PostgreSQL.
You can modify a DB instance to use one of the DB instance classes powered by AWS Graviton2
processors by completing the same steps as any other DB instance modification.
• db.r5b – Instance classes that are memory optimized for throughput-intensive applications. Powered
by the AWS Nitro System, db.r5b instances deliver up to 60 Gbps bandwidth and 260,000 IOPS of EBS
performance, which is the fastest block storage performance on EC2.
• db.r5d – Instance classes that are optimized for low latency, very high random I/O performance, and
high sequential read throughput.
• db.r5 – Latest generation instance classes optimized for memory-intensive applications. These offer
improved networking and Amazon Elastic Block Store (Amazon EBS) performance. They are powered
by the AWS Nitro System, a combination of dedicated hardware and lightweight hypervisor.
• db.r3 – Instance classes that provide memory optimization.
You can modify a DB instance to use one of the DB instance classes powered by AWS Graviton2
processors by completing the same steps as with any other DB instance modification.
• db.t3 – Next generation instance classes that provide a baseline performance level, with the ability
to burst to full CPU usage. These instance classes provide more computing capacity than the previous
db.t2 instance classes. They are powered by the AWS Nitro System, a combination of dedicated
hardware and lightweight hypervisor.
• db.t2 – Instance classes that provide a baseline performance level, with the ability to burst to full CPU
usage.
Note
The DB instance classes that use the AWS Nitro System (db.m5, db.r5, db.t3) are throttled on
combined read plus write workload.
For DB instance class hardware specifications, see Hardware specifications for DB instance classes
(p. 41).
DB instance class support varies according to the version and edition of SQL Server. For
instance class support by version and edition, see DB instance class support for Microsoft SQL
Server (p. 803).
Oracle
DB instance class support varies according to the Oracle Database version and edition. RDS for
Oracle supports additional memory-optimized instance classes. These classes have names of the
form db.r5.instance_size.tpcthreads_per_core.memratio. For the vCPU count and memory
allocation for each optimized class, see Supported Oracle DB instance classes (p. 1170).
11
Amazon Relational Database Service User Guide
Supported DB engines
In the following table, you can find details about supported Amazon RDS DB instance classes for each
Amazon RDS DB engine.
12
Amazon Relational Database Service User Guide
Supported DB engines
db.m5d.24xlarge No Yes No No No
db.m5d.16xlarge No Yes No No No
db.m5d.12xlarge No Yes No No No
db.m5d.8xlarge No Yes No No No
db.m5d.4xlarge No Yes No No No
db.m5d.2xlarge No Yes No No No
db.m5d.xlarge No Yes No No No
db.m5d.large No Yes No No No
13
Amazon Relational Database Service User Guide
Supported DB engines
14
Amazon Relational Database Service User Guide
Supported DB engines
15
Amazon Relational Database Service User Guide
Supported DB engines
16
Amazon Relational Database Service User Guide
Supported DB engines
17
Amazon Relational Database Service User Guide
Supported DB engines
db.r5d.24xlarge No Yes No No No
db.r5d.16xlarge No Yes No No No
db.r5d.12xlarge No Yes No No No
db.r5d.8xlarge No Yes No No No
db.r5d.4xlarge No Yes No No No
db.r5d.2xlarge No Yes No No No
db.r5d.xlarge No Yes No No No
db.r5d.large No Yes No No No
18
Amazon Relational Database Service User Guide
Supported DB engines
19
Amazon Relational Database Service User Guide
Supported DB engines
db.r5 – latest generation memory optimized instance classes preconfigured for high memory, storage, and I/O
db.r5.12xlarge.tpc2.mem2x No No No Yes No
db.r5.8xlarge.tpc2.mem3x No No No Yes No
db.r5.6xlarge.tpc2.mem4x No No No Yes No
db.r5.4xlarge.tpc2.mem4x No No No Yes No
db.r5.4xlarge.tpc2.mem3x No No No Yes No
db.r5.4xlarge.tpc2.mem2x No No No Yes No
db.r5.2xlarge.tpc2.mem8x No No No Yes No
db.r5.2xlarge.tpc2.mem4x No No No Yes No
db.r5.2xlarge.tpc1.mem2x No No No Yes No
db.r5.xlarge.tpc2.mem4x No No No Yes No
db.r5.xlarge.tpc2.mem2x No No No Yes No
db.r5.large.tpc1.mem2x No No No Yes No
20
Amazon Relational Database Service User Guide
Supported DB engines
21
Amazon Relational Database Service User Guide
Supported DB engines
22
Amazon Relational Database Service User Guide
Supported DB engines
23
Amazon Relational Database Service User Guide
Supported DB engines
24
Amazon Relational Database Service User Guide
Determining DB instance class support in AWS Regions
25
Amazon Relational Database Service User Guide
Determining DB instance class support in AWS Regions
Note
When you perform operations with the AWS CLI, such as creating or modifying a DB instance,
it automatically shows the supported DB instance classes for a specific DB engine, DB engine
version, and AWS Region.
Contents
• Using the Amazon RDS pricing page to determine DB instance class support in AWS
Regions (p. 26)
• Using the AWS CLI to determine DB instance class support in AWS Regions (p. 26)
• Listing the DB instance classes that are supported by a specific DB engine version in an AWS
Region (p. 27)
• Listing the DB engine versions that support a specific DB instance class in an AWS
Region (p. 28)
To use the pricing page to determine the DB instance classes supported by each engine in a
Region
Other choices might be available for some DB engines, such as Single-AZ Deployment or Multi-AZ
Deployment.
sqlserver-ex
sqlserver-web
26
Amazon Relational Database Service User Guide
Determining DB instance class support in AWS Regions
oracle-se
For information about AWS Region names, see AWS Regions (p. 55).
The following examples demonstrate how to determine DB instance class support in an AWS Region
using the describe-orderable-db-instance-options AWS CLI command.
Note
To limit the output, these examples show results only for the General Purpose SSD (gp2) storage
type. If necessary, you can change the storage type to Provisioned IOPS (io1) or magnetic
(standard) in the commands.
Topics
• Listing the DB instance classes that are supported by a specific DB engine version in an AWS
Region (p. 27)
• Listing the DB engine versions that support a specific DB instance class in an AWS Region (p. 28)
For Windows:
For example, the following command lists the supported DB instance classes for version 12.4 of the RDS
for PostgreSQL DB engine in US East (N. Virginia).
27
Amazon Relational Database Service User Guide
Changing your DB instance class
For Windows:
For Windows:
For example, the following command lists the DB engine versions of the RDS for PostgreSQL DB engine
that support the db.r5.large DB instance class in US East (N. Virginia).
For Windows:
28
Amazon Relational Database Service User Guide
Configuring the processor
Some instance classes require that your DB instance is in a VPC. If your current DB instance isn't in a VPC,
and you want to use an instance class that requires one, first move your DB instance into a VPC. For more
information, see Moving a DB instance not in a VPC into a VPC (p. 1998).
Topics
• Overview of configuring the processor (p. 29)
• DB instance classes that support processor configuration (p. 29)
• Setting the CPU cores and threads per CPU core for a DB instance class (p. 34)
• Number of CPU cores – You can customize the number of CPU cores for the DB instance. You might do
this to potentially optimize the licensing costs of your software with a DB instance that has sufficient
amounts of RAM for memory-intensive workloads but fewer CPU cores.
• Threads per core – You can disable Intel Hyper-Threading Technology by specifying a single thread
per CPU core. You might do this for certain workloads, such as high-performance computing (HPC)
workloads.
You can control the number of CPU cores and threads for each core separately. You can set one or both
in a request. After a setting is associated with a DB instance, the setting persists until you change it.
The processor settings for a DB instance are associated with snapshots of the DB instance. When a
snapshot is restored, its restored DB instance uses the processor feature settings used when the snapshot
was taken.
If you modify the DB instance class for a DB instance with nondefault processor settings, either specify
default processor settings or explicitly specify processor settings at modification. This requirement
ensures that you are aware of the third-party licensing costs that might be incurred when you modify the
DB instance.
There is no additional or reduced charge for specifying processor features on an Amazon RDS DB
instance. You're charged the same as for DB instances that are launched with default CPU configurations.
• You're configuring an Oracle DB instance. For information about the DB instance classes supported by
different Oracle database editions, see RDS for Oracle instance classes (p. 1170).
29
Amazon Relational Database Service User Guide
Configuring the processor
• Your instance is using the Bring Your Own License (BYOL) licensing option. For more information about
Oracle licensing options, see Oracle licensing options (p. 1167).
• Your instance isn't one of the db.r5 instance classes that have predefined
processor configurations. These instance classes have names of the form
db.r5.instance_size.tpcthreads_per_core.memratio. For example, db.r5.xlarge.tpc2.mem4x
is preconfigured with 2 threads per core (tpc2) and 4x as much memory as the standard db.r5.xlarge
instance class. You can't configure the processor features of these optimized instance classes. For more
information, see Supported Oracle DB instance classes (p. 1170).
In the following table, you can find the DB instance classes that support setting a number of CPU cores
and CPU threads per core. You can also find the default value and the valid values for the number of CPU
cores and CPU threads per core for each DB instance class.
DB instance Default vCPUs Default CPU Default Valid number Valid number
class cores threads per of CPU cores of threads per
core core
db.m5.large 2 1 2 1 1, 2
db.m5.xlarge 4 2 2 2 1, 2
db.m5.2xlarge 8 4 2 2, 4 1, 2
db.m5.4xlarge 16 8 2 2, 4, 6, 8 1, 2
db.m5.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.m5.12xlarge 48 24 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24
db.m5.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.m5d.large 2 1 2 1 1, 2
db.m5d.xlarge 4 2 2 2 1, 2
db.m5d.2xlarge 8 4 2 2, 4 1, 2
db.m5d.4xlarge 16 8 2 2, 4, 6, 8 1, 2
db.m5d.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.m5d.12xlarge 48 24 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24
30
Amazon Relational Database Service User Guide
Configuring the processor
DB instance Default vCPUs Default CPU Default Valid number Valid number
class cores threads per of CPU cores of threads per
core core
db.m5d.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.m4.10xlarge 40 20 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20
db.m4.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.r5.large 2 1 2 1 1, 2
db.r5.xlarge 4 2 2 2 1, 2
db.r5.2xlarge 8 4 2 2, 4 1, 2
db.r5.4xlarge 16 8 2 2, 4, 6, 8 1, 2
db.r5.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.r5.12xlarge 48 24 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24
db.r5.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.r5b.large 2 1 2 1 1, 2
db.r5b.xlarge 4 2 2 2 1, 2
db.r5b.2xlarge 8 4 2 2, 4 1, 2
db.r5b.4xlarge 16 8 2 2, 4, 6, 8 1, 2
31
Amazon Relational Database Service User Guide
Configuring the processor
DB instance Default vCPUs Default CPU Default Valid number Valid number
class cores threads per of CPU cores of threads per
core core
db.r5b.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.r5b.12xlarge 48 24 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24
db.r5b.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.r5d.large 2 1 2 1 1, 2
db.r5d.xlarge 4 2 2 2 1, 2
db.r5d.2xlarge 8 4 2 2, 4 1, 2
db.r5d.4xlarge 16 8 2 2, 4, 6, 8 1, 2
db.r5d.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.r5d.12xlarge 48 24 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24
db.r5d.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.r4.large 2 1 2 1 1, 2
db.r4.xlarge 4 2 2 1, 2 1, 2
db.r4.2xlarge 8 4 2 1, 2, 3, 4 1, 2
db.r4.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 1, 2
7, 8
32
Amazon Relational Database Service User Guide
Configuring the processor
DB instance Default vCPUs Default CPU Default Valid number Valid number
class cores threads per of CPU cores of threads per
core core
db.r4.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 1, 2
7, 8, 9, 10, 11,
12, 13, 14, 15,
16
db.r4.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.r3.large 2 1 2 1 1, 2
db.r3.xlarge 4 2 2 1, 2 1, 2
db.r3.2xlarge 8 4 2 1, 2, 3, 4 1, 2
db.r3.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 1, 2
7, 8
db.r3.8xlarge 32 16 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16
db.x1.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.x1e.xlarge 4 2 2 1, 2 1, 2
db.x1e.2xlarge 8 4 2 1, 2, 3, 4 1, 2
db.x1e.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 1, 2
7, 8
db.x1e.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 1, 2
7, 8, 9, 10, 11,
12, 13, 14, 15,
16
db.x1e.16xlarge 64 32 2 2, 4, 6, 8, 10, 1, 2
12, 14, 16, 18,
20, 22, 24, 26,
28, 30, 32
db.z1d.large 2 1 2 1 1, 2
33
Amazon Relational Database Service User Guide
Configuring the processor
DB instance Default vCPUs Default CPU Default Valid number Valid number
class cores threads per of CPU cores of threads per
core core
db.z1d.xlarge 4 2 2 2 1, 2
db.z1d.2xlarge 8 4 2 2, 4 1, 2
db.z1d.3xlarge 12 6 2 2, 4, 6 1, 2
db.z1d.6xlarge 24 12 2 2, 4, 6, 8, 10, 1, 2
12
Note
You can use AWS CloudTrail to monitor and audit changes to the process configuration of
Amazon RDS for Oracle DB instances. For more information about using CloudTrail, see Working
with AWS CloudTrail and Amazon RDS (p. 632).
Setting the CPU cores and threads per CPU core for a DB
instance class
You can configure the number of CPU cores and threads per core for the DB instance class when you
perform the following operations:
Note
When you modify a DB instance to configure the number of CPU cores or threads per core, there
is a brief DB instance outage.
You can set the CPU cores and the threads per CPU core for a DB instance class using the AWS
Management Console, the AWS CLI, or the RDS API.
Console
When you are creating, modifying, or restoring a DB instance, you set the DB instance class in the
AWS Management Console. The Instance specifications section shows options for the processor. The
following image shows the processor features options.
34
Amazon Relational Database Service User Guide
Configuring the processor
35
Amazon Relational Database Service User Guide
Configuring the processor
Set the following options to the appropriate values for your DB instance class under Processor features:
• Core count – Set the number of CPU cores using this option. The value must be equal to or less than
the maximum number of CPU cores for the DB instance class.
• Threads per core – Specify 2 to enable multiple threads per core, or specify 1 to disable multiple
threads per core.
When you modify or restore a DB instance, you can also set the CPU cores and the threads per CPU core
to the defaults for the instance class.
When you view the details for a DB instance in the console, you can view the processor information for
its DB instance class on the Configuration tab. The following image shows a DB instance class with one
CPU core and multiple threads per core enabled.
For Oracle DB instances, the processor information only appears for Bring Your Own License (BYOL) DB
instances.
AWS CLI
You can set the processor features for a DB instance when you run one of the following AWS CLI
commands:
• create-db-instance
36
Amazon Relational Database Service User Guide
Configuring the processor
• modify-db-instance
• restore-db-instance-from-db-snapshot
• restore-db-instance-from-s3
• restore-db-instance-to-point-in-time
To configure the processor of a DB instance class for a DB instance by using the AWS CLI, include the --
processor-features option in the command. Specify the number of CPU cores with the coreCount
feature name, and specify whether multiple threads per core are enabled with the threadsPerCore
feature name.
Examples
• Setting the number of CPU cores for a DB instance (p. 37)
• Setting the number of CPU cores and disabling multiple threads for a DB instance (p. 37)
• Viewing the valid processor values for a DB instance class (p. 38)
• Returning to default processor settings for a DB instance (p. 39)
• Returning to the default number of CPU cores for a DB instance (p. 39)
• Returning to the default number of threads per core for a DB instance (p. 40)
Example
The following example modifies mydbinstance by setting the number of CPU cores to 4. The changes
are applied immediately by using --apply-immediately. If you want to apply the changes during the
next scheduled maintenance window, omit the --apply-immediately option.
For Windows:
Setting the number of CPU cores and disabling multiple threads for a DB instance
Example
The following example modifies mydbinstance by setting the number of CPU cores to 4 and disabling
multiple threads per core. The changes are applied immediately by using --apply-immediately. If
you want to apply the changes during the next scheduled maintenance window, omit the --apply-
immediately option.
37
Amazon Relational Database Service User Guide
Configuring the processor
For Windows:
Example
You can view the valid processor values for a particular DB instance class by running the describe-
orderable-db-instance-options command and specifying the instance class for the --db-instance-
class option. For example, the output for the following command shows the processor options for the
db.r3.large instance class.
{
"SupportsIops": true,
"MaxIopsPerGib": 50.0,
"LicenseModel": "bring-your-own-license",
"DBInstanceClass": "db.r3.large",
"SupportsIAMDatabaseAuthentication": false,
"MinStorageSize": 100,
"AvailabilityZones": [
{
"Name": "us-west-2a"
},
{
"Name": "us-west-2b"
},
{
"Name": "us-west-2c"
}
],
"EngineVersion": "12.1.0.2.v2",
"MaxStorageSize": 32768,
"MinIopsPerGib": 1.0,
"MaxIopsPerDbInstance": 40000,
"ReadReplicaCapable": false,
"AvailableProcessorFeatures": [
{
"Name": "coreCount",
"DefaultValue": "1",
"AllowedValues": "1"
},
{
"Name": "threadsPerCore",
"DefaultValue": "2",
"AllowedValues": "1,2"
}
],
38
Amazon Relational Database Service User Guide
Configuring the processor
"SupportsEnhancedMonitoring": true,
"SupportsPerformanceInsights": false,
"MinIopsPerDbInstance": 1000,
"StorageType": "io1",
"Vpc": false,
"SupportsStorageEncryption": true,
"Engine": "oracle-ee",
"MultiAZCapable": true
}
In addition, you can run the following commands for DB instance class processor information:
In the output of the preceding commands, the values for the processor features are not null only if the
following conditions are met:
If the preceding conditions aren't met, you can get the instance type using describe-db-instances. You
can get the processor information for this instance type by running the EC2 operation describe-instance-
types.
Example
The following example modifies mydbinstance by returning its DB instance class to the default
processor values for it. The changes are applied immediately by using --apply-immediately. If
you want to apply the changes during the next scheduled maintenance window, omit the --apply-
immediately option.
For Windows:
Example
The following example modifies mydbinstance by returning its DB instance class to the default number
of CPU cores for it. The threads per core setting isn't changed. The changes are applied immediately by
using --apply-immediately. If you want to apply the changes during the next scheduled maintenance
window, omit the --apply-immediately option.
39
Amazon Relational Database Service User Guide
Configuring the processor
For Windows:
Example
The following example modifies mydbinstance by returning its DB instance class to the default number
of threads per core for it. The number of CPU cores setting isn't changed. The changes are applied
immediately by using --apply-immediately. If you want to apply the changes during the next
scheduled maintenance window, omit the --apply-immediately option.
For Windows:
RDS API
You can set the processor features for a DB instance when you call one of the following Amazon RDS API
operations:
• CreateDBInstance
• ModifyDBInstance
• RestoreDBInstanceFromDBSnapshot
• RestoreDBInstanceFromS3
• RestoreDBInstanceToPointInTime
To configure the processor features of a DB instance class for a DB instance by using the Amazon RDS
API, include the ProcessFeatures parameter in the call.
Specify the number of CPU cores with the coreCount feature name, and specify whether multiple
threads per core are enabled with the threadsPerCore feature name.
You can view the valid processor values for a particular instance class by running the
DescribeOrderableDBInstanceOptions operation and specifying the instance class for the
DBInstanceClass parameter. You can also use the following operations:
40
Amazon Relational Database Service User Guide
Hardware specifications
In the output of the preceding operations, the values for the processor features are not null only if the
following conditions are met:
If the preceding conditions aren't met, you can get the instance type using DescribeDBInstances.
You can get the processor information for this instance type by running the EC2 operation
DescribeInstanceTypes.
vCPU
The number of virtual central processing units (CPUs). A virtual CPU is a unit of capacity that you can
use to compare DB instance classes. Instead of purchasing or leasing a particular processor to use for
several months or years, you are renting capacity by the hour. Our goal is to make a consistent and
specific amount of CPU capacity available, within the limits of the actual underlying hardware.
ECU
The relative measure of the integer processing power of an Amazon EC2 instance. To make it easy
for developers to compare CPU capacity between different instance classes, we have defined an
Amazon EC2 Compute Unit. The amount of CPU that is allocated to a particular instance is expressed
in terms of these EC2 Compute Units. One ECU currently provides CPU capacity equivalent to a 1.0–
1.2 GHz 2007 Opteron or 2007 Xeon processor.
Memory (GiB)
The RAM, in gibibytes, allocated to the DB instance. There is often a consistent ratio between
memory and vCPU. As an example, take the db.r4 instance class, which has a memory to vCPU ratio
similar to the db.r5 instance class. However, for most use cases the db.r5 instance class provides
better, more consistent performance than the db.r4 instance class.
VPC Only
The instance class is supported only for DB instances that are in a VPC based on the Amazon VPC
service. In some cases, you might want to use an instance class that requires a VPC but your current
DB instance isn't in a VPC. In these cases, start by moving your DB instance into a VPC. For more
information, see Moving a DB instance not in a VPC into a VPC (p. 1998).
EBS-Optimized
The DB instance uses an optimized configuration stack and provides additional, dedicated capacity
for I/O. This optimization provides the best performance by minimizing contention between I/O and
other traffic from your instance. For more information about Amazon EBS–optimized instances, see
Amazon EBS–Optimized instances in the Amazon EC2 User Guide for Linux Instances.
Max. Bandwidth (Mbps)
The maximum bandwidth in megabits per second. Divide by 8 to get the expected throughput in
megabytes per second.
41
Amazon Relational Database Service User Guide
Hardware specifications
Important
General Purpose SSD (gp2) volumes for Amazon RDS DB instances have a throughput limit
of 250 MiB/s in most cases. However, the throughput limit can vary depending on volume
size. For more information, see Amazon EBS volume types in the Amazon EC2 User Guide
for Linux Instances. For information on estimating bandwidth for gp2 storage, see General
Purpose SSD storage (p. 48).
Network Performance
In the following table, you can find hardware details about the Amazon RDS DB instance classes.
For information about Amazon RDS DB engine support for each DB instance class, see Supported DB
engines for DB instance classes (p. 11).
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
42
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
43
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
44
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
45
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
46
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
* These DB instance classes can support maximum performance for 30 minutes at least once every
24 hours. For more information on baseline performance of these instance types, see Amazon EBS-
optimized instances in the Amazon EC2 User Guide for Linux Instances.
** The r3.8xlarge instance doesn't have dedicated EBS bandwidth and therefore doesn't offer EBS
optimization. On this instance, network traffic and Amazon EBS traffic share the same 10-gigabit
network interface.
47
Amazon Relational Database Service User Guide
DB instance storage
• General Purpose SSD – General Purpose SSD volumes offer cost-effective storage that is ideal for
a broad range of workloads. These volumes deliver single-digit millisecond latencies and the ability
to burst to 3,000 IOPS for extended periods of time. Baseline performance for these volumes is
determined by the volume's size.
For more information about General Purpose SSD storage, including the storage size ranges, see
General Purpose SSD storage (p. 48).
• Provisioned IOPS – Provisioned IOPS storage is designed to meet the needs of I/O-intensive
workloads, particularly database workloads, that require low I/O latency and consistent I/O
throughput.
For more information about provisioned IOPS storage, including the storage size ranges, see
Provisioned IOPS SSD storage (p. 50).
• Magnetic – Amazon RDS also supports magnetic storage for backward compatibility. We recommend
that you use General Purpose SSD or Provisioned IOPS for any new storage needs. The maximum
amount of storage allowed for DB instances on magnetic storage is less than that of the other storage
types. For more information, see Magnetic storage (p. 51).
Several factors can affect the performance of Amazon EBS volumes, such as instance configuration,
I/O characteristics, and workload demand. For more information about getting the most out of your
Provisioned IOPS volumes, see Amazon EBS volume performance.
Baseline I/O performance for General Purpose SSD storage is 3 IOPS for each GiB, with a minimum of
100 IOPS. This relationship means that larger volumes have better performance. For example, baseline
performance for a 100-GiB volume is 300 IOPS. Baseline performance for a 1-TiB volume is 3,000 IOPS.
Maximum baseline performance for a gp2 volume (5.34 TiB and greater) is 16,000 IOPS.
48
Amazon Relational Database Service User Guide
General Purpose SSD storage
Volumes below 1 TiB in size also have ability to burst to 3,000 IOPS for extended periods of time.
Instance I/O credit balance determines burst performance. For more information about instance I/O
credits, see I/O credits and burst performance (p. 49).
Many workloads never deplete the burst balance, making General Purpose SSD an ideal storage choice
for many workloads. However, some workloads can exhaust the 3,000 IOPS burst storage credit balance,
so you should plan your storage capacity to meet the needs of your workloads.
For gp2 volumes larger than 1 TiB, the baseline performance is greater than the burst performance. For
such volumes, burst is irrelevant because the baseline performance is better than the 3,000 IOPS burst
performance.
Note
DB instances that use General Purpose SSD storage can experience much longer latency after
read replica creation, Multi-AZ conversion, and DB snapshot restoration than instances that
use Provisioned IOPS storage. If you need a DB instance with minimum latency after these
operations, we recommend using Provisioned IOPS storage.
When using General Purpose SSD storage, your DB instance receives an initial I/O credit balance of 5.4
million I/O credits. This initial credit balance is enough to sustain a burst performance of 3,000 IOPS
for 30 minutes. This balance is designed to provide a fast initial boot cycle for boot volumes and to
provide a good bootstrapping experience for other applications. Volumes earn I/O credits at the baseline
performance rate of 3 IOPS for each GiB of volume size. For example, a 100-GiB SSD volume has a
baseline performance of 300 IOPS.
When your storage requires more than the base performance I/O level, it uses I/O credits in the I/O
credit balance to burst to the required performance level. Such a burst goes to a maximum of 3,000
IOPS. Storage larger than 1,000 GiB has a base performance that is equal or greater than the maximum
burst performance. When your storage uses fewer I/O credits than it earns in a second, unused I/O
credits are added to the I/O credit balance. The maximum I/O credit balance for a DB instance using
General Purpose SSD storage is equal to the initial I/O credit balance (5.4 million I/O credits).
Suppose that your storage uses all of its I/O credit balance. If so, its maximum performance remains
at the base performance level until I/O demand drops below the base level and unused I/O credits are
added to the I/O credit balance. (The base performance level is the rate at which your storage earns I/
O credits.) The more storage, the greater the base performance is and the faster it replenishes the I/O
credit balance.
Note
Storage conversions between magnetic storage and General Purpose SSD storage can
potentially deplete your I/O credit balance, resulting in longer conversion times. For
more information about scaling storage, see Working with storage for Amazon RDS DB
instances (p. 376).
The burst duration of your storage depends on the size of the storage, the burst IOPS required, and the
I/O credit balance when the burst begins. This relationship is shown in the equation following.
(Credit balance)
49
Amazon Relational Database Service User Guide
Provisioned IOPS storage
You might notice that your storage performance is frequently limited to the base level due to an empty
I/O credit balance. If so, consider allocating more General Purpose SSD storage with a higher base
performance level. Alternatively, you can switch to Provisioned IOPS storage for workloads that require
sustained IOPS performance.
For workloads with steady state I/O requirements, provisioning less than 100 GiB of General Purpose
SSD storage might result in higher latencies if you exhaust your I/O credit balance.
Note
In general, most workloads never exceed the I/O credit balance.
For a more detailed description of how baseline performance and I/O credit balance affect performance
see Understanding burst vs. baseline performance with Amazon RDS and GP2.
When you create a DB instance, you specify the IOPS rate and the size of the volume. The ratio of IOPS
to allocated storage (in GiB) must be at least 0.5 (1.0 on RDS for SQL Server) and not more than 50.
Amazon RDS provides that IOPS rate for the DB instance until you change it.
The following table shows the range of Provisioned IOPS and storage size range for each database
engine.
The ratio of IOPS to allocated storage (in GiB) must be from 1–50 on RDS for SQL Server, and 0.5–50 on
other RDS DB engines.
Note
For SQL Server, the maximum 64,000 IOPS is guaranteed only on Nitro-based instances that
are on the m5, m5d, r5, r5b, r5d, and z1d instance types. Other instance families guarantee
performance up to 32,000 IOPS.
For Oracle, you can provision the maximum 256,000 IOPS only on the r5b instance type.
50
Amazon Relational Database Service User Guide
Magnetic storage
For PostgreSQL, the maximum IOPS on the db.m5.8xlarge, db.m5.16xlarge, db.r5.8xlarge, and
db.r5.16xlarge instance classes is 40,000.
Important
Depending on the instance class you're using, you might see lower IOPS performance than the
maximum that RDS allows you to provision. For specific information on IOPS performance for
DB instance classes, see Amazon EBS-optimized instances. We recommend that you determine
the maximum IOPS for the instance class before setting a Provisioned IOPS value for your DB
instance.
You can also use Provisioned IOPS SSD storage with read replicas for MySQL, MariaDB or PostgreSQL.
The type of storage for a read replica is independent of that on the primary DB instance. For example,
you might use General Purpose SSD for read replicas with a primary DB instance that uses Provisioned
IOPS SSD storage to reduce costs. However, your read replica's performance in this case might differ
from that of a configuration where both the primary DB instance and the read replicas use Provisioned
IOPS SSD storage.
Provisioned IOPS SSD storage provides a way to reserve I/O capacity by specifying IOPS. However, as
with any other system capacity attribute, its maximum throughput under load is constrained by the
resource that is consumed first. That resource might be network bandwidth, CPU, memory, or database
internal resources.
Magnetic storage
Amazon RDS also supports magnetic storage for backward compatibility. We recommend that you
use General Purpose SSD or Provisioned IOPS SSD for any new storage needs. The following are some
limitations for magnetic storage:
• Doesn't allow you to scale storage when using the SQL Server database engine.
• Doesn't support storage autoscaling.
• Doesn't support elastic volumes.
• Limited to a maximum size of 3 TiB.
• Limited to a maximum of 1,000 IOPS.
51
Amazon Relational Database Service User Guide
Monitoring storage performance
The following metrics are useful for monitoring storage for your DB instance:
• IOPS – The number of I/O operations completed each second. This metric is reported as the average
IOPS for a given time interval. Amazon RDS reports read and write IOPS separately on 1-minute
intervals. Total IOPS is the sum of the read and write IOPS. Typical values for IOPS range from zero to
tens of thousands per second.
• Latency – The elapsed time between the submission of an I/O request and its completion. This metric
is reported as the average latency for a given time interval. Amazon RDS reports read and write
latency separately at 1-minute intervals. Typical values for latency are in milliseconds (ms).
• Throughput – The number of bytes each second that are transferred to or from disk. This metric is
reported as the average throughput for a given time interval. Amazon RDS reports read and write
throughput separately on 1-minute intervals using units of megabytes per second (MB/s). Typical
values for throughput range from zero to the I/O channel's maximum bandwidth.
• Queue Depth – The number of I/O requests in the queue waiting to be serviced. These are I/O
requests that have been submitted by the application but have not been sent to the device because
the device is busy servicing other I/O requests. Time spent waiting in the queue is a component of
latency and service time (not available as a metric). This metric is reported as the average queue depth
for a given time interval. Amazon RDS reports queue depth in 1-minute intervals. Typical values for
queue depth range from zero to several hundred.
Measured IOPS values are independent of the size of the individual I/O operation. This means that when
you measure I/O performance, you should look at the throughput of the instance, not simply the number
of I/O operations.
System activities
The following system-related activities consume I/O capacity and might reduce DB instance performance
while in progress:
Database workload
In some cases, your database or application design results in concurrency issues, locking, or other forms
of database contention. In these cases, you might not be able to use all the provisioned bandwidth
directly. In addition, you might encounter the following workload-related situations:
52
Amazon Relational Database Service User Guide
Factors that affect storage performance
• You experience query contention in the database even though some I/O capacity is unused.
In some cases, there isn't a system resource that is at or near a limit, and adding threads doesn't increase
the database transaction rate. In such cases, the bottleneck is most likely contention in the database.
The most common forms are row lock and index page lock contention, but there are many other
possibilities. If this is your situation, seek the advice of a database performance tuning expert.
DB instance class
To get the most performance out of your Amazon RDS DB instance, choose a current generation instance
type with enough bandwidth to support your storage type. For example, you can choose Amazon EBS–
optimized instances and instances with 10-gigabit network connectivity.
Important
Depending on the instance class you're using, you might see lower IOPS performance than the
maximum that you can provision with RDS. For specific information on IOPS performance for
DB instance classes, see Amazon EBS–optimized instances. We recommend that you determine
the maximum IOPS for the instance class before setting a Provisioned IOPS value for your DB
instance.
We encourage you to use the latest generation of instances to get the best performance. Previous
generation DB instances can also have lower maximum storage.
Some older 32-bit file systems might have lower storage capacities. To determine the storage capacity of
your DB instance, you can use the describe-valid-db-instance-modifications AWS CLI command.
The following list shows the maximum storage that most DB instance classes can scale to for each
database engine:
• MariaDB: 64 TiB
• Microsoft SQL Server: 16 TiB
• MySQL: 64 TiB
• Oracle: 64 TiB
• PostgreSQL: 64 TiB
The following table shows some exceptions. All RDS for Microsoft SQL Server DB instances have a
maximum storage of 16 TiB, so there are no entries for SQL Server.
db.t3.medium 16 16 32 32
db.t3.small 16 16 32 16
db.t3.micro 16 16 32 16
53
Amazon Relational Database Service User Guide
Factors that affect storage performance
db.t2.medium 32 32 N/A 32
db.t2.small 16 16 N/A 16
db.t2.micro 16 16 N/A 16
For more details about all instance classes supported, see Previous generation DB instances.
54
Amazon Relational Database Service User Guide
Regions, Availability Zones, and Local Zones
By using Local Zones, you can place resources, such as compute and storage, in multiple locations closer
to your users. Amazon RDS enables you to place resources, such as DB instances, and data in multiple
locations. Resources aren't replicated across AWS Regions unless you do so specifically.
Amazon operates state-of-the-art, highly-available data centers. Although rare, failures can occur that
affect the availability of DB instances that are in the same location. If you host all your DB instances in a
single location that is affected by such a failure, none of your DB instances will be available.
It is important to remember that each AWS Region is completely independent. Any Amazon RDS activity
you initiate (for example, creating database instances or listing available database instances) runs only
in your current default AWS Region. The default AWS Region can be changed in the console, by setting
the AWS_DEFAULT_REGION environment variable, or it can be overridden by using the --region
parameter with the AWS Command Line Interface (AWS CLI). For more information, see Configuring the
AWS Command Line Interface, specifically the sections about environment variables and command line
options.
Amazon RDS supports special AWS Regions called AWS GovCloud (US) that are designed to allow
US government agencies and customers to move more sensitive workloads into the cloud. The AWS
GovCloud (US) Regions address the US government's specific regulatory and compliance requirements.
For more information, see What is AWS GovCloud (US)?
To create or work with an Amazon RDS DB instance in a specific AWS Region, use the corresponding
regional service endpoint.
AWS Regions
Each AWS Region is designed to be isolated from the other AWS Regions. This design achieves the
greatest possible fault tolerance and stability.
55
Amazon Relational Database Service User Guide
AWS Regions
When you view your resources, you see only the resources that are tied to the AWS Region that you
specified. This is because AWS Regions are isolated from each other, and we don't automatically replicate
resources across AWS Regions.
Region availability
The following table shows the AWS Regions where Amazon RDS is currently available and the endpoint
for each Region.
rds-fips.us-east-2.amazonaws.com HTTPS
rds-fips.us-east-1.amazonaws.com HTTPS
rds-fips.us-west-1.amazonaws.com HTTPS
rds-fips.us-west-2.amazonaws.com HTTPS
56
Amazon Relational Database Service User Guide
AWS Regions
rds-fips.ca-central-1.amazonaws.com HTTPS
If you do not explicitly specify an endpoint, the US West (Oregon) endpoint is the default.
When you work with a DB instance using the AWS CLI or API operations, make sure that you specify its
regional endpoint.
57
Amazon Relational Database Service User Guide
Availability Zones
Availability Zones
When you create a DB instance, you can choose an Availability Zone or have Amazon RDS choose one for
you randomly. An Availability Zone is represented by an AWS Region code followed by a letter identifier
(for example, us-east-1a).
You can't choose the Availability Zones for the primary and secondary DB instances in a Multi-AZ DB
deployment. Amazon RDS chooses them for you randomly. For more information about Multi-AZ
deployments, see Multi-AZ deployments for high availability (p. 59).
Note
Random selection of Availability Zones by RDS doesn't guarantee an even distribution of DB
instances among Availability Zones within a single account or DB subnet group. You can request
a specific AZ when you create or modify a Single-AZ instance, and you can use more-specific DB
subnet groups for Multi-AZ instances. For more information, see Creating an Amazon RDS DB
instance (p. 194) and Modifying an Amazon RDS DB instance (p. 306).
Local Zones
A Local Zone is an extension of an AWS Region that is geographically close to your users. You can extend
any VPC from the parent AWS Region into Local Zones by creating a new subnet and assigning it to the
AWS Local Zone. When you create a subnet in a Local Zone, your VPC is extended to that Local Zone. The
subnet in the Local Zone operates the same as other subnets in your VPC.
When you create a DB instance, you can choose a subnet in a Local Zone. Local Zones have their own
connections to the internet and support AWS Direct Connect. Thus, resources created in a Local Zone can
serve local users with very low-latency communications. For more information, see AWS Local Zones.
A Local Zone is represented by an AWS Region code followed by an identifier that indicates the location,
for example us-west-2-lax-1a.
Note
A Local Zone can't be included in a Multi-AZ deployment.
For more information, see Enabling Local Zones in the Amazon EC2 User Guide for Linux Instances.
2. Create a subnet in the Local Zone.
For more information, see Creating a subnet in your VPC in the Amazon VPC User Guide.
3. Create a DB subnet group in the Local Zone.
When you create a DB subnet group, choose the Availability Zone group for the Local Zone.
For more information, see Creating an Amazon RDS DB instance (p. 194).
Important
Currently, Local Zones are only available in the US West (Oregon) Region. In this AWS Region,
the Los Angeles AWS Local Zone is available.
58
Amazon Relational Database Service User Guide
Multi-AZ deployments
Topics
• Multi-AZ DB instance deployments (p. 60)
• Multi-AZ DB cluster deployments (preview) (p. 65)
Note
Multi-AZ DB clusters are in preview for RDS for MySQL and RDS for PostgreSQL and are subject
to change.
59
Amazon Relational Database Service User Guide
Multi-AZ DB instance deployments
Using the RDS console, you can create a Multi-AZ DB instance deployment by simply specifying Multi-
AZ when creating a DB instance. You can use the console to convert existing DB instances to Multi-AZ
DB instance deployments by modifying the DB instance and specifying the Multi-AZ option. You can
also specify a Multi-AZ DB instance deployment with the AWS CLI or Amazon RDS API. Use the create-
60
Amazon Relational Database Service User Guide
Multi-AZ DB instance deployments
The RDS console shows the Availability Zone of the standby replica (called the secondary AZ). You can
also use the describe-db-instances CLI command or the DescribeDBInstances API operation to find the
secondary AZ.
DB instances using Multi-AZ DB instance deployments can have increased write and commit latency
compared to a Single-AZ deployment. This can happen because of the synchronous data replication that
occurs. You might have a change in latency if your deployment fails over to the standby replica, although
AWS is engineered with low-latency network connectivity between Availability Zones. For production
workloads, we recommend that you use Provisioned IOPS (input/output operations per second) for fast,
consistent performance. For more information about DB instance classes, see DB instance classes (p. 10).
For information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 306).
Important
This action avoids downtime when you convert from Single-AZ to Multi-AZ, but you can
experience a performance impact during and after converting to Multi-AZ. This impact can be
significant for workloads that are sensitive to write latency.
To turn on Multi-AZ for a DB instance, RDS takes a snapshot of the primary DB instance's
Amazon EBS volume and restores it on the newly created standby replica. RDS then
synchronizes both volumes. New volumes created from existing EBS snapshots load lazily in
the background. This capability lets large volumes be restored from a snapshot quickly, but
it can add latency during the modification and after it's complete. For more information, see
Restoring an Amazon EBS volume from a snapshot in the Amazon EC2 documentation.
After the modification is complete, Amazon RDS triggers an event (RDS-EVENT-0025) that indicates the
process is complete. You can monitor Amazon RDS events. For more information about events, see Using
Amazon RDS event notification (p. 571).
Amazon RDS handles failovers automatically so you can resume database operations as quickly as
possible without administrative intervention. The primary DB instance switches over automatically to
the standby replica if any of the conditions described in the following table occurs. You can view these
failover reasons in the event log.
61
Amazon Relational Database Service User Guide
Multi-AZ DB instance deployments
The operating system underlying the RDS A failover was triggered during the maintenance
database instance is being patched in an offline window for an OS patch or a security update.
operation.
For more information, see Maintaining a DB
instance (p. 320).
The primary host of the RDS Multi-AZ instance is The Multi-AZ DB instance deployment detected an
unhealthy. impaired primary DB instance and failed over.
The primary host of the RDS Multi-AZ instance is RDS monitoring detected a network reachability
unreachable due to loss of network connectivity. failure to the primary DB instance and triggered a
failover.
The RDS instance was modified by customer. An RDS DB instance modification triggered a
failover.
The RDS Multi-AZ primary instance is busy and The primary DB instance is unresponsive. We
unresponsive. recommend that you do the following:
The storage volume underlying the primary The Multi-AZ DB instance deployment detected
host of the RDS Multi-AZ instance experienced a a storage issue on the primary DB instance and
failure. failed over.
The user requested a failover of the DB instance. You rebooted the DB instance and chose Reboot
with failover.
62
Amazon Relational Database Service User Guide
Multi-AZ DB instance deployments
To determine if your Multi-AZ DB cluster has failed over, you can do the following:
• Set up DB event subscriptions to notify you by email or SMS that a failover has been initiated. For
more information about events, see Using Amazon RDS event notification (p. 571).
• View your DB events by using the RDS console or API operations.
• View the current state of your Multi-AZ DB instance deployment by using the RDS console or API
operations.
For information on how you can respond to failovers, reduce recovery time, and other best practices for
Amazon RDS, see Best practices for Amazon RDS (p. 180).
The JVM caches DNS name lookups. When the JVM resolves a host name to an IP address, it caches the IP
address for a specified period of time, known as the time-to-live (TTL).
Because AWS resources use DNS name entries that occasionally change, we recommend that you
configure your JVM with a TTL value of no more than 60 seconds. Doing this makes sure that when a
resource's IP address changes, your application can receive and use the resource's new IP address by
requerying the DNS.
On some Java configurations, the JVM default TTL is set so that it never refreshes DNS entries until
the JVM is restarted. Thus, if the IP address for an AWS resource changes while your application is still
running, it can't use that resource until you manually restart the JVM and the cached IP information
is refreshed. In this case, it's crucial to set the JVM's TTL so that it periodically refreshes its cached IP
information.
Note
The default TTL can vary according to the version of your JVM and whether a security manager
is installed. Many JVMs provide a default TTL less than 60 seconds. If you're using such a JVM
and not using a security manager, you can ignore the rest of this topic. For more information on
security managers in Oracle, see The security manager in the Oracle documentation.
To modify the JVM's TTL, set the networkaddress.cache.ttl property value. Use one of the
following methods, depending on your needs:
• To set the property value globally for all applications that use the JVM, set
networkaddress.cache.ttl in the $JAVA_HOME/jre/lib/security/java.security file.
networkaddress.cache.ttl=60
• To set the property locally for your application only, set networkaddress.cache.ttl in your
application's initialization code before any network connections are established.
63
Amazon Relational Database Service User Guide
Multi-AZ DB instance deployments
java.security.Security.setProperty("networkaddress.cache.ttl" , "60");
64
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Multi-AZ DB clusters are in preview for RDS for MySQL and RDS for PostgreSQL and are subject to
change.
A Multi-AZ DB cluster deployment is a high availability deployment mode of Amazon RDS with two
readable standby DB instances. A Multi-AZ DB cluster has a writer DB instance and two reader DB
instances in three separate Availability Zones in the same AWS Region. Multi-AZ DB clusters provide high
availability, increased capacity for read workloads, and lower write latency when compared to Multi-AZ
DB instance deployments.
Topics
• Overview of Multi-AZ DB clusters (p. 65)
• Supported DB instance classes for Multi-AZ DB clusters (p. 66)
• Creating a Multi-AZ DB cluster (p. 67)
• Managing connections for Multi-AZ DB clusters (p. 78)
• Managing a Multi-AZ DB cluster with the AWS Management Console (p. 80)
• Modifying a Multi-AZ DB cluster (p. 82)
• Rebooting Multi-AZ DB clusters and reader DB instances (p. 90)
• Working with parameter groups for Multi-AZ DB clusters (p. 91)
• Failover process for Multi-AZ DB clusters (p. 91)
• Creating a Multi-AZ DB cluster snapshot (p. 93)
• Restoring from a snapshot to a Multi-AZ DB cluster (p. 94)
• Restoring a Multi-AZ DB cluster to a specified time (p. 96)
• Deleting a Multi-AZ DB cluster (p. 98)
• Limitations for Multi-AZ DB clusters (p. 99)
Important
Multi-AZ DB clusters aren't the same as Aurora DB clusters. For information about Aurora DB
clusters, see the Amazon Aurora User Guide.
65
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Multi-AZ DB clusters typically have lower write latency when compared to Multi-AZ DB instance
deployments. The RDS console shows the Availability Zone of the writer DB instance and the Availability
Zones of the reader DB instances. You can also use the describe-db-clusters CLI command or the
DescribeDBClusters API operation to find this information.
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
db.m6gd
66
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
db.r6gd
In the following topic, you can find out how to create a Multi-AZ DB cluster. To get started, first see DB
cluster prerequisites (p. 67).
For instructions on connecting to your Multi-AZ DB cluster, see Connecting to an Amazon RDS DB
instance (p. 215).
DB cluster prerequisites
Before you create a Multi-AZ DB cluster, make sure to complete the tasks in Setting up for Amazon
RDS (p. 112). The following are additional prerequisites to creating a Multi-AZ DB cluster.
67
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
VPC prerequisites
You can only create a Multi-AZ DB cluster in a virtual private cloud (VPC) based on the Amazon VPC
service, in an AWS Region that has at least three Availability Zones. The DB subnet group that you choose
for the DB cluster must cover at least three Availability Zones. This configuration ensures that your DB
cluster always has at least two DB instance available for failover, in the unlikely event of an Availability
Zone failure.
If you are using the AWS Management Console to create your Multi-AZ DB cluster, you can have Amazon
RDS automatically create a VPC for you. Or you can use an existing VPC or create a new VPC for your
Multi-AZ DB cluster. Your VPC must have at least one subnet in each of at least three Availability Zones
for you to use it with a Multi-AZ DB cluster. For information on VPCs, see Amazon Virtual Private Cloud
VPCs and Amazon RDS (p. 1975).
If you don't have a default VPC or you haven't created a VPC, and you don't plan to use the console, do
the following:
• Create a VPC with at least one subnet in each of at least three of the Availability Zones in the AWS
Region where you want to deploy your DB cluster. For more information, see Working with a DB
instance in a VPC (p. 1976).
• Specify a VPC security group that authorizes connections to your DB cluster. For more information, see
Working with a DB instance in a VPC (p. 1976).
• Specify an RDS DB subnet group that defines at least three subnets in the VPC that can be used by the
Multi-AZ DB cluster. For more information, see Working with DB subnet groups (p. 1977).
Additional prerequisites
If you are connecting to AWS using AWS Identity and Access Management (IAM) credentials, your AWS
account must have IAM policies that grant the permissions required to perform Amazon RDS operations.
For more information, see Identity and access management in Amazon RDS (p. 1893).
If you are using IAM to access the Amazon RDS console, first sign on to the AWS Management Console
with your IAM user credentials. Then go to the Amazon RDS console at https://console.aws.amazon.com/
rds/.
If you want to tailor the configuration parameters for your DB cluster, specify a DB cluster parameter
group with the required parameter settings. For information about creating or modifying a DB cluster
parameter group, see Working with parameter groups for Multi-AZ DB clusters (p. 91).
Determine the TCP/IP port number to specify for your DB cluster. The firewalls at some companies block
connections to the default ports. If your company firewall blocks the default port, choose another port
for your DB cluster. All DB instances in a DB cluster use the same port.
Creating a DB cluster
You can create a Multi-AZ DB cluster using the AWS Management Console, the AWS CLI, or the RDS API.
Console
You can create a Multi-AZ DB cluster by choosing Multi-AZ DB cluster - preview in the Availability and
durability section.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the AWS Management Console, choose the AWS Region in which you
want to create the DB cluster.
68
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
For preview, only the US East (N. Virginia), US West (Oregon), and Europe (Ireland) AWS Regions
support Multi-AZ DB clusters.
3. In the navigation pane, choose Databases.
4. Choose Create database.
To create a Multi-AZ DB cluster, make sure that Standard Create is selected and Easy Create isn't.
5. In Engine type, choose MySQL or PostgreSQL.
6. For Version, choose the DB engine version.
You can create a Multi-AZ DB cluster only with MySQL version 8.0.26 and PostgreSQL version 13.4.
7. In Templates, choose the appropriate template for your deployment.
8. In Availability and durability, choose Multi-AZ DB cluster - preview.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB cluster, choose View credential details.
69
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
To connect to the DB cluster as the master user, use the user name and password that appear.
Important
You can't view the master user password again.
15. For Databases, choose the name of the new DB cluster.
On the RDS console, the details for the new DB cluster appear. The DB cluster has a status of Creating
until the DB cluster is created and ready for use. When the state changes to Available, you can connect
to the DB cluster. Depending on the DB cluster class and storage allocated, it can take several minutes
for the new DB cluster to be available.
AWS CLI
Before you create a Multi-AZ DB cluster using the AWS CLI, make sure to fulfill the required
prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB cluster
prerequisites (p. 67).
To create a Multi-AZ DB cluster by using the AWS CLI, call the create-db-cluster command. Specify the --
db-cluster-identifier. For the --engine option, specify either mysql or postgres.
For information about each option, see Settings for creating Multi-AZ DB clusters (p. 71).
The create-db-cluster command creates the writer DB instance for your DB cluster, and two reader
DB instances. Each DB instance is in a different Availability Zone.
For example, the following command creates a MySQL 8.0 Multi-AZ DB cluster named mysql-multi-
az-db-cluster.
Example
For Linux, macOS, or Unix:
For Windows:
70
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
--allocated-storage 4000 ^
--storage-type io1 ^
--iops 10000 ^
--db-cluster-instance-class db.r6gd.xlarge
The following command creates a PostgreSQL 13.4 Multi-AZ DB cluster named postgresql-multi-
az-db-cluster.
Example
For Linux, macOS, or Unix:
For Windows:
RDS API
Before you can create a Multi-AZ DB cluster using the RDS API, make sure to fulfill the required
prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB cluster
prerequisites (p. 67).
To create a Multi-AZ DB cluster by using the RDS API, call the CreateDBCluster operation. Specify the
DBClusterIdentifier. For the Engine parameter, specify either mysql or postgresql.
For information about each option, see Settings for creating Multi-AZ DB clusters (p. 71).
The CreateDBCluster operation creates the writer DB instance for your DB cluster, and two reader DB
instances. Each DB instance is in a different Availability Zone.
71
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
Auto minor version Enable auto minor version upgrade to CLI option:
upgrade have your DB cluster receive preferred
minor DB engine version upgrades --auto-minor-version-upgrade
automatically when they become
available. Amazon RDS performs --no-auto-minor-version-upgrade
automatic minor version upgrades in the
API parameter:
maintenance window.
AutoMinorVersionUpgrade
Backup retention The number of days that you want CLI option:
period automatic backups of your DB cluster to
be retained. For a Multi-AZ DB cluster, this --backup-retention-period
value must be set to 1 or greater.
API parameter:
For more information, see Working with
backups (p. 388). BackupRetentionPeriod
Backup window The time period during which Amazon CLI option:
RDS automatically takes a backup of
your DB cluster. Unless you have a --preferred-backup-window
specific time that you want to have your
database backed up, use the default of No API parameter:
preference.
PreferredBackupWindow
For more information, see Working with
backups (p. 388).
Database For Multi-AZ DB clusters, only Password None because password authentication is the
authentication authentication is supported. default.
Database port The port that you want to access the DB CLI option:
cluster through. The default port is shown.
If you use a DB security group with your --port
DB cluster, this port value must be the
same one that you provided when creating RDS API parameter:
the DB security group.
Port
In the preview, the port can't be changed
after the DB cluster is created.
DB cluster The name for your DB cluster. Name your CLI option:
identifier DB clusters in the same way that you
name your on-premises servers. Your --db-cluster-identifier
DB cluster identifier can contain up to
72
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
63 alphanumeric characters, and must RDS API parameter:
be unique for your account in the AWS
Region you chose. DBClusterIdentifier
DB engine version The version of database engine that you CLI option:
want to use.
--engine-version
EngineVersion
DB parameter The DB instance parameter group that you Not applicable. Amazon RDS associates each
group want associated with the DB instances in DB instance with the appropriate default
the DB cluster. parameter group.
73
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
KmsKeyId
StorageEncrypted
MonitoringRoleArn
Initial database The name for the database on your DB CLI option:
name cluster. If you don't provide a name,
Amazon RDS doesn't create a database --database-name
on the DB cluster for MySQL, but it does
create a database on the DB cluster for RDS API parameter:
PostgreSQL. The name can't be a word
DatabaseName
reserved by the database engine, and has
other constraints depending on the DB
engine.
MySQL:
PostgreSQL:
74
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
Master password The password for your master user CLI option:
account.
--master-user-password
MasterUserPassword
Master username The name that you use as the master user CLI option:
name to log on to your DB cluster with all
database privileges. --master-username
75
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
Storage type The storage type for your DB cluster. CLI option:
DBSubnetGroupName
76
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console setting Setting description CLI option and RDS API parameter
Virtual Private A Amazon VPC to associate with this DB For the CLI and API, you specify the VPC
Cloud (VPC) cluster. security group IDs.
VPC security The security groups to associate with the CLI option:
groups DB cluster.
--vpc-security-group-ids
For more information, see VPC security
groups (p. 1948). RDS API parameter:
VpcSecurityGroupIds
You also can't specify these settings for Multi-AZ DB clusters in the console.
--availability-zones AvailabilityZones
--backtrack-window BacktrackWindow
--character-set-name CharacterSetName
--domain Domain
--domain-iam-role-name DomainIAMRoleName
--enable-cloudwatch-logs-exports | -- EnableCloudwatchLogsExports
no-enable-cloudwatch-logs-exports
--enable-global-write-forwarding | -- EnableGlobalWriteForwarding
no-enable-global-write-forwarding
--enable-iam-database-authentication EnableIAMDatabaseAuthentication
| --no-enable-iam-database-
authentication
--global-cluster-identifier GlobalClusterIdentifier
--option-group-name OptionGroupName
--pre-signed-url PreSignedUrl
--replication-source-identifier ReplicationSourceIdentifier
77
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
--scaling-configuration ScalingConfiguration
For certain tasks, different DB instances or groups of DB instances perform different roles. For example,
the writer DB instance handles all data definition language (DDL) and data manipulation language (DML)
statements.
Using endpoints, you can map each connection to the appropriate DB instance or group of DB instances
based on your use case. For example, to perform DDL and DML statements, you can connect to
whichever DB instance is the writer DB instance. To perform queries, you can connect to the reader
endpoint, with the Multi-AZ DB cluster automatically performing load-balancing among the reader DB
instances. For diagnosis or tuning, you can connect to a specific DB instance endpoint to examine details
about a specific DB instance.
Topics
• Types of Multi-AZ DB cluster endpoints (p. 78)
• Viewing the endpoints for a Multi-AZ DB cluster (p. 79)
• Using the cluster endpoint (p. 79)
• Using the reader endpoint (p. 80)
• Using the instance endpoints (p. 80)
• How Multi-AZ DB endpoints work with high availability (p. 80)
Cluster endpoint
A cluster endpoint (or writer endpoint) for a Multi-AZ DB cluster connects to the current writer DB
instance for that DB cluster. This endpoint is the only one that can perform write operations such as
DDL and DML statements. This endpoint can also perform read operations.
Each Multi-AZ DB cluster has one cluster endpoint and one writer DB instance.
You use the cluster endpoint for all write operations on the DB cluster, including inserts, updates,
deletes, and DDL changes. You can also use the cluster endpoint for read operations, such as queries.
The cluster endpoint provides failover support for read/write connections to the DB cluster. If the
current writer DB instance of a DB cluster fails, the Multi-AZ DB cluster automatically fails over to a
new writer DB instance. During a failover, the DB cluster continues to serve connection requests to
the cluster endpoint from the new writer DB instance, with minimal interruption of service.
78
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com
Reader endpoint
A reader endpoint for a Multi-AZ DB cluster provides load-balancing support for read-only
connections to the DB cluster. Use the reader endpoint for read operations, such as queries. By
processing those statements on the reader DB instances, this endpoint reduces the overhead on the
writer DB instance. It also helps the cluster to scale the capacity to handle simultaneous SELECT
queries. Each Multi-AZ DB cluster has one reader endpoint.
The reader endpoint load-balances each connection request among the reader DB instances. When
you use the reader endpoint for a session, you can only perform read-only statements such as
SELECT in that session.
mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com
Instance endpoint
The instance endpoint provides direct control over connections to the DB cluster. This control can
help you address scenarios where using the cluster endpoint or reader endpoint might not be
appropriate. For example, your client application might require more fine-grained load balancing
based on workload type. In this case, you can configure multiple clients to connect to different
reader DB instances in a DB cluster to distribute read workloads.
The following example illustrates an instance endpoint for a DB instance in a Multi-AZ DB cluster.
mydbinstance.123456789012.us-east-1.rds.amazonaws.com
With the AWS CLI, you see the writer and reader endpoints in the output of the describe-db-clusters
command. For example, the following command shows the endpoint attributes for all clusters in your
current AWS Region.
With the Amazon RDS API, you retrieve the endpoints by calling the DescribeDBClusterEndpoints
function. The output also shows Amazon Aurora DB cluster endpoints, if any exist.
You use the cluster endpoint when you administer your DB cluster, perform extract, transform, load (ETL)
operations, or develop and test applications. The cluster endpoint connects to the writer DB instance of
the cluster. The writer DB instance is the only DB instance where you can create tables and indexes, run
INSERT statements, and perform other DDL and DML operations.
79
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
The physical IP address pointed to by the cluster endpoint changes when the failover mechanism
promotes a new DB instance to be the writer DB instance for the cluster. If you use any form of
connection pooling or other multiplexing, be prepared to flush or reduce the time-to-live for any cached
DNS information. Doing so ensures that you don't try to establish a read/write connection to a DB
instance that became unavailable or is now read-only after a failover.
The reader endpoint load-balances connections to available reader DB instances in a Multi-AZ DB cluster.
It doesn't load-balance individual queries. If you want to load-balance each query to distribute the read
workload for a DB cluster, open a new connection to the reader endpoint for each query.
Each Multi-AZ cluster has a single built-in reader endpoint, whose name and other attributes are
managed by Amazon RDS. You can't create, delete, or modify this kind of endpoint.
In day-to-day operations, the main way that you use instance endpoints is to diagnose capacity or
performance issues that affect one specific DB instance in a Multi-AZ DB cluster. While connected to a
specific DB instance, you can examine its status variables, metrics, and so on. Doing this can help you
determine what's happening for that DB instance that's different from what's happening for other DB
instances in the cluster.
If the writer DB instance of a DB cluster fails, Amazon RDS automatically fails over to a new writer DB
instance. It does so by promoting a reader DB instance to a new writer DB instance. If a failover occurs,
you can use the writer endpoint to reconnect to the newly promoted writer DB instance. Or you can
use the reader endpoint to reconnect to one of the reader DB instances in the DB cluster. During a
failover, the reader endpoint might direct connections to the new writer DB instance of a DB cluster for
a short time after a reader DB instance is promoted to the new writer DB instance. If you design your
own application logic to manage instance endpoint connections, you can manually or programmatically
discover the resulting set of available DB instances in the DB cluster.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
80
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
2. In the navigation pane, choose Databases, and then choose the Multi-AZ DB cluster that you want to
manage.
The available actions in the Actions menu depend on whether the Multi-AZ DB cluster is selected or a DB
instance in the cluster is selected.
Choose the Multi-AZ DB cluster to view the cluster details and perform actions at the cluster level.
Choose a DB instance in a Multi-AZ DB cluster to view the DB instance details and perform actions at the
DB instance level.
81
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
You can modify a Multi-AZ DB cluster to change its settings. You can also perform operations on a Multi-
AZ DB cluster, such as taking a snapshot of it. However, you can't modify the DB instances in a Multi-AZ
DB cluster, and the only supported operation is rebooting a DB instance.
Note
Multi-AZ DB clusters are supported only for the MySQL and PostgreSQL DB engines.
You can modify a Multi-AZ DB cluster using the AWS Management Console, the AWS CLI, or the RDS API.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the Multi-AZ DB cluster that you want to
modify.
3. Choose Modify. The Modify DB cluster page appears.
4. Change any of the settings that you want. For information about each setting, see Settings for
modifying Multi-AZ DB clusters (p. 83).
5. When all the changes are as you want them, choose Continue and check the summary of
modifications.
6. (Optional) Choose Apply immediately to apply the changes immediately. Choosing this option
can cause downtime in some cases. For more information, see Using the Apply Immediately
setting (p. 83).
7. On the confirmation page, review your changes. If they're correct, choose Modify DB cluster to save
your changes.
AWS CLI
To modify a Multi-AZ DB cluster by using the AWS CLI, call the modify-db-cluster command. Specify the
DB cluster identifier and the values for the options that you want to modify. For information about each
option, see Settings for modifying Multi-AZ DB clusters (p. 83).
Example
The following code modifies my-multi-az-dbcluster by setting the backup retention period to
1 week (7 days). The code turns on deletion protection by using --deletion-protection. To turn
off deletion protection, use --no-deletion-protection. The changes are applied during the next
maintenance window by using --no-apply-immediately. Use --apply-immediately to apply the
changes immediately. For more information, see Using the Apply Immediately setting (p. 83).
82
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
For Windows:
RDS API
To modify a Multi-AZ DB cluster by using the Amazon RDS API, call the ModifyDBCluster operation.
Specify the DB cluster identifier, and the parameters for the settings that you want to modify. For
information about each parameter, see Settings for modifying Multi-AZ DB clusters (p. 83).
If you don't choose to apply changes immediately, the changes are put into the pending modifications
queue. During the next maintenance window, any pending changes in the queue are applied. If you
choose to apply changes immediately, your new changes and any changes in the pending modifications
queue are applied.
Important
If any of the pending modifications require the DB cluster to be temporarily unavailable
(downtime), choosing the apply immediately option can cause unexpected downtime.
When you choose to apply a change immediately, any pending modifications are also applied
immediately, instead of during the next maintenance window.
If you don't want a pending change to be applied in the next maintenance window, you
can modify the DB instance to revert the change. You can do this by using the AWS CLI and
specifying the --apply-immediately option.
Changes to some database settings are applied immediately, even if you choose to defer your changes.
To see how the different database settings interact with the apply immediately setting, see Settings for
modifying Multi-AZ DB clusters (p. 83).
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
Allocated The amount of CLI option: If you choose to apply Downtime doesn't occur
storage storage to allocate the change immediately, during this change.
for each DB instance --allocated- it occurs immediately.
in your DB cluster (in storage
gibibytes). If you don't choose
API parameter: to apply the change
For more information, immediately, it occurs
see Amazon AllocatedStorage during the next
RDS DB instance maintenance window.
storage (p. 48).
83
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
Auto Enable auto minor CLI option: The change occurs Downtime doesn't occur
minor version upgrade to immediately. This during this change.
version have your DB cluster --auto-minor- setting ignores the
upgrade receive preferred version-upgrade apply immediately
minor DB engine setting.
version upgrades --no-auto-minor-
automatically version-upgrade
when they become
API parameter:
available. Amazon
RDS performs AutoMinorVersionUpgrade
automatic minor
version upgrades
in the maintenance
window.
Backup The number of CLI option: If you choose to apply Downtime occurs if
retention days that you want the change immediately, you change from 0 to a
period automatic backups --backup- it occurs immediately. nonzero value, or from a
of your DB cluster to retention-period nonzero value to 0.
be retained. For any If you don't choose
nontrivial DB cluster, API parameter: to apply the change
set this value to 1 or immediately, and you
BackupRetentionPeriodchange the setting
greater.
from a nonzero value
For more information, to another nonzero
see Working with value, the change is
backups (p. 388). applied asynchronously,
as soon as possible.
Otherwise, the change
occurs during the next
maintenance window.
Backup The time period CLI option: The change is applied Downtime doesn't occur
window during which Amazon asynchronously, as soon during this change.
RDS automatically --preferred- as possible.
takes a backup of backup-window
your DB cluster.
Unless you have a API parameter:
specific time that you
PreferredBackupWindow
want to have your
database backed up,
use the default of No
preference.
84
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
Database For Multi-AZ None because password If you choose to apply Downtime doesn't occur
authentication
DB clusters, authentication is the the change immediately, during this change.
only Password default. it occurs immediately.
authentication is
supported. If you don't choose
to apply the change
immediately, it occurs
during the next
maintenance window.
DB The compute and CLI option: If you choose to apply Downtime occurs during
cluster memory capacity the change immediately, this change.
instance of each DB instance --db-cluster- it occurs immediately.
class in the Multi-AZ DB instance-class
cluster, for example If you don't choose
db.r6gd.xlarge. RDS API parameter: to apply the change
immediately, it occurs
If possible, choose DBClusterInstanceClass
during the next
a DB instance class maintenance window.
large enough that a
typical query working
set can be held in
memory. When
working sets are
held in memory, the
system can avoid
writing to disk,
which improves
performance. For
more information,
see Supported DB
instance classes
for Multi-AZ DB
clusters (p. 66).
85
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
DB The version of CLI option: If you choose to apply An outage occurs during
engine database engine that the change immediately, this change.
version you want to use. --engine-version it occurs immediately.
RDS API parameter: If you don't choose
to apply the change
EngineVersion immediately, it occurs
during the next
maintenance window.
Deletion Enable deletion CLI option: The change occurs An outage doesn't occur
protection protection to prevent immediately. This during this change.
your DB cluster from --deletion- setting ignores the
being deleted. protection apply immediately
setting.
For more information, --no-deletion-
see Deleting a DB protection
instance (p. 384).
RDS API parameter:
DeletionProtection
Maintenance
The 30-minute CLI option: The change occurs If there are one or
window window in immediately. This more pending actions
which pending --preferred- setting ignores the that cause downtime,
modifications to maintenance-window apply immediately and the maintenance
your DB cluster setting. window is changed to
are applied. If the RDS API parameter: include the current time,
time period doesn't those pending actions
PreferredMaintenanceWindow
matter, choose No are applied immediately
preference. and downtime occurs.
New The password for CLI option: The change is applied Downtime doesn't occur
master your master user asynchronously, as during this change.
password account. --master-user- soon as possible. This
password setting ignores the
apply immediately
RDS API parameter: setting.
MasterUserPassword
86
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
ProvisionedThe amount of CLI option: If you choose to apply Downtime doesn't occur
IOPS Provisioned IOPS the change immediately, during this change.
(input/output --iops it occurs immediately.
operations per
second) to be initially RDS API parameter: If you don't choose
allocated for the DB to apply the change
Iops immediately, it occurs
cluster. This setting
is available only if during the next
Provisioned IOPS maintenance window.
(io1) is selected as
the storage type.
87
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
Public Publicly accessible CLI option: The change occurs An outage doesn't occur
access to give the DB cluster immediately. This during this change.
a public IP address, --publicly- setting ignores the
meaning that it's accessible apply immediately
accessible outside its setting.
virtual private cloud --no-publicly-
(VPC). To be publicly accessible
accessible, the DB
RDS API parameter:
cluster also has to be
in a public subnet in PubliclyAccessible
the VPC.
Not publicly
accessible to make
the DB cluster
accessible only from
inside the VPC.
To connect to a DB
cluster from outside
of its VPC, the DB
cluster must be
publicly accessible.
Also, access must
be granted using
the inbound rules
of the DB cluster's
security group, and
other requirements
must be met. For
more information,
see Can't connect
to Amazon RDS DB
instance (p. 2005).
88
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Console Setting description CLI option and RDS API When the change Downtime notes
setting parameter occurs
Storage The storage type for CLI option: For the preview, you For the preview, you
type your DB cluster. can't change the storage can't change the storage
--storage-type type. type.
For preview, only
Provisioned IOPS (io1) RDS API parameter:
storage is supported.
StorageType
For more information,
see Amazon RDS
storage types (p. 48).
VPC The security groups CLI option: The change is applied An outage doesn't occur
security to associate with the asynchronously, as during this change.
group DB cluster. --vpc-security- soon as possible. This
group-ids setting ignores the
For more information, apply immediately
see VPC security RDS API parameter: setting.
groups (p. 1948).
VpcSecurityGroupIds
You also can't modify these settings for Multi-AZ DB clusters in the console.
--allow-major-version-upgrade|--no- AllowMajorVersionUpgrade
allow-major-version-upgrade
--backtrack-window BacktrackWindow
--cloudwatch-logs-export-configuration CloudwatchLogsExportConfiguration
--db-instance-parameter-group-name DBInstanceParameterGroupName
--domain Domain
--domain-iam-role-name DomainIAMRoleName
--enable-global-write-forwarding | -- EnableGlobalWriteForwarding
no-enable-global-write-forwarding
--enable-iam-database-authentication EnableIAMDatabaseAuthentication
| --no-enable-iam-database-
authentication
--new-db-cluster-identifier NewDBClusterIdentifier
89
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
--option-group-name OptionGroupName
--port Port
--scaling-configuration ScalingConfiguration
If a DB cluster isn't using the latest changes to its associated DB cluster parameter group, the AWS
Management Console shows the DB cluster parameter group with a status of pending-reboot. The
pending-reboot parameter groups status doesn't result in an automatic reboot during the next
maintenance window. To apply the latest parameter changes to that DB cluster, manually reboot the DB
cluster. For more information about parameter groups, see Working with parameter groups for Multi-AZ
DB clusters (p. 91).
Rebooting a DB cluster restarts the database engine service. Rebooting a DB cluster results in a
momentary outage, during which the DB cluster status is set to rebooting.
You can't reboot your DB cluster if it isn't in the Available state. Your database can be unavailable for
several reasons, such as an in-progress backup, a previously requested modification, or a maintenance-
window action.
Important
When you reboot the writer instance of a Multi-AZ DB cluster, it doesn't affect the reader DB
instances in that DB cluster, and no failover occurs. When you reboot a reader DB instance, no
failover occurs. To fail over a Multi-AZ DB cluster, choose Failover in the console, call the AWS
CLI command failover-db-cluster, or call the API operation FailoverDBCluster.
The time required to reboot your DB cluster depends on the crash recovery process, database activity
at the time of reboot, and the behavior of your specific DB cluster. To improve the reboot time, we
recommend that you reduce database activity as much as possible during the reboot process. Reducing
database activity reduces rollback activity for in-transit transactions.
Console
To reboot a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the Multi-AZ DB cluster that you want to
reboot.
3. For Actions, choose Reboot.
Or choose Cancel.
90
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
AWS CLI
To reboot a Multi-AZ DB cluster by using the AWS CLI, call the reboot-db-cluster command.
RDS API
To reboot a Multi-AZ DB cluster by using the Amazon RDS API, call the RebootDBCluster operation.
In a Multi-AZ DB cluster, a DB parameter group is set to the default DB parameter group for the DB
engine and DB engine version. The settings in the DB cluster parameter group are used for all of the DB
instances in the cluster.
For information about parameter groups, see Working with DB parameter groups (p. 284).
Topics
• Automatic failovers (p. 91)
• Manually failing over a Multi-AZ DB cluster (p. 91)
• Determining whether a Multi-AZ DB cluster has failed over (p. 92)
• Setting the JVM TTL for DNS name lookups (p. 92)
Automatic failovers
Amazon RDS handles failovers automatically so you can resume database operations as quickly as
possible without administrative intervention. To fail over, the writer DB instance switches automatically
to a reader DB instance.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
91
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
AWS CLI
To fail over a Multi-AZ DB cluster manually, use the AWS CLI command failover-db-cluster.
Example
RDS API
To fail over a Multi-AZ DB cluster manually, call the Amazon RDS API FailoverDBCluster and specify the
DBClusterIdentifier.
• Set up DB event subscriptions to notify you by email or SMS that a failover has been initiated. For
more information about events, see Using Amazon RDS event notification (p. 571).
• View your DB events by using the Amazon RDS console or API operations.
• View the current state of your Multi-AZ DB cluster by using the Amazon RDS console, the AWS CLI, and
the RDS API.
For information on how you can respond to failovers, reduce recovery time, and other best practices for
Amazon RDS, see Best practices for Amazon RDS (p. 180).
The JVM caches DNS name lookups. When the JVM resolves a host name to an IP address, it caches the IP
address for a specified period of time, known as the time-to-live (TTL).
Because AWS resources use DNS name entries that occasionally change, we recommend that you
configure your JVM with a TTL value of no more than 60 seconds. Doing this makes sure that when a
resource's IP address changes, your application can receive and use the resource's new IP address by
requerying the DNS.
On some Java configurations, the JVM default TTL is set so that it never refreshes DNS entries until
the JVM is restarted. Thus, if the IP address for an AWS resource changes while your application is still
running, it can't use that resource until you manually restart the JVM and the cached IP information
is refreshed. In this case, it's crucial to set the JVM's TTL so that it periodically refreshes its cached IP
information.
92
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
Note
The default TTL can vary according to the version of your JVM and whether a security manager
is installed. Many JVMs provide a default TTL less than 60 seconds. If you're using such a JVM
and not using a security manager, you can ignore the rest of this topic. For more information on
security managers in Oracle, see The security manager in the Oracle documentation.
To modify the JVM's TTL, set the networkaddress.cache.ttl property value. Use one of the
following methods, depending on your needs:
• To set the property value globally for all applications that use the JVM, set
networkaddress.cache.ttl in the $JAVA_HOME/jre/lib/security/java.security file.
networkaddress.cache.ttl=60
• To set the property locally for your application only, set networkaddress.cache.ttl in your
application's initialization code before any network connections are established.
java.security.Security.setProperty("networkaddress.cache.ttl" , "60");
You can create a Multi-AZ DB cluster snapshot using the AWS Management Console, the AWS CLI, or the
RDS API.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. In the list, choose the Multi-AZ DB cluster for which you want to take a snapshot.
4. For Actions, choose Take snapshot.
The Snapshots page appears, with the new Multi-AZ DB cluster snapshot's status shown as Creating.
After its status is Available, you can see its creation time.
AWS CLI
You can create a Multi-AZ DB cluster snapshot by using the AWS CLI create-db-cluster-snapshot
command with the following options:
• --db-cluster-identifier
93
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
• --db-cluster-snapshot-identifier
In this example, you create a Multi-AZ DB cluster snapshot called mymultiazdbclustersnapshot for a
DB cluster called mymultiazdbcluster.
Example
For Windows:
RDS API
You can create a Multi-AZ DB cluster snapshot by using the Amazon RDS API CreateDBClusterSnapshot
operation with the following parameters:
• DBClusterIdentifier
• DBClusterSnapshotIdentifier
Tip
You can migrate a single-AZ deployment or a Multi-AZ DB instance deployment to a Multi-AZ
DB cluster deployment by restoring a snapshot.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the snapshot that you want to restore from.
4. For Actions, choose Restore snapshot.
5. On the Restore snapshot page, in Availability and durability, choose Multi-AZ DB cluster -
preview.
94
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
For more information, see Supported DB instance classes for Multi-AZ DB clusters (p. 66).
7. For DB cluster identifier, enter the name for your restored Multi-AZ DB cluster.
8. For the remaining sections, specify your DB cluster settings. For information about each setting, see
Settings for creating Multi-AZ DB clusters (p. 71).
9. Choose Restore DB instance.
AWS CLI
To restore a snapshot to a Multi-AZ DB cluster, use the AWS CLI command restore-db-cluster-from-
snapshot.
In this example, you restore from a previously created snapshot named mysnapshot. You restore to a
new Multi-AZ DB cluster named mynewmultiazdbcluster. You also specify the DB instance class used
by the DB instances in the Multi-AZ DB cluster. Specify either mysql or postgres for the DB engine.
Example
For Windows:
95
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
--db-cluster-instance-class db.r6gd.xlarge
After the DB cluster has been restored, make sure to add the Multi-AZ DB cluster to the security
group used by the DB cluster or DB instance used to create the snapshot. Doing so provides the same
functionality as that of the previous DB cluster or DB instance.
RDS API
• DBClusterIdentifier
• SnapshotIdentifier
• Engine
After the DB cluster has been restored, make sure to add the Multi-AZ DB cluster to the security
group used by the DB cluster or DB instance used to create the snapshot. Doing so provides the same
functionality as that of the previous DB cluster or DB instance.
Restored Multi-AZ DB clusters are automatically associated with the default DB cluster parameter group.
However, you can apply a customer DB cluster parameter group by specifying it during a restore.
RDS uploads transaction logs for Multi-AZ DB clusters to Amazon S3 continuously. To see the latest
restorable time for a Multi-AZ DB cluster, use the AWS CLI describe-db-clusters command. Look at the
value returned in the LatestRestorableTime field for the DB cluster.
You can restore to any point in time within your backup retention period. To see the earliest restorable
time for a Multi-AZ DB cluster, use the AWS CLI describe-db-clusters command. Look at the value
returned in the EarliestRestorableTime field for the DB cluster.
Note
We recommend that you restore to the same or similar Multi-AZ DB cluster size—and IOPS if
using Provisioned IOPS storage—as the source DB cluster. You might get an error if, for example,
you choose a DB cluster size with an incompatible IOPS value.
You can restore a Multi-AZ DB cluster to a point in time using the AWS Management Console, the AWS
CLI, or the RDS API.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the Multi-AZ DB cluster that you want to restore.
4. For Actions, choose Restore to point in time.
96
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
5. Choose Latest restorable time to restore to the latest possible time, or choose Custom to choose a
time.
If you chose Custom, enter the date and time to which you want to restore the Multi-AZ DB cluster.
Note
Times are shown in your local time zone, which is indicated by an offset from Coordinated
Universal Time (UTC). For example, UTC-5 is Eastern Standard Time/Central Daylight Time.
6. For DB cluster identifier, enter the name for your restored Multi-AZ DB cluster.
7. In Availability and durability, choose Multi-AZ DB cluster - preview.
For more information, see Supported DB instance classes for Multi-AZ DB clusters (p. 66).
9. For the remaining sections, specify your DB cluster settings. For information about each setting, see
Settings for creating Multi-AZ DB clusters (p. 71).
10. Choose Restore to point in time.
AWS CLI
To restore a Multi-AZ DB cluster to a specified time, use the AWS CLI command restore-db-cluster-to-
point-in-time to create a new Multi-AZ DB cluster.
Example
For Windows:
97
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
RDS API
To restore a DB cluster to a specified time, call the Amazon RDS API RestoreDBClusterToPointInTime
operation with the following parameters:
• SourceDBClusterIdentifier
• DBClusterIdentifier
• RestoreToTime
The time required to delete a Multi-AZ DB cluster can vary depending on the backup retention period
(that is, how many backups to delete), how much data is deleted, and whether a final snapshot is taken.
You can't delete a Multi-AZ DB cluster when deletion protection is turned on for it. For more information,
see Deletion protection (p. 384). You can turn off deletion protection by modifying the Multi-AZ DB
cluster. For more information, see Modifying a Multi-AZ DB cluster (p. 82).
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the Multi-AZ DB cluster that you want to
delete.
3. For Actions, choose Delete.
4. Choose Create final snapshot? to create a final DB snapshot for the Multi-AZ DB cluster.
If you create a final snapshot, enter a name for Final snapshot name.
5. Choose Retain automated backups to retain automated backups.
6. Enter delete me in the box.
7. Choose Delete.
AWS CLI
To delete a Multi-AZ DB cluster by using the AWS CLI, call the delete-db-cluster command with the
following options:
• --db-cluster-identifier
• --final-db-snapshot-identifier or --skip-final-snapshot
98
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
For Windows:
For Windows:
RDS API
To delete a Multi-AZ DB cluster by using the Amazon RDS API, call the DeleteDBCluster operation with
the following parameters:
• DBClusterIdentifier
• FinalDBSnapshotIdentifier or SkipFinalSnapshot
• You can create a Multi-AZ DB cluster only with MySQL version 8.0.26 and PostgreSQL version 13.4.
• You can create Multi-AZ DB clusters only in the following AWS Regions:
• US East (N. Virginia)
• US West (Oregon)
• Europe (Ireland)
• Multi-AZ DB clusters must use Provisioned IOPS storage.
• You can't change a single-AZ DB instance deployment or Multi-AZ DB instance deployment into a
Multi-AZ DB cluster. However, you can restore a snapshot of a single-AZ DB instance deployment or
Multi-AZ DB instance deployment to a Multi-AZ DB cluster.
• You can't restore a Multi-AZ DB cluster snapshot to a Multi-AZ DB instance deployment or single-AZ
deployment.
• You can't stop, start, or rename a DB instance in a Multi-AZ DB cluster.
• You can't use tags with a Multi-AZ DB cluster or with the DB instances in a Multi-AZ DB cluster.
• You can't use option groups with a Multi-AZ DB cluster or with the DB instances in a Multi-AZ DB
cluster.
• You can't publish logs to CloudWatch Logs.
99
Amazon Relational Database Service User Guide
Multi-AZ DB cluster deployments (preview)
100
Amazon Relational Database Service User Guide
DB instance billing for Amazon RDS
• DB instance hours (per hour) – Based on the DB instance class of the DB instance (for example,
db.t2.small or db.m4.large). Pricing is listed on a per-hour basis, but bills are calculated down to the
second and show times in decimal form. RDS usage is billed in one second increments, with a minimum
of 10 minutes. For more information, see DB instance classes (p. 10).
• Storage (per GiB per month) – Storage capacity that you have provisioned to your DB instance. If you
scale your provisioned storage capacity within the month, your bill is prorated. For more information,
see Amazon RDS DB instance storage (p. 48).
• I/O requests (per 1 million requests per month) – Total number of storage I/O requests that you have
made in a billing cycle, for Amazon RDS magnetic storage only.
• Provisioned IOPS (per IOPS per month) – Provisioned IOPS rate, regardless of IOPS consumed, for
Amazon RDS Provisioned IOPS (SSD) storage only. Provisioned storage for EBS volumes are billed in
one second increments, with a minimum of 10 minutes.
• Backup storage (per GiB per month) – Backup storage is the storage that is associated with automated
database backups and any active database snapshots that you have taken. Increasing your backup
retention period or taking additional database snapshots increases the backup storage consumed by
your database. Per second billing doesn't apply to backup storage (metered in GB-month).
For more information, see Backing up and restoring an Amazon RDS DB instance (p. 387).
• Data transfer (per GB) – Data transfer in and out of your DB instance from or to the internet and other
AWS Regions.
Amazon RDS provides the following purchasing options to enable you to optimize your costs based on
your needs:
• On-Demand Instances – Pay by the hour for the DB instance hours that you use. Pricing is listed on a
per-hour basis, but bills are calculated down to the second and show times in decimal form. RDS usage
is now billed in one second increments, with a minimum of 10 minutes.
• Reserved Instances – Reserve a DB instance for a one-year or three-year term and get a significant
discount compared to the on-demand DB instance pricing. With Reserved Instance usage, you can
launch, delete, start, or stop multiple instances within an hour and get the Reserved Instance benefit
for all of the instances.
For Amazon RDS pricing information, see the Amazon RDS product page.
Topics
• On-Demand DB instances for Amazon RDS (p. 102)
• Reserved DB instances for Amazon RDS (p. 103)
101
Amazon Relational Database Service User Guide
On-Demand DB instances
Billing starts for a DB instance as soon as the DB instance is available. Pricing is listed on a per-hour
basis, but bills are calculated down to the second and show times in decimal form. Amazon RDS usage
is billed in one-second increments, with a minimum of 10 minutes. In the case of billable configuration
change, such as scaling compute or storage capacity, you're charged a 10-minute minimum. Billing
continues until the DB instance terminates, which occurs when you delete the DB instance or if the DB
instance fails.
If you no longer want to be charged for your DB instance, you must stop or delete it to avoid being billed
for additional DB instance hours. For more information about the DB instance states for which you are
billed, see Viewing DB instance status (p. 470).
Stopped DB instances
While your DB instance is stopped, you're charged for provisioned storage, including Provisioned IOPS.
You are also charged for backup storage, including storage for manual snapshots and automated
backups within your specified retention window. You aren't charged for DB instance hours.
Multi-AZ DB instances
If you specify that your DB instance should be a Multi-AZ deployment, you're billed according to the
Multi-AZ pricing posted on the Amazon RDS pricing page.
102
Amazon Relational Database Service User Guide
Reserved DB instances
The general process for working with reserved DB instances is: First get information about available
reserved DB instance offerings, then purchase a reserved DB instance offering, and finally get
information about your existing reserved DB instances.
You can modify a reserved DB instance. If the modification is within the specifications of the reserved
DB instance, part or all of the discount still applies to the modified DB instance. If the modification is
outside the specifications, such as changing the instance class, the discount no longer applies. For more
information, see Size-flexible reserved DB instances (p. 104).
For more information about reserved DB instances, including pricing, see Amazon RDS reserved
instances.
Offering types
Reserved DB instances are available in three varieties—No Upfront, Partial Upfront, and All Upfront—
that let you optimize your Amazon RDS costs based on your expected usage.
No Upfront
This option provides access to a reserved DB instance without requiring an upfront payment. Your
No Upfront reserved DB instance bills a discounted hourly rate for every hour within the term,
regardless of usage, and no upfront payment is required. This option is only available as a one-year
reservation.
Partial Upfront
This option requires a part of the reserved DB instance to be paid upfront. The remaining hours in
the term are billed at a discounted hourly rate, regardless of usage. This option is the replacement
for the previous Heavy Utilization option.
All Upfront
Full payment is made at the start of the term, with no other costs incurred for the remainder of the
term regardless of the number of hours used.
If you are using consolidated billing, all the accounts in the organization are treated as one account. This
means that all accounts in the organization can receive the hourly cost benefit of reserved DB instances
that are purchased by any other account. For more information about consolidated billing, see Amazon
RDS reserved DB instances in the AWS Billing and Cost Management User Guide.
103
Amazon Relational Database Service User Guide
Reserved DB instances
If you have a DB instance, and you need to scale it to larger capacity, your reserved DB instance is
automatically applied to your scaled DB instance. That is, your reserved DB instances are automatically
applied across all DB instance class sizes. Size-flexible reserved DB instances are available for DB
instances with the same AWS Region and database engine. Size-flexible reserved DB instances can only
scale in their instance class type. For example, a reserved DB instance for a db.m4.large can apply to a
db.m4.xlarge, but not to a db.m5.large, because db.m4 and db.m5 are different instance class types.
Reserved DB instance benefits also apply for both Multi-AZ and Single-AZ configurations. Flexibility
means that you can move freely between configurations within the same DB instance class type. For
example, you can move from a Single-AZ deployment running on one large DB instance (four normalized
units) to a Multi-AZ deployment running on two small DB instances (2*2 = 4 normalized units).
Size-flexible reserved DB instances are available for the following Amazon RDS database engines:
• MariaDB
• MySQL
• Oracle, Bring Your Own License
• PostgreSQL
For details about using size-flexible reserved instances with Aurora, see Reserved DB instances for
Aurora.
You can compare usage for different reserved DB instance sizes by using normalized units. For example,
one unit of usage on two db.m3.large DB instances is equivalent to eight normalized units of usage on
one db.m3.small. The following table shows the number of normalized units for each DB instance size.
micro 0.5 1
small 1 2
medium 2 4
large 4 8
xlarge 8 16
2xlarge 16 32
4xlarge 32 64
6xlarge 48 96
8xlarge 64 128
10xlarge 80 160
12xlarge 96 192
104
Amazon Relational Database Service User Guide
Reserved DB instances
For example, suppose that you purchase a db.t2.medium reserved DB instance, and you have two
running db.t2.small DB instances in your account in the same AWS Region. In this case, the billing
benefit is applied in full to both instances.
Alternatively, if you have one db.t2.large instance running in your account in the same AWS Region,
the billing benefit is applied to 50 percent of the usage of the DB instance.
• An RDS for MySQL reserved Single-AZ db.r4.large DB instance class in US East (N. Virginia) with the No
Upfront option at a cost of $0.12 for the instance, or $90 per month
• 400 GiB of General Purpose SSD (gp2) storage at a cost of 0.115 per GiB per month, or $45.60 per
month
• 600 GiB of backup storage at $0.095, or $19 per month (400 GiB free)
105
Amazon Relational Database Service User Guide
Reserved DB instances
Add all of these options ($90 + $45.60 + $19) with the reserved DB instance, and the total cost per
month is $154.60.
If you chose to use an on-demand DB instance instead of a reserved DB instance, an RDS for MySQL
Single-AZ db.r4.large DB instance class in US East (N. Virginia) costs $0.1386 per hour, or $101.18 per
month. So, for an on-demand DB instance, add all of these options ($101.18 + $45.60 + $19), and the
total cost per month is $165.78. You save a little over $11 per month by using the reserved DB instance.
Note
The prices in this example are sample prices and might not match actual prices.
For Amazon RDS pricing information, see the Amazon RDS product page.
You're billed for the upfront costs regardless of whether you use the resources.
If you delete a DB instance that is covered by a reserved DB instance discount, you can launch another DB
instance with compatible specifications. In this case, you continue to get the discounted rate during the
reservation term (one or three years).
Console
You can use the AWS Management Console to work with reserved DB instances as shown in the following
procedures.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Reserved instances.
3. Choose Purchase Reserved DB Instance.
4. For Product description, choose the DB engine and licensing type.
5. For DB instance class, choose the DB instance class.
6. For Multi-AZ deployment, choose whether you want a Multi-AZ deployment.
7. For Term, choose the length of time you want the DB instance reserved.
8. For Offering type, choose the offering type.
After you select the offering type, you can see the pricing information.
Important
Choose Cancel to avoid purchasing the reserved DB instance and incurring any charges.
After you have information about the available reserved DB instance offerings, you can use the
information to purchase an offering as shown in the following procedure.
106
Amazon Relational Database Service User Guide
Reserved DB instances
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Reserved instances.
3. Choose Purchase Reserved DB Instance.
4. For Product description, choose the DB engine and licensing type.
5. For DB instance class, choose the DB instance class.
6. For Multi-AZ deployment, choose whether you want a Multi-AZ deployment.
7. For Term, choose the length of time you want the DB instance reserved.
8. For Offering type, choose the offering type.
After you choose the offering type, you can see the pricing information.
9. (Optional) You can assign your own identifier to the reserved DB instances that you purchase to help
you track them. For Reserved Id, type an identifier for your reserved DB instance.
107
Amazon Relational Database Service User Guide
Reserved DB instances
The Purchase Reserved DB Instances dialog box appears, with a summary of the reserved DB
instance attributes that you've selected and the payment due.
11. On the confirmation page, review your reserved DB instance. If the information is correct, choose
Order to purchase the reserved DB instance.
After you have purchased reserved DB instances, you can get information about your reserved DB
instances as shown in the following procedure.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the Navigation pane, choose Reserved instances.
The reserved DB instances for your account appear. To see detailed information about a particular
reserved DB instance, choose that instance in the list. You can then see detailed information about
that instance in the detail pane at the bottom of the console.
108
Amazon Relational Database Service User Guide
Reserved DB instances
AWS CLI
You can use the AWS CLI to work with reserved DB instances as shown in the following examples.
After you have information about the available reserved DB instance offerings, you can use the
information to purchase an offering.
For Windows:
109
Amazon Relational Database Service User Guide
Reserved DB instances
After you have purchased reserved DB instances, you can get information about your reserved DB
instances.
To get information about reserved DB instances for your AWS account, call the AWS CLI command
describe-reserved-db-instances, as shown in the following example.
RDS API
You can use the RDS API to work with reserved DB instances:
• To get information about available reserved DB instance offerings, call the Amazon RDS API operation
DescribeReservedDBInstancesOfferings.
• After you have information about the available reserved DB instance offerings, you can use the
information to purchase an offering. Call the PurchaseReservedDBInstancesOffering RDS API
operation with the following parameters:
• --reserved-db-instances-offering-id – The ID of the offering that you want to purchase.
• --reserved-db-instance-id – You can assign your own identifier to the reserved DB instances
that you purchase to help track them.
• After you have purchased reserved DB instances, you can get information about your reserved DB
instances. Call the DescribeReservedDBInstances RDS API operation.
Your reserved DB instances and their hourly charges for the current month are shown under Amazon
Relational Database Service for Database Engine Reserved Instances.
110
Amazon Relational Database Service User Guide
Reserved DB instances
The reserved DB instance in this example was purchased All Upfront, so there are no hourly charges.
6. Choose the Cost Explorer (bar graph) icon next to the Reserved Instances heading.
The Cost Explorer displays the Monthly EC2 running hours costs and usage graph.
7. Clear the Usage Type Group filter to the right of the graph.
8. Choose the time period and time unit for which you want to examine usage costs.
The following example shows usage costs for on-demand and reserved DB instances for the year to
date by month.
The reserved DB instance costs from January through June 2021 are monthly charges for a Partial
Upfront instance, while the cost in August 2021 is a one-time charge for an All Upfront instance.
The reserved instance discount for the Partial Upfront instance expired in June 2021, but the DB
instance wasn't deleted. After the expiration date, it was simply charged at the on-demand rate.
111
Amazon Relational Database Service User Guide
Sign up for AWS
If you already have an AWS account, know your Amazon RDS requirements, and prefer to use the
defaults for IAM and VPC security groups, skip ahead to Getting started with Amazon RDS (p. 118).
With Amazon RDS, you pay only for the resources you use. The Amazon RDS DB instances that you
create are live (not running in a sandbox). You incur the standard Amazon RDS usage fees for each DB
instance until you terminate it. For more information about Amazon RDS usage rates, see the Amazon
RDS product page. If you are a new AWS customer, you can get started with Amazon RDS for free; for
more information, see AWS free tier.
If you have an AWS account already, skip to the next section, Create an IAM user (p. 112).
If you don't have an AWS account, you can use the following procedure to create one.
1. Open https://portal.aws.amazon.com/billing/signup.
2. Follow the online instructions.
Part of the sign-up procedure involves receiving a phone call and entering a verification code on the
phone keypad.
Note your AWS account number, because you'll need it for the next task.
One way to do this is to create a new IAM user and grant it administrator permissions. Alternatively, you
can add an existing IAM user to an IAM group with Amazon RDS administrative permissions. You can then
access AWS from a special URL using the credentials for the IAM user.
If you signed up for AWS but haven't created an IAM user for yourself, you can create one using the IAM
console.
112
Amazon Relational Database Service User Guide
Create an IAM user
To create an administrator user for yourself and add the user to an administrators group
(console)
1. Sign in to the IAM console as the account owner by choosing Root user and entering your AWS
account email address. On the next page, enter your password.
Note
We strongly recommend that you adhere to the best practice of using the Administrator
IAM user that follows and securely lock away the root user credentials. Sign in as the root
user only to perform a few account and service management tasks.
2. In the navigation pane, choose Users and then choose Add user.
3. For User name, enter Administrator.
4. Select the check box next to AWS Management Console access. Then select Custom password, and
then enter your new password in the text box.
5. (Optional) By default, AWS requires the new user to create a new password when first signing in. You
can clear the check box next to User must create a new password at next sign-in to allow the new
user to reset their password after they sign in.
6. Choose Next: Permissions.
7. Under Set permissions, choose Add user to group.
8. Choose Create group.
9. In the Create group dialog box, for Group name enter Administrators.
10. Choose Filter policies, and then select AWS managed - job function to filter the table contents.
11. In the policy list, select the check box for AdministratorAccess. Then choose Create group.
Note
You must activate IAM user and role access to Billing before you can use the
AdministratorAccess permissions to access the AWS Billing and Cost Management
console. To do this, follow the instructions in step 1 of the tutorial about delegating access
to the billing console.
12. Back in the list of groups, select the check box for your new group. Choose Refresh if necessary to
see the group in the list.
13. Choose Next: Tags.
14. (Optional) Add metadata to the user by attaching tags as key-value pairs. For more information
about using tags in IAM, see Tagging IAM entities in the IAM User Guide.
15. Choose Next: Review to see the list of group memberships to be added to the new user. When you
are ready to proceed, choose Create user.
You can use this same process to create more groups and users and to give your users access to your AWS
account resources. To learn about using policies that restrict user permissions to specific AWS resources,
see Access management and Example policies.
To sign in as the new IAM user, first sign out of the AWS Management Console. Then use the following
URL, where your_aws_account_id is your AWS account number without the hyphens. For example, if
your AWS account number is 1234-5678-9012, your AWS account ID is 123456789012.
https://your_aws_account_id.signin.aws.amazon.com/console/
Type the IAM user name and password that you just created. When you're signed in, the navigation bar
displays "your_user_name @ your_aws_account_id".
If you don't want the URL for your sign-in page to contain your AWS account ID, you can create an
account alias. From the IAM dashboard, choose Customize and type an alias, such as your company
name. To sign in after you create an account alias, use the following URL.
113
Amazon Relational Database Service User Guide
Determine requirements
https://your_account_alias.signin.aws.amazon.com/console/
To verify the sign-in link for IAM users for your account, open the IAM console and check under AWS
Account Alias on the dashboard.
You can also create access keys for your AWS account. These access keys can be used to access AWS
through the AWS Command Line Interface (AWS CLI) or through the Amazon RDS API. For more
information, see Programmatic access, Installing, updating, and uninstalling the AWS CLI, and the
Amazon RDS API reference.
Determine requirements
The basic building block of Amazon RDS is the DB instance. In a DB instance, you create your databases.
A DB instance provides a network address called an endpoint. Your applications use this endpoint to
connect to your DB instance. When you create a DB instance, you specify details like storage, memory,
database engine and version, network configuration, security, and maintenance periods. You control
network access to a DB instance through a security group.
Before you create a DB instance and a security group, you must know your DB instance and network
needs. Here are some important things to consider:
• Resource requirements – What are the memory and processor requirements for your application or
service? You use these settings to help you determine what DB instance class to use. For specifications
about DB instance classes, see DB instance classes (p. 10).
• VPC, subnet, and security group – Your DB instance will most likely be in a virtual private cloud
(VPC). To connect to your DB instance, you need to set up security group rules. These rules are set up
differently depending on what kind of VPC you use and how you use it: in a default VPC or in a user-
defined VPC.
The following list describes the rules for each VPC option:
• Default VPC – If your AWS account has a default VPC in the current AWS Region, that VPC is
configured to support DB instances. If you specify the default VPC when you create the DB instance,
do the following:
• Make sure to create a VPC security group that authorizes connections from the application or
service to the Amazon RDS DB instance. Use the Security Group option on the VPC console or
the AWS CLI to create VPC security groups. For information, see Step 4: Create a VPC security
group (p. 1982).
• Specify the default DB subnet group. If this is the first DB instance you have created in this AWS
Region, Amazon RDS creates the default DB subnet group when it creates the DB instance.
• User-defined VPC – If you want to specify a user-defined VPC when you create a DB instance, be
aware of the following:
• Make sure to create a VPC security group that authorizes connections from the application or
service to the Amazon RDS DB instance. Use the Security Group option on the VPC console or
the AWS CLI to create VPC security groups. For information, see Step 4: Create a VPC security
group (p. 1982).
• The VPC must meet certain requirements in order to host DB instances, such as having at least two
subnets, each in a separate Availability Zone. For information, see Amazon Virtual Private Cloud
VPCs and Amazon RDS (p. 1975).
• Make sure to specify a DB subnet group that defines which subnets in that VPC can be used by the
DB instance. For information, see the DB subnet group section in Working with a DB instance in a
VPC (p. 1976).
114
Amazon Relational Database Service User Guide
Provide access to your DB instance
Note
Some legacy accounts don't use a VPC. If you are accessing a new AWS Region or you are
a new RDS user (after 2013), you are most likely creating a DB instance inside a VPC. For
more information, see Determining whether you are using the EC2-VPC or EC2-Classic
platform (p. 1994).
• High availability: Do you need failover support? On Amazon RDS, a Multi-AZ deployment creates a
primary DB instance and a secondary standby DB instance in another Availability Zone for failover
support. We recommend Multi-AZ deployments for production workloads to maintain high availability.
For development and test purposes, you can use a deployment that isn't Multi-AZ. For more
information, see Multi-AZ deployments for high availability (p. 59).
• IAM policies: Does your AWS account have policies that grant the permissions needed to perform
Amazon RDS operations? If you are connecting to AWS using IAM credentials, your IAM account must
have IAM policies that grant the permissions required to perform Amazon RDS operations. For more
information, see Identity and access management in Amazon RDS (p. 1893).
• Open ports: What TCP/IP port does your database listen on? The firewall at some companies might
block connections to the default port for your database engine. If your company firewall blocks the
default port, choose another port for the new DB instance. When you create a DB instance that listens
on a port you specify, you can change the port by modifying the DB instance.
• AWS Region: What AWS Region do you want your database in? Having your database in close
proximity to your application or web service can reduce network latency. For more information, see
Regions, Availability Zones, and Local Zones (p. 55).
• DB disk subsystem: What are your storage requirements? Amazon RDS provides three storage types:
• Magnetic (Standard Storage)
• General Purpose (SSD)
• Provisioned IOPS (PIOPS)
Magnetic storage offers cost-effective storage that is ideal for applications with light or burst I/
O requirements. General purpose, SSD-backed storage, also called gp2, can provide faster access
than disk-based storage. Provisioned IOPS storage is designed to meet the needs of I/O-intensive
workloads, particularly database workloads, which are sensitive to storage performance and
consistency in random access I/O throughput. For more information on Amazon RDS storage, see
Amazon RDS DB instance storage (p. 48).
When you have the information you need to create the security group and the DB instance, continue to
the next step.
Before you can connect to your DB instance, you must add rules to a security group that enable you
to connect. Use your network and configuration information to create rules to allow access to your DB
instance.
For example, suppose that you have an application that accesses a database on your DB instance in a
VPC. In this case, you must add a custom TCP rule that specifies the port range and IP addresses that
your application uses to access the database. If you have an application on an Amazon EC2 instance, you
can use the security group that you set up for the Amazon EC2 instance.
115
Amazon Relational Database Service User Guide
Provide access to your DB instance
For information about common scenarios for accessing a DB instance, see Scenarios for accessing a DB
instance in a VPC (p. 1982).
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc.
Note
Make sure you are in the VPC console, not the RDS console.
2. In the top right corner of the AWS Management Console, choose the AWS Region where you want
to create your VPC security group and DB instance. In the list of Amazon VPC resources for that AWS
Region, you should see at least one VPC and several subnets. If you don't, you don't have a default
VPC in that AWS Region.
3. In the navigation pane, choose Security Groups.
4. Choose Create security group.
You can use the VPC security group that you just created as the security group for your DB instance when
you create it.
Note
If you use a default VPC, a default subnet group spanning all of the VPC's subnets is created
for you. When you create a DB instance, you can select the default VPC and use default for DB
Subnet Group.
Once you have completed the setup requirements, you can create a DB instance using your requirements
and security group by following the instructions in Creating an Amazon RDS DB instance (p. 194).
For information about getting started by creating a DB instance that uses a specific DB engine, see the
relevant documentation in the following table.
Microsoft SQL Server Creating a Microsoft SQL Server DB instance and connecting to it (p. 126)
116
Amazon Relational Database Service User Guide
Provide access to your DB instance
Note
If you can't connect to a DB instance after you create it, see the troubleshooting information in
Can't connect to Amazon RDS DB instance (p. 2005).
117
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
and connecting to a database
Creating a DB instance and connecting to a database on a DB instance is slightly different for each of the
DB engines. Choose one of the following DB engines that you want to use for detailed information on
creating and connecting to the DB instance. After you have created and connected to your DB instance,
there are instructions to help you delete the DB instance.
Topics
• Creating a MariaDB DB instance and connecting to a database on a MariaDB DB instance (p. 118)
• Creating a Microsoft SQL Server DB instance and connecting to it (p. 126)
• Creating a MySQL DB instance and connecting to a database on a MySQL DB instance (p. 135)
• Creating an Oracle DB instance and connecting to a database on an Oracle DB instance (p. 143)
• Creating a PostgreSQL DB instance and connecting to a database on a PostgreSQL DB
instance (p. 149)
• Tutorial: Create a web server and an Amazon RDS DB instance (p. 160)
Topics
• Creating a MariaDB DB instance (p. 118)
• Connecting to a database on a DB instance running the MariaDB database engine (p. 122)
• Deleting a DB instance (p. 125)
118
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
You can use Easy create to create a DB instance running MariaDB with the AWS Management Console.
With Easy create, you specify only the DB engine type, DB instance size, and DB instance identifier. Easy
create uses the default settings for the other configuration options. When you use Standard create
instead of Easy create, you specify more configuration options when you create a database, including
ones for availability, security, backups, and maintenance.
In this example, you use Easy create to create a DB instance running the MariaDB database engine with a
db.t2.micro DB instance class.
Note
For information about creating DB instances with Standard create, see Creating an Amazon RDS
DB instance (p. 194).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database and make sure that Easy create is chosen.
The Create database page should look similar to the following image.
119
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
9. To use an automatically generated master password for the DB instance, make sure that the Auto
generate a password box is selected.
To enter your master password, clear the Auto generate a password box, and then enter the same
password in Master password and Confirm password.
10. (Optional) Open View default settings for Easy create.
120
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
You can examine the default settings used with Easy create. The Editable after database is created
column shows which options you can change after database creation.
The following are important considerations for changing the default settings:
• In some cases, you might want your DB instance to use a specific virtual private cloud (VPC) based
on the Amazon VPC service. Or you might require a specific subnet group or security group. If so,
use Standard create to specify these resources. You might have created these resources when you
set up for Amazon RDS. For more information, see Provide access to your DB instance in your VPC
by creating a security group (p. 115).
121
Amazon Relational Database Service User Guide
Connecting to a database on a
DB instance running MariaDB
• If you want to be able to access the DB instance from a client outside of its VPC, use Standard
create to set Public access to Yes.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB instance, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important
You can't view the master user password again. If you don't record it, you might have to
change it.
If you need to change the master user password after the DB instance is available, you can
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
12. For Databases, choose the name of the new Maria DB instance.
On the RDS console, the details for new DB instance appear. The DB instance has a status of
Creating until the DB instance is ready to use. When the state changes to Available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to
20 minutes before the new instance is available.
1. Install a SQL client that you can use to connect to the DB instance.
122
Amazon Relational Database Service User Guide
Connecting to a database on a
DB instance running MariaDB
You can connect to an Amazon RDS for MariaDB DB instance by using tools like the mysql command-
line client. For more information on using the mysql command-line client, see mysql command-
line client in the MariaDB documentation. One GUI-based application that you can use to connect
is Heidi. For more information, see the Download HeidiSQL page. For information about installing
MySQL (including the mysql command-line client), see Installing and upgrading MySQL.
2. Make sure that your DB instance is associated with a security group that provides access to it.
For more information, see Provide access to your DB instance in your VPC by creating a security
group (p. 115).
If you didn't specify the appropriate security group when you created the DB instance, you can
modify the DB instance to change its security group. For more information, see Modifying an
Amazon RDS DB instance (p. 306).
3. Find the endpoint (DNS name) and port number for your DB instance.
a. Open the RDS console and then choose Databases to display a list of your DB instances.
b. Choose the Maria DB instance name to display its details.
c. On the Connectivity & security tab, copy the endpoint. Also note the port number. You need
both the endpoint and the port number to connect to the DB instance.
123
Amazon Relational Database Service User Guide
Connecting to a database on a
DB instance running MariaDB
4. Enter the following command at a command prompt on a client computer to connect to a database
on a Maria DB instance. Substitute the DNS name (endpoint) for your DB instance for <endpoint>.
In addition, substitute the master user name that you used for <mymasteruser> and provide the
master password that you used when prompted for a password.
After you enter the password for the user, you should see output similar to the following.
124
Amazon Relational Database Service User Guide
Deleting a DB instance
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
For more information about connecting to a MariaDB DB instance, see Connecting to a DB instance
running the MariaDB database engine (p. 756). If you can't connect to your DB instance, see Can't
connect to Amazon RDS DB instance (p. 2005).
Deleting a DB instance
After you have connected to the sample DB instance that you created, you should delete the DB instance
so you are no longer charged for it.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance you want to delete.
4. For Actions, choose Delete.
5. For Create final snapshot?, choose No, and select the acknowledgment.
6. Choose Delete.
125
Amazon Relational Database Service User Guide
Creating a SQL Server DB instance and connecting to it
In this topic, you create a sample SQL Server DB instance. You then connect to the DB instance and run a
simple query. Finally, you delete the sample DB instance.
In this example, you use Easy create to create a DB instance running the Microsoft SQL Server database
engine with a db.t2.micro DB instance class.
Note
For information about creating DB instances with Standard create, see Creating an Amazon RDS
DB instance (p. 194).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database and make sure that Easy create is chosen.
126
Amazon Relational Database Service User Guide
Creating a sample SQL Server DB instance
8. For Master username, enter a name for the master user, or leave the default name.
9. To use an automatically generated master password for the DB instance, select the Auto generate a
password box.
To enter your master password, clear the Auto generate a password box, and then enter the same
password in Master password and Confirm password.
The Create database page should look similar to the following image.
127
Amazon Relational Database Service User Guide
Creating a sample SQL Server DB instance
128
Amazon Relational Database Service User Guide
Creating a sample SQL Server DB instance
You can examine the default settings used with Easy create. The Editable after database is created
column shows which options you can change after database creation.
The following are important considerations for changing the default settings:
• In some cases, you might want your DB instance to use a specific virtual private cloud (VPC) based
on the Amazon VPC service. Or you might require a specific subnet group or security group. If so,
use Standard create to specify these resources. You might have created these resources when you
set up for Amazon RDS. For more information, see Provide access to your DB instance in your VPC
by creating a security group (p. 115).
129
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
• If you want to be able to access the DB instance from a client outside of its VPC;, use Standard
create to set Public access to Yes.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB instance, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important
You can't view the master user password again. If you don't record it, you might have to
change it.
If you need to change the master user password after the DB instance is available, you can
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
12. For Databases, choose the name of the new Microsoft SQL Server DB instance.
On the RDS console, the details for new DB instance appear. The DB instance has a status of
Creating until the DB instance is ready to use. When the state changes to Available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to
20 minutes before the new instance is available.
Before you begin, your database should have a status of Available. If it has a status of Creating or
Backing-up, wait until it shows Available. The status updates without requiring you to refresh the page.
This process can take up to 20 minutes.
Also, make sure that you have SSMS installed. You can also connect to RDS for SQL Server by using
a different tool, such as an add-in for your development environment or some other database tool.
However, this tutorial only covers using SSMS. To download a standalone version of this SSMS, see
Download SQL Server Management Studio (SSMS) in the Microsoft documentation.
130
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
1. Make sure that your DB instance is associated with a security group that provides access to it.
For more information, see Provide access to your DB instance in your VPC by creating a security
group (p. 115).
If you didn't specify the appropriate security group when you created the DB instance, you can
modify the DB instance to change its security group. For more information, see Modifying an
Amazon RDS DB instance (p. 306).
2. Find the DNS name and port number for your DB instance.
a. Open the RDS console, and then choose Databases to display a list of your DB instances.
b. Hover your mouse cursor over the name sample-instance, which is blue. When you do this, the
mouse cursor changes into a selection icon (for example, a pointing hand). Also, the DB instance
name becomes underlined.
Click on the DB instance name to choose it. The screen changes to display the information for
the DB instance you choose.
c. On the Connectivity tab, which opens by default, copy the endpoint. The Endpoint looks
something like this: sample-instance.123456789012.us-east-2.rds.amazonaws.com.
Also, note the port number. The default port for SQL Server is 1433. If yours is different, write it
down.
131
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
sample-instance.abc2defghije.us-west-2.rds.amazonaws.com,1433
132
Amazon Relational Database Service User Guide
Exploring your sample DB instance
d. For Login, enter the user name that you chose to use for your sample DB instance. This is also
known as the master user name.
e. For Password, enter the password that you chose earlier for your sample DB instance. This is
also known as the master user password.
5. Choose Connect.
For more information about connecting to a Microsoft SQL Server DB instance, see Connecting to a DB
instance running the Microsoft SQL Server database engine (p. 824). For information on connection
issues, see Can't connect to Amazon RDS DB instance (p. 2005).
1. Your SQL Server DB instance comes with SQL Server's standard built-in system databases (master,
model, msdb, and tempdb). To explore the system databases, do the following:
Your SQL Server DB instance also comes with a database named rdsadmin. Amazon RDS uses this
database to store the objects that it uses to manage your database. The rdsadmin database also
includes stored procedures that you can run to perform advanced tasks.
2. Start creating your own databases and running queries against your DB instance and databases as
usual. To run a test query against your sample DB instance, do the following:
a. In SSMS, on the File menu point to New and then choose Query with Current Connection.
133
Amazon Relational Database Service User Guide
Deleting your sample DB instance
select @@VERSION
c. Run the query. SSMS returns the SQL Server version of your Amazon RDS DB instance.
To delete a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the button next to sample-instance, or whatever you named your sample DB instance.
4. From Actions, choose Delete.
5. If you see a message that says This database has deletion protection option enabled, follow these
steps:
a. Choose Modify.
b. On the Deletion protection card (near the bottom of the page), clear the box next to Enable
deletion protection. Then choose Continue.
c. On the Scheduling of modifications card, choose Apply immediately. Then choose Modify DB
instance.
d. Try again to delete the instance by choosing Delete from the Actions menu.
6. Clear the box for Create final snapshot. Because this isn't a production database, you don't need to
save a copy of it.
7. Verify that you selected the correct database to delete. The name "sample-instance" displays in the
title of the screen: Delete sample-instance instance?
If you don't recognize the name of your sample instance in the title, choose Cancel and start over.
8. To confirm that you want to permanently delete the database that is displayed in the title of this
screen, do the following:
134
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
and connecting to a database
• Select the box to confirm: I acknowledge that upon instance deletion, automated backups,
including system snapshots and point-in-time recovery, will no longer be available.
• Enter "delete me" into the box To confirm deletion, type delete me into the field.
• Choose Delete. This action can't be undone.
Topics
• Creating a MySQL DB instance (p. 135)
• Connecting to a database on a DB instance running the MySQL database engine (p. 139)
• Deleting a DB instance (p. 142)
You can use Easy create to create a DB instance running MySQL with the AWS Management Console.
With Easy create, you specify only the DB engine type, DB instance size, and DB instance identifier. Easy
create uses the default settings for the other configuration options. When you use Standard create
instead of Easy create, you specify more configuration options when you create a database, including
ones for availability, security, backups, and maintenance.
In this example, you use Easy create to create a DB instance running the MySQL database engine with a
db.t2.micro DB instance class.
Note
For information about creating DB instances with Standard create, see Creating an Amazon RDS
DB instance (p. 194).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database and make sure that Easy create is chosen.
135
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
The Create database page should look similar to the following image.
136
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
9. To use an automatically generated master password for the DB instance, make sure that the Auto
generate a password box is selected.
137
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
To enter your master password, clear the Auto generate a password box, and then enter the same
password in Master password and Confirm password.
10. (Optional) Open View default settings for Easy create.
You can examine the default settings used with Easy create. The Editable after database is created
column shows which options you can change after database creation.
The following are important considerations for changing the default settings:
• In some cases, you might want your DB instance to use a specific virtual private cloud (VPC) based
on the Amazon VPC service. Or you might require a specific subnet group or security group. If so,
138
Amazon Relational Database Service User Guide
Connecting to a database on a DB instance running MySQL
use Standard create to specify these resources. You might have created these resources when you
set up for Amazon RDS. For more information, see Provide access to your DB instance in your VPC
by creating a security group (p. 115).
• If you want to be able to access the DB instance from a client outside of its VPC, use Standard
create to set Public access to Yes.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB instance, choose View credential details.
You can use the user name and password that appears to connect to the DB instance as the master
user.
Important
You can't view the master user password again. If you don't record it, you might have to
change it.
If you need to change the master user password after the DB instance is available, you can
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
12. In the Databases list, choose the name of the new MySQL DB instance.
On the RDS console, the details for new DB instance appear. The DB instance has a status of
Creating until the DB instance is ready to use. When the state changes to Available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to
20 minutes before the new instance is available.
1. Install a SQL client that you can use to connect to the DB instance.
139
Amazon Relational Database Service User Guide
Connecting to a database on a DB instance running MySQL
You can connect to a MySQL DB instance by using tools like the mysql command line utility. For
more information on using the MySQL client, seemysql - the MySQL command-line client in
the MySQL documentation. One GUI-based application that you can use to connect is MySQL
Workbench. For more information, see the Download MySQL Workbench page.
For more information on using MySQL, see the MySQL documentation. For information about
installing MySQL (including the MySQL client), see Installing and upgrading MySQL.
If your DB instance is publicly accessible, you can install the SQL client outside of your VPC. If your
DB instance is private, you typically install the SQL client on a resource inside your VPC, such as an
Amazon EC2 instance.
2. Make sure that your DB instance is associated with a security group that provides access to it.
For more information, see Provide access to your DB instance in your VPC by creating a security
group (p. 115).
If you didn't specify the appropriate security group when you created the DB instance, you can
modify the DB instance to change its security group. For more information, see Modifying an
Amazon RDS DB instance (p. 306).
3. Find the endpoint (DNS name) and port number for your DB instance.
a. Open the RDS console and then choose Databases to display a list of your DB instances.
b. Choose the MySQL DB instance name to display its details.
c. On the Connectivity & security tab, copy the endpoint. Also, note the port number. You need
both the endpoint and the port number to connect to the DB instance.
140
Amazon Relational Database Service User Guide
Connecting to a database on a DB instance running MySQL
4. Connect to the a database on a MySQL DB instance. For example, enter the following command at
a command prompt on a client computer to connect to a database on a MySQL DB instance using
the MySQL client. Substitute the DNS name for your DB instance for <endpoint>. In addition,
substitute the master user name that you used for <mymasteruser>, and provide the master
password that you used when prompted for a password.
After you enter the password for the user, you should see output similar to the following.
141
Amazon Relational Database Service User Guide
Deleting a DB instance
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
For more information about connecting to a MySQL DB instance, see Connecting to a DB instance
running the MySQL database engine (p. 1012). If you can't connect to your DB instance, see Can't
connect to Amazon RDS DB instance (p. 2005).
Deleting a DB instance
After you have connected to the sample DB instance that you created, you should delete the DB instance
so you are no longer charged for it.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to delete.
4. For Actions, choose Delete.
5. For Create final snapshot?, choose No, and select the acknowledgment.
6. Choose Delete.
142
Amazon Relational Database Service User Guide
Creating an Oracle DB instance
and connecting to a database
There's no charge for creating an AWS account. However, by completing this tutorial, you might incur
costs for the AWS resources that you use. You can delete these resources after you complete the tutorial
if they are no longer needed.
In this topic, you create a sample Oracle DB instance and connect to it. Finally, you delete the sample DB
instance.
You can use Easy create to create a DB instance running Oracle with the AWS Management Console.
With Easy create, you specify only the DB engine type, DB instance size, and DB instance identifier. Easy
create uses the default settings for the other configuration options. When you use Standard create
instead of Easy create, you specify more configuration options when you create a database, including
ones for availability, security, backups, and maintenance.
In this example, you use Easy create to create a DB instance running the Oracle database engine with a
db.m4.large DB instance class.
For information about creating DB instances with Standard create, see Creating an Amazon RDS DB
instance (p. 194). If you want to use free tier, use Standard create.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database and ensure that Easy create is chosen.
143
Amazon Relational Database Service User Guide
Creating a sample Oracle DB instance
The Create database page should look similar to the following image.
144
Amazon Relational Database Service User Guide
Creating a sample Oracle DB instance
9. To use an automatically generated master password for the DB instance, make sure that the Auto
generate a password box is selected.
To enter your master password, clear the Auto generate a password box, and then enter the same
password in Master password and Confirm password.
10. (Optional) Open View default settings for Easy create.
145
Amazon Relational Database Service User Guide
Creating a sample Oracle DB instance
You can examine the default settings used with Easy create. The Editable after database is created
column shows which options you can change after database creation.
The following are important considerations for changing the default settings:
• In some cases, you might want your DB instance to use a specific virtual private cloud (VPC) based
on the Amazon VPC service. Or you might require a specific subnet group or security group. If so,
use Standard create to specify these resources. You might have created these resources when you
set up for Amazon RDS. For more information, see Provide access to your DB instance in your VPC
by creating a security group (p. 115).
146
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
• If you want to be able to access the DB instance from a client outside of its VPC, use Standard
create to set Public access to Yes.
If you used an automatically generated password, the View credential details button appears on the
Databases page.
To view the master user name and password for the DB instance, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important
You can't view the master user password again. If you don't record it, you might have to
change it.
If you need to change the master user password after the DB instance is available, you can
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
12. For Databases, choose the name of the new Oracle DB instance.
On the RDS console, the details for new DB instance appear. The DB instance has a status of
Creating until the DB instance is ready to use. When the state changes to Available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to
20 minutes before the new instance is available.
147
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
1. Make sure your DB instance is associated with a security group that provides access to it. For more
information, see Provide access to your DB instance in your VPC by creating a security group (p. 115).
If you didn't specify the appropriate security group when you created the DB instance, you can
modify the DB instance to change its security group. For more information, see Modifying an
Amazon RDS DB instance (p. 306).
2. Find the endpoint (DNS name) and port number for your DB instance.
a. Open the RDS console and then choose Databases to display a list of your DB instances.
b. Choose the Oracle DB instance name to display its details.
c. On the Connectivity & security tab, copy the following pieces of information:
• Endpoint
• Port
You need both the endpoint and the port number to connect to the DB instance.
You need both the DB name and the master user name to connect to the DB instance.
3. Enter the following command on one line at a command prompt to connect to your DB instance by
using the sqlplus utility. Use the following values:
• For dbuser, enter the name of the master user that you copied in the preceding steps.
148
Amazon Relational Database Service User Guide
Deleting your sample DB instance
• For HOST=endpoint, enter the endpoint that you copied in the preceding steps.
• For PORT=portnum, enter the port number that you copied in the preceding steps.
• For SID=DB_NAME, enter the Oracle database name (not the instance name) that you copied in the
preceding steps.
sqlplus 'dbuser@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=endpoint)(PORT=portnum))
(CONNECT_DATA=(SID=DB_NAME)))'
SQL>
For more information about connecting to an Oracle DB instance, see Connecting to your Oracle
DB instance (p. 1180). For information on connection issues, see Can't connect to Amazon RDS DB
instance (p. 2005).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to delete.
4. For Actions, choose Delete.
5. For Create final snapshot?, choose No, and choose the acknowledgment.
6. Choose Delete.
There's no charge for creating an AWS account. However, by completing this tutorial, you might incur
costs for the AWS resources that you use. You can delete these resources after you complete the tutorial
if they are no longer needed.
149
Amazon Relational Database Service User Guide
Creating a PostgreSQL DB instance
Contents
• Creating a PostgreSQL DB instance (p. 150)
• Connecting to a PostgreSQL DB instance (p. 153)
• Using pgAdmin to connect to a PostgreSQL DB instance (p. 154)
• Using psql to connect to a PostgreSQL DB instance (p. 159)
• Deleting a DB instance (p. 159)
You can use Easy create to create a DB instance running PostgreSQL with the AWS Management
Console. With Easy create, you specify only the DB engine type, DB instance size, and DB instance
identifier. Easy create uses the default settings for the other configuration options. When you use
Standard create instead of Easy create, you specify more configuration options when you create a
database, including ones for availability, security, backups, and maintenance.
In this example, you use Easy create to create a DB instance running the PostgreSQL database engine
with a db.r6g.large DB instance class.
Note
For information about creating DB instances with Standard create, see Creating an Amazon RDS
DB instance (p. 194). If you want to use free tier, use Standard create.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database and make sure that Easy create is chosen.
The Create database page should look similar to the following image.
150
Amazon Relational Database Service User Guide
Creating a PostgreSQL DB instance
9. To use an automatically generated master password for the DB instance, make sure that the Auto
generate a password box is selected.
To enter your master password, clear the Auto generate a password box, and then enter the same
password in Master password and Confirm password.
10. (Optional) Open View default settings for Easy create.
151
Amazon Relational Database Service User Guide
Creating a PostgreSQL DB instance
You can examine the default settings used with Easy create. The Editable after database is created
column shows which options you can change after database creation.
The following are important considerations for changing the default settings:
• In some cases, you might want your DB instance to use a specific virtual private cloud (VPC) based
on the Amazon VPC service. Or you might require a specific subnet group or security group. If so,
use Standard create to specify these resources. You might have created these resources when you
set up for Amazon RDS. For more information, see Provide access to your DB instance in your VPC
by creating a security group (p. 115).
152
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
• If you want to be able to access the DB instance from a client outside of its VPC, use Standard
create to set Public access to Yes.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB instance, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important
You can't view the master user password again. If you don't record it, you might have to
change it.
If you need to change the master user password after the DB instance is available, you can
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
12. For Databases, choose the name of the new PostgreSQL DB instance.
On the RDS console, the details for new DB instance appear. The DB instance has a status of
Creating until the DB instance is ready to use. When the state changes to Available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to
20 minutes before the new instance is available.
153
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
Before you attempt to connect to the DB instance, make sure that the DB instance is associated with a
security group that provides access to it. For more information, see Provide access to your DB instance in
your VPC by creating a security group (p. 115).
In some cases, you might have difficulty connecting to the DB instance. If so, the problem is most often
with the access rules that you set up in the security group that you assigned to the DB instance. If you
didn't specify the appropriate security group when you created the DB instance, you can modify the
DB instance to change its security group. For more information, see Modifying an Amazon RDS DB
instance (p. 306).
For more information about connecting to a PostgreSQL DB instance, see Connecting to a DB instance
running the PostgreSQL database engine (p. 1748). If you can't connect to your DB instance, see
Troubleshooting connections to your RDS for PostgreSQL instance (p. 1752).
Topics
• Using pgAdmin to connect to a PostgreSQL DB instance (p. 154)
• Using psql to connect to a PostgreSQL DB instance (p. 159)
1. Find the endpoint (DNS name) and port number for your DB instance.
a. Open the RDS console and then choose Databases to display a list of your DB instances.
b. Choose the PostgreSQL DB instance name to display its details.
c. On the Connectivity & security tab, copy the endpoint. Also, note the port number. You need
both the endpoint and the port number to connect to the DB instance.
154
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
d. On the Configuration tab, note the DB name. You don't need this to connect using pgAdmin,
but you do need it to connect using psql.
155
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
2. Install pgAdmin from https://www.pgadmin.org/. You can download and use pgAdmin without
having a local instance of PostgreSQL on your client computer.
3. Launch the pgAdmin application on your client computer.
4. Choose Add Server from the File menu.
5. In the New Server Registration dialog box, enter the DB instance endpoint (for example,
database-1.123456789012.us-west-1.rds.amazonaws.com) in the Host
box. Don't include the colon or port number as shown on the Amazon RDS console
(database-1.c6c8dntfzzhgv0.us-west-1.rds.amazonaws.com:5432).
Enter the port you assigned to the DB instance for Port. Enter the user name and user password that
you entered when you created the DB instance for Username and Password.
156
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
6. Choose OK.
7. In the Object browser, expand Server Groups. Choose the server (the DB instance) you created, and
then choose the database name.
157
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
8. Choose the plugin icon and choose PSQL Console. The psql command window opens for the default
database you created.
9. Use the command window to enter SQL or psql commands. Enter \q to close the window.
158
Amazon Relational Database Service User Guide
Deleting a DB instance
For example, the following command connects to a database called mypgdb on a PostgreSQL DB
instance called mypostgresql using fictitious credentials.
Deleting a DB instance
After you have connected to the sample DB instance that you created, you should delete the DB instance
so you are no longer charged for it.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to delete.
4. For Actions, choose Delete.
5. For Create final snapshot?, choose No, and select the acknowledgment.
6. Choose Delete.
159
Amazon Relational Database Service User Guide
Tutorial: Create a web server
and an Amazon RDS DB instance
In the tutorial that follows, you specify the VPC, subnets, and security groups when you create the DB
instance. You also specify them when you create the EC2 instance to host your web server. The VPC,
subnets, and security groups are required for the DB instance and the web server to communicate. After
the VPC is set up, this tutorial shows you how to create the DB instance and install the web server. You
connect your web server to your DB instance in the VPC using the DB instance endpoint endpoint.
1. Complete the tasks in Tutorial: Create an Amazon VPC for use with a DB instance (p. 1988).
Before you begin this tutorial, make sure that you have a VPC with both public and private subnets,
and corresponding security groups. If you don't have these, complete the following tasks in the
tutorial:
The following diagram shows the configuration when the tutorial is complete.
160
Amazon Relational Database Service User Guide
Create a DB instance
Create a DB instance
In this step, you create an Amazon RDS for MySQL DB instance that maintains the data used by a web
application.
Important
Before you begin this step, make sure that you have a VPC with both public and private subnets,
and corresponding security groups. If you don't have these, see Tutorial: Create an Amazon VPC
for use with a DB instance (p. 1988). Complete the steps in Create a VPC with private and public
subnets (p. 1988), Create additional subnets (p. 1989), Create a VPC security group for a public
web server (p. 1990), and Create a VPC security group for a private DB instance (p. 1991).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the AWS Management Console, choose the AWS Region where you want
to create the DB instance. This example uses the US West (Oregon) Region.
3. In the navigation pane, choose Databases.
4. Choose Create database.
5. On the Create database page, shown following, make sure that the Standard create option is
chosen, and then choose MySQL.
161
Amazon Relational Database Service User Guide
Create a DB instance
162
Amazon Relational Database Service User Guide
Create a DB instance
8. In the DB instance class section, enable Include previous generation classes, and set these values:
163
Amazon Relational Database Service User Guide
Create a DB instance
9. In the Storage and Availability & durability sections, use the default values.
10. In the Connectivity section, set these values:
• Virtual private cloud (VPC) – Choose an existing VPC with both public and private subnets,
such as the tutorial-vpc (vpc-identifier) created in Create a VPC with private and public
subnets (p. 1988)
Note
The VPC must have subnets in different Availability Zones.
• Subnet group – The DB subnet group for the VPC, such as the tutorial-db-subnet-group
created in Create a DB subnet group (p. 1991)
• Public access – No
• VPC security group – Choose existing
• Existing VPC security groups – Choose an existing VPC security group that is configured for
private access, such as the tutorial-db-securitygroup created in Create a VPC security
group for a private DB instance (p. 1991).
Remove other security groups, such as the default security group, by choosing the X associated
with each.
• Availability Zone – No preference
• Open Additional configuration, and make sure Database port uses the default value 3306.
164
Amazon Relational Database Service User Guide
Create a DB instance
11. In the Database authentication section, make sure Password authentication is selected.
12. Open the Additional configuration section, and enter sample for Initial database name. Keep the
default settings for the other options.
13. To create your MySQL DB instance, choose Create database.
Your new DB instance appears in the Databases list with the status Creating.
14. Wait for the Status of your new DB instance to show as Available. Then choose the DB instance
name to show its details.
15. In the Connectivity & security section, view the Endpoint and Port of the DB instance.
165
Amazon Relational Database Service User Guide
Create a web server
Note the endpoint and port for your DB instance. You use this information to connect your web
server to your DB instance.
16. Complete Create an EC2 instance and install a web server (p. 166).
166
Amazon Relational Database Service User Guide
Create a web server
1. Sign in to the AWS Management Console and open the Amazon EC2 console at https://
console.aws.amazon.com/ec2/.
2. Choose EC2 Dashboard, and then choose Launch instance, as shown following.
167
Amazon Relational Database Service User Guide
Create a web server
4. Choose the t2.micro instance type, as shown following, and then choose Next: Configure Instance
Details.
5. On the Configure Instance Details page, shown following, set these values and keep the other
values as their defaults:
• Network: Choose the VPC with both public and private subnets that you chose for the DB
instance, such as the vpc-identifier | tutorial-vpc created in Create a VPC with private
and public subnets (p. 1988).
• Subnet: Choose an existing public subnet, such as subnet-identifier | Tutorial public
| us-west-2a created in Create a VPC security group for a public web server (p. 1990).
• Auto-assign Public IP: Choose Enable.
168
Amazon Relational Database Service User Guide
Create a web server
169
Amazon Relational Database Service User Guide
Create a web server
13. On the Select an existing key pair or create a new key pair page, shown following, choose Create
a new key pair and set Key pair name to tutorial-key-pair. Choose Download Key Pair, and
then save the key pair file on your local machine. You use this key pair file to connect to your EC2
instance.
170
Amazon Relational Database Service User Guide
Create a web server
14. To launch your EC2 instance, choose Launch Instances. On the Launch Status page, shown
following, note the identifier for your new EC2 instance, for example: i-0288d65fd4470b6a9.
171
Amazon Relational Database Service User Guide
Create a web server
To connect to your EC2 instance and install the Apache web server with PHP
1. Connect to the EC2 instance that you created earlier by following the steps in Connect to your Linux
instance.
2. Get the latest bug fixes and security updates by updating the software on your EC2 instance. To do
this, use the following command.
Note
The -y option installs the updates without asking for confirmation. To examine updates
before installing, omit this option.
3. After the updates complete, install the PHP software using the amazon-linux-extras install
command. This command installs multiple software packages and related dependencies at the same
time.
172
Amazon Relational Database Service User Guide
Create a web server
If you receive an error stating sudo: amazon-linux-extras: command not found, then your
instance was not launched with an Amazon Linux 2 AMI (perhaps you are using the Amazon Linux
AMI instead). You can view your version of Amazon Linux using the following command.
cat /etc/system-release
You can test that your web server is properly installed and started. To do this, enter the public
Domain Name System (DNS) name of your EC2 instance in the address bar of a web browser, for
example: http://ec2-42-8-168-21.us-west-1.compute.amazonaws.com. If your web server
is running, then you see the Apache test page.
If you don't see the Apache test page, check your inbound rules for the VPC security group that you
created in Tutorial: Create an Amazon VPC for use with a DB instance (p. 1988). Make sure that your
inbound rules include a rule allowing HTTP (port 80) access for the IP address you use to connect to
the web server.
Note
The Apache test page appears only when there is no content in the document root
directory, /var/www/html. After you add content to the document root directory, your
content appears at the public DNS address of your EC2 instance instead of the Apache test
page.
6. Configure the web server to start with each system boot using the systemctl command.
To allow ec2-user to manage files in the default root directory for your Apache web server, modify the
ownership and permissions of the /var/www directory. There are many ways to accomplish this task.
In this tutorial, you add ec2-user to the apache group, to give the apache group ownership of the /
var/www directory and assign write permissions to the group.
2. Log out to refresh your permissions and include the new apache group.
exit
3. Log back in again and verify that the apache group exists with the groups command.
173
Amazon Relational Database Service User Guide
Create a web server
groups
4. Change the group ownership of the /var/www directory and its contents to the apache group.
5. Change the directory permissions of /var/www and its subdirectories to add group write
permissions and set the group ID on subdirectories created in the future.
6. Recursively change the permissions for files in the /var/www directory and its subdirectories to add
group write permissions.
Now, ec2-user (and any future members of the apache group) can add, delete, and edit files in the
Apache document root, enabling you to add content, such as a static website or a PHP application.
Note
A web server running the HTTP protocol provides no transport security for the data that it
sends or receives. When you connect to an HTTP server using a web browser, the URLs that
you visit, the content of web pages that you receive, and the contents (including passwords) of
any HTML forms that you submit are all visible to eavesdroppers anywhere along the network
pathway. The best practice for securing your web server is to install support for HTTPS (HTTP
Secure), which protects your data with SSL/TLS encryption. For more information, see Tutorial:
Configure SSL/TLS with the Amazon Linux AMI in the Amazon EC2 User Guide.
To add content to the Apache web server that connects to your DB instance
1. While still connected to your EC2 instance, change the directory to /var/www and create a new
subdirectory named inc.
cd /var/www
mkdir inc
cd inc
2. Create a new file in the inc directory named dbinfo.inc, and then edit the file by calling nano (or
the editor of your choice).
>dbinfo.inc
nano dbinfo.inc
3. Add the following contents to the dbinfo.inc file. Here, db_instance_endpoint is your DB
instance endpoint, without the port, and master password is the master password for your DB
instance.
174
Amazon Relational Database Service User Guide
Create a web server
Note
We recommend placing the user name and password information in a folder that isn't part
of the document root for your web server. Doing this reduces the possibility of your security
information being exposed.
<?php
define('DB_SERVER', 'db_instance_endpoint');
define('DB_USERNAME', 'tutorial_user');
define('DB_PASSWORD', 'master password');
define('DB_DATABASE', 'sample');
?>
cd /var/www/html
6. Create a new file in the html directory named SamplePage.php, and then edit the file by calling
nano (or the editor of your choice).
>SamplePage.php
nano SamplePage.php
if (strlen($employee_name) || strlen($employee_address)) {
AddEmployee($connection, $employee_name, $employee_address);
}
?>
175
Amazon Relational Database Service User Guide
Create a web server
<?php
while($query_data = mysqli_fetch_row($result)) {
echo "<tr>";
echo "<td>",$query_data[0], "</td>",
"<td>",$query_data[1], "</td>",
"<td>",$query_data[2], "</td>";
echo "</tr>";
}
?>
</table>
mysqli_free_result($result);
mysqli_close($connection);
?>
</body>
</html>
<?php
176
Amazon Relational Database Service User Guide
Create a web server
$checktable = mysqli_query($connection,
"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_NAME = '$t' AND
TABLE_SCHEMA = '$d'");
return false;
}
?>
You can use SamplePage.php to add data to your DB instance. The data that you add is then displayed
on the page. To verify that the data was inserted into the table, you can install MySQL on the Amazon
EC2 instance, connect to the DB instance, and query the table.
For information about installing the MySQL client and connecting to a DB instance, see Connecting to a
DB instance running the MySQL database engine (p. 1012).
To make sure that your DB instance is as secure as possible, verify that sources outside of the VPC can't
connect to your DB instance.
After you have finished testing your web server and your database, you should delete your DB instance
and your Amazon EC2 instance.
• To delete a DB instance, follow the instructions in Deleting a DB instance (p. 384). You don't need to
create a final snapshot.
• To terminate an Amazon EC2 instance, follow the instruction in Terminate your instance in the Amazon
EC2 User Guide.
177
Amazon Relational Database Service User Guide
Tutorials in this guide
Topics
• Tutorials in this guide (p. 178)
• Tutorials in other AWS guides (p. 178)
• Tutorials and sample code in GitHub (p. 179)
• Tutorial: Create an Amazon VPC for use with a DB instance (p. 1988)
Learn how to include a DB instance in an Amazon virtual private cloud (VPC) that shares data with a
web server that is running on an Amazon EC2 instance in the same VPC.
• Tutorial: Create a web server and an Amazon RDS DB instance (p. 160)
Learn how to install an Apache web server with PHP and create a MySQL database. The web server
runs on an Amazon EC2 instance using Amazon Linux, and the MySQL database is a MySQL DB
instance. Both the Amazon EC2 instance and the DB instance run in an Amazon VPC.
• Tutorial: Restore a DB instance from a DB snapshot (p. 460)
Learn how to log a DB instance state change using Amazon EventBridge and AWS Lambda.
• Tutorial: Rotating a Secret for an AWS Database in the AWS Secrets Manager User Guide
Learn how to create a secret for an AWS database and configure the secret to rotate on a schedule.
You trigger one rotation manually, and then confirm that the new version of the secret continues to
provide access.
178
Amazon Relational Database Service User Guide
Tutorials and sample code in GitHub
• Tutorial: Configuring a Lambda function to access Amazon RDS in an Amazon VPC in the AWS Lambda
Developer Guide
Learn how to create a Lambda function to access a database, create a table, add a few records, and
retrieve the records from the table. You also learn how to invoke the Lambda function and verify the
query results.
• Tutorials and samples in the AWS Elastic Beanstalk Developer Guide
Learn how to deploy applications that use Amazon RDS databases with AWS Elastic Beanstalk.
• Using Data from an Amazon RDS Database to Create an Amazon ML Datasource in the Amazon
Machine Learning Developer Guide
Learn how to create an Amazon Machine Learning (Amazon ML) datasource object from data stored in
a MySQL DB instance.
• Manually Enabling Access to an Amazon RDS Instance in a VPC in the Amazon QuickSight User Guide
Learn how to enable Amazon QuickSight access to an Amazon RDS DB instance in a VPC.
Learn how to create an application that tracks and reports on work items using Amazon RDS, Amazon
Simple Email Service, Elastic Beanstalk, and SDK for Java 2.x.
• SDK for Go code samples for Amazon RDS
View a collection of SDK for Go code samples for Amazon RDS and Aurora.
• SDK for Java 2.x code samples for Amazon RDS
View a collection of SDK for Java 2.x code samples for Amazon RDS and Aurora.
• SDK for PHP code samples for Amazon RDS
View a collection of SDK for PHP code samples for Amazon RDS and Aurora.
• SDK for Ruby code samples for Amazon RDS
View a collection of SDK for Ruby code samples for Amazon RDS and Aurora.
179
Amazon Relational Database Service User Guide
Amazon RDS basic operational guidelines
Topics
• Amazon RDS basic operational guidelines (p. 180)
• DB instance RAM recommendations (p. 181)
• Using Enhanced Monitoring to identify operating system issues (p. 181)
• Using metrics to identify performance issues (p. 181)
• Tuning queries (p. 185)
• Best practices for working with MySQL (p. 186)
• Best practices for working with MariaDB (p. 187)
• Best practices for working with Oracle (p. 188)
• Best practices for working with PostgreSQL (p. 188)
• Best practices for working with SQL Server (p. 190)
• Working with DB parameter groups (p. 191)
• Best practices for automating DB instance creation (p. 191)
• Amazon RDS new features and best practices presentation video (p. 192)
Note
For common recommendations for Amazon RDS, see Viewing Amazon RDS
recommendations (p. 473).
• Monitor your memory, CPU, and storage usage. Amazon CloudWatch can be set up to notify you
when usage patterns change or when you approach the capacity of your deployment, so that you can
maintain system performance and availability.
• Scale up your DB instance when you are approaching storage capacity limits. You should have
some buffer in storage and memory to accommodate unforeseen increases in demand from your
applications.
• Enable automatic backups and set the backup window to occur during the daily low in write IOPS.
That's when a backup is least disruptive to your database usage.
• If your database workload requires more I/O than you have provisioned, recovery after a failover
or database failure will be slow. To increase the I/O capacity of a DB instance, do any or all of the
following:
• Migrate to a different DB instance class with high I/O capacity.
• Convert from magnetic storage to either General Purpose or Provisioned IOPS storage, depending
on how much of an increase you need. For information on available storage types, see Amazon RDS
storage types (p. 48).
If you convert to Provisioned IOPS storage, make sure you also use a DB instance class that is
optimized for Provisioned IOPS. For information on Provisioned IOPS, see Provisioned IOPS SSD
storage (p. 50).
180
Amazon Relational Database Service User Guide
DB instance RAM recommendations
• If you are already using Provisioned IOPS storage, provision additional throughput capacity.
• If your client application is caching the Domain Name Service (DNS) data of your DB instances, set a
time-to-live (TTL) value of less than 30 seconds. Because the underlying IP address of a DB instance
can change after a failover, caching the DNS data for an extended time can lead to connection failures
if your application tries to connect to an IP address that no longer is in service.
• Test failover for your DB instance to understand how long the process takes for your particular use
case and to ensure that the application that accesses your DB instance can automatically connect to
the new DB instance after failover occurs.
To tell if your working set is almost all in memory, check the ReadIOPS metric (using Amazon
CloudWatch) while the DB instance is under load. The value of ReadIOPS should be small and stable.
If scaling up the DB instance class—to a class with more RAM—results in a dramatic drop in ReadIOPS,
your working set was not almost completely in memory. Continue to scale up until ReadIOPS no longer
drops dramatically after a scaling operation, or ReadIOPS is reduced to a very small amount. For
information on monitoring a DB instance's metrics, see Viewing DB instance metrics (p. 477).
To troubleshoot performance issues, it's important to understand the baseline performance of the
system. When you set up a new DB instance and get it running with a typical workload, you should
capture the average, maximum, and minimum values of all of the performance metrics at a number
of different intervals (for example, one hour, 24 hours, one week, two weeks) to get an idea of what is
normal. It helps to get comparisons for both peak and off-peak hours of operation. You can then use this
information to identify when performance is dropping below standard levels.
181
Amazon Relational Database Service User Guide
Viewing performance metrics
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose a DB instance.
3. Choose Monitoring. The first eight performance metrics display. The metrics default to showing
information for the current day.
4. Use the numbered buttons at top right to page through the additional metrics, or choose adjust the
settings to see more metrics.
5. Choose a performance metric to adjust the time range in order to see data for other than the
current day. You can change the Statistic, Time Range, and Period values to adjust the information
displayed. For example, to see the peak values for a metric for each day of the last two weeks, set
Statistic to Maximum, Time Range to Last 2 Weeks, and Period to Day.
Note
Changing the Statistic, Time Range, and Period values changes them for all metrics. The
updated values persist for the remainder of your session or until you change them again.
You can also view performance metrics using the CLI or API. For more information, see Viewing DB
instance metrics (p. 477).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose a DB instance.
3. Choose Logs & events.
4. In the CloudWatch alarms section, choose Create alarm.
182
Amazon Relational Database Service User Guide
Viewing performance metrics
5. For Send notifications, choose Yes, and for Send notifications to, choose New email or SMS topic.
6. For Topic name, enter a name for the notification, and for With these recipients, enter a comma-
separated list of email addresses and phone numbers.
7. For Metric, choose the alarm statistic and metric to set.
8. For Threshold, specify whether the metric must be greater than, less than, or equal to the threshold,
and specify the threshold value.
9. For Evaluation period, choose the evaluation period for the alarm, and for consecutive period(s) of,
choose the period during which the threshold must have been reached in order to trigger the alarm.
10. For Name of alarm, enter a name for the alarm.
11. Choose Create Alarm.
183
Amazon Relational Database Service User Guide
Evaluating performance metrics
CPU
Memory
• Freeable Memory – How much RAM is available on the DB instance, in megabytes. The red line in the
Monitoring tab metrics is marked at 75% for CPU, Memory and Storage Metrics. If instance memory
consumption frequently crosses that line, then this indicates that you should check your workload or
upgrade your instance.
• Swap Usage – How much swap space is used by the DB instance, in megabytes.
Disk space
• Free Storage Space – How much disk space is not currently being used by the DB instance, in
megabytes.
Input/output operations
• Read IOPS, Write IOPS – The average number of disk read or write operations per second.
• Read Latency, Write Latency – The average time for a read or write operation in milliseconds.
• Read Throughput, Write Throughput – The average number of megabytes read from or written to disk
per second.
• Queue Depth – The number of I/O operations that are waiting to be written to or read from disk.
Network traffic
• Network Receive Throughput, Network Transmit Throughput – The rate of network traffic to and from
the DB instance in bytes per second.
Database connections
• DB Connections – The number of client sessions that are connected to the DB instance.
For more detailed individual descriptions of the performance metrics available, see Monitoring Amazon
RDS metrics with Amazon CloudWatch (p. 480).
Generally speaking, acceptable values for performance metrics depend on what your baseline looks
like and what your application is doing. Investigate consistent or trending variances from your baseline.
Advice about specific types of metrics follows:
• High CPU or RAM consumption – High values for CPU or RAM consumption might be appropriate,
provided that they are in keeping with your goals for your application (like throughput or concurrency)
and are expected.
184
Amazon Relational Database Service User Guide
Tuning queries
• Disk space consumption – Investigate disk space consumption if space used is consistently at or
above 85 percent of the total disk space. See if it is possible to delete data from the instance or archive
data to a different system to free up space.
• Network traffic – For network traffic, talk with your system administrator to understand what
expected throughput is for your domain network and Internet connection. Investigate network traffic if
throughput is consistently lower than expected.
• Database connections – Consider constraining database connections if you see high numbers of
user connections in conjunction with decreases in instance performance and response time. The
best number of user connections for your DB instance will vary based on your instance class and
the complexity of the operations being performed. You can determine the number of database
connections by associating your DB instance with a parameter group where the User Connections
parameter is set to other than 0 (unlimited). You can either use an existing parameter group or create a
new one. For more information, see Working with DB parameter groups (p. 284).
• IOPS metrics – The expected values for IOPS metrics depend on disk specification and server
configuration, so use your baseline to know what is typical. Investigate if values are consistently
different than your baseline. For best IOPS performance, make sure your typical working set will fit
into memory to minimize read and write operations.
For issues with any performance metrics, one of the first things you can do to improve performance is
tune the most used and most expensive queries to see if that lowers the pressure on system resources.
For more information, see Tuning queries (p. 185).
If your queries are tuned and an issue persists, consider upgrading your Amazon RDS DB instance
classes (p. 10) to one with more of the resource (CPU, RAM, disk space, network bandwidth, I/O capacity)
that is related to the issue you are experiencing.
Tuning queries
One of the best ways to improve DB instance performance is to tune your most commonly used and
most resource-intensive queries to make them less expensive to run. For information on improving
queries, use the following resources:
• MySQL – See Optimizing SELECT statements in the MySQL documentation. For additional query tuning
resources, see MySQL performance tuning and optimization resources.
• Oracle – See Database SQL Tuning Guide in the Oracle documentation.
• SQL Server – See Analyzing a query in the Microsoft documentation. You can also use the execution-,
index-, and I/O-related data management views (DMVs) described in System Dynamic Management
Views in the Microsoft documentation to troubleshoot SQL Server query issues.
A common aspect of query tuning is creating effective indexes. For potential index improvements
for your DB instance, see Database Engine Tuning Advisor in the Microsoft documentation. For
information on using Tuning Advisor on RDS for SQL Server, see Analyzing your database workload on
an Amazon RDS for SQL Server DB instance with Database Engine Tuning Advisor (p. 983).
• PostgreSQL – See Using EXPLAIN in the PostgreSQL documentation to learn how to analyze a query
plan. You can use this information to modify a query or underlying tables in order to improve query
performance.
For information about how to specify joins in your query for the best performance, see Controlling the
planner with explicit JOIN clauses.
• MariaDB – See Query optimizations in the MariaDB documentation.
185
Amazon Relational Database Service User Guide
Best practices for working with MySQL
Table size
Typically, operating system constraints on file sizes determine the effective maximum table size for
MySQL databases. So, the limits usually aren't determined by internal MySQL constraints.
On a MySQL DB instance, avoid tables in your database growing too large. Although the general storage
limit is 64 TiB, provisioned storage limits restrict the maximum size of a MySQL table file to 16 TiB.
Partition your large tables so that file sizes are well under the 16 TiB limit. This approach can also
improve performance and recovery time. For more information, see MySQL file size limits in Amazon
RDS (p. 1125).
Very large tables (greater than 100 GB in size) can negatively affect performance for both reads
and writes (including DML statements and especially DDL statements). Indexes on larges tables
can significantly improve select performance, but they can also degrade the performance of DML
statements. DDL statements, such as ALTER TABLE, can be significantly slower for the large tables
because those operations might completely rebuild a table in some cases. These DDL statements might
lock the tables for the duration of the operation.
The amount of memory required by MySQL for reads and writes depends on the tables involved in the
operations. It is a best practice to have at least enough RAM to the hold the indexes of actively used
tables. To find the ten largest tables and indexes in a database, use the following query:
Number of tables
While the underlying file system might have a limit on the number of files that represent tables, MySQL
has no limit on the number of tables. However, the total number of tables in the MySQL InnoDB storage
engine can contribute to the performance degradation, regardless of the size of those tables. To limit
the operating system impact, you can split the tables across multiple databases in the same MySQL DB
instance. Doing so might limit the number of files in a directory but won't solve the overall problem.
When there is performance degradation because of a large number of tables (more than 10 thousand), it
is caused by MySQL working with storage files, including opening and closing them. To address this issue,
you can increase the size of the table_open_cache and table_definition_cache parameters.
However, increasing the values of those parameters might significantly increase the amount of memory
MySQL uses, and might even use all of the available memory. For more information, see How MySQL
Opens and Closes Tables in the MySQL documentation.
In addition, too many tables can significantly affect MySQL startup time. Both a clean shutdown and
restart and a crash recovery can be affected, especially in versions prior to MySQL 8.0.
We recommend having fewer than ten thousand tables total across all of the databases in a DB instance.
For a use case with a large number of tables in a MySQL database, see One Million Tables in MySQL 8.0.
186
Amazon Relational Database Service User Guide
Storage engine
Storage engine
The point-in-time restore and snapshot restore features of Amazon RDS for MySQL require a crash-
recoverable storage engine and are supported for the InnoDB storage engine only. Although MySQL
supports multiple storage engines with varying capabilities, not all of them are optimized for crash
recovery and data durability. For example, the MyISAM storage engine does not support reliable crash
recovery and might prevent a Point-In-Time Restore or snapshot restore from working as intended. This
might result in lost or corrupt data when MySQL is restarted after a crash.
InnoDB is the recommended and supported storage engine for MySQL DB instances on Amazon RDS.
InnoDB instances can also be migrated to Aurora, while MyISAM instances can't be migrated. However,
MyISAM performs better than InnoDB if you require intense, full-text search capability. If you still choose
to use MyISAM with Amazon RDS, following the steps outlined in Automated backups with unsupported
MySQL storage engines (p. 396) can be helpful in certain scenarios for snapshot restore functionality.
If you want to convert existing MyISAM tables to InnoDB tables, you can use the process outlined in the
MySQL documentation. MyISAM and InnoDB have different strengths and weaknesses, so you should
fully evaluate the impact of making this switch on your applications before doing so.
In addition, Federated Storage Engine is currently not supported by Amazon RDS for MySQL.
Table size
Typically, operating system constraints on file sizes determine the effective maximum table size for
MariaDB databases. So, the limits usually aren't determined by internal MariaDB constraints.
On a MariaDB DB instance, avoid tables in your database growing too large. Although the general
storage limit is 64 TiB, provisioned storage limits restrict the maximum size of a MariaDB table file to 16
TiB. Partition your large tables so that file sizes are well under the 16 TiB limit. This approach can also
improve performance and recovery time.
Very large tables (greater than 100 GB in size) can negatively affect performance for both reads
and writes (including DML statements and especially DDL statements). Indexes on larges tables
can significantly improve select performance, but they can also degrade the performance of DML
statements. DDL statements, such as ALTER TABLE, can be significantly slower for the large tables
because those operations might completely rebuild a table in some cases. These DDL statements might
lock the tables for the duration of the operation.
The amount of memory required by MariaDB for reads and writes depends on the tables involved in
the operations. It is a best practice to have at least enough RAM to the hold the indexes of actively used
tables. To find the ten largest tables and indexes in a database, use the following query:
187
Amazon Relational Database Service User Guide
Number of tables
Number of tables
While the underlying file system might have a limit on the number of files that represent tables, MariaDB
has no limit on the number of tables. However, the total number of tables in the MariaDB InnoDB
storage engine can contribute to the performance degradation, regardless of the size of those tables.
To limit the operating system impact, you can split the tables across multiple databases in the same
MariaDB DB instance. Doing so might limit the number of files in a directory but won't solve the overall
problem.
When there is performance degradation because of a large number of tables (more than 10 thousand),
it is caused by MariaDB working with storage files, including opening and closing them. To address
this issue, you can increase the size of the table_open_cache and table_definition_cache
parameters. However, increasing the values of those parameters might significantly increase the amount
of memory MariaDB uses, and might even use all of the available memory. For more information, see
Optimizing table_open_cache in the MariaDB documentation.
In addition, too many tables can significantly affect MariaDB startup time. Both a clean shutdown and
restart and a crash recovery can be affected. We recommend having fewer than ten thousand tables total
across all of the databases in a DB instance.
Storage engine
The point-in-time restore and snapshot restore features of Amazon RDS for MariaDB require a crash-
recoverable storage engine. Although MariaDB supports multiple storage engines with varying
capabilities, not all of them are optimized for crash recovery and data durability. For example, although
Aria is a crash-safe replacement for MyISAM, it might still prevent a point-in-time restore or snapshot
restore from working as intended. This might result in lost or corrupt data when MariaDB is restarted
after a crash. InnoDB is the recommended and supported storage engine for MariaDB DB instances on
Amazon RDS. If you still choose to use Aria with Amazon RDS, following the steps outlined in Automated
backups with unsupported MariaDB storage engines (p. 397) can be helpful in certain scenarios for
snapshot restore functionality.
If you want to convert existing MyISAM tables to InnoDB tables, you can use the process outlined in the
MariaDB documentation. MyISAM and InnoDB have different strengths and weaknesses, so you should
fully evaluate the impact of making this switch on your applications before doing so.
A 2020 AWS virtual workshop included a presentation on running production Oracle databases on
Amazon RDS. A video of the presentation is available here.
188
Amazon Relational Database Service User Guide
Loading data into a PostgreSQL DB instance
For information on how Amazon RDS implements other common PostgreSQL DBA tasks, see Common
DBA tasks for PostgreSQL (p. 1823).
Modify your DB parameter group to include the following settings. You should test the parameter
settings to find the most efficient settings for your DB instance:
• Increase the value of the maintenance_work_mem parameter. For more information about
PostgreSQL resource consumption parameters, see the PostgreSQL documentation.
• Increase the value of the max_wal_size and checkpoint_timeout parameters to reduce the
number of writes to the wal log.
• Disable the synchronous_commit parameter.
• Disable the PostgreSQL autovacuum parameter.
• Make sure none of the tables you are importing are unlogged. Data stored in unlogged tables can be
lost during a failover. For more information, see CREATE TABLE UNLOGGED.
Use the pg_dump -Fc (compressed) or pg_restore -j (parallel) commands with these settings.
After the load operation completes, return your DB instance and DB parameters to their normal settings.
Your database administrator needs to know and understand this maintenance operation. For the
PostgreSQL documentation on autovacuum, see The Autovacuum Daemon.
Autovacuum is not a "resource free" operation, but it works in the background and yields to user
operations as much as possible. When enabled, autovacuum checks for tables that have had a large
number of updated or deleted tuples. It also protects against loss of very old data due to transaction ID
wraparound. For more information, see Preventing transaction ID wraparound failures.
Autovacuum should not be thought of as a high-overhead operation that can be reduced to gain better
performance. On the contrary, tables that have a high velocity of updates and deletes will quickly
deteriorate over time if autovacuum is not run.
Important
Not running autovacuum can result in an eventual required outage to perform a much
more intrusive vacuum operation. When an Amazon RDS PostgreSQL DB instance becomes
unavailable because of an over conservative use of autovacuum, the PostgreSQL database will
189
Amazon Relational Database Service User Guide
Amazon RDS for PostgreSQL best practices video
shut down to protect itself. At that point, Amazon RDS must perform a single-user-mode full
vacuum directly on the DB instance , which can result in a multi-hour outage. Thus, we strongly
recommend that you do not turn off autovacuum, which is enabled by default.
The autovacuum parameters determine when and how hard autovacuum works.
Theautovacuum_vacuum_threshold and autovacuum_vacuum_scale_factor parameters
determine when autovacuum is run. The autovacuum_max_workers, autovacuum_nap_time,
autovacuum_cost_limit, and autovacuum_cost_delay parameters determine how hard
autovacuum works. For more information about autovacuum, when it runs, and what parameters are
required, see Routine Vacuuming in the PostgreSQL documentation.
The following query shows the number of "dead" tuples in a table named table1:
• Use Amazon RDS DB events to monitor failovers. For example, you can be notified by text message
or email when a DB instance fails over. For more information about Amazon RDS events, see Using
Amazon RDS event notification (p. 571).
• If your application caches DNS values, set time to live (TTL) to less than 30 seconds. Setting TTL as so
is a good practice in case there is a failover, where the IP address might change and the cached value
might no longer be in service.
• We recommend that you do not enable the following modes because they turn off transaction logging,
which is required for Multi-AZ:
• Simple recover mode
• Offline mode
• Read-only mode
• Test to determine how long it takes for your DB instance to failover. Failover time can vary due to
the type of database, the instance class, and the storage type you use. You should also test your
application's ability to continue working if a failover occurs.
• To shorten failover time, you should do the following:
• Ensure that you have sufficient Provisioned IOPS allocated for your workload. Inadequate I/O can
lengthen failover times. Database recovery requires I/O.
• Use smaller transactions. Database recovery relies on transactions, so if you can break up large
transactions into multiple smaller transactions, your failover time should be shorter.
190
Amazon Relational Database Service User Guide
Amazon RDS for SQL Server best practices video
• Take into consideration that during a failover, there will be elevated latencies. As part of the failover
process, Amazon RDS automatically replicates your data to a new standby instance. This replication
means that new data is being committed to two different DB instances, so there might be some
latency until the standby DB instance has caught up to the new primary DB instance.
• Deploy your applications in all Availability Zones. If an Availability Zone does go down, your
applications in the other Availability Zones will still be available.
When working with a Multi-AZ deployment of SQL Server, remember that Amazon RDS creates replicas
for all SQL Server databases on your instance. If you don't want specific databases to have secondary
replicas, set up a separate DB instance that doesn't use Multi-AZ for those databases.
For information about backing up your DB instance, see Backing up and restoring an Amazon RDS DB
instance (p. 387).
To determine the preferred minor version, you can run the describe-db-engine-versions command
with the --default-only option as shown in the following example.
{
"DBEngineVersions": [
{
"Engine": "postgres",
"EngineVersion": "12.5",
"DBParameterGroupFamily": "postgres12",
"DBEngineDescription": "PostgreSQL",
"DBEngineVersionDescription": "PostgreSQL 12.5-R1",
...some output truncated...
}
]
}
191
Amazon Relational Database Service User Guide
Amazon RDS new features and
best practices presentation video
192
Amazon Relational Database Service User Guide
You can configure a DB instance with an option group and a DB parameter group.
• An option group specifies features, called options, that are available for a particular Amazon RDS DB
instance.
• A DB parameter group acts as a container for engine configuration values that are applied to one or
more DB instances.
The options and parameters that are available depend on the DB engine and DB engine version. You can
specify an option group and a DB parameter group when you create a DB instance, or you can modify a
DB instance to specify them.
Topics
• Creating an Amazon RDS DB instance (p. 194)
• Creating Amazon RDS resources with AWS CloudFormation (p. 214)
• Connecting to an Amazon RDS DB instance (p. 215)
• Using Amazon RDS Proxy (p. 221)
• Working with option groups (p. 268)
• Working with DB parameter groups (p. 284)
193
Amazon Relational Database Service User Guide
Creating a DB instance
Console
You can create a DB instance by using the AWS Management Console with Easy create enabled or
not enabled. With Easy create enabled, you specify only the DB engine type, DB instance size, and DB
instance identifier. Easy create uses the default setting for other configuration options. With Easy create
not enabled, you specify more configuration options when you create a database, including ones for
availability, security, backups, and maintenance.
Note
In the following procedure, Standard create is enabled, and Easy create isn't enabled. This
procedure uses Microsoft SQL Server as an example.
For examples that use Easy create to walk you through creating and connecting to sample DB
instances for each engine, see Getting started with Amazon RDS (p. 118). For an example that
uses the original console to create a DB instance, see Original console example (p. 209).
To create a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database.
5. In Choose a database creation method, select Standard Create.
6. In Engine options, choose the engine type: MariaDB, Microsoft SQL Server, MySQL, Oracle, or
PostgreSQL. Microsoft SQL Server is shown here.
194
Amazon Relational Database Service User Guide
Creating a DB instance
7. For Edition, if you're using Oracle or SQL Server choose the DB engine edition that you want to use.
MySQL has only one option for the edition, and MariaDB and PostgreSQL have none.
8. For Version, choose the engine version.
9. In Templates, choose the template that matches your use case. If you choose Production, the
following are preselected in a later step:
195
Amazon Relational Database Service User Guide
Creating a DB instance
b. If you want to specify a password, clear the Auto generate a password check box if it is
selected.
c. (Optional) Change the Master username value.
d. Enter the same password in Master password and Confirm password.
11. For the remaining sections, specify your DB instance settings. For information about each setting,
see Settings for DB instances (p. 197).
12. Choose Create database.
If you chose to use an automatically generated password, the View credential details button
appears on the Databases page.
To view the master user name and password for the DB instance, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important
You can't view the master user password again. If you don't record it, you might have to
change it. If you need to change the master user password after the DB instance is available,
modify the DB instance to do so. For more information about modifying a DB instance, see
Modifying an Amazon RDS DB instance (p. 306).
13. For Databases, choose the name of the new DB instance.
On the RDS console, the details for the new DB instance appear. The DB instance has a status of
Creating until the DB instance is created and ready for use. When the state changes to Available,
you can connect to the DB instance. Depending on the DB instance class and storage allocated, it can
take several minutes for the new instance to be available.
AWS CLI
To create a DB instance by using the AWS CLI, call the create-db-instance command with the following
parameters:
• --db-instance-identifier
• --db-instance-class
• --vpc-security-group-ids
• --db-subnet-group
• --engine
196
Amazon Relational Database Service User Guide
Available settings
• --master-username
• --master-user-password
• --allocated-storage
• --backup-retention-period
For information about each setting, see Settings for DB instances (p. 197).
Example
For Windows:
RDS API
To create a DB instance by using the Amazon RDS API, call the CreateDBInstance operation.
For information about each setting, see Settings for DB instances (p. 197).
You can create a DB instance using the console, the create-db-instance CLI command, or the
CreateDBInstance RDS API operation.
197
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Auto minor Enable auto minor version upgrade CLI option: All
version upgrade to enable your DB instance to
receive preferred minor DB engine --auto-minor-version-upgrade
version upgrades automatically
when they become available. --no-auto-minor-version-
Amazon RDS performs automatic upgrade
minor version upgrades in the
API parameter:
maintenance window.
AutoMinorVersionUpgrade
For more information, see
Automatically upgrading the minor
engine version (p. 333).
Availability zone The Availability Zone for your DB CLI option: All
instance. Use the default value of
No Preference unless you want to --availability-zone
specify an Availability Zone.
API parameter:
For more information, see Regions,
Availability Zones, and Local Zones AvailabilityZone
(p. 55).
AWS KMS key Only available if Encryption is set to CLI option: All
Enable encryption. Choose the AWS
KMS key to use for encrypting this --kms-key-id
DB instance. For more information,
API parameter:
198
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
see Encrypting Amazon RDS KmsKeyId
resources (p. 1879).
Backup The number of days that you want CLI option: All
retention period automatic backups of your DB
instance to be retained. For any --backup-retention-period
nontrivial DB instance, set this value
to 1 or greater. API parameter:
Backup window The time period during which CLI option: All
Amazon RDS automatically takes
a backup of your DB instance. --preferred-backup-window
Unless you have a specific time that
you want to have your database API parameter:
backed up, use the default of No
PreferredBackupWindow
Preference.
199
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Character set The character set for your DB CLI option: Oracle
instance. The default value of
AL32UTF8 for the DB character --character-set-name
set is for the Unicode 5.0 UTF-8
Universal character set. You can't API parameter:
change the DB character set after
CharacterSetName
you create the DB instance.
In a single-tenant configuration, a
non-default DB character set affects
only the PDB, not the CDB. For more
information, see RDS for Oracle
architecture (p. 1173).
Copy tags to This option copies any DB instance CLI option: All
snapshots tags to a DB snapshot when you
create a snapshot. --copy-tags-to-snapshot
CopyTagsToSnapshot
200
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Database Choose Amazon RDS if you For the CLI and API, you specify the Oracle
management don't need to customize your database engine type.
type environment.
201
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Database port The port that you want to access CLI option: All
the DB instance through. The
default port is shown. If you use --port
a DB security group with your DB
instance, this port value must be the RDS API parameter:
same one that you provided when
Port
creating the DB security group.
Note
The firewalls at some
companies block
connections to the default
MariaDB, MySQL, and
PostgreSQL ports. If your
company firewall blocks the
default port, enter another
port for your DB instance.
EngineVersion
202
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
StorageEncrypted
MonitoringRoleArn
Engine
203
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Initial database The name for the database on your CLI option: All except
name DB instance. If you don't provide a SQL Server
name, Amazon RDS doesn't create a --db-name
database on the DB instance (except
for Oracle and PostgreSQL). The RDS API parameter:
name can't be a word reserved by
DBName
the database engine, and has other
constraints depending on the DB
engine.
Oracle:
PostgreSQL:
Log exports The types of database log files to CLI option: All
publish to Amazon CloudWatch
Logs. --enable-cloudwatch-logs-
exports
For more information, see
Publishing database logs to Amazon RDS API parameter:
CloudWatch Logs (p. 595).
EnableCloudwatchLogsExports
204
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Master The password for your master user CLI option: All
password account. The password has the
following number of printable ASCII --master-user-password
characters (excluding /, ", a space,
and @) depending on the DB engine: RDS API parameter:
Master The name that you use as the CLI option: All
username master user name to log on to
your DB instance with all database --master-username
privileges.
RDS API parameter:
• It can contain 1–16 alphanumeric
characters and underscores. MasterUsername
• Its first character must be a letter.
• It can't be a word reserved by the
database engine.
Microsoft SQL Enable Microsoft SQL Server CLI options: SQL Server
Server Windows Windows authentication, then
Authentication Browse Directory to choose the --domain
directory where you want to
allow authorized domain users --domain-iam-role-name
to authenticate with this SQL
RDS API parameters:
Server instance using Windows
Authentication. Domain
DomainIAMRoleName
205
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
National The national character set for your CLI option: Oracle
character set DB instance, commonly called the
(NCHAR) NCHAR character set. You can set --nchar-character-set-name
the national character set to either
AL16UTF16 (default) or UTF-8. You API parameter:
can't change the national character
NcharCharacterSetName
set after you create the DB instance.
206
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
207
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Storage type The storage type for your DB CLI option: All
instance.
--storage-type
For more information, see Amazon
RDS storage types (p. 48). RDS API parameter:
StorageType
208
Amazon Relational Database Service User Guide
Original console example
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
DBSubnetGroupName
Time zone The time zone for your DB instance. CLI option: SQL Server
If you don't choose a time zone,
your DB instance uses the default --timezone
time zone. You can't change the
time zone after the DB instance is RDS API parameter:
created.
Timezone
For more information, see Local
time zone for Microsoft SQL Server
DB instances (p. 815).
Virtual Private A Amazon VPC to associate with this For the CLI and API, you specify the VPC All
Cloud (VPC) DB instance. security group IDs.
VPC security The security group to associate with CLI option: All
group the DB instance.
--vpc-security-group-ids
For more information, see VPC
security groups (p. 1948). RDS API parameter:
VpcSecurityGroupIds
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to
create the DB instance.
3. In the navigation pane, choose Databases.
If the navigation pane is closed, choose the menu icon at the top left to open it.
4. Choose Create database to open the Select engine page.
5. Choose the Microsoft SQL Server icon.
209
Amazon Relational Database Service User Guide
Original console example
6. Choose the SQL Server DB engine edition that you want to use. The SQL Server editions that are
available vary by AWS Region.
7. For some editions, the Use Case step asks if you are planning to use the DB instance you are creating
for production. If you are, choose Production. If you choose Production, the following are all
preselected in a later step:
210
Amazon Relational Database Service User Guide
Original console example
On the Specify DB Details page, specify your DB instance information. For information about each
setting, see Settings for DB instances (p. 197).
On the Configure Advanced Settings page, provide additional information that Amazon
RDS needs to launch the DB instance. For information about each setting, see Settings for DB
instances (p. 197).
211
Amazon Relational Database Service User Guide
Original console example
On the RDS console, the new DB instance appears in the list of DB instances. The DB instance has a status
of creating until the DB instance is ready to use. When the state changes to available, you can connect
to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to 20
minutes before the new instance is available.
212
Amazon Relational Database Service User Guide
Original console example
213
Amazon Relational Database Service User Guide
Creating resources with AWS CloudFormation
When you use AWS CloudFormation, you can reuse your template to set up your RDS resources
consistently and repeatedly. Describe your resources once, and then provision the same resources over
and over in multiple AWS accounts and Regions.
RDS supports creating resources in AWS CloudFormation. For more information, including examples
of JSON and YAML templates for these resources, see the RDS resource type reference in the AWS
CloudFormation User Guide.
• AWS CloudFormation
• AWS CloudFormation User Guide
• AWS CloudFormation API Reference
• AWS CloudFormation Command Line Interface User Guide
214
Amazon Relational Database Service User Guide
Connecting to a DB instance
Topics
• Finding the connection information for an Amazon RDS DB instance (p. 215)
• Database authentication options (p. 218)
• Encrypted connections (p. 219)
• Scenarios for accessing a DB instance in a VPC (p. 219)
• Connecting to a DB instance that is running a specific DB engine (p. 219)
• Managing connections with RDS Proxy (p. 220)
The endpoint is unique for each DB instance, and the values of the port and user can vary. The following
list shows the most common port for each DB engine:
• MariaDB – 3306
• Microsoft SQL Server – 1433
• MySQL – 3306
• Oracle – 1521
• PostgreSQL – 5432
To connect to a DB instance, use any client for a DB engine. For example, you might use the mysql utility
to connect to a MariaDB or MySQL DB instance. You might use Microsoft SQL Server Management Studio
to connect to a SQL Server DB instance. You might use Oracle SQL Developer to connect to an Oracle DB
instance, or the psql command line utility to connect to a PostgreSQL DB instance.
To find the connection information for a DB instance, you can use the AWS Management Console, the
AWS Command Line Interface (AWS CLI) describe-db-instances command, or the Amazon RDS API
DescribeDBInstances operation to list its details.
215
Amazon Relational Database Service User Guide
Finding the connection information
Console
To find the connection information for a DB instance in the AWS Management Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases to display a list of your DB instances.
3. Choose the name of the DB instance to display its details.
4. On the Connectivity & security tab, copy the endpoint. Also, note the port number. You need both
the endpoint and the port number to connect to the DB instance.
216
Amazon Relational Database Service User Guide
Finding the connection information
5. If you need to find the master user name, choose the Configuration tab and view the Master
username value.
AWS CLI
To find the connection information for a DB instance by using the AWS CLI, call the describe-db-
instances command. In the call, query for the DB instance ID, endpoint, port, and master user name.
217
Amazon Relational Database Service User Guide
Database authentication options
For Windows:
[
[
"mydb",
"mydb.123456789012.us-east-1.rds.amazonaws.com",
3306,
"admin"
],
[
"myoracledb",
"myoracledb.123456789012.us-east-1.rds.amazonaws.com",
1521,
"dbadmin"
],
[
"mypostgresqldb",
"mypostgresqldb.123456789012.us-east-1.rds.amazonaws.com",
5432,
"postgresadmin"
]
]
RDS API
To find the connection information for a DB instance by using the Amazon RDS API, call the
DescribeDBInstances operation. In the output, find the values for the endpoint address, endpoint port,
and master user name.
• Password authentication – Your DB instance performs all administration of user accounts. You create
users and specify passwords with SQL statements. The SQL statements you can use depend on your
DB engine.
• AWS Identity and Access Management (IAM) database authentication – You don't need to use a
password when you connect to a DB instance. Instead, you use an authentication token.
• Kerberos authentication – You use external authentication of database users using Kerberos and
Microsoft Active Directory. Kerberos is a network authentication protocol that uses tickets and
symmetric-key cryptography to eliminate the need to transmit passwords over the network. Kerberos
has been built into Active Directory and is designed to authenticate users to network resources, such as
databases.
IAM database authentication and Kerberos authentication are available only for specific DB engines and
versions.
218
Amazon Relational Database Service User Guide
Encrypted connections
For more information, see Database authentication with Amazon RDS (p. 1877).
Encrypted connections
You can use Secure Socket Layer (SSL) or Transport Layer Security (TLS) from your application to encrypt
a connection to a DB instance. Each DB engine has its own process for implementing SSL/TLS. For more
information, see Using SSL/TLS to encrypt a connection to a DB instance (p. 1883).
A VPC security group controls access to DB instances inside a VPC. Each VPC security group rule enables
a specific source to access a DB instance in a VPC that is associated with that VPC security group. The
source can be a range of addresses (for example, 203.0.113.0/24), or another VPC security group. By
specifying a VPC security group as the source, you allow incoming traffic from all instances (typically
application servers) that use the source VPC security group.
Before attempting to connect to your DB instance, configure your VPC for your use case. The following
are common scenarios for accessing a DB instance in a VPC:
• A DB instance in a VPC accessed by an Amazon EC2 instance in the same VPC – A common use of a
DB instance in a VPC is to share data with an application server that is running in an EC2 instance in
the same VPC. The EC2 instance might run a web server with an application that interacts with the DB
instance.
• A DB instance in a VPC accessed by an EC2 instance in a different VPC – When your DB instance is in
a different VPC from the EC2 instance that you're using to access it, you can use VPC peering to access
the DB instance.
• A DB instance in a VPC accessed by a client application through the internet – To access a DB
instance in a VPC from a client application through the internet, you configure a VPC with a single
public subnet, and an internet gateway to enable communication over the internet.
To connect to a DB instance from outside of its VPC, the DB instance must be publicly accessible.
Also, access must be granted using the inbound rules of the DB instance's security group, and
other requirements must be met. For more information, see Can't connect to Amazon RDS DB
instance (p. 2005).
• A DB instance in a VPC accessed by a private network – If your DB instance isn't publicly accessible,
you can use an AWS Site-to-Site VPN connection or an AWS Direct Connect connection to access it
from a private network.
• A DB instance in a VPC accessed by an EC2 instance not in a VPC – You can communicate between a
DB instance that is in a VPC and an EC2 instance that is not in a VPC by using ClassicLink.
For more information, see Scenarios for accessing a DB instance in a VPC (p. 1982).
219
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• Connecting to a DB instance running the Microsoft SQL Server database engine (p. 824)
• Connecting to a DB instance running the MySQL database engine (p. 1012)
• Connecting to your Oracle DB instance (p. 1180)
• Connecting to a DB instance running the PostgreSQL database engine (p. 1748)
220
Amazon Relational Database Service User Guide
Using RDS Proxy
Using RDS Proxy, you can handle unpredictable surges in database traffic that otherwise might cause
issues due to oversubscribing connections or creating new connections at a fast rate. RDS Proxy
establishes a database connection pool and reuses connections in this pool without the memory and
CPU overhead of opening a new database connection each time. To protect the database against
oversubscription, you can control the number of database connections that are created.
RDS Proxy queues or throttles application connections that can't be served immediately from the pool
of connections. Although latencies might increase, your application can continue to scale without
abruptly failing or overwhelming the database. If connection requests exceed the limits you specify, RDS
Proxy rejects application connections (that is, it sheds load). At the same time, it maintains predictable
performance for the load that can be served with the available capacity.
You can reduce the overhead to process credentials and establish a secure connection for each new
connection. RDS Proxy can handle some of that work on behalf of the database.
Topics
• Supported engines and Region availability for RDS Proxy (p. 221)
• Quotas and limitations for RDS Proxy (p. 222)
• Planning where to use RDS Proxy (p. 223)
• RDS Proxy concepts and terminology (p. 224)
• Getting started with RDS Proxy (p. 228)
• Managing an RDS Proxy (p. 239)
• Working with Amazon RDS Proxy endpoints (p. 248)
• Monitoring RDS Proxy using Amazon CloudWatch (p. 254)
• RDS Proxy command-line examples (p. 259)
• Troubleshooting for RDS Proxy (p. 261)
• Using RDS Proxy with AWS CloudFormation (p. 266)
• US East (Ohio)
221
Amazon Relational Database Service User Guide
Quotas and limitations
• You can have up to 20 proxies for each AWS account ID. If your application requires more proxies, you
can request additional proxies by opening a ticket with the AWS Support organization.
• Each proxy can have up to 200 associated Secrets Manager secrets. Thus, each proxy can connect to
with up to 200 different user accounts at any given time.
• You can create, view, modify, and delete up to 20 endpoints for each proxy. These endpoints are in
addition to the default endpoint that's automatically created for each proxy.
• In an Aurora cluster, all of the connections using the default proxy endpoint are handled by the Aurora
writer instance. To perform load balancing for read-intensive workloads, you can create a read-only
endpoint for a proxy. That endpoint passes connections to the reader endpoint of the cluster. That
way, your proxy connections can take advantage of Aurora read scalability. For more information, see
Overview of proxy endpoints (p. 248).
For RDS DB instances in replication configurations, you can associate a proxy only with the writer DB
instance, not a read replica.
• You can't use RDS Proxy with Aurora Serverless clusters.
• Using RDS Proxy with Aurora clusters that are part of an Aurora global database isn't currently
supported.
• Your RDS Proxy must be in the same virtual private cloud (VPC) as the database. The proxy can't be
publicly accessible, although the database can be.
Note
For Aurora DB clusters, you can turn on cross-VPC access. To do this, create an additional
endpoint for a proxy and specify a different VPC, subnets, and security groups with
that endpoint. For more information, see Accessing Aurora and RDS databases across
VPCs (p. 249).
• You can't use RDS Proxy with a VPC that has its tenancy set to dedicated.
• If you use RDS Proxy with an RDS DB instance or Aurora DB cluster that has IAM authentication
enabled, make sure that all users who connect through a proxy authenticate through user names and
passwords. See Setting up AWS Identity and Access Management (IAM) policies (p. 230) for details
about IAM support in RDS Proxy.
• You can't use RDS Proxy with custom DNS.
• RDS Proxy is available for the MySQL and PostgreSQL engine families.
• Each proxy can be associated with a single target DB instance or cluster. However, you can associate
multiple proxies with the same DB instance or cluster.
222
Amazon Relational Database Service User Guide
Planning where to use RDS Proxy
• Any DB instance or cluster that encounters "too many connections" errors is a good candidate for
associating with a proxy. The proxy enables applications to open many client connections, while the
proxy manages a smaller number of long-lived connections to the DB instance or cluster.
• For DB instances or clusters that use smaller AWS instance classes, such as T2 or T3, using a proxy
can help avoid out-of-memory conditions. It can also help reduce the CPU overhead for establishing
connections. These conditions can occur when dealing with large numbers of connections.
• You can monitor certain Amazon CloudWatch metrics to determine whether a DB instance or cluster
is approaching certain types of limit. These limits are for the number of connections and the memory
associated with connection management. You can also monitor certain CloudWatch metrics to
determine whether a DB instance or cluster is handling many short-lived connections. Opening and
closing such connections can impose performance overhead on your database. For information about
the metrics to monitor, see Monitoring RDS Proxy using Amazon CloudWatch (p. 254).
• AWS Lambda functions can also be good candidates for using a proxy. These functions make frequent
short database connections that benefit from connection pooling offered by RDS Proxy. You can take
advantage of any IAM authentication you already have for Lambda functions, instead of managing
database credentials in your Lambda application code.
• Applications that use languages and frameworks such as PHP and Ruby on Rails are typically good
candidates for using a proxy. Such applications typically open and close large numbers of database
connections, and don't have built-in connection pooling mechanisms.
• Applications that keep a large number of connections open for long periods are typically good
candidates for using a proxy. Applications in industries such as software as a service (SaaS) or
ecommerce often minimize the latency for database requests by leaving connections open. With RDS
Proxy, an application can keep more connections open than it can when connecting directly to the DB
instance or cluster.
• You might not have adopted IAM authentication and Secrets Manager due to the complexity of
setting up such authentication for all DB instances and clusters. If so, you can leave the existing
223
Amazon Relational Database Service User Guide
RDS Proxy concepts and terminology
authentication methods in place and delegate the authentication to a proxy. The proxy can enforce
the authentication policies for client connections for particular applications. You can take advantage
of any IAM authentication you already have for Lambda functions, instead of managing database
credentials in your Lambda application code.
• RDS Proxy is highly available and deployed over multiple Availability Zones (AZs). To ensure overall
high availability for your database, deploy your Amazon RDS DB instance or Aurora cluster in a Multi-
AZ configuration.
RDS Proxy handles the network traffic between the client application and the database. It does so in an
active way first by understanding the database protocol. It then adjusts its behavior based on the SQL
operations from your application and the result sets from the database.
RDS Proxy reduces the memory and CPU overhead for connection management on your database.
The database needs less memory and CPU resources when applications open many simultaneous
connections. It also doesn't require logic in your applications to close and reopen connections that stay
idle for a long time. Similarly, it requires less application logic to reestablish connections in case of a
database problem.
The infrastructure for RDS Proxy is highly available and deployed over multiple Availability Zones (AZs).
The computation, memory, and storage for RDS Proxy are independent of your RDS DB instances and
Aurora DB clusters. This separation helps lower overhead on your database servers, so that they can
devote their resources to serving database workloads. The RDS Proxy compute resources are serverless,
automatically scaling based on your database workload.
Topics
• Overview of RDS Proxy concepts (p. 224)
• Connection pooling (p. 225)
• RDS Proxy security (p. 225)
• Failover (p. 227)
• Transactions (p. 227)
Each proxy handles connections to a single RDS DB instance or Aurora DB cluster. The proxy
automatically determines the current writer instance for RDS Multi-AZ DB instances and Aurora
provisioned clusters. For Aurora multi-master clusters, the proxy connects to one of the writer instances
and uses the other writer instances as hot standby targets.
The connections that a proxy keeps open and available for your database application to use make up the
connection pool.
By default, RDS Proxy can reuse a connection after each transaction in your session. This transaction-
level reuse is called multiplexing. When RDS Proxy temporarily removes a connection from the
connection pool to reuse it, that operation is called borrowing the connection. When it's safe to do so,
RDS Proxy returns that connection to the connection pool.
224
Amazon Relational Database Service User Guide
RDS Proxy concepts and terminology
In some cases, RDS Proxy can't be sure that it's safe to reuse a database connection outside of the current
session. In these cases, it keeps the session on the same connection until the session ends. This fallback
behavior is called pinning.
A proxy has a default endpoint. You connect to this endpoint when you work with an RDS DB instance
or Aurora DB cluster, instead of connecting to the read/write endpoint that connects directly to the
instance or cluster. The special-purpose endpoints for an Aurora cluster remain available for you to use.
For Aurora DB clusters, you can also create additional read/write and read-only endpoints. For more
information, see Overview of proxy endpoints (p. 248).
For example, you can still connect to the cluster endpoint for read/write connections without connection
pooling. You can still connect to the reader endpoint for load-balanced read-only connections. You
can still connect to the instance endpoints for diagnosis and troubleshooting of specific DB instances
within an Aurora cluster. If you are using other AWS services such as AWS Lambda to connect to RDS
databases, you change their connection settings to use the proxy endpoint. For example, you specify the
proxy endpoint to allow Lambda functions to access your database while taking advantage of RDS Proxy
functionality.
Each proxy contains a target group. This target group embodies the RDS DB instance or Aurora DB cluster
that the proxy can connect to. For an Aurora cluster, by default the target group is associated with all
the DB instances in that cluster. That way, the proxy can connect to whichever Aurora DB instance is
promoted to be the writer instance in the cluster. The RDS DB instance associated with a proxy, or the
Aurora DB cluster and its instances, are called the targets of that proxy. For convenience, when you create
a proxy through the console, RDS Proxy also creates the corresponding target group and registers the
associated targets automatically.
An engine family is a related set of database engines that use the same DB protocol. You choose the
engine family for each proxy that you create.
Connection pooling
Each proxy performs connection pooling for the writer instance of its associated RDS or Aurora database.
Connection pooling is an optimization that reduces the overhead associated with opening and closing
connections and with keeping many connections open simultaneously. This overhead includes memory
needed to handle each new connection. It also involves CPU overhead to close each connection and
open a new one, such as Transport Layer Security/Secure Sockets Layer (TLS/SSL) handshaking,
authentication, negotiating capabilities, and so on. Connection pooling simplifies your application logic.
You don't need to write application code to minimize the number of simultaneous open connections.
Each proxy also performs connection multiplexing, also known as connection reuse. With multiplexing,
RDS Proxy performs all the operations for a transaction using one underlying database connection, then
can use a different connection for the next transaction. You can open many simultaneous connections
to the proxy, and the proxy keeps a smaller number of connections open to the DB instance or cluster.
Doing so further minimizes the memory overhead for connections on the database server. This technique
also reduces the chance of "too many connections" errors.
RDS Proxy can act as an additional layer of security between client applications and the underlying
database. For example, you can connect to the proxy using TLS 1.2, even if the underlying DB instance
supports only TLS 1.0 or 1.1. You can connect to the proxy using an IAM role, even if the proxy connects
to the database using the native user and password authentication method. By using this technique, you
225
Amazon Relational Database Service User Guide
RDS Proxy concepts and terminology
can enforce strong authentication requirements for database applications without a costly migration
effort for the DB instances themselves.
You store the database credentials used by RDS Proxy in AWS Secrets Manager. Each database user
for the RDS DB instance or Aurora DB cluster accessed by a proxy must have a corresponding secret
in Secrets Manager. You can also set up IAM authentication for users of RDS Proxy. By doing so,
you can enforce IAM authentication for database access even if the databases use native password
authentication. We recommend using these security features instead of embedding database credentials
in your application code.
To enforce TLS for all connections between the proxy and your database, you can specify a setting
Require Transport Layer Security when you create or modify a proxy.
RDS Proxy can also ensure that your session uses TLS/SSL between your client and the RDS Proxy
endpoint. To have RDS Proxy do so, specify the requirement on the client side. SSL session variables are
not set for SSL connections to a database using RDS Proxy.
• For RDS for MySQL and Aurora MySQL, specify the requirement on the client side with the --ssl-
mode parameter when you run the mysql command.
• For Amazon RDS PostgreSQL and Aurora PostgreSQL, specify sslmode=require as part of the
conninfo string when you run the psql command.
RDS Proxy supports TLS protocol version 1.0, 1.1, and 1.2. You can connect to the proxy using a higher
version of TLS than you use in the underlying database.
By default, client programs establish an encrypted connection with RDS Proxy, with further control
available through the --ssl-mode option. From the client side, RDS Proxy supports all SSL modes.
PREFERRED
No SSL is allowed.
REQUIRED
Enforce SSL.
VERIFY_CA
226
Amazon Relational Database Service User Guide
RDS Proxy concepts and terminology
When using a client with --ssl-mode VERIFY_CA or VERIFY_IDENTITY, specify the --ssl-ca option
pointing to a CA in .pem format. For a .pem file that you can use, download the Amazon root CA 1 trust
store from Amazon Trust Services.
RDS Proxy uses wildcard certificates, which apply to a both a domain and its subdomains. If you use the
mysql client to connect with SSL mode VERIFY_IDENTITY, currently you must use the MySQL 8.0-
compatible mysql command.
Failover
Failover is a high-availability feature that replaces a database instance with another one when the
original instance becomes unavailable. A failover might happen because of a problem with a database
instance. It might also be part of normal maintenance procedures, such as during a database upgrade.
Failover applies to RDS DB instances in a Multi-AZ configuration, and Aurora DB clusters with one or
more reader instances in addition to the writer instance.
Connecting through a proxy makes your application more resilient to database failovers. When the
original DB instance becomes unavailable, RDS Proxy connects to the standby database without dropping
idle application connections. Doing so helps to speed up and simplify the failover process. The result is
faster failover that's less disruptive to your application than a typical reboot or database problem.
Without RDS Proxy, a failover involves a brief outage. During the outage, you can't perform write
operations on that database. Any existing database connections are disrupted and your application must
reopen them. The database becomes available for new connections and write operations when a read-
only DB instance is promoted to take the place of the one that's unavailable.
During DB failovers, RDS Proxy continues to accept connections at the same IP address and automatically
directs connections to the new primary DB instance. Clients connecting through RDS Proxy are not
susceptible to the following:
For applications that maintain their own connection pool, going through RDS Proxy means that most
connections stay alive during failovers or other disruptions. Only connections that are in the middle of a
transaction or SQL statement are canceled. RDS Proxy immediately accepts new connections. When the
database writer is unavailable, RDS Proxy queues up incoming requests.
For applications that don't maintain their own connection pools, RDS Proxy offers faster connection
rates and more open connections. It offloads the expensive overhead of frequent reconnects from the
database. It does so by reusing database connections maintained in the RDS Proxy connection pool. This
approach is particularly important for TLS connections, where setup costs are significant.
Transactions
All the statements within a single transaction always use the same underlying database connection.
The connection becomes available for use by a different session when the transaction ends. Using the
transaction as the unit of granularity has the following consequences:
• Connection reuse can happen after each individual statement when the RDS for MySQL or Aurora
MySQL autocommit setting is enabled.
227
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
• Conversely, when the autocommit setting is disabled, the first statement you issue in a session
begins a new transaction. Thus, if you enter a sequence of SELECT, INSERT, UPDATE, and other data
manipulation language (DML) statements, connection reuse doesn't happen until you issue a COMMIT,
ROLLBACK, or otherwise end the transaction.
• Entering a data definition language (DDL) statement causes the transaction to end after that
statement completes.
RDS Proxy detects when a transaction ends through the network protocol used by the database client
application. Transaction detection doesn't rely on keywords such as COMMIT or ROLLBACK appearing in
the text of the SQL statement.
In some cases, RDS Proxy might detect a database request that makes it impractical to move your session
to a different connection. In these cases, it turns off multiplexing for that connection the remainder
of your session. The same rule applies if RDS Proxy can't be certain that multiplexing is practical for
the session. This operation is called pinning. For ways to detect and minimize pinning, see Avoiding
pinning (p. 245).
Topics
• Setting up network prerequisites (p. 228)
• Setting up database credentials in AWS Secrets Manager (p. 229)
• Setting up AWS Identity and Access Management (IAM) policies (p. 230)
• Creating an RDS Proxy (p. 233)
• Viewing an RDS Proxy (p. 236)
• Connecting to a database through RDS Proxy (p. 237)
The following Linux example shows AWS CLI commands that examine the VPCs and subnets owned by
your AWS account. In particular, you pass subnet IDs as parameters when you create a proxy using the
CLI.
The following Linux example shows AWS CLI commands to determine the subnet IDs corresponding
to a specific Aurora DB cluster or RDS DB instance. For an Aurora cluster, first you find the ID for one
of the associated DB instances. You can extract the subnet IDs used by that DB instance by examining
the nested fields within the DBSubnetGroup and Subnets attributes in the describe output for the DB
instance. You specify some or all of those subnet IDs when setting up a proxy for that database server.
228
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
$ # Optional first step, only needed if you're starting from an Aurora cluster. Find the ID
of any DB instance in the cluster.
$ aws rds describe-db-clusters --db-cluster-identifier my_cluster_id --query '*[].
[DBClusterMembers]|[0]|[0][*].DBInstanceIdentifier' --output text
my_instance_id
instance_id_2
instance_id_3
...
$ # From the DB instance, trace through the DBSubnetGroup and Subnets to find the subnet
IDs.
$ aws rds describe-db-instances --db-instance-identifier my_instance_id --query '*[].
[DBSubnetGroup]|[0]|[0]|[Subnets]|[0]|[*].SubnetIdentifier' --output text
subnet_id_1
subnet_id_2
subnet_id_3
...
As an alternative, you can first find the VPC ID for the DB instance. Then you can examine the VPC to find
its subnets. The following Linux example shows how.
In Secrets Manager, you create these secrets with values for the username and password fields. Doing
so allows the proxy to connect to the corresponding database users on whichever RDS DB instances or
Aurora DB clusters that you associate with the proxy. To do this, you can use the setting Credentials for
other database, Credentials for RDS database, or Other type of secrets. Fill in the appropriate values
for the User name and Password fields, and placeholder values for any other required fields. The proxy
ignores other fields such as Host and Port if they're present in the secret. Those details are automatically
supplied by the proxy.
You can also choose Other type of secrets. In this case, you create the secret with keys named username
and password.
Because the secrets used by your proxy aren't tied to a specific database server, you can reuse a secret
across multiple proxies if you use the same credentials across multiple database servers. For example,
you might use the same credentials across a group of development and test servers.
To connect through the proxy as a specific user, make sure that the password associated with a secret
matches the database password for that user. If there's a mismatch, you can update the associated secret
in Secrets Manager. In this case, you can still connect to other accounts where the secret credentials and
the database passwords do match.
229
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
When you create a proxy through the AWS CLI or RDS API, you specify the Amazon Resource Names
(ARNs) of the corresponding secrets for all the DB user accounts that the proxy can access. In the AWS
Management Console, you choose the secrets by their descriptive names.
For instructions about creating secrets in Secrets Manager, see the Creating a secret page in the Secrets
Manager documentation. Use one of the following techniques:
For example, the following commands create Secrets Manager secrets for two database users, one
named admin and the other named app-user.
To see the secrets owned by your AWS account, use a command such as the following.
When you create a proxy using the CLI, you pass the Amazon Resource Names (ARNs) of one or more
secrets to the --auth parameter. The following Linux example shows how to prepare a report with only
the name and ARN of each secret owned by your AWS account. This example uses the --output table
parameter that is available in AWS CLI version 2. If you are using AWS CLI version 1, use --output text
instead.
To verify that you stored the correct credentials and in the right format in a secret, use a command such
as the following. Substitute the short name or the ARN of the secret for your_secret_name.
The output should include a line displaying a JSON-encoded value like the following.
"SecretString": "{\"username\":\"your_username\",\"password\":\"your_password\"}",
230
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
Tip
The following procedure applies if you use the IAM console. If you use the AWS Management
Console for RDS, RDS can create the IAM policy for you automatically. In that case, you can skip
the following procedure.
To create an IAM policy that accesses your Secrets Manager secrets for use with your proxy
1. Sign in to the IAM console. Follow the Create role process, as described in Creating IAM roles.
Include the Add Role to Database step.
2. For the new role, perform the Add inline policy step. Use the same general procedures as in Editing
IAM policies. Paste the following JSON into the JSON text box. Substitute your own account ID.
Substitute your AWS Region for us-east-2. Substitute the Amazon Resource Names (ARNs) for the
secrets that you created. For the kms:Decrypt action, substitute the ARN of the default AWS KMS
key or your own KMS key depending on which one you used to encrypt the Secrets Manager secrets.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": [
"arn:aws:secretsmanager:us-east-2:account_id:secret:secret_name_1",
"arn:aws:secretsmanager:us-east-2:account_id:secret:secret_name_2"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "arn:aws:kms:us-east-2:account_id:key/key_id",
"Condition": {
"StringEquals": {
"kms:ViaService": "secretsmanager.us-east-2.amazonaws.com"
}
}
}
]
}
3. Edit the trust policy for this IAM role. Paste the following JSON into the JSON text box.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "rds.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
The following commands perform the same operation through the AWS CLI.
PREFIX=choose_an_identifier
231
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
232
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
To create a proxy
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
3. Choose Create proxy.
4. Choose all the settings for your proxy.
• Proxy identifier. Specify a name of your choosing, unique within your AWS account ID and current
AWS Region.
• Engine compatibility. Choose either MySQL or POSTGRESQL.
• Require Transport Layer Security. Choose this setting if you want the proxy to enforce TLS/SSL
for all client connections. When you use an encrypted or unencrypted connection to a proxy, the
proxy uses the same encryption setting when it makes a connection to the underlying database.
• Idle client connection timeout. Choose a time period that a client connection can be idle before
the proxy can close it. The default is 1,800 seconds (30 minutes). A client connection is considered
idle when the application doesn't submit a new request within the specified time after the
previous request completed. The underlying database connection stays open and is returned to
the connection pool. Thus, it's available to be reused for new client connections.
Consider lowering the idle client connection timeout if you want the proxy to proactively remove
stale connections. If your workload is spiking, consider raising the idle client connection timeout to
save the cost of establishing connections.
• Database. Choose one RDS DB instance or Aurora DB cluster to access through this proxy. The list
only includes DB instances and clusters with compatible database engines, engine versions, and
other settings. If the list is empty, create a new DB instance or cluster that's compatible with RDS
Proxy. To do so, follow the procedure in Creating an Amazon RDS DB instance (p. 194) . Then try
creating the proxy again.
• Connection pool maximum connections. Specify a value from 1 through 100. This setting
represents the percentage of the max_connections value that RDS Proxy can use for its
connections. If you only intend to use one proxy with this DB instance or cluster, you can set this
value to 100. For details about how RDS Proxy uses this setting, see Controlling connection limits
and timeouts (p. 244).
• Session pinning filters. (Optional) This is an advanced setting, for troubleshooting performance
issues with particular applications. Currently, the only choice is EXCLUDE_VARIABLE_SETS.
Choose a filter only if both of following are true: Your application isn't reusing connections
due to certain kinds of SQL statements, and you can verify that reusing connections with those
SQL statements doesn't affect application correctness. For more information, see Avoiding
pinning (p. 245).
• Connection borrow timeout. In some cases, you might expect the proxy to sometimes use all
available database connections. In such cases, you can specify how long the proxy waits for
a database connection to become available before returning a timeout error. You can specify
233
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
a period up to a maximum of five minutes. This setting only applies when the proxy has the
maximum number of connections open and all connections are already in use.
• Initialization query. (Optional) You can specify one or more SQL statements for the proxy to run
when opening each new database connection. The setting is typically used with SET statements
to make sure that each connection has identical settings such as time zone and character set. For
multiple statements, use semicolons as the separator. You can also include multiple variables in a
single SET statement, such as SET x=1, y=2. Initialization query is not currently supported for
PostgreSQL.
• Secrets Manager secrets. Choose at least one Secrets Manager secret that contains DB user
credentials for the RDS DB instance or Aurora DB cluster that you intend to access with this proxy.
• IAM role. Choose an IAM role that has permission to access the Secrets Manager secrets that you
chose earlier. You can also choose for the AWS Management Console to create a new IAM role for
you and use that.
• IAM Authentication. Choose whether to require or disallow IAM authentication for connections to
your proxy. The choice of IAM authentication or native database authentication applies to all DB
users that access this proxy.
• Subnets. This field is prepopulated with all the subnets associated with your VPC. You can remove
any subnets that you don't need for this proxy. You must leave at least two subnets.
• VPC security group. Choose an existing VPC security group. You can also choose for the AWS
Management Console to create a new security group for you and use that.
Note
This security group must allow access to the database the proxy connects to. The same
security group is used for ingress from your applications to the proxy, and for egress from
the proxy to the database. For example, suppose that you use the same security group for
your database and your proxy. In this case, make sure that you specify that resources in
that security group can communicate with other resources in the same security group.
When using a shared VPC, you can't use the default security group for the VPC, or one
that belongs to another account. Choose a security group that belongs to your account. If
one doesn't exist, create one. For more information about this limitation, see Work with
shared VPCs.
• Enable enhanced logging. You can enable this setting to troubleshoot proxy compatibility or
performance issues.
When this setting is enabled, RDS Proxy includes detailed information about SQL statements in its
logs. This information helps you to debug issues involving SQL behavior or the performance and
scalability of the proxy connections. The debug information includes the text of SQL statements
that you submit through the proxy. Thus, only enable this setting when needed for debugging,
and only when you have security measures in place to safeguard any sensitive information that
appears in the logs.
To minimize overhead associated with your proxy, RDS Proxy automatically turns this setting off
24 hours after you enable it. Enable it temporarily to troubleshoot a specific issue.
5. Choose Create Proxy.
234
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
AWS CLI
To create a proxy, use the AWS CLI command create-db-proxy. The --engine-family value is case-
sensitive.
Example
For Linux, macOS, or Unix:
For Windows:
Tip
If you don't already know the subnet IDs to use for the --vpc-subnet-ids parameter, see
Setting up network prerequisites (p. 228) for examples of how to find the subnet IDs that you
can use.
Note
The security group must allow access to the database the proxy connects to. The same security
group is used for ingress from your applications to the proxy, and for egress from the proxy to
the database. For example, suppose that you use the same security group for your database
and your proxy. In this case, make sure that you specify that resources in that security group can
communicate with other resources in the same security group.
When using a shared VPC, you can't use the default security group for the VPC, or one that
belongs to another account. Choose a security group that belongs to your account. If one
doesn't exist, create one. For more information about this limitation, see Work with shared VPCs.
To create the required information and associations for the proxy, you also use the register-db-proxy-
targets command. Specify the target group name default. RDS Proxy automatically creates a target
group with this name when you create each proxy.
235
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
RDS API
To create an RDS proxy, call the Amazon RDS API operation CreateDBProxy. You pass a parameter with
the AuthConfig data structure.
RDS Proxy automatically creates a target group named default when you create each proxy. You
associate an RDS DB instance or Aurora DB cluster with the target group by calling the function
RegisterDBProxyTargets.
Any database applications that use the proxy require the proxy endpoint to use in the connection string.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the AWS Management Console, choose the AWS Region in which you
created the RDS Proxy.
3. In the navigation pane, choose Proxies.
4. Choose the name of an RDS proxy to display its details.
5. On the details page, the Target groups section shows how the proxy is associated with a specific
RDS DB instance or Aurora DB cluster. You can follow the link to the default target group page to
see more details about the association between the proxy and the database. This page is where you
see settings that you specified when creating the proxy, such as maximum connection percentage,
connection borrow timeout, engine compatibility, and session pinning filters.
CLI
To view your proxy using the CLI, use the describe-db-proxies command. By default, it displays all proxies
owned by your AWS account. To see details for a single proxy, specify its name with the --db-proxy-
name parameter.
To view the other information associated with the proxy, use the following commands.
Use the following sequence of commands to see more detail about the things that are associated with
the proxy:
236
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
RDS API
To view your proxies using the RDS API, use the DescribeDBProxies operation. It returns values of the
DBProxy data type.
To see details of the connection settings for the proxy, use the proxy identifiers from this return value
with the DescribeDBProxyTargetGroups operation. It returns values of the DBProxyTargetGroup data
type.
To see the RDS instance or Aurora DB cluster associated with the proxy, use the DescribeDBProxyTargets
operation. It returns values of the DBProxyTarget data type.
Topics
• Connecting to a proxy using native authentication (p. 237)
• Connecting to a proxy using IAM authentication (p. 238)
• Considerations for connecting to a proxy with PostgreSQL (p. 238)
1. Find the proxy endpoint. In the AWS Management Console, you can find the endpoint on the details
page for the corresponding proxy. With the AWS CLI, you can use the describe-db-proxies command.
The following example shows how.
2. Specify that endpoint as the host parameter in the connection string for your client application. For
example, specify the proxy endpoint as the value for the mysql -h option or psql -h option.
237
Amazon Relational Database Service User Guide
Getting started with RDS Proxy
3. Supply the same database user name and password as you usually do.
To connect to RDS Proxy using IAM authentication, follow the same general procedure as for connecting
to an RDS DB instance or Aurora cluster using IAM authentication. For general information about using
IAM with RDS and Aurora, see Security in Amazon RDS (p. 1876).
The major differences in IAM usage for RDS Proxy include the following:
• You don't configure each individual database user with an authorization plugin. The database users
still have regular user names and passwords within the database. You set up Secrets Manager secrets
containing these user names and passwords, and authorize RDS Proxy to retrieve the credentials from
Secrets Manager.
The IAM authentication applies to the connection between your client program and the proxy. The
proxy then authenticates to the database using the user name and password credentials retrieved from
Secrets Manager.
• Instead of the instance, cluster, or reader endpoint, you specify the proxy endpoint. For details about
the proxy endpoint, see Connecting to your DB instance using IAM authentication (p. 1916).
• In the direct database IAM authentication case, you selectively choose database users and configure
them to be identified with a special authentication plugin. You can then connect to those users using
IAM authentication.
In the proxy use case, you provide the proxy with Secrets that contain some user's user name and
password (native authentication). You then connect to the proxy using IAM authentication. Here, you
do this by generating an authentication token with the proxy endpoint, not the database endpoint.
You also use a user name that matches one of the user names for the secrets that you provided.
• Make sure that you use Transport Layer Security (TLS)/Secure Sockets Layer (SSL) when connecting to
a proxy using IAM authentication.
You can grant a specific user access to the proxy by modifying the IAM policy. An example follows.
"Resource": "arn:aws:rds-db:us-east-2:1234567890:dbuser:prx-ABCDEFGHIJKL01234/db_user"
When connecting through an RDS proxy, the startup message can include the following currently
recognized parameters:
• user
• database
• replication
The startup message can also include the following additional runtime parameters:
238
Amazon Relational Database Service User Guide
Managing an RDS Proxy
• application_name
• client_encoding
• DateStyle
• TimeZone
• extra_float_digits
For more information about PostgreSQL messaging, see the Frontend/Backend protocol in the
PostgreSQL documentation.
For PostgreSQL, if you use JDBC we recommend the following to avoid pinning:
• Set the JDBC connection parameter assumeMinServerVersion to at least 9.0 to avoid pinning.
Doing this prevents the JDBC driver from performing an extra round trip during connection startup
when it runs SET extra_float_digits = 3.
• Set the JDBC connection parameter ApplicationName to any/your-application-name to
avoid pinning. Doing this prevents the JDBC driver from performing an extra round trip during
connection startup when it runs SET application_name = "PostgreSQL JDBC Driver".
Note the JDBC parameter is ApplicationName but the PostgreSQL StartupMessage parameter is
application_name.
• Set the JDBC connection parameter preferQueryMode to extendedForPrepared to avoid pinning.
The extendedForPrepared ensures that the extended mode is used only for prepared statements.
The default for the preferQueryMode parameter is extended, which uses the extended mode for
all queries. The extended mode uses a series of Prepare, Bind, Execute, and Sync requests and
corresponding responses. This type of series causes connection pinning in an RDS proxy.
For more information, see Avoiding pinning (p. 245). For more information about connecting using
JDBC, see Connecting to the database in the PostgreSQL documentation.
Topics
• Modifying an RDS Proxy (p. 239)
• Adding a new database user (p. 244)
• Changing the password for a database user (p. 244)
• Controlling connection limits and timeouts (p. 244)
• Managing and monitoring connection pooling (p. 244)
• Avoiding pinning (p. 245)
• Deleting an RDS Proxy (p. 247)
239
Amazon Relational Database Service User Guide
Managing an RDS Proxy
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
3. In the list of proxies, choose the proxy whose settings you want to modify or go to its details page.
4. For Actions, choose Modify.
5. Enter or choose the properties to modify. You can modify the following:
If you didn't find the settings listed that you want to change, use the following procedure to update the
target group for the proxy. The target group associated with a proxy controls the settings related to the
physical database connections. Each proxy has one associated target group named default, which is
created automatically along with the proxy.
You can only modify the target group from the proxy details page, not from the list on the Proxies page.
240
Amazon Relational Database Service User Guide
Managing an RDS Proxy
as the separator. You can also include multiple variables in a single SET statement, such as SET
x=1, y=2. Initialization query is not currently supported for PostgreSQL.
You can't change certain properties, such as the target group identifier and the database engine.
5. Choose Modify target group.
AWS CLI
To modify a proxy using the AWS CLI, use the commands modify-db-proxy, modify-db-proxy-target-
group, deregister-db-proxy-targets, and register-db-proxy-targets.
With the modify-db-proxy command, you can change properties such as the following:
To modify connection-related settings or rename the target group, use the modify-db-proxy-
target-group command. Currently, all proxies have a single target group named default. When
working with this target group, you specify the name of the proxy and default for the name of the
target group.
The following example shows how to first check the MaxIdleConnectionsPercent setting for a proxy
and then change it, using the target group.
{
"TargetGroups": [
{
"Status": "available",
"UpdatedDate": "2019-11-30T16:49:30.342Z",
"ConnectionPoolConfig": {
"MaxIdleConnectionsPercent": 50,
"ConnectionBorrowTimeout": 120,
"MaxConnectionsPercent": 100,
"SessionPinningFilters": []
},
"TargetGroupName": "default",
"CreatedDate": "2019-11-30T16:49:27.940Z",
"DBProxyName": "the-proxy",
"IsDefault": true
}
]
}
241
Amazon Relational Database Service User Guide
Managing an RDS Proxy
{
"DBProxyTargetGroup": {
"Status": "available",
"UpdatedDate": "2019-12-02T04:09:50.420Z",
"ConnectionPoolConfig": {
"MaxIdleConnectionsPercent": 75,
"ConnectionBorrowTimeout": 120,
"MaxConnectionsPercent": 100,
"SessionPinningFilters": []
},
"TargetGroupName": "default",
"CreatedDate": "2019-11-30T16:49:27.940Z",
"DBProxyName": "the-proxy",
"IsDefault": true
}
}
The following example starts with a proxy that is associated with an Aurora MySQL cluster named
cluster-56-2020-02-25-1399. The example shows how to change the proxy so that it can connect
to a different cluster named provisioned-cluster.
When you work with an RDS DB instance, you specify the --db-instance-identifier option. When
you work with an Aurora DB cluster, you specify the --db-cluster-identifier option instead.
The following example modifies an Aurora MySQL proxy. An Aurora PostgreSQL proxy has port 5432.
{
"Targets": [
{
"Endpoint": "instance-9814.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
"RdsResourceId": "instance-9814"
},
{
"Endpoint": "instance-8898.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
"RdsResourceId": "instance-8898"
},
{
"Endpoint": "instance-1018.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
"RdsResourceId": "instance-1018"
},
{
"Type": "TRACKED_CLUSTER",
"Port": 0,
"RdsResourceId": "cluster-56-2020-02-25-1399"
},
{
"Endpoint": "instance-4330.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
242
Amazon Relational Database Service User Guide
Managing an RDS Proxy
"RdsResourceId": "instance-4330"
}
]
}
{
"Targets": []
}
{
"DBProxyTargets": [
{
"Type": "TRACKED_CLUSTER",
"Port": 0,
"RdsResourceId": "provisioned-cluster"
},
{
"Endpoint": "gkldje.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
"RdsResourceId": "gkldje"
},
{
"Endpoint": "provisioned-1.demo.us-east-1.rds.amazonaws.com",
"Type": "RDS_INSTANCE",
"Port": 3306,
"RdsResourceId": "provisioned-1"
}
]
}
RDS API
To modify a proxy using the RDS API, you use the operations ModifyDBProxy,
ModifyDBProxyTargetGroup, DeregisterDBProxyTargets, and RegisterDBProxyTargets operations.
With ModifyDBProxyTargetGroup, you can modify connection-related settings or rename the target
group. Currently, all proxies have a single target group named default. When working with this target
group, you specify the name of the proxy and default for the name of the target group.
243
Amazon Relational Database Service User Guide
Managing an RDS Proxy
• Create a new Secrets Manager secret, using the procedure described in Setting up database credentials
in AWS Secrets Manager (p. 229).
• Update the IAM role to give RDS Proxy access to the new Secrets Manager secret. To do so, update the
resources section of the IAM role policy.
• If the new user takes the place of an existing one, update the credentials stored in the proxy's Secrets
Manager secret for the existing user.
To set this value for your RDS DB instance or Aurora DB cluster, follow the procedures in Working with
DB parameter groups (p. 284). These procedures demonstrate how to associate a parameter group with
your database and edit the max_connections value in the parameter group.
The proxy setting for maximum connections represents a percentage of the max_connections value
for the database that's associated with the proxy. If you have multiple applications all using the same
database, you can effectively divide their connection quotas by using a proxy for each application with
a specific percentage of max_connections. If you do so, ensure that the percentages add up to 100 or
less for all proxies associated with the same database.
RDS Proxy periodically disconnects idle connections and returns them to the connection pool. You can
adjust this timeout interval. Doing so helps your applications to deal with stale resources, especially if
the application mistakenly leaves a connection open while holding important database resources.
Because the connection pool is managed by RDS Proxy, you can monitor it and adjust connection limits
and timeout intervals without changing your application code.
For each proxy, you can specify an upper limit on the number of database connections used by the
connection pool. This setting is represented by the Connection pool maximum connections field in the
RDS Proxy console or the MaxConnectionsPercent parameter in the AWS CLI or API. You specify the
limit as a percentage. This percentage applies to the maximum connections configured in the database.
The exact number varies depending on the DB instance size and configuration settings.
For example, suppose that you configured RDS Proxy to use 75 percent of the maximum connections
for the database. The maximum value is defined by the max_connections configuration parameter. In
this case, the other 25 percent of maximum connections remain available to assign to other proxies or
244
Amazon Relational Database Service User Guide
Managing an RDS Proxy
for connections that don't go through a proxy. In some cases, the proxy might keep less than 75 percent
of the maximum connections open at a particular time. Those cases might include situations where the
database doesn't have many simultaneous connections, or some connections stay idle for long periods.
The overall number of connections available for the connection pool changes as you update the
max_connections configuration setting that applies to an RDS DB instance or an Aurora cluster.
The proxy doesn't reserve all of these connections in advance. Thus, you can specify a relatively large
percentage, and those connections are only opened when the proxy becomes busy enough to need them.
You can choose how long to wait for a database connection to become available for use by your
application. This setting is represented by the Connection borrow timeout field in the RDS Proxy
console or the ConnectionBorrowTimeout parameter in the AWS CLI or API. This setting specifies how
long to wait for a connection to become available in the connection pool before returning a timeout
error. It applies when the number of connections is at the maximum, and so no connections are available
in the connection pool. It also applies if no appropriate database instance is available to handle the
request because, for example, a failover operation is in process. Using this setting, you can set the best
wait period for your application without having to change the query timeout in your application code.
You can control how actively the proxy closes idle database connections in the connection pool. This
setting is represented by the MaxIdleConnectionsPercent parameter of the DBProxyTargetGroup
in the AWS CLI or API. With a high value, the proxy leaves a high percentage of idle database connections
open. With a low value, the proxy closes a high percentage of idle database connections. It's expressed as
a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the
target group. The default value is 50 percent. To change the value of MaxIdleConnectionsPercent,
use the CLI command modify-db-proxy-target-group or the API operation ModifyDBProxyTargetGroup.
Note
RDS Proxy closes database connections some time after 24 hours when they are no longer in
use. The proxy performs this action regardless of the value of the maximum idle connections
setting.
Avoiding pinning
Multiplexing is more efficient when database requests don't rely on state information from previous
requests. In that case, RDS Proxy can reuse a connection at the conclusion of each transaction. Examples
of such state information include most variables and configuration parameters that you can change
through SET or SELECT statements. SQL transactions on a client connection can multiplex between
underlying database connections by default.
Your connections to the proxy can enter a state known as pinning. When a connection is pinned, each
later transaction uses the same underlying database connection until the session ends. Other client
connections also can't reuse that database connection until the session ends. The session ends when the
client connection is dropped.
RDS Proxy automatically pins a client connection to a specific DB connection when it detects a session
state change that isn't appropriate for other sessions. Pinning reduces the effectiveness of connection
reuse. If all or almost all of your connections experience pinning, consider modifying your application
code or workload to reduce the conditions that cause the pinning.
For example, if your application changes a session variable or configuration parameter, later statements
can rely on the new variable or parameter to be in effect. Thus, when RDS Proxy processes requests to
change session variables or configuration settings, it pins that session to the DB connection. That way,
the session state remains in effect for all later transactions in the same session.
This rule doesn't apply to all parameters you can set. RDS Proxy tracks changes to the character set,
collation, time zone, autocommit, current database, SQL mode, and session_track_schema settings.
Thus RDS Proxy doesn't pin the session when you modify these. In this case, RDS Proxy only reuses the
connection for other sessions that have the same values for those settings.
245
Amazon Relational Database Service User Guide
Managing an RDS Proxy
Performance tuning for RDS Proxy involves trying to maximize transaction-level connection reuse
(multiplexing) by minimizing pinning. You can do so by doing the following:
For example, you can define an initialization query for a proxy that sets certain configuration
parameters. Then, RDS Proxy applies those settings whenever it sets up a new connection for that
proxy. You can remove the corresponding SET statements from your application code, so that they
don't interfere with transaction-level multiplexing.
Important
For proxies associated with MySQL databases, don't set the configuration parameter
sql_auto_is_null to true or a nonzero value in the initialization query. Doing so might
cause incorrect application behavior.
The proxy pins the session to the current connection in the following situations where multiplexing
might cause unexpected behavior:
• Any statement with a text size greater than 16 KB causes the proxy to pin the session.
• Prepared statements cause the proxy to pin the session. This rule applies whether the prepared
statement uses SQL text or the binary protocol.
• Explicit MySQL statements LOCK TABLE, LOCK TABLES, or FLUSH TABLES WITH READ LOCK cause
the proxy to pin the session.
• Setting a user variable or a system variable (with some exceptions) causes the proxy to pin the session.
If this situation reduces your connection reuse too much, you can choose for SET operations not
to cause pinning. For information about how to do so by setting the SessionPinningFilters
property, see Creating an RDS Proxy (p. 233).
• Creating a temporary table causes the proxy to pin the session. That way, the contents of the
temporary table are preserved throughout the session regardless of transaction boundaries.
• Calling the MySQL functions ROW_COUNT, FOUND_ROWS, and LAST_INSERT_ID sometimes causes
pinning.
The exact circumstances where these functions cause pinning might differ between Aurora MySQL
versions that are compatible with MySQL 5.6 and MySQL 5.7.
Calling MySQL stored procedures and stored functions doesn't cause pinning. RDS Proxy doesn't
detect any session state changes resulting from such calls. Therefore, make sure that your application
doesn't change session state inside stored routines and rely on that session state to persist across
transactions. For example, if a stored procedure creates a temporary table that is intended to persist
across transactions, that application currently isn't compatible with RDS Proxy.
246
Amazon Relational Database Service User Guide
Managing an RDS Proxy
If you have expert knowledge about your application behavior, you can skip the pinning behavior for
certain application statements. To do so, choose the Session pinning filters option when creating the
proxy. Currently, you can opt out of session pinning for setting session variables and configuration
settings.
For metrics about how often pinning occurs for a proxy, see Monitoring RDS Proxy using Amazon
CloudWatch (p. 254).
To delete a proxy
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
3. Choose the proxy to delete from the list.
4. Choose Delete Proxy.
AWS CLI
To delete a DB proxy, use the AWS CLI command delete-db-proxy. To remove related associations, also
use the deregister-db-proxy-targets command.
RDS API
To delete a DB proxy, call the Amazon RDS API function DeleteDBProxy. To delete related items and
associations, you also call the functions DeleteDBProxyTargetGroup and DeregisterDBProxyTargets.
247
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
• You can use multiple endpoints with a proxy to monitor and troubleshoot connections from different
applications independently.
• You can use reader endpoints with Aurora DB clusters to improve read scalability and high availability
for your query-intensive applications.
• You can use a cross-VPC endpoint to allow access to databases in one VPC from resources such as
Amazon EC2 instances in a different VPC.
Topics
• Overview of proxy endpoints (p. 248)
• Reader endpoints (p. 249)
• Accessing Aurora and RDS databases across VPCs (p. 249)
• Creating a proxy endpoint (p. 250)
• Viewing proxy endpoints (p. 251)
• Modifying a proxy endpoint (p. 252)
• Deleting a proxy endpoint (p. 253)
• Limits for proxy endpoints (p. 254)
By default, the endpoint that you connect to when you use RDS Proxy with an Aurora cluster has read/
write capability. As a consequence, this endpoint sends all requests to the writer instance of the cluster,
and all of those connections count against the max_connections value for the writer instance. If
your proxy is associated with an Aurora DB cluster, you can create additional read/write or read-only
endpoints for that proxy.
You can use a read-only endpoint with your proxy for read-only queries, the same way that you use the
reader endpoint for an Aurora provisioned cluster. Doing so helps you to take advantage of the read
scalability of an Aurora cluster with one or more reader DB instances. You can run more simultaneous
queries and make more simultaneous connections by using a read-only endpoint and adding more reader
DB instances to your Aurora cluster as needed.
For a proxy endpoint that you create, you can also associate the endpoint with a different virtual private
cloud (VPC) than the proxy itself uses. By doing so, you can connect to the proxy from a different VPC,
for example a VPC used by a different application within your organization.
For information about limits associated with proxy endpoints, see Limits for proxy endpoints (p. 254).
In the RDS Proxy logs, each entry is prefixed with the name of the associated proxy endpoint. This name
can be the name you specified for a user-defined endpoint, or the special name default for read/write
requests using the default endpoint of a proxy.
Each proxy endpoint has its own set of CloudWatch metrics. You can monitor the metrics for all
endpoints of a proxy. You can also monitor metrics for a specific endpoint, or for all the read/write
248
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
or read-only endpoints of a proxy. For more information, see Monitoring RDS Proxy using Amazon
CloudWatch (p. 254).
A proxy endpoint uses the same authentication mechanism as its associated proxy. RDS Proxy
automatically sets up permissions and authorizations for the user-defined endpoint, consistent with the
properties of the associated proxy.
Reader endpoints
With RDS Proxy, you can create and use reader endpoints. However, these endpoints only work for
proxies associated with Aurora DB clusters. You might see references to reader endpoints in the AWS
Management Console. If you use the RDS CLI or API, you might see the TargetRole attribute with a
value of READ_ONLY. You can take advantage of these features by changing the target of a proxy from
an RDS DB instance to an Aurora DB cluster. To learn about reader endpoints, see Managing connections
with Amazon RDS Proxy in the Aurora User Guide.
With RDS Proxy, you can set up access to an Aurora cluster or RDS instance in one VPC from resources
such as EC2 instances in another VPC. For example, your organization might have multiple applications
that access the same database resources. Each application might be in its own VPC.
To enable cross-VPC access, you create a new endpoint for the proxy. If you aren't familiar with creating
proxy endpoints, see Working with Amazon RDS Proxy endpoints (p. 248) for details. The proxy itself
resides in the same VPC as the Aurora DB cluster or RDS instance. However, the cross-VPC endpoint
resides in the other VPC, along with the other resources such as the EC2 instances. The cross-VPC
endpoint is associated with subnets and security groups from the same VPC as the EC2 and other
resources. These associations let you connect to the endpoint from the applications that otherwise can't
access the database due to the VPC restrictions.
The following steps explain how to create and access a cross-VPC endpoint through RDS Proxy:
1. Create two VPCs, or choose two VPCs that you already use for Aurora and RDS work. Each VPC should
have its own associated network resources such as an Internet gateway, route tables, subnets, and
security groups. If you only have one VPC, you can consult Getting started with Amazon RDS (p. 118)
for the steps to set up another VPC to use RDS successfully. You can also examine your existing VPC in
the Amazon EC2 console to see what kinds of resources to connect together.
2. Create a DB proxy associated with the Aurora DB cluster or RDS instance that you want to connect to.
Follow the procedure in Creating an RDS Proxy (p. 233).
3. On the Details page for your proxy in the RDS console, under the Proxy endpoints section, choose
Create endpoint. Follow the procedure in Creating a proxy endpoint (p. 250).
4. Choose whether to make the cross-VPC endpoint read/write or read-only.
5. Instead of accepting the default of the same VPC as the Aurora DB cluster or RDS instance, choose a
different VPC. This VPC must be in the same AWS Region as the VPC where the proxy resides.
6. Now instead of accepting the defaults for subnets and security groups from the same VPC as the
Aurora DB cluster or RDS instance, make new selections. Make these based on the subnets and
security groups from the VPC that you chose.
7. You don't need to change any of the settings for the Secrets Manager secrets. The same credentials
work for all endpoints for your proxy, regardless of which VPC each endpoint is in.
8. Wait for the new endpoint to reach the Available state.
249
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
9. Make a note of the full endpoint name. This is the value ending in
Region_name.rds.amazonaws.com that you supply as part of the connection string for your
database application.
10.Access the new endpoint from a resource in the same VPC as the endpoint. A simple way to test this
process is to create a new EC2 instance in this VPC. Then you can log into the EC2 instance and run the
mysql or psql commands to connect by using the endpoint value in your connection string.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
3. Click the name of the proxy that you want to create a new endpoint for.
Connections that use a read/write endpoint can perform any kind of operation: data definition
language (DDL) statements, data manipulation language (DML) statements, and queries. These
endpoints always connect to the primary instance of the Aurora cluster. You can use read/write
endpoints for general database operations when you only use a single endpoint in your application.
You can also use read/write endpoints for administrative operations, online transaction processing
(OLTP) applications, and extract-transform-load (ETL) jobs.
Connections that use a read-only endpoint can only perform queries. When there are multiple
reader instances in the Aurora cluster, RDS Proxy can use a different reader instance for each
connection to the endpoint. That way, a query-intensive application can take advantage of Aurora's
clustering capability. You can add more query capacity to the cluster by adding more reader DB
instances. These read-only connections don't impose any overhead on the primary instance of the
cluster. That way, your reporting and analysis queries don't slow down the write operations of your
OLTP applications.
7. For Virtual Private Cloud (VPC), choose the default if you plan to access the endpoint from the
same EC2 instances or other resources where you normally access the proxy or its associated
database. If you want to set up cross-VPC access for this proxy, choose a VPC other than the default.
For more information about cross-VPC access, see Accessing Aurora and RDS databases across
VPCs (p. 249).
8. For Subnets, RDS Proxy fills in the same subnets as the associated proxy by default. If you want to
restrict access to the endpoint so that only a portion of the address range of the VPC can connect to
it, remove one or more subnets from the set of choices.
9. For VPC security group, you can choose an existing security group or create a new one. RDS Proxy
fills in the same security group or groups as the associated proxy by default. If the inbound and
outbound rules for the proxy are appropriate for this endpoint, you can leave the default choice.
If you choose to create a new security group, specify a name for the security group on this page.
Then edit the security group settings from the EC2 console afterward.
10. Choose Create proxy endpoint.
250
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
AWS CLI
To create a proxy endpoint, use the AWS CLI create-db-proxy-endpoint command.
• --db-proxy-name value
• --db-proxy-endpoint-name value
• --vpc-subnet-ids list_of_ids. Separate the subnet IDs with spaces. You don't specify the ID of
the VPC itself.
Example
The following example creates a proxy endpoint named my-endpoint.
For Windows:
RDS API
To create a proxy endpoint, use the RDS API CreateProxyEndpoint action.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
251
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
3. In the list, choose the proxy whose endpoint you want to view. Click the proxy name to view its
details page.
4. In the Proxy endpoints section, choose the endpoint that you want to view. Click its name to view
the details page.
5. Examine the parameters whose values you're interested in. You can check properties such as the
following:
AWS CLI
To view one or more DB proxy endpoints, use the AWS CLI describe-db-proxy-endpoints command.
• --db-proxy-endpoint-name
• --db-proxy-name
Example
For Windows:
RDS API
To describe one or more proxy endpoints, use the RDS API DescribeDBProxyEndpoints operation.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Proxies.
3. In the list, choose the proxy whose endpoint you want to modify. Click the proxy name to view its
details page.
4. In the Proxy endpoints section, choose the endpoint that you want to modify. You can select it in
the list, or click its name to view the details page.
5. On the proxy details page, under the Proxy endpoints section, choose Edit. Or on the proxy
endpoint details page, for Actions, choose Edit.
252
Amazon Relational Database Service User Guide
Working with RDS Proxy endpoints
AWS CLI
To modify a DB proxy endpoint, use the AWS CLI modify-db-proxy-endpoint command with the
following required parameters:
• --db-proxy-endpoint-name
Specify changes to the endpoint properties by using one or more of the following parameters:
• --new-db-proxy-endpoint-name
• --vpc-security-group-ids. Separate the security group IDs with spaces.
Example
For Windows:
RDS API
Console
253
Amazon Relational Database Service User Guide
Monitoring RDS Proxy
AWS CLI
To delete a proxy endpoint, run the delete-db-proxy-endpoint command with the following required
parameters:
• --db-proxy-endpoint-name
For Windows:
RDS API
To delete a proxy endpoint with the RDS API, run the DeleteDBProxyEndpoint operation. Specify the
name of the proxy endpoint for the DBProxyEndpointName parameter.
The maximum number of user-defined endpoints for a proxy is 20. Thus, a proxy can have up to 21
endpoints: the default endpoint, plus 20 that you create.
When you associate additional endpoints with a proxy, RDS Proxy automatically determines which DB
instances in your cluster to use for each endpoint. You can't choose specific instances the way that you
can with Aurora custom endpoints.
You can connect to proxy endpoints that you create using the SSL modes REQUIRED and VERIFY_CA.
You can't connect to an endpoint that you create using the SSL mode VERIFY_IDENTITY.
In the RDS Proxy logs, each entry is prefixed with the name of the associated proxy endpoint. This name
can be the name you specified for a user-defined endpoint, or the special name default for read/write
requests using the default endpoint of a proxy.
254
Amazon Relational Database Service User Guide
Monitoring RDS Proxy
Each proxy endpoint has its own CloudWatch metrics. You can monitor the usage of each proxy endpoint
independently. For more information about proxy endpoints, see Working with Amazon RDS Proxy
endpoints (p. 248).
You can aggregate the values for each metric using one of the following dimension sets. For example,
by using the ProxyName dimension set, you can analyze all the traffic for a particular proxy. By using
the other dimension sets, you can split the metrics in different ways. You can split the metrics based on
the different endpoints or target databases of each proxy, or the read/write and read-only traffic to each
database.
255
Amazon Relational Database Service User Guide
Monitoring RDS Proxy
The number of
ClientConnectionsSetupFailedAuth 1 minute and above Dimension set
client connection 1 (p. 255), Dimension
attempts that failed set 2 (p. 255)
due to misconfigured
authentication or
TLS. The most useful
statistic for this metric
is Sum.
The number of
ClientConnectionsSetupSucceeded 1 minute and above Dimension set
client connections 1 (p. 255), Dimension
successfully established set 2 (p. 255)
with any authentication
mechanism with or
without TLS. The most
useful statistic for this
metric is Sum.
The time in
DatabaseConnectionsBorrowLatency 1 minute and above Dimension set
microseconds that it 1 (p. 255), Dimension
takes for the proxy set 2 (p. 255)
being monitored
to get a database
connection. The most
useful statistic for this
metric is Average.
256
Amazon Relational Database Service User Guide
Monitoring RDS Proxy
The number of
DatabaseConnectionsSetupFailed 1 minute and above Dimension set
database connection 1 (p. 255), Dimension
requests that failed. set 3 (p. 255),
The most useful Dimension set
statistic for this metric 4 (p. 255)
is Sum.
The number of
DatabaseConnectionsSetupSucceeded 1 minute and above Dimension set
database connections 1 (p. 255), Dimension
successfully established set 3 (p. 255),
with or without TLS. Dimension set
The most useful 4 (p. 255)
statistic for this metric
is Sum.
257
Amazon Relational Database Service User Guide
Monitoring RDS Proxy
The maximum
MaxDatabaseConnectionsAllowed 1 minute Dimension set
number of database 1 (p. 255), Dimension
connections allowed. set 3 (p. 255),
This metric is reported Dimension set
every minute. The most 4 (p. 255)
useful statistic for this
metric is Sum.
The time in
QueryDatabaseResponseLatency 1 minute and above Dimension set
microseconds that 1 (p. 255), Dimension
the database took set 2 (p. 255),
to respond to the Dimension set
query. The most useful 3 (p. 255), Dimension
statistic for this metric set 4 (p. 255)
is Average.
You can find logs of RDS Proxy activity under CloudWatch in the AWS Management Console. Each proxy
has an entry in the Log groups page.
258
Amazon Relational Database Service User Guide
RDS Proxy examples
Important
These logs are intended for human consumption for troubleshooting purposes and not for
programmatic access. The format and content of the logs is subject to change.
In particular, older logs don't contain any prefixes indicating the endpoint for each request. In
newer logs, each entry is prefixed with the name of the associated proxy endpoint. This name
can be the name that you specified for a user-defined endpoint, or the special name default
for requests using the default endpoint of a proxy.
Examples
This MySQL example demonstrates how open connections continue working during a failover, for
example when you reboot a database or it becomes unavailable due to a problem. This example
uses a proxy named the-proxy and an Aurora DB cluster with DB instances instance-8898 and
instance-9814. When you run the failover-db-cluster command from the Linux command line,
the writer instance that the proxy is connected to changes to a different DB instance. You can see that
the DB instance associated with the proxy changes while the connection remains open.
mysql>
[1]+ Stopped mysql -h the-proxy.proxy-demo.us-east-1.rds.amazonaws.com -
u admin_user -p
$ # Initially, instance-9814 is the writer.
$ aws rds failover-db-cluster --db-cluster-identifier cluster-56-2019-11-14-1399
JSON output
$ # After a short time, the console shows that the failover operation is complete.
$ # Now instance-8898 is the writer.
$ fg
mysql -h the-proxy.proxy-demo.us.us-east-1.rds.amazonaws.com -u admin_user -p
mysql>
259
Amazon Relational Database Service User Guide
RDS Proxy examples
export REGION=us-east-1
export CLUSTER_PARAM_GROUP=rds-proxy-mysql-56-max-connections-demo
export CLUSTER_NAME=rds-proxy-mysql-56
260
Amazon Relational Database Service User Guide
Troubleshooting RDS Proxy
In the RDS Proxy logs, each entry is prefixed with the name of the associated proxy endpoint. This name
can be the name you specified for a user-defined endpoint, or the special name default for read/
write requests using the default endpoint of a proxy. For more information about proxy endpoints, see
Working with Amazon RDS Proxy endpoints (p. 248).
Topics
• Verifying connectivity for a proxy (p. 261)
• Common issues and solutions (p. 262)
Examine the proxy itself using the describe-db-proxies command. Also examine the associated target
group using the describe-db-proxy-target-groups Check that the details of the targets match the RDS
DB instance or Aurora DB cluster that you intend to associate with the proxy. Use commands such as the
following.
To confirm that the proxy can connect to the underlying database, examine the targets specified in the
target groups using the describe-db-proxy-targets command. Use a command such as the following.
The output of the describe-db-proxy-targets command includes a TargetHealth field. You can
examine the fields State, Reason, and Description inside TargetHealth to check if the proxy can
communicate with the underlying DB instance.
• A State value of AVAILABLE indicates that the proxy can connect to the DB instance.
• A State value of UNAVAILABLE indicates a temporary or permanent connection problem. In
this case, examine the Reason and Description fields. For example, if Reason has a value of
PENDING_PROXY_CAPACITY, try connecting again after the proxy finishes its scaling operation. If
Reason has a value of UNREACHABLE, CONNECTION_FAILED, or AUTH_FAILURE, use the explanation
from the Description field to help you diagnose the issue.
• The State field might have a value of REGISTERING for a brief time before changing to AVAILABLE
or UNAVAILABLE.
If the following Netcat command (nc) is successful, you can access the proxy endpoint from the EC2
instance or other system where you're logged in. This command reports failure if you're not in the same
VPC as the proxy and the associated database. You might be able to log directly in to the database
without being in the same VPC. However, you can't log into the proxy unless you're in the same VPC.
261
Amazon Relational Database Service User Guide
Troubleshooting RDS Proxy
You can use the following commands to make sure that your EC2 instance has the required properties. In
particular, the VPC for the EC2 instance must be the same as the VPC for the RDS DB instance or Aurora
DB cluster that the proxy connects to.
Make sure that the SecretString field displayed by get-secret-value is encoded as a JSON
string that includes username and password fields. The following example shows the format of the
SecretString field.
{
"ARN": "some_arn",
"Name": "some_name",
"VersionId": "some_version_id",
"SecretString": '{"username":"some_username","password":"some_password"}',
"VersionStages": [ "some_stage" ],
"CreatedDate": some_timestamp
}
You might encounter the following issues while creating a new proxy or connecting to a proxy.
403: The security Select an existing IAM role instead of choosing to create a new one.
token included in
the request is
invalid
You might encounter the following issues while connecting to a MySQL proxy.
ERROR 1040 The rate of connection requests from the client to the proxy has exceeded
(HY000): the limit.
Connections rate
limit exceeded
(limit_value)
ERROR 1040 The number of simultaneous requests with IAM authentication from the
(HY000): IAM client to the proxy has exceeded the limit.
262
Amazon Relational Database Service User Guide
Troubleshooting RDS Proxy
ERROR 1040 The number of simultaneous connection requests from the client to the
(HY000): Number proxy exceeded the limit.
simultaneous
connections
exceeded
(limit_value)
ERROR 1231 The value set for the character_set_client parameter is not valid. For
(42000): Variable example, the value ucs2 is not valid because it can crash the MySQL server.
''character_set_client''
can't be set to
the value of value
ERROR 3159 You enabled the setting Require Transport Layer Security in the proxy
(HY000): This RDS but your connection included the parameter ssl-mode=DISABLED in the
Proxy requires TLS MySQL client. Do either of the following:
connections.
• Disable the setting Require Transport Layer Security for the proxy.
• Connect to the database using the minimum setting of ssl-
mode=REQUIRED in the MySQL client.
ERROR 2026 The TLS handshake to the proxy failed. Some possible reasons include the
(HY000): SSL following:
connection error:
Internal Server • SSL is required but the server doesn't support it.
Error • An internal server error occurred.
• A bad handshake occurred.
ERROR 9501 The proxy timed-out waiting to acquire a database connection. Some
(HY000): Timed- possible reasons include the following:
out waiting to
acquire database • The proxy is unable to establish a database connection because the
connection maximum connections have been reached
• The proxy is unable to establish a database connection because the
database is unavailable.
You might encounter the following issues while connecting to a PostgreSQL proxy.
263
Amazon Relational Database Service User Guide
Troubleshooting RDS Proxy
IAM authentication is The user tried to connect The user needs to connect to the
allowed only with SSL to the database using IAM database using the minimum
connections. authentication with the setting setting of sslmode=require in
sslmode=disable in the the PostgreSQL client. For more
PostgreSQL client. information, see the PostgreSQL
SSL support documentation.
This RDS Proxy requires The user enabled the option To fix this error, do one of the
TLS connections. Require Transport Layer following:
Security but tried to connect
with sslmode=disable in the • Disable the proxy's Require
PostgreSQL client. Transport Layer Security
option.
• Connect to the database
using the minimum setting
of sslmode=allow in the
PostgreSQL client.
IAM authentication This error might be due to the To fix this error, do the
failed for user following reasons: following:
user_name. Check the IAM
token for this user and • The client supplied the 1. Confirm that the provided
try again. incorrect IAM user name. IAM user exists.
• The client supplied an 2. Confirm that the IAM
incorrect IAM authorization authorization token belongs
token for the user. to the provided IAM user.
• The client is using an IAM 3. Confirm that the IAM policy
policy that does not have the has adequate permissions for
necessary permissions. RDS.
• The client supplied an expired 4. Check the validity of the IAM
IAM authorization token for authorization token used.
the user.
This RDS proxy has no There is no Secrets Manager Add a Secrets Manager secret for
credentials for the role secret for this role. this role.
role_name. Check the
credentials for this
role and try again.
RDS supports only IAM or The database client being used If you're not using IAM
MD5 authentication. to connect to the proxy is using authentication, use the MD5
an authentication mechanism password authentication only.
not currently supported by the
proxy, such as SCRAM-SHA-256.
A user name is missing The database client being used Make sure to define a user name
from the connection to connect to the proxy isn't when setting up a connection to
startup packet. Provide sending a user name when the proxy using the PostgreSQL
a user name for this trying to establish a connection. client of your choice.
connection.
Feature not supported: The PostgreSQL client used Use a newer PostgreSQL client
RDS Proxy supports to connect to the proxy uses a that supports the 3.0 messaging
only version 3.0 of the protocol older than 3.0. protocol. If you're using the
PostgreSQL psql CLI, use a
264
Amazon Relational Database Service User Guide
Troubleshooting RDS Proxy
Feature not supported: The PostgreSQL client used to Turn off the streaming
RDS Proxy currently connect to the proxy is trying replication mode in the
doesn't support to use the streaming replication PostgreSQL client being used to
streaming replication mode, which isn't currently connect.
mode. supported by RDS Proxy.
Feature not supported: Through the startup message, Turn off the option being
RDS Proxy currently the PostgreSQL client used shown as not supported from
doesn't support the to connect to the proxy is the message above in the
option option_name. requesting an option that isn't PostgreSQL client being used to
currently supported by RDS connect.
Proxy.
The IAM authentication The number of simultaneous Reduce the rate in which
failed because of too requests with IAM connections using IAM
many competing requests. authentication from the client to authentication from a
the proxy has exceeded the limit. PostgreSQL client are
established.
The maximum number The number of simultaneous Reduce the number of active
of client connections connection requests from the connections from PostgreSQL
to the proxy exceeded client to the proxy exceeded the clients to this RDS proxy.
number_value. limit.
Rate of connection The rate of connection requests Reduce the rate in which
to proxy exceeded from the client to the proxy has connections from a PostgreSQL
number_value. exceeded the limit. client are established.
The password that was The password for this role Check the secret for this role in
provided for the role doesn't match the Secrets Secrets Manager to see if the
role_name is wrong. Manager secret. password is the same as what's
being used in your PostgreSQL
client.
IAM is allowed only with A client tried to connect using Enable SSL in the PostgreSQL
SSL connections. IAM authentication, but SSL client.
wasn't enabled.
265
Amazon Relational Database Service User Guide
Using RDS Proxy with AWS CloudFormation
Timed-out waiting The proxy timed-out waiting to Possible solutions are the
to acquire database acquire a database connection. following:
connection. Some possible reasons include
the following: • Check the target of the RDS
DB instance or Aurora DB
• The proxy can't establish a cluster status to see if it's
database connection because unavailable.
the maximum connections • Check if there are long-
have been reached. running transactions and/or
• The proxy can't establish a queries being executed. They
database connection because can use database connections
the database is unavailable. from the connection pool for a
long time.
The following listing shows a sample AWS CloudFormation template for RDS Proxy.
Resources:
DBProxy:
Type: AWS::RDS::DBProxy
Properties:
DBProxyName: CanaryProxy
EngineFamily: MYSQL
RoleArn:
Fn::ImportValue: SecretReaderRoleArn
Auth:
- {AuthScheme: SECRETS, SecretArn: !ImportValue ProxySecret, IAMAuth: DISABLED}
VpcSubnetIds:
Fn::Split: [",", "Fn::ImportValue": SubnetIds]
ProxyTargetGroup:
Type: AWS::RDS::DBProxyTargetGroup
Properties:
DBProxyName: CanaryProxy
TargetGroupName: default
DBInstanceIdentifiers:
- Fn::ImportValue: DBInstanceName
266
Amazon Relational Database Service User Guide
Using RDS Proxy with AWS CloudFormation
DependsOn: DBProxy
For more information about the Amazon RDS and Aurora resources that you can create using AWS
CloudFormation, see RDS resource type reference.
267
Amazon Relational Database Service User Guide
Working with option groups
Microsoft SQL Server Options for the Microsoft SQL Server database engine (p. 920)
PostgreSQL PostgreSQL does not use options and option groups. PostgreSQL
uses extensions and modules to provide additional features.
For more information, see PostgreSQL extensions supported on
Amazon RDS (p. 1721).
To associate an option group with a DB instance, modify the DB instance. For more information, see
Modifying an Amazon RDS DB instance (p. 306).
Both DB instances and DB snapshots can be associated with an option group. In some cases, you might
restore from a DB snapshot or perform a point-in-time restore for a DB instance. In these cases, the
option group associated with the DB snapshot or DB instance is, by default, associated with the restored
DB instance. You can associate a different option group with a restored DB instance. However, the new
option group must contain any persistent or permanent options that were included in the original option
group. Persistent and permanent options are described following.
Options require additional memory to run on a DB instance. Thus, you might need to launch a larger
instance to use them, depending on your current use of your DB instance. For example, Oracle Enterprise
Manager Database Control uses about 300 MB of RAM. If you enable this option for a small DB instance,
you might encounter performance problems or out-of-memory errors.
268
Amazon Relational Database Service User Guide
Option groups overview
Persistent options can't be removed from an option group while DB instances are associated with the
option group. An example of a persistent option is the TDE option for Microsoft SQL Server transparent
data encryption (TDE). You must disassociate all DB instances from the option group before a persistent
option can be removed from the option group. In some cases, you might restore or perform a point-in-
time restore from a DB snapshot. In these cases, if the option group associated with that DB snapshot
contains a persistent option, you can only associate the restored DB instance with that option group.
Permanent options, such as the TDE option for Oracle Advanced Security TDE, can never be removed
from an option group. You can change the option group of a DB instance that is using the permanent
option. However, the option group associated with the DB instance must include the same permanent
option. In some cases, you might restore or perform a point-in-time restore from a DB snapshot. In these
cases, if the option group associated with that DB snapshot contains a permanent option, you can only
associate the restored DB instance with an option group with that permanent option.
For Oracle DB instances, you can copy shared DB snapshots that have the options Timezone or OLS
(or both). To do so, specify a target option group that includes these options when you copy the DB
snapshot. The OLS option is permanent and persistent only for Oracle DB instances running Oracle
version 12.2 or higher. For more information about these options, see Oracle time zone (p. 1385) and
Oracle Label Security (p. 1350).
If a DB instance is in a VPC, the option group associated with the instance is linked to that VPC. This
means that you can't use the option group assigned to a DB instance if you try to restore the instance
to a different VPC or a different platform. If you restore a DB instance to a different VPC or a different
platform, you can do one of the following:
With persistent or permanent options, such as Oracle TDE, you must create a new option group that
includes the persistent or permanent option when restoring a DB instance into a different VPC.
Option settings control the behavior of an option. For example, the Oracle Advanced Security option
NATIVE_NETWORK_ENCRYPTION has a setting that you can use to specify the encryption algorithm for
network traffic to and from the DB instance. Some options settings are optimized for use with Amazon
RDS and cannot be changed.
• Oracle Enterprise Manager Database Express (p. 1333) and Oracle Management Agent for Enterprise
Manager Cloud Control (p. 1337).
• Oracle native network encryption (p. 1359) and Oracle Secure Sockets Layer (p. 1367).
269
Amazon Relational Database Service User Guide
Creating an option group
After you create a new option group, it has no options. To learn how to add options to the option group,
see Adding an option to an option group (p. 272). After you have added the options you want, you
can then associate the option group with a DB instance so that the options become available on the DB
instance. For information about associating an option group with a DB instance, see the documentation
for your specific engine listed at Working with option groups (p. 268).
Console
One way of creating an option group is by using the AWS Management Console.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Choose Create group.
4. In the Create option group window, do the following:
a. For Name, type a name for the option group that is unique within your AWS account. The name
can contain only letters, digits, and hyphens.
b. For Description, type a brief description of the option group. The description is used for display
purposes.
c. For Engine, choose the DB engine that you want.
d. For Major engine version, choose the major version of the DB engine that you want.
5. To continue, choose Create. To cancel the operation instead, choose Cancel.
AWS CLI
To create an option group, use the AWS CLI create-option-group command with the following
required parameters.
• --option-group-name
• --engine-name
• --major-engine-version
• --option-group-description
Example
The following example creates an option group named testoptiongroup, which is associated with the
Oracle Enterprise Edition DB engine. The description is enclosed in quotation marks.
270
Amazon Relational Database Service User Guide
Copying an option group
--option-group-name testoptiongroup \
--engine-name oracle-ee \
--major-engine-version 12.1 \
--option-group-description "Test option group"
For Windows:
RDS API
To create an option group, call the Amazon RDS API CreateOptionGroup operation. Include the
following parameters:
• OptionGroupName
• EngineName
• MajorEngineVersion
• OptionGroupDescription
AWS CLI
To copy an option group, use the AWS CLI copy-option-group command. Include the following required
options:
• --source-option-group-identifier
• --target-option-group-identifier
• --target-option-group-description
Example
The following example creates an option group named new-option-group, which is a local copy of the
option group my-option-group.
271
Amazon Relational Database Service User Guide
Adding an option to an option group
--target-option-group-identifier new-option-group \
--target-option-group-description "My new option group"
For Windows:
RDS API
To copy an option group, call the Amazon RDS API CopyOptionGroup operation. Include the following
required parameters.
• SourceOptionGroupIdentifier
• TargetOptionGroupIdentifier
• TargetOptionGroupDescription
• When you add an option that adds or updates a port value, such as the OEM option.
• When you add or remove an option group with an option that includes a port value.
In these cases, choose the Apply Immediately option in the console. Or you can include the --apply-
immediately option when using the AWS CLI or set the ApplyImmediately parameter to true when
using the Amazon RDS API. Options that don't include port values can be applied immediately, or can be
applied during the next maintenance window for the DB instance.
Note
If you specify a security group as a value for an option in an option group, you manage the
security group by modifying the option group. You can't change or remove this security group
by modifying a DB instance. Also, the security group doesn't appear in the DB instance details
in the AWS Management Console or in the output for the AWS CLI command describe-db-
instances.
Console
You can use the AWS Management Console to add an option to an option group.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Choose the option group that you want to modify, and then choose Add option.
272
Amazon Relational Database Service User Guide
Adding an option to an option group
a. Choose the option that you want to add. You might need to provide additional values,
depending on the option that you select. For example, when you choose the OEM option, you
must also type a port value and specify a security group.
b. To enable the option on all associated DB instances as soon as you add it, for Apply
Immediately, choose Yes. If you choose No (the default), the option is enabled for each
associated DB instance during its next maintenance window.
273
Amazon Relational Database Service User Guide
Adding an option to an option group
5. When the settings are as you want them, choose Add option.
AWS CLI
To add an option to an option group, run the AWS CLI add-option-to-option-group command with the
option that you want to add. To enable the new option immediately on all associated DB instances,
include the --apply-immediately parameter. By default, the option is enabled for each associated DB
instance during its next maintenance window. Include the following required parameter:
• --option-group-name
Example
The following example adds the Oracle Enterprise Manager Database Control (OEM) option to an option
group named testoptiongroup and immediately enables it. Even if you use the default security group,
you must specify that security group.
274
Amazon Relational Database Service User Guide
Adding an option to an option group
--option-group-name testoptiongroup \
--options OptionName=OEM,Port=5500,DBSecurityGroupMemberships=default \
--apply-immediately
For Windows:
Example
The following example adds the Oracle OEM option to an option group. It also specifies a custom port
and a pair of Amazon EC2 VPC security groups to use for that port.
For Windows:
Example
The following example adds the Oracle option NATIVE_NETWORK_ENCRYPTION to an option group and
specifies the option settings. If no option settings are specified, default values are used.
275
Amazon Relational Database Service User Guide
Listing the options and option settings for an option group
For Windows:
RDS API
To add an option to an option group using the Amazon RDS API, call the ModifyOptionGroup operation
with the option that you want to add. To enable the new option immediately on all associated DB
instances, include the ApplyImmediately parameter and set it to true. By default, the option is
enabled for each associated DB instance during its next maintenance window. Include the following
required parameter:
• OptionGroupName
276
Amazon Relational Database Service User Guide
Modifying an option setting
Console
You can use the AWS Management Console to list all of the options and option settings for an option
group.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Choose the name of the option group to display its details. The options and option settings in the
option group are listed.
AWS CLI
To list the options and option settings for an option group, use the AWS CLI describe-option-
groups command. Specify the name of the option group whose options and settings you want to view.
If you don't specify an option group name, all option groups are described.
Example
The following example lists the options and option settings for all option groups.
Example
The following example lists the options and option settings for an option group named
testoptiongroup.
RDS API
To list the options and option settings for an option group, use the Amazon RDS API
DescribeOptionGroups operation. Specify the name of the option group whose options and settings
you want to view. If you don't specify an option group name, all option groups are described.
• When you add an option that adds or updates a port value, such as the OEM option.
• When you add or remove an option group with an option that includes a port value.
In these cases, choose the Apply Immediately option in the console. Or you can include the --apply-
immediately option when using the AWS CLI or set the ApplyImmediately parameter to true when
277
Amazon Relational Database Service User Guide
Modifying an option setting
using the RDS API. Options that don't include port values can be applied immediately, or can be applied
during the next maintenance window for the DB instance.
Note
If you specify a security group as a value for an option in an option group, you manage the
security group by modifying the option group. You can't change or remove this security group
by modifying a DB instance. Also, the security group doesn't appear in the DB instance details
in the AWS Management Console or in the output for the AWS CLI command describe-db-
instances.
Console
You can use the AWS Management Console to modify an option setting.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Select the option group whose option that you want to modify, and then choose Modify option.
4. In the Modify option window, from Installed Options, choose the option whose setting you want to
modify. Make the changes that you want.
5. To enable the option as soon as you add it, for Apply Immediately, choose Yes. If you choose No
(the default), the option is enabled for each associated DB instance during its next maintenance
window.
6. When the settings are as you want them, choose Modify Option.
AWS CLI
To modify an option setting, use the AWS CLI add-option-to-option-group command with the
option group and option that you want to modify. By default, the option is enabled for each associated
DB instance during its next maintenance window. To apply the change immediately to all associated
DB instances, include the --apply-immediately parameter. To modify an option setting, use the --
settings argument.
Example
The following example modifies the port that the Oracle Enterprise Manager Database Control (OEM)
uses in an option group named testoptiongroup and immediately applies the change.
For Windows:
278
Amazon Relational Database Service User Guide
Modifying an option setting
Example
The following example modifies the Oracle option NATIVE_NETWORK_ENCRYPTION and changes the
option settings.
For Windows:
279
Amazon Relational Database Service User Guide
Removing an option from an option group
RDS API
To modify an option setting, use the Amazon RDS API ModifyOptionGroup command with the option
group and option that you want to modify. By default, the option is enabled for each associated DB
instance during its next maintenance window. To apply the change immediately to all associated DB
instances, include the ApplyImmediately parameter and set it to true.
If you remove all options from an option group, Amazon RDS doesn't delete the option group. DB
instances that are associated with the empty option group continue to be associated with it; they just
won't have any active options. Alternatively, to remove all options from a DB instance, you can associate
the DB instance with the default (empty) option group.
Console
You can use the AWS Management Console to remove an option from an option group.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Select the option group whose option you want to remove, and then choose Delete option.
4. In the Delete option window, do the following:
• Select the check box for the option that you want to delete.
• For the deletion to take effect as soon as you make it, for Apply immediately, choose Yes. If you
choose No (the default), the option is deleted for each associated DB instance during its next
maintenance window.
280
Amazon Relational Database Service User Guide
Deleting an option group
5. When the settings are as you want them, choose Yes, Delete.
AWS CLI
To remove an option from an option group, use the AWS CLI remove-option-from-option-
group command with the option that you want to delete. By default, the option is removed from each
associated DB instance during its next maintenance window. To apply the change immediately, include
the --apply-immediately parameter.
Example
The following example removes the Oracle Enterprise Manager Database Control (OEM) option from an
option group named testoptiongroup and immediately applies the change.
For Windows:
RDS API
To remove an option from an option group, use the Amazon RDS API ModifyOptionGroup action. By
default, the option is removed from each associated DB instance during its next maintenance window. To
apply the change immediately, include the ApplyImmediately parameter and set it to true.
• OptionGroupName
• OptionsToRemove.OptionName
You can't delete a default option group. In addition, if you try to delete an option group that is
associated with an Amazon RDS resource, an error similar to the following is returned.
281
Amazon Relational Database Service User Guide
Deleting an option group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Choose the name of the option group to show its details.
4. Check the Associated Instances and Snapshots section for the associated Amazon RDS resources.
If a DB instance is associated with the option group, modify the DB instance to use a different option
group. For more information, see Modifying an Amazon RDS DB instance (p. 306).
If a manual DB snapshot is associated with the option group, modify the DB snapshot to use a different
option group using the AWS CLI modify-db-snapshot command.
Note
You can't modify the option group of an automated DB snapshot.
Console
One way of deleting an option group is by using the AWS Management Console.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Option groups.
3. Choose the option group.
4. Choose Delete group.
5. On the confirmation page, choose Delete to finish deleting the option group, or choose Cancel to
cancel the deletion.
AWS CLI
To delete an option group, use the AWS CLI delete-option-group command with the following
required parameter.
• --option-group-name
Example
282
Amazon Relational Database Service User Guide
Deleting an option group
For Windows:
RDS API
To delete an option group, call the Amazon RDS API DeleteOptionGroup operation. Include the
following parameter:
• OptionGroupName
283
Amazon Relational Database Service User Guide
Working with parameter groups
You manage your database configuration by associating your DB instances with parameter groups.
Amazon RDS defines parameter groups with default settings.
Important
You can define your own parameter groups with customized settings. Then you can modify your
DB instances to use your own parameter groups.
For information about modifying a DB instance, see Modifying an Amazon RDS DB
instance (p. 306).
Note
Some DB engines offer additional features that you can add to your database as options in an
option group. For information about option groups, see Working with option groups (p. 268).
A DB parameter group acts as a container for engine configuration values that are applied to one or more
DB instances.
If you create a DB instance without specifying a DB parameter group, the DB instance uses a default DB
parameter group. Each default DB parameter group contains database engine defaults and Amazon RDS
system defaults based on the engine, compute class, and allocated storage of the instance. You can't
modify the parameter settings of a default parameter group. Instead, you create your own parameter
group where you choose your own parameter settings. Not all DB engine parameters can be changed in a
parameter group that you create.
If you want to use your own parameter group, you create a new parameter group and modify the
parameters that you want to. You then modify your DB instance to use the new parameter group. If
you update parameters within a DB parameter group, the changes apply to all DB instances that are
associated with that parameter group.
You can copy an existing DB parameter group with the AWS CLI copy-db-parameter-group command.
Copying a parameter group can be convenient when you want to include most of an existing DB
parameter group's custom parameters and values in a new DB parameter group.
Here are some important points about working with parameters in a DB parameter group:
• Database parameters are either static or dynamic. When you change a static parameter, a database
reboot is required take it into effect. When you change a dynamic parameter and save the DB
parameter group, the change is applied immediately regardless of the Apply Immediately setting.
When you change a static parameter and save the DB parameter group, the parameter change
takes effect after you manually reboot the DB instance. You can reboot a DB instance using the RDS
console, by calling the reboot-db-instance CLI command, or by calling the RebootDbInstance
API operation. The requirement to reboot the associated DB instance after a static parameter
change helps mitigate the risk of a parameter misconfiguration affecting an API call, such as calling
ModifyDBInstance to change DB instance class or scale storage.
If a DB instance isn't using the latest changes to its associated DB parameter group, the AWS
Management Console shows the DB parameter group with a status of pending-reboot. The pending-
reboot parameter groups status doesn't result in an automatic reboot during the next maintenance
window. To apply the latest parameter changes to that DB instance, manually reboot the DB instance.
• When you associate a new DB parameter group with a DB instance, the modified static and dynamic
parameters are applied only after the DB instance is rebooted. However, if you modify dynamic
parameters in the newly associated DB parameter group, these changes are applied immediately
without a reboot. For more information about changing the DB parameter group, see Modifying an
Amazon RDS DB instance (p. 306).
284
Amazon Relational Database Service User Guide
Creating a DB parameter group
• You can specify the value for a DB parameter as an integer or as an integer expression built from
formulas, variables, functions, and operators. Functions can include a mathematical log expression. For
more information, see Specifying DB parameters (p. 296).
• Set any parameters that relate to the character set or collation of your database in your parameter
group before creating the DB instance and before you create a database in your DB instance. This
ensures that the default database and new databases in your DB instance use the character set and
collation values that you specify. If you change character set or collation parameters for your DB
instance, the parameter changes are not applied to existing databases.
For some DB engines, you can change character set or collation values for an existing database using
the ALTER DATABASE command, for example:
For more information about changing the character set or collation values for a database, check the
documentation for your DB engine.
• Improperly setting parameters in a DB parameter group can have unintended adverse effects,
including degraded performance and system instability. Always exercise caution when modifying
database parameters and back up your data before modifying a DB parameter group. Try out
parameter group setting changes on a test DB instance before applying those parameter group
changes to a production DB instance.
• To determine the supported parameters for your DB engine, you can view the parameters in the DB
parameter group used by the DB instance. For more information, see Viewing parameter values for a
DB parameter group (p. 295).
Topics
• Creating a DB parameter group (p. 285)
• Associating a DB parameter group with a DB instance (p. 287)
• Modifying parameters in a DB parameter group (p. 288)
• Resetting parameters in a DB parameter group to their default values (p. 290)
• Copying a DB parameter group (p. 292)
• Listing DB parameter groups (p. 294)
• Viewing parameter values for a DB parameter group (p. 295)
• Comparing DB parameter groups (p. 296)
• Specifying DB parameters (p. 296)
Console
To create a DB parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. Choose Create parameter group.
285
Amazon Relational Database Service User Guide
Creating a DB parameter group
AWS CLI
To create a DB parameter group, use the AWS CLI create-db-parameter-group command. The
following example creates a DB parameter group named mydbparametergroup for MySQL version 5.6
with a description of "My new parameter group."
• --db-parameter-group-name
• --db-parameter-group-family
• --description
To list all of the available parameter group families, use the following command:
Note
The output contains duplicates.
Example
For Windows:
RDS API
To create a DB parameter group, use the RDS API CreateDBParameterGroup operation.
286
Amazon Relational Database Service User Guide
Associating a DB parameter group with a DB instance
• DBParameterGroupName
• DBParameterGroupFamily
• Description
For information about creating a DB parameter group, see Creating a DB parameter group (p. 285).
For information about creating a DB instance, see Creating an Amazon RDS DB instance (p. 194). For
information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 306).
Note
When you associate a new DB parameter group with a DB instance, the modified static and
dynamic parameters are applied only after the DB instance is rebooted. However, if you modify
dynamic parameters in the newly associated DB parameter group, these changes are applied
immediately without a reboot.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
modify.
3. Choose Modify. The Modify DB Instance page appears.
4. Change the DB parameter group setting.
5. Choose Continue and check the summary of modifications.
6. (Optional) Choose Apply immediately to apply the changes immediately. Choosing this option
can cause an outage in some cases. For more information, see Using the Apply Immediately
setting (p. 307).
7. On the confirmation page, review your changes. If they are correct, choose Modify DB instance to
save your changes.
AWS CLI
To associate a DB parameter group with a DB instance, use the AWS CLI modify-db-instance
command with the following options:
• --db-instance-identifier
• --db-parameter-group-name
The following example associates the mydbpg DB parameter group with the database-1 DB
instance. The changes are applied immediately by using --apply-immediately. Use --no-apply-
287
Amazon Relational Database Service User Guide
Modifying parameters in a DB parameter group
immediately to apply the changes during the next maintenance window. For more information, see
Using the Apply Immediately setting (p. 307).
Example
For Windows:
RDS API
To associate a DB parameter group with a DB instance, use the RDS API ModifyDBInstance operation
with the following parameters:
• DBInstanceName
• DBParameterGroupName
Changes to some parameters are applied to the DB instance immediately without a reboot. Changes to
other parameters are applied only after the DB instance is rebooted. The RDS console shows the status
of the DB parameter group associated with a DB instance on the Configuration tab. For example, if the
DB instance isn't using the latest changes to its associated DB parameter group, the RDS console shows
the DB parameter group with a status of pending-reboot. To apply the latest parameter changes to that
DB instance, manually reboot the DB instance.
288
Amazon Relational Database Service User Guide
Modifying parameters in a DB parameter group
Console
To modify a DB parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. In the list, choose the parameter group that you want to modify.
4. For Parameter group actions, choose Edit.
5. Change the values of the parameters that you want to modify. You can scroll through the
parameters using the arrow keys at the top right of the dialog box.
AWS CLI
To modify a DB parameter group, use the AWS CLI modify-db-parameter-group command with the
following required options:
• --db-parameter-group-name
289
Amazon Relational Database Service User Guide
Resetting parameters in a DB parameter group
• --parameters
The following example modifies the max_connections and max_allowed_packet values in the DB
parameter group named mydbparametergroup.
Example
"ParameterName=max_allowed_packet,ParameterValue=1024,ApplyMethod=immediate"
For Windows:
"ParameterName=max_allowed_packet,ParameterValue=1024,ApplyMethod=immediate"
DBPARAMETERGROUP mydbparametergroup
RDS API
To modify a DB parameter group, use the RDS API ModifyDBParameterGroup operation with the
following required parameters:
• DBParameterGroupName
• Parameters
When you use the console, you can reset specific parameters to their default values, but you can't easily
reset all of the parameters in the DB parameter group at once. When you use the AWS CLI or RDS API,
you can reset specific parameters to their default values, and you can reset all of the parameters in the
DB parameter group at once.
Changes to some parameters are applied to the DB instance immediately without a reboot. Changes to
other parameters are applied only after the DB instance is rebooted. The RDS console shows the status
of the DB parameter group associated with a DB instance on the Configuration tab. For example, if the
DB instance isn't using the latest changes to its associated DB parameter group, the RDS console shows
the DB parameter group with a status of pending-reboot. To apply the latest parameter changes to that
DB instance, manually reboot the DB instance.
290
Amazon Relational Database Service User Guide
Resetting parameters in a DB parameter group
Note
In a default DB parameter group, parameters are always set to their default values.
Console
To reset parameters in a DB parameter group to their default values
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. In the list, choose the parameter group.
4. For Parameter group actions, choose Edit.
5. Choose the parameters that you want to reset to their default values. You can scroll through the
parameters using the arrow keys at the top right of the dialog box.
AWS CLI
To reset some or all of the parameters in a DB parameter group, use the AWS CLI reset-db-
parameter-group command with the following required option: --db-parameter-group-name.
291
Amazon Relational Database Service User Guide
Copying a DB parameter group
To reset all of the parameters in the DB parameter group, specify the --reset-all-parameters
option. To reset specific parameters, specify the --parameters option.
The following example resets all of the parameters in the DB parameter group named
mydbparametergroup to their default values.
Example
For Windows:
The following example resets the max_connections and max_allowed_packet options to their
default values in the DB parameter group named mydbparametergroup.
Example
For Windows:
DBParameterGroupName mydbparametergroup
RDS API
To reset parameters in a DB parameter group to their default values, use the RDS
API ResetDBParameterGroup command with the following required parameter:
DBParameterGroupName.
To reset all of the parameters in the DB parameter group, set the ResetAllParameters parameter to
true. To reset specific parameters, specify the Parameters parameter.
292
Amazon Relational Database Service User Guide
Copying a DB parameter group
custom parameters and values from that group in a new DB parameter group. You can copy a DB
parameter group by using the AWS Management Console, the AWS CLI copy-db-parameter-group
command, or the RDS API CopyDBParameterGroup operation.
After you copy a DB parameter group, wait at least 5 minutes before creating your first DB instance that
uses that DB parameter group as the default parameter group. Doing this allows Amazon RDS to fully
complete the copy action before the parameter group is used. This is especially important for parameters
that are critical when creating the default database for a DB instance. An example is the character set
for the default database defined by the character_set_database parameter. Use the Parameter
Groups option of the Amazon RDS console or the describe-db-parameters command to verify that your
DB parameter group is created.
Note
You can't copy a default parameter group. However, you can create a new parameter group that
is based on a default parameter group.
Currently, you can't copy a parameter group to a different AWS Region.
Console
To copy a DB parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. In the list, choose the custom parameter group that you want to copy.
4. For Parameter group actions, choose Copy.
5. In New DB parameter group identifier, enter a name for the new parameter group.
6. In Description, enter a description for the new parameter group.
7. Choose Copy.
AWS CLI
To copy a DB parameter group, use the AWS CLI copy-db-parameter-group command with the
following required options:
• --source-db-parameter-group-identifier
• --target-db-parameter-group-identifier
• --target-db-parameter-group-description
The following example creates a new DB parameter group named mygroup2 that is a copy of the DB
parameter group mygroup1.
Example
For Windows:
293
Amazon Relational Database Service User Guide
Listing DB parameter groups
--target-db-parameter-group-identifier mygroup2 ^
--target-db-parameter-group-description "DB parameter group 2"
RDS API
To copy a DB parameter group, use the RDS API CopyDBParameterGroup operation with the following
required parameters:
• SourceDBParameterGroupIdentifier
• TargetDBParameterGroupIdentifier
• TargetDBParameterGroupDescription
Console
To list all DB parameter groups for an AWS account
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
AWS CLI
To list all DB parameter groups for an AWS account, use the AWS CLI describe-db-parameter-
groups command.
Example
The following example lists all available DB parameter groups for an AWS account.
294
Amazon Relational Database Service User Guide
Viewing parameter values for a DB parameter group
For Windows:
RDS API
To list all DB parameter groups for an AWS account, use the RDS API DescribeDBParameterGroups
operation.
Console
To view the parameter values for a DB parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
AWS CLI
To view the parameter values for a DB parameter group, use the AWS CLI describe-db-parameters
command with the following required parameter.
• --db-parameter-group-name
Example
The following example lists the parameters and parameter values for a DB parameter group named
mydbparametergroup.
295
Amazon Relational Database Service User Guide
Comparing DB parameter groups
RDS API
To view the parameter values for a DB parameter group, use the RDS API DescribeDBParameters
command with the following required parameter.
• DBParameterGroupName
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. In the list, choose the two parameter groups that you want to compare.
4. For Parameter group actions, choose Compare.
Note
If the items you selected aren't equivalent, you can't choose Compare. For example, you
can't compare a MySQL 5.6 and a MySQL 5.7 parameter group. You can't compare a DB
parameter group and an Aurora DB cluster parameter group.
Specifying DB parameters
DB parameter types include the following:
• Integer
• Boolean
• String
• Long
• Double
• Timestamp
• Object of other defined data types
• Array of values of type integer, Boolean, string, long, double, timestamp, or object
You can also specify integer and Boolean DB parameters using expressions, formulas, and functions.
For the Oracle engine, you can use the DBInstanceClassHugePagesDefault formula variable to
specify a Boolean DB parameter. See DB parameter formula variables (p. 297).
For the PostgreSQL engine, you can use an expression to specify a Boolean DB parameter. See Boolean
DB parameter expressions (p. 299).
Contents
• DB parameter formulas (p. 297)
296
Amazon Relational Database Service User Guide
Specifying DB parameters
DB parameter formulas
A DB parameter formula is an expression that resolves to an integer value or a Boolean value. You
enclose the expression in braces: {}. You can use a formula for either a DB parameter value or as an
argument to a DB parameter function.
Syntax
{FormulaVariable}
{FormulaVariable*Integer}
{FormulaVariable*Integer/Integer}
{FormulaVariable/Integer}
AllocatedStorage
Returns a Boolean value. Currently, it's only supported for Oracle engines.
For more information, see Enabling HugePages for an Oracle DB instance (p. 1283).
DBInstanceClassMemory
Returns an integer of the number of bytes of memory allocated to the DB instance class associated
with the current DB instance, less the memory used by RDS processes that manage the instance.
DBInstanceVCPU
Returns an integer representing the number of virtual central processing units (vCPUs) used by
Amazon RDS to manage the instance. Currently, it's only supported for the PostgreSQL engine.
EndPointPort
Returns an integer representing the port used when connecting to the DB instance.
Division operator: /
Divides the dividend by the divisor, returning an integer quotient. Decimals in the quotient are
truncated, not rounded.
297
Amazon Relational Database Service User Guide
Specifying DB parameters
Syntax
dividend / divisor
Multiplies the expressions, returning the product of the expressions. Decimals in the expressions are
truncated, not rounded.
Syntax
expression * expression
DB parameter functions
You specify the arguments of DB parameter functions as either integers or formulas. Each function must
have at least one argument. Specify multiple arguments as a comma-separated list. The list can't have
any empty members, such as argument1,,argument3. Function names are case-insensitive.
IF
Returns an argument.
Currently, it's only supported for Oracle engines, and the only supported first argument is
{DBInstanceClassHugePagesDefault}. For more information, see Enabling HugePages for an
Oracle DB instance (p. 1283).
Syntax
Returns the second argument if the first argument evaluates to true. Returns the third argument
otherwise.
GREATEST
Syntax
GREATEST(argument1, argument2,...argumentn)
Returns an integer.
LEAST
Syntax
LEAST(argument1, argument2,...argumentn)
Returns an integer.
298
Amazon Relational Database Service User Guide
Specifying DB parameters
SUM
Syntax
SUM(argument1, argument2,...argumentn)
Returns an integer.
Syntax
Syntax
Syntax
Syntax
Syntax
299
Amazon Relational Database Service User Guide
Specifying DB parameters
The following Boolean DB parameter expression example compares the result of a parameter formula
with an integer to modify the Boolean DB parameter wal_compression for a PostgreSQL DB instance.
The parameter expression compares the number of vCPUs with the value 2. If the number of vCPUs is
greater than 2, then the wal_compression DB parameter is set to true.
{log(DBInstanceClassMemory/8187281418)*1000}
The log function represents log base 2. This example also uses the DBInstanceClassMemory formula
variable. See DB parameter formula variables (p. 297).
Note
Currently, you can't specify the MySQL innodb_log_file_size parameter with any value
other than an integer.
You can specify the GREATEST function in an Oracle processes parameter. Use it to set the number of
user processes to the larger of either 80 or DBInstanceClassMemory divided by 9,868,951.
GREATEST({DBInstanceClassMemory/9868951},80)
You can specify the LEAST function in a MySQL max_binlog_cache_size parameter value. Use
it to set the maximum cache size a transaction can use in a MySQL instance to the lesser of 1 MB or
DBInstanceClass/256.
LEAST({DBInstanceClassMemory/256},10485760)
300
Amazon Relational Database Service User Guide
Topics
• Stopping an Amazon RDS DB instance temporarily (p. 302)
• Starting an Amazon RDS DB instance that was previously stopped (p. 305)
• Modifying an Amazon RDS DB instance (p. 306)
• Maintaining a DB instance (p. 320)
• Upgrading a DB instance engine version (p. 331)
• Renaming a DB instance (p. 334)
• Rebooting a DB instance (p. 336)
• Working with read replicas (p. 338)
• Tagging Amazon RDS resources (p. 359)
• Working with Amazon Resource Names (ARNs) in Amazon RDS (p. 369)
• Working with storage for Amazon RDS DB instances (p. 376)
• Deleting a DB instance (p. 384)
301
Amazon Relational Database Service User Guide
Stopping a DB instance
You can stop and start DB instances that are running the following engines:
• MariaDB
• Microsoft SQL Server
• MySQL
• Oracle
• PostgreSQL
Stopping and starting a DB instance is supported for all DB instance classes, and in all AWS Regions.
You can stop and start a DB instance whether it is configured for a single Availability Zone or for Multi-
AZ, for database engines that support Multi-AZ deployments. You can't stop an Amazon RDS for SQL
Server DB instance in a Multi-AZ configuration.
Note
For a Multi-AZ deployment, a large amount of time might be required to stop a DB instance.
If you have at least one backup after a previous failover, then you can speed up the stop DB
instance operation by performing a reboot with failover operation before stopping the DB
instance.
When you stop a DB instance, the DB instance performs a normal shutdown and stops running. The
status of the DB instance changes to stopping and then stopped. Any storage volumes remain
attached to the DB instance, and their data is kept. Any data stored in the RAM of the DB instance is
deleted.
Stopping a DB instance removes pending actions, except for pending actions for the DB instance's option
group or DB parameter group.
Automated backups aren't created while a DB instance is stopped. Backups can be retained longer than
the backup retention period if a DB instance has been stopped. RDS doesn't include time spent in the
stopped state when the backup retention window is calculated.
Important
You can stop a DB instance for up to seven days. If you don't manually start your DB instance
after seven days, your DB instance is automatically started so that it doesn't fall behind any
required maintenance updates.
Benefits
Stopping and starting a DB instance is faster than creating a DB snapshot, and then restoring the
snapshot.
When you stop a DB instance it retains its ID, Domain Name Server (DNS) endpoint, parameter group,
security group, and option group. When you start a DB instance, it has the same configuration as when
302
Amazon Relational Database Service User Guide
Limitations
you stopped it. In addition, if you stop a DB instance, Amazon RDS retains the Amazon Simple Storage
Service (Amazon S3) transaction logs so you can do a point-in-time restore if necessary.
Limitations
The following are some limitations to stopping and starting a DB instance:
• You can't stop a DB instance that has a read replica, or that is a read replica.
• You can't stop an Amazon RDS for SQL Server DB instance in a Multi-AZ configuration.
• You can't modify a stopped DB instance.
• You can't delete an option group that is associated with a stopped DB instance.
• You can't delete a DB parameter group that is associated with a stopped DB instance.
• In a Multi-AZ configuration, the primary and secondary Availability Zones might be switched after you
start the DB instance.
You can change the option group or DB parameter group that is associated with a stopped DB instance,
but the change does not occur until the next time you start the DB instance. If you chose to apply
changes immediately, the change occurs when you start the DB instance. Otherwise the change occurs
during the next maintenance window after you start the DB instance.
Public IP address
When you stop a DB instance, it retains its DNS endpoint. If you stop a DB instance that has a public IP
address, Amazon RDS releases its public IP address. When the DB instance is restarted, it has a different
public IP address.
Note
You should always connect to a DB instance using the DNS endpoint, not the IP address.
Console
To stop a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to stop.
3. For Actions, choose Stop.
4. (Optional) In the Stop DB Instance window, choose Yes for Create Snapshot? and enter the
snapshot name for Snapshot name. Choose Yes if you want to create a snapshot of the DB instance
before stopping it.
5. Choose Yes, Stop Now to stop the DB instance, or choose Cancel to cancel the operation.
303
Amazon Relational Database Service User Guide
Stopping a DB instance
AWS CLI
To stop a DB instance by using the AWS CLI, call the stop-db-instance command with the following
option:
Example
RDS API
To stop a DB instance by using the Amazon RDS API, call the StopDBInstance operation with the
following parameter:
304
Amazon Relational Database Service User Guide
Starting a DB instance
When you start a DB instance that you previously stopped, the DB instance retains the ID, Domain Name
Server (DNS) endpoint, parameter group, security group, and option group. When you start a stopped
instance, you are charged a full instance hour.
Console
To start a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to start.
3. For Actions, choose Start.
AWS CLI
To start a DB instance by using the AWS CLI, call the start-db-instance command with the following
option:
Example
RDS API
To start a DB instance by using the Amazon RDS API, call the StartDBInstance operation with the
following parameter:
305
Amazon Relational Database Service User Guide
Modifying a DB instance
We recommend that you test any changes on a test instance before modifying a production instance, so
that you fully understand the impact of each change. Testing is especially important when upgrading
database versions.
Most modifications to a DB instance you can either apply immediately or defer until the next
maintenance window. Some modifications, such as parameter group changes, require that you manually
reboot your DB instance for the change to take effect.
Important
Some modifications result in downtime because Amazon RDS must reboot your DB instance
for the change to take effect. Review the impact to your database and applications before
modifying your DB instance settings.
Console
To modify a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
modify.
3. Choose Modify. The Modify DB instance page appears.
4. Change any of the settings that you want. For information about each setting, see Settings for DB
instances (p. 307).
5. When all the changes are as you want them, choose Continue and check the summary of
modifications.
6. (Optional) Choose Apply immediately to apply the changes immediately. Choosing this option
can cause downtime in some cases. For more information, see Using the Apply Immediately
setting (p. 307).
7. On the confirmation page, review your changes. If they are correct, choose Modify DB instance to
save your changes.
AWS CLI
To modify a DB instance by using the AWS CLI, call the modify-db-instance command. Specify the DB
instance identifier and the values for the options that you want to modify. For information about each
option, see Settings for DB instances (p. 307).
Example
The following code modifies mydbinstance by setting the backup retention period to 1 week (7
days). The code enables deletion protection by using --deletion-protection. To disable deletion
protection, use --no-deletion-protection. The changes are applied during the next maintenance
window by using --no-apply-immediately. Use --apply-immediately to apply the changes
immediately. For more information, see Using the Apply Immediately setting (p. 307).
306
Amazon Relational Database Service User Guide
Apply Immediately setting
For Windows:
RDS API
To modify a DB instance by using the Amazon RDS API, call the ModifyDBInstance operation. Specify
the DB instance identifier, and the parameters for the settings that you want to modify. For information
about each parameter, see Settings for DB instances (p. 307).
If you don't choose to apply changes immediately, the changes are put into the pending modifications
queue. During the next maintenance window, any pending changes in the queue are applied. If you
choose to apply changes immediately, your new changes and any changes in the pending modifications
queue are applied.
Important
If any of the pending modifications require the DB instance to be temporarily unavailable
(downtime), choosing the apply immediately option can cause unexpected downtime.
When you choose to apply a change immediately, any pending modifications are also applied
immediately, instead of during the next maintenance window.
If you don't want a pending change to be applied in the next maintenance window, you
can modify the DB instance to revert the change. You can do this by using the AWS CLI and
specifying the --apply-immediately option.
Changes to some database settings are applied immediately, even if you choose to defer your changes.
To see how the different database settings interact with the apply immediately setting, see Settings for
DB instances (p. 307).
You can modify a DB instance using the console, the modify-db-instance CLI command, or the
ModifyDBInstance RDS API operation.
307
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Auto minor version upgrade CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Yes to enable your DB instance --auto-minor- setting ignores the change.
to receive preferred minor version- apply immediately
DB engine version upgrades upgrade|--no- setting.
automatically when they auto-minor-
become available. Amazon version-upgrade
RDS performs automatic
minor version upgrades in RDS API parameter:
the maintenance window.
Otherwise, No. AutoMinorVersionUpgrade
308
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Choose Enable replication to information on asynchronously, as SQL
another AWS Region to create enabling cross- soon as possible. Server
backups in an additional Region Region backups
for disaster recovery. using the AWS CLI
or RDS API, see
Then choose the Destination Enabling cross-
Region for the additional Region automated
backups. backups (p. 400).
Backup retention period CLI option: If you choose to Downtime occurs if All DB
apply the change you change from 0 engines
The number of days that --backup- immediately, it to a nonzero value,
automatic backups are retained. retention-period occurs immediately. or from a nonzero
To disable automatic backups, value to 0.
set the backup retention period RDS API parameter:If you don't choose
to 0. to apply the change This applies to both
BackupRetentionPeriod
immediately, Single-AZ and Multi-
For more information, see and you change AZ DB instances.
Working with backups (p. 388). the setting
Note from a nonzero
If you use AWS Backup value to another
to manage your nonzero value, the
backups, this option change is applied
doesn't appear. For asynchronously, as
information about AWS soon as possible.
Backup, see the AWS Otherwise, the
Backup Developer Guide. change occurs
during the next
maintenance
window.
309
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Copy tags to snapshots CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
If you have any DB instance tags, --copy-tags-to- setting ignores the change.
enable this option to copy them snapshot or --no- apply immediately
when you create a DB snapshot. copy-tags-to- setting.
snapshot
For more information,
see Tagging Amazon RDS RDS API parameter:
resources (p. 359).
CopyTagsToSnapshot
Database port CLI option: The change occurs The DB instance All DB
immediately. This is rebooted engines
The port that you want to use to --db-port-number setting ignores the immediately.
access the DB instance. apply immediately
RDS API parameter: setting.
The port value must not match
any of the port values specified DBPortNumber
for options in the option group
that is associated with the DB
instance.
310
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
For more information, see DB RDS API parameter: If you don't choose
instance classes (p. 10). to apply the change
DBInstanceClass immediately, it
occurs during the
next maintenance
window.
For more
information, see
Working with
DB parameter
groups (p. 284) and
Rebooting a DB
instance (p. 336).
311
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Deletion protection CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Enable deletion protection to --deletion- setting ignores the change.
prevent your DB instance from protection|-- apply immediately
being deleted. no-deletion- setting.
protection
For more information,
see Deleting a DB RDS API parameter:
instance (p. 384).
DeletionProtection
Enhanced Monitoring CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Enable Enhanced Monitoring to --monitoring- setting ignores the change.
enable gathering metrics in real interval and -- apply immediately
time for the operating system monitoring-role- setting.
that your DB instance runs on. arn
312
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Log exports CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
The types of database log --cloudwatch- setting ignores the change.
files to publish to Amazon logs-export- apply immediately
CloudWatch Logs. configuration setting.
For more information, see RDS API parameter:
Publishing database logs
to Amazon CloudWatch CloudwatchLogsExportConfiguration
Logs (p. 595).
Maintenance window CLI option: The change occurs If there are one All DB
immediately. This or more pending engines
The time range during which --preferred- setting ignores the actions that cause
system maintenance occurs. maintenance- apply immediately downtime, and
System maintenance includes window setting. the maintenance
upgrades, if applicable. The window is changed
maintenance window is a start RDS API parameter: to include the
time in Universal Coordinated current time, those
Time (UTC), and a duration in PreferredMaintenanceWindow
pending actions are
hours. applied immediately
and downtime
If you set the window to the occurs.
current time, there must be at
least 30 minutes between the
current time and the end of
the window to ensure that any
pending changes are applied.
313
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
New master password CLI option: The change Downtime doesn't All DB
is applied occur during this engines
The password for your master --master-user- asynchronously, as change.
user. The password must contain password soon as possible.
8–41 alphanumeric characters. This setting
RDS API parameter: ignores the apply
immediately setting.
MasterUserPassword
Performance Insights CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Enable Performance Insights --enable- setting ignores the change.
to monitor your DB instance performance- apply immediately
load so that you can analyze insights|-- setting.
and troubleshoot your database no-enable-
performance. performance-
insights
Performance Insights isn't
available for some DB engine RDS API parameter:
versions and DB instance classes.
The Performance Insights EnablePerformanceInsights
section doesn't appear in the
console if it isn't available for
your DB instance.
314
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Performance Insights AWS KMS CLI option: The change occurs Downtime doesn't All DB
key immediately. This occur during this engines
--performance- setting ignores the change.
The AWS KMS key identifier for insights-kms- apply immediately
the AWS KMS key for encryption key-id setting.
of Performance Insights data.
The key identifier is the Amazon RDS API parameter:
Resource Name (ARN), AWS KMS
key identifier, or the key alias for PerformanceInsightsKMSKeyId
the KMS key.
Performance Insights Retention CLI option: The change occurs Downtime doesn't All DB
period immediately. This occur during this engines
--performance- setting ignores the change.
The amount of time, in days, insights- apply immediately
to retain Performance Insights retention-period setting.
data. Valid values are 7 or 731 (2
years). RDS API parameter:
ProcessorFeatures
and
UseDefaultProcessorFeatures
315
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Public access CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Publicly accessible to give the --publicly- setting ignores the change.
DB instance a public IP address, accessible|-- apply immediately
meaning that it's accessible no-publicly- setting.
outside the VPC. To be publicly accessible
accessible, the DB instance also
has to be in a public subnet in RDS API parameter:
the VPC.
PubliclyAccessible
Not publicly accessible to make
the DB instance accessible only
from inside the VPC.
To connect to a DB instance
from outside of its Amazon
VPC, the DB instance must be
publicly accessible, access must
be granted using the inbound
rules of the DB instance's
security group, and other
requirements must be met. For
more information, see Can't
connect to Amazon RDS DB
instance (p. 2005).
316
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
Storage autoscaling CLI option: The change occurs Downtime doesn't All DB
immediately. This occur during this engines
Enable storage autoscaling --max-allocated- setting ignores the change.
to enable Amazon RDS to storage apply immediately
automatically increase storage setting.
when needed to avoid having RDS API parameter:
your DB instance run out of
storage space. MaxAllocatedStorage
317
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
318
Amazon Relational Database Service User Guide
Available settings
Console setting and description CLI option and RDS When the change Downtime notes Supported
API parameter occurs DB
engines
319
Amazon Relational Database Service User Guide
Maintaining a DB instance
Maintaining a DB instance
Periodically, Amazon RDS performs maintenance on Amazon RDS resources. Maintenance most often
involves updates to the DB instance's underlying hardware, underlying operating system (OS), or
database engine version. Updates to the operating system most often occur for security issues and
should be done as soon as possible.
Some maintenance items require that Amazon RDS take your DB instance offline for a short time.
Maintenance items that require a resource to be offline include required operating system or database
patching. Required patching is automatically scheduled only for patches that are related to security and
instance reliability. Such patching occurs infrequently (typically once every few months) and seldom
requires more than a fraction of your maintenance window.
Deferred DB instance modifications that you have chosen not to apply immediately are also applied
during the maintenance window. For example, you might choose to change the DB instance class
or parameter group during the maintenance window. Such modifications that you specify using
the pending reboot setting don't show up in the Pending maintenance list. For information about
modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 306).
You can view whether a maintenance update is available for your DB instance by using the RDS console,
the AWS CLI, or the Amazon RDS API. If an update is available, it is indicated in the Maintenance column
for the DB instance on the Amazon RDS console, as shown following.
If no maintenance update is available for a DB instance, the column value is none for it.
If a maintenance update is available for a DB instance, the following column values are possible:
• required – The maintenance action will be applied to the resource and can't be deferred indefinitely.
• available – The maintenance action is available, but it will not be applied to the resource
automatically. You can apply it manually.
• next window – The maintenance action will be applied to the resource during the next maintenance
window.
• In progress – The maintenance action is in the process of being applied to the resource.
• If the maintenance value is next window, defer the maintenance items by choosing Defer upgrade
from Actions. You can't defer a maintenance action if it has already started.
• Apply the maintenance items immediately.
320
Amazon Relational Database Service User Guide
Maintaining a DB instance
• Schedule the maintenance items to start during your next maintenance window.
• Take no action.
Note
Certain OS updates are marked as required. If you defer a required update, you get a notice
from Amazon RDS indicating when the update will be performed. Other updates are marked as
available, and these you can defer indefinitely.
To take an action, choose the DB instance to show its details, then choose Maintenance & backups. The
pending maintenance items appear.
The maintenance window determines when pending operations start, but doesn't limit the total run
time of these operations. Maintenance operations aren't guaranteed to finish before the maintenance
window ends, and can continue beyond the specified end time. For more information, see The Amazon
RDS maintenance window (p. 324).
321
Amazon Relational Database Service User Guide
Applying updates
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that has a required update.
4. For Actions, choose one of the following:
• Upgrade now
• Upgrade at next window
Note
If you choose Upgrade at next window and later want to delay the update, you can
choose Defer upgrade. You can't defer a maintenance action if it has already started.
To cancel a maintenance action, modify the DB instance and disable Auto minor version
upgrade.
AWS CLI
To apply a pending update to a DB instance, use the apply-pending-maintenance-action AWS CLI
command.
Example
For Windows:
Note
To defer a maintenance action, specify undo-opt-in for --opt-in-type. You can't specify
undo-opt-in for --opt-in-type if the maintenance action has already started.
To cancel a maintenance action, run the modify-db-instance AWS CLI command and specify --
no-auto-minor-version-upgrade.
To return a list of resources that have at least one pending update, use the describe-pending-
maintenance-actions AWS CLI command.
322
Amazon Relational Database Service User Guide
Maintenance for Multi-AZ deployments
Example
For Windows:
You can also return a list of resources for a DB instance by specifying the --filters parameter of the
describe-pending-maintenance-actions AWS CLI command. The format for the --filters
command is Name=filter-name,Value=resource-id,....
The following are the accepted values for the Name parameter of a filter:
• db-instance-id – Accepts a list of DB instance identifiers or Amazon Resource Names (ARNs). The
returned list only includes pending maintenance actions for the DB instances identified by these
identifiers or ARNs.
• db-cluster-id – Accepts a list of DB cluster identifiers or ARNs for Amazon Aurora. The returned list
only includes pending maintenance actions for the DB clusters identified by these identifiers or ARNs.
For example, the following example returns the pending maintenance actions for the sample-
instance1 and sample-instance2 DB instances.
Example
For Windows:
RDS API
To apply an update to a DB instance, call the Amazon RDS API ApplyPendingMaintenanceAction
operation.
To return a list of resources that have at least one pending update, call the Amazon RDS API
DescribePendingMaintenanceActions operation.
323
Amazon Relational Database Service User Guide
The maintenance window
3. Perform maintenance on the old primary, which becomes the new standby.
When you modify the database engine for your DB instance in a Multi-AZ deployment, then Amazon
RDS upgrades both the primary and secondary DB instances at the same time. In this case, the database
engine for the entire Multi-AZ deployment is shut down during the upgrade.
For more information on Multi-AZ deployments, see Multi-AZ deployments for high availability (p. 59).
The 30-minute maintenance window is selected at random from an 8-hour block of time per region. If
you don't specify a preferred maintenance window when you create the DB instance, then Amazon RDS
assigns a 30-minute maintenance window on a randomly selected day of the week.
RDS will consume some of the resources on your DB instance while maintenance is being applied. You
might observe a minimal effect on performance. For a DB instance, on rare occasions, a Multi-AZ failover
might be required for a maintenance update to complete.
Following, you can find the time blocks for each region from which default maintenance windows are
assigned.
324
Amazon Relational Database Service User Guide
Adjusting the maintenance window for a DB instance
In the following example, you adjust the preferred maintenance window for a DB instance.
For the purpose of this example, we assume that the DB instance named mydbinstance exists and has a
preferred maintenance window of "Sun:05:00-Sun:06:00" UTC.
Console
To adjust the preferred maintenance window
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then select the DB instance that you want to modify.
3. Choose Modify. The Modify DB Instance page appears.
4. In the Maintenance section, update the maintenance window.
Note
The maintenance window and the backup window for the DB instance cannot overlap. If
you enter a value for the maintenance window that overlaps the backup window, an error
message appears.
5. Choose Continue.
325
Amazon Relational Database Service User Guide
Working with mandatory operating system updates
6. To apply the changes to the maintenance window immediately, select Apply immediately.
7. Choose Modify DB Instance to save your changes.
Alternatively, choose Back to edit your changes, or choose Cancel to cancel your changes.
AWS CLI
To adjust the preferred maintenance window, use the AWS CLI modify-db-instance command with
the following parameters:
• --db-instance-identifier
• --preferred-maintenance-window
Example
The following code example sets the maintenance window to Tuesdays from 4:00-4:30AM UTC.
For Windows:
RDS API
To adjust the preferred maintenance window, use the Amazon RDS API ModifyDBInstance operation
with the following parameters:
• DBInstanceIdentifier
• PreferredMaintenanceWindow
Whether a mandatory operating system update is required for a DB instance depends on its DB engine
version and DB instance class. In the following sections, you can find descriptions of the affected DB
engine versions and DB instance classes for RDS for MySQL and RDS for PostgreSQL.
Topics
• Mandatory operating system updates for RDS for MySQL (p. 327)
• Mandatory operating system updates for RDS for PostgreSQL (p. 328)
• Recommended actions for mandatory operating system updates (p. 329)
326
Amazon Relational Database Service User Guide
Working with mandatory operating system updates
We recommend that you update the operating system Now–January 31, 2022
for your RDS for MySQL DB instances.
Amazon RDS starts automatic upgrades of the January 31, 2022–March 30, 2022
operating system for your RDS for MySQL DB instances
to the latest version in a maintenance window.
Amazon RDS starts automatic upgrades of the After March 30, 2022
operating system for your RDS for MySQL DB instances
to the latest version regardless of whether they are in a
maintenance window.
Amazon RDS won't upgrade the DB engine version or modify the DB instance class of your DB instances
automatically. For this operating system update to be required, a DB instance must be running the
versions with "Yes" in the following table for each DB instance class.
Mandatory operating system updates by version and DB instance class for RDS for MySQL
8.0.21 and No No No No No No
lower 8.0
versions
5.7.31 and No No No No No No
lower 5.7
versions
5.6.49 and No No No No No No
lower 5.6
versions
327
Amazon Relational Database Service User Guide
Working with mandatory operating system updates
We recommend that you update the operating system Now–January 10, 2022
for your RDS for PostgreSQL DB instances.
Amazon RDS starts automatic upgrades of the January 10, 2022–March 30, 2022
operating system for your RDS for PostgreSQL DB
instances to the latest version in a maintenance window.
Amazon RDS starts automatic upgrades of the After March 30, 2022
operating system for your RDS for PostgreSQL DB
instances to the latest version regardless of whether
they are in a maintenance window.
Amazon RDS won't upgrade the DB engine version or modify the DB instance class of your DB instances
automatically. For this operating system update to be required, a DB instance must be running the
versions with "Yes" in the following table for each DB instance class.
Mandatory operating system updates by version and DB instance class for RDS for
PostgreSQL
12.5 and No No No No No No
lower 12
versions
11.10 and No No No No No No
lower 11
versions
328
Amazon Relational Database Service User Guide
Working with mandatory operating system updates
10.15 and No No No No No No
lower 10
versions
If an operating system update is required for your DB instance based on its DB engine version and DB
instance class, the required update appears in the AWS Management Console. In this case, update the
operating system by following the instructions in Applying updates for a DB instance (p. 322).
If you are unable to identify any mandatory operating system updates in the AWS Management Console,
we recommend the following actions:
• Your DB instance doesn't use a DB engine version that requires this operating system update. Your DB
instance uses an affected DB instance class.
We recommend that you modify your DB instance to use a DB instance class that requires this
operating system update. For example, if your DB instance uses a db.r3 DB instance class, we
recommend that you modify your DB instance to use a db.r4 or db.r5 DB instance class. Similarly, if
your DB instance uses a db.m3 DB instance class, we recommend that you modify your DB instance to
use a db.m4 or db.m5 DB instance class. In this case, you don't need to update the operating system
because the DB instance class modification applies the operating system update. You can also modify
your DB instance to use a different DB instance class family, such as db.m6g or db.r6g.
329
Amazon Relational Database Service User Guide
Working with mandatory operating system updates
If your DB instance already uses a DB instance class that isn't in a DB instance class family that is
affected by this operating system update, then you don't need to modify its DB instance class. For
example, if your DB instance uses a db.m6g, db.x2g, or db.z1d DB instance class, then you don't need
to modify its DB instance class.
For more information about DB instance classes, see DB instance classes (p. 10). For more information
about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 306).
• Your DB instance doesn't use a DB engine version that requires this operating system update. Your DB
instance uses an older DB instance class in a DB instance class family that is affected by this operating
system update.
For example, if your DB instance uses a db.r3 DB instance class, we recommend that you modify
your DB instance to use a db.r4 or db.r5 DB instance class. Similarly, if your DB instance uses a
db.m3 DB instance class, we recommend that you modify your DB instance to use a db.m4 or db.m5
DB instance class. In this case, you don't need to update the operating system because the DB
instance class modification applies the operating system update. You can also modify your DB
instance to use a different DB instance class family, such as db.m6g or db.r6g.
For more information about DB instance classes, see DB instance classes (p. 10). For more
information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 306).
330
Amazon Relational Database Service User Guide
Upgrading the engine version
There are two kinds of upgrades: major version upgrades and minor version upgrades. In general, a
major engine version upgrade can introduce changes that are not compatible with existing applications.
In contrast, a minor version upgrade includes only changes that are backward-compatible with existing
applications.
The version numbering sequence is specific to each database engine. For example, RDS for MySQL 5.7
and 8.0 are major engine versions and upgrading from any 5.7 version to any 8.0 version is a major
version upgrade. RDS for MySQL version 5.7.22 and 5.7.23 are minor versions and upgrading from 5.7.22
to 5.7.23 is a minor version upgrade.
Important
You can't modify a DB instance when it is being upgraded. During an upgrade, the DB instance
status is upgrading.
For more information about major and minor version upgrades for a specific DB engine, see the
following documentation for your DB engine:
For major version upgrades, you must manually modify the DB engine version through the AWS
Management Console, AWS CLI, or RDS API. For minor version upgrades, you can manually modify the
engine version, or you can choose to enable auto minor version upgrades.
Topics
• Manually upgrading the engine version (p. 331)
• Automatically upgrading the minor engine version (p. 333)
Console
To upgrade the engine version of a DB instance by using the console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
upgrade.
3. Choose Modify. The Modify DB Instance page appears.
331
Amazon Relational Database Service User Guide
Manually upgrading the engine version
Alternatively, choose Back to edit your changes, or choose Cancel to cancel your changes.
AWS CLI
To upgrade the engine version of a DB instance, use the CLI modify-db-instance command. Specify the
following parameters:
For information about valid engine versions, use the AWS CLI describe-db-engine-versions command.
• --allow-major-version-upgrade – to upgrade the major version.
• --no-apply-immediately – to apply changes during the next maintenance window. To apply
changes immediately, use --apply-immediately.
Example
For Windows:
RDS API
To upgrade the engine version of a DB instance, use the ModifyDBInstance action. Specify the following
parameters:
332
Amazon Relational Database Service User Guide
Automatically upgrading the minor engine version
If you want Amazon RDS to upgrade the DB engine version of a database automatically, you can enable
auto minor version upgrades for the database.
When Amazon RDS designates a minor engine version as the preferred minor engine version, each
database that meets both of the following conditions is upgraded to the minor engine version
automatically:
• The database is running a minor version of the DB engine that is lower than the preferred minor
engine version.
• The database has auto minor version upgrade enabled.
You can control whether auto minor version upgrade is enabled for a DB instance when you perform the
following tasks:
When you perform these tasks, you can control whether auto minor version upgrade is enabled for the
DB instance in the following ways:
• Using the console, set the Auto minor version upgrade option.
• Using the AWS CLI, set the --auto-minor-version-upgrade|--no-auto-minor-version-
upgrade option.
• Using the RDS API, set the AutoMinorVersionUpgrade parameter.
To determine whether a maintenance update, such as a DB engine version upgrade, is available for
your DB instance, you can use the console, AWS CLI, or RDS API. You can also upgrade the DB engine
version manually and adjust the maintenance window. For more information, see Maintaining a DB
instance (p. 320).
Important
If you plan to migrate an RDS for PostgreSQL DB instance to an Aurora PostgreSQL DB cluster
in the near future, we strongly recommend that you disable auto minor version upgrades
for the DB instance early in the migration planning phase. Migration to Aurora PostgreSQL
might be delayed if the RDS for PostgreSQL version isn't yet supported by Aurora PostgreSQL.
For information about Aurora PostgreSQL versions, see Engine versions for Amazon Aurora
PostgreSQL.
333
Amazon Relational Database Service User Guide
Renaming a DB instance
Renaming a DB instance
You can rename a DB instance by using the AWS Management Console, the AWS CLI modify-db-
instance command, or the Amazon RDS API ModifyDBInstance action. Renaming a DB instance can
have far-reaching effects. The following is a list of considerations before you rename a DB instance.
• When you rename a DB instance, the endpoint for the DB instance changes, because the URL includes
the name you assigned to the DB instance. You should always redirect traffic from the old URL to the
new one.
• When you rename a DB instance, the old DNS name that was used by the DB instance is immediately
deleted, although it could remain cached for a few minutes. The new DNS name for the renamed DB
instance becomes effective in about 10 minutes. The renamed DB instance is not available until the
new name becomes effective.
• You cannot use an existing DB instance name when renaming an instance.
• All read replicas associated with a DB instance remain associated with that instance after it is
renamed. For example, suppose you have a DB instance that serves your production database and the
instance has several associated read replicas. If you rename the DB instance and then replace it in the
production environment with a DB snapshot, the DB instance that you renamed will still have the read
replicas associated with it.
• Metrics and events associated with the name of a DB instance are maintained if you reuse a DB
instance name. For example, if you promote a read replica and rename it to be the name of the
previous primary DB instance, the events and metrics associated with the primary DB instance are
associated with the renamed instance.
• DB instance tags remain with the DB instance, regardless of renaming.
• DB snapshots are retained for a renamed DB instance.
Note
A DB instance is an isolated database environment running in the cloud. A DB instance can host
multiple databases, or a single Oracle database with multiple schemas. For information about
changing a database name, see the documentation for your DB engine.
1. Stop all traffic going to the primary DB instance. This can involve redirecting traffic from accessing
the databases on the DB instance or some other way you want to use to prevent traffic from accessing
your databases on the DB instance.
2. Rename the primary DB instance to a name that indicates it is no longer the primary DB instance as
described later in this topic.
3. Create a new primary DB instance by restoring from a DB snapshot or by promoting a read replica, and
then give the new instance the name of the previous primary DB instance.
4. Associate any read replicas with the new primary DB instance.
If you delete the old primary DB instance, you are responsible for deleting any unwanted DB snapshots
of the old primary DB instance.
For information about promoting a read replica, see Promoting a read replica to be a standalone DB
instance (p. 345).
334
Amazon Relational Database Service User Guide
Renaming to replace an existing DB instance
Important
The DB instance is rebooted when it is renamed.
Console
To rename a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to rename.
4. Choose Modify.
5. In Settings, enter a new name for DB instance identifier.
6. Choose Continue.
7. To apply the changes immediately, choose Apply immediately. Choosing this option can cause an
outage in some cases. For more information, see Modifying an Amazon RDS DB instance (p. 306).
8. On the confirmation page, review your changes. If they are correct, choose Modify DB Instance to
save your changes.
Alternatively, choose Back to edit your changes, or choose Cancel to cancel your changes.
AWS CLI
To rename a DB instance, use the AWS CLI command modify-db-instance. Provide the current --db-
instance-identifier value and --new-db-instance-identifier parameter with the new name
of the DB instance.
Example
For Windows:
RDS API
To rename a DB instance, call Amazon RDS API operation ModifyDBInstance with the following
parameters:
335
Amazon Relational Database Service User Guide
Rebooting a DB instance
Rebooting a DB instance
You might need to reboot your DB instance, usually for maintenance reasons. For example, if you make
certain modifications, or if you change the DB parameter group associated with the DB instance, you
must reboot the instance for the changes to take effect.
Note
If a DB instance isn't using the latest changes to its associated DB parameter group, the AWS
Management Console shows the DB parameter group with a status of pending-reboot. The
pending-reboot parameter groups status doesn't result in an automatic reboot during the next
maintenance window. To apply the latest parameter changes to that DB instance, manually
reboot the DB instance. For more information about parameter groups, see Working with DB
parameter groups (p. 284).
Rebooting a DB instance restarts the database engine service. Rebooting a DB instance results in a
momentary outage, during which the DB instance status is set to rebooting.
If the Amazon RDS DB instance is configured for Multi-AZ, you can perform the reboot with a failover.
An Amazon RDS event is created when the reboot is completed. If your DB instance is a Multi-AZ
deployment, you can force a failover from one Availability Zone (AZ) to another when you reboot. When
you force a failover of your DB instance, Amazon RDS automatically switches to a standby replica in
another Availability Zone, and updates the DNS record for the DB instance to point to the standby DB
instance. As a result, you need to clean up and re-establish any existing connections to your DB instance.
Rebooting with failover is beneficial when you want to simulate a failure of a DB instance for testing,
or restore operations to the original AZ after a failover occurs. For more information, see Multi-AZ
deployments for high availability (p. 59).
On RDS for Microsoft SQL Server, reboot with failover reboots only the primary DB instance. After
the failover, the primary DB instance becomes the new secondary DB instance. Parameters might not
be updated for Multi-AZ instances. For reboot without failover, both the primary and secondary DB
instances reboot, and parameters are updated after the reboot. If the DB instance is unresponsive, we
recommend reboot without failover.
Note
When you force a failover from one Availability Zone to another when you reboot, the
Availability Zone change might not be reflected in the AWS Management Console, and in calls to
the AWS CLI and RDS API, for several minutes.
You can't reboot your DB instance if it isn't in the available state. Your database can be unavailable for
several reasons, such as an in-progress backup, a previously requested modification, or a maintenance-
window action.
The time required to reboot your DB instance depends on the crash recovery process, database activity
at the time of reboot, and the behavior of your specific DB engine. To improve the reboot time, we
recommend that you reduce database activity as much as possible during the reboot process. Reducing
database activity reduces rollback activity for in-transit transactions.
For a DB instance with read replicas, you can reboot the source DB instance and its read replicas
independently. After a reboot completes, replication resumes automatically.
Console
To reboot a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to reboot.
3. For Actions, choose Reboot.
336
Amazon Relational Database Service User Guide
Rebooting a DB instance
AWS CLI
To reboot a DB instance by using the AWS CLI, call the reboot-db-instance command.
For Windows:
To force a failover from one AZ to the other, use the --force-failover parameter.
For Windows:
RDS API
To reboot a DB instance by using the Amazon RDS API, call the RebootDBInstance operation.
337
Amazon Relational Database Service User Guide
Working with read replicas
Note
The information following applies to creating Amazon RDS read replicas either in the same
AWS Region as the source DB instance, or in a separate AWS Region. The information following
doesn't apply to setting up replication with an instance that is running on an Amazon EC2
instance or that is on-premises.
When you create a read replica, you first specify an existing DB instance as the source. Then Amazon RDS
takes a snapshot of the source instance and creates a read-only instance from the snapshot. Amazon RDS
then uses the asynchronous replication method for the DB engine to update the read replica whenever
there is a change to the primary DB instance. The read replica operates as a DB instance that allows only
338
Amazon Relational Database Service User Guide
Working with read replicas
read-only connections. Applications connect to a read replica the same way they do to any DB instance.
Amazon RDS replicates all databases in the source DB instance.
Note
The Oracle DB engine supports replica databases in mounted mode. A mounted replica doesn't
accept user connections and so can't serve a read-only workload. The primary use for mounted
replicas is cross-Region disaster recovery. For more information, see Working with Oracle
replicas for Amazon RDS (p. 1300).
In some cases, a read replica resides in a different AWS Region from its primary DB instance. In these
cases, Amazon RDS sets up a secure communications channel between the primary DB instance and
the read replica. Amazon RDS establishes any AWS security configurations needed to enable the secure
channel, such as adding security group entries. For more information about cross-Region read replicas,
see Creating a read replica in a different AWS Region (p. 350).
You can configure a read replica for a DB instance that also has a standby replica configured for high
availability in a Multi-AZ deployment. Replication with the standby replica is synchronous, and the
standby replica can't serve read traffic.
For more information about high availability and standby replicas, see Multi-AZ deployments for high
availability (p. 59).
339
Amazon Relational Database Service User Guide
Overview
Read replicas are supported by the MariaDB, Microsoft SQL Server, MySQL, Oracle, and PostgreSQL DB
engines. In this section, you can find general information about using read replicas with all of these
engines. For information about using read replicas with a specific engine, see the following sections:
• Scaling beyond the compute or I/O capacity of a single DB instance for read-heavy database
workloads. You can direct this excess read traffic to one or more read replicas.
• Serving read traffic while the source DB instance is unavailable. In some cases, your source DB instance
might not be able to take I/O requests, for example due to I/O suspension for backups or scheduled
maintenance. In these cases, you can direct read traffic to your read replicas. For this use case, keep in
mind that the data on the read replica might be "stale" because the source DB instance is unavailable.
• Business reporting or data warehousing scenarios where you might want business reporting queries to
run against a read replica, rather than your production DB instance.
• Implementing disaster recovery. You can promote a read replica to a standalone instance as a disaster
recovery solution if the primary DB instance fails.
By default, a read replica is created with the same storage type as the source DB instance. However, you
can create a read replica that has a different storage type from the source DB instance based on the
options listed in the following table.
Source DB instance storage Source DB instance storage Read replica storage type
type allocation options
Note
When you increase the allocated storage of a read replica, it must be by at least 10 percent. If
you try to increase the value by less than 10 percent, you get an error.
Amazon RDS doesn't support circular replication. You can't configure a DB instance to serve as a
replication source for an existing DB instance. You can only create a new read replica from an existing
DB instance. For example, if MyDBInstance replicates to ReadReplica1, you can't configure
ReadReplica1 to replicate back to MyDBInstance. For MariaDB and MySQL you can create a read
replica from an existing read replica. For example, from ReadReplica1, you can create a new read
340
Amazon Relational Database Service User Guide
Overview
replica, such as ReadReplica2. For Oracle, PostgreSQL, and SQL Server, you can't create a read replica
from an existing read replica.
If you no longer need read replicas, you can explicitly delete them using the same mechanisms for
deleting a DB instance. If you delete a source DB instance without deleting its read replicas in the same
AWS Region, each read replica is promoted to a standalone DB instance. For information about deleting
a DB instance, see Deleting a DB instance (p. 384). For information about read replica promotion, see
Promoting a read replica to be a standalone DB instance (p. 345).
If you have cross-Region read replicas, see Cross-Region replication considerations (p. 355) for
information related to deleting the source DB instance for a cross-Region read replica.
How are RDS for MySQL and If a primary DB PostgreSQL has The Virtual
transaction RDS for MariaDB keep instance has no the parameter Log File
logs purged? any binary logs that cross-Region read wal_keep_segments (VLF) of the
haven't been applied. replicas, Amazon that dictates how transaction
RDS for Oracle keeps many write ahead log file on
a minimum of two log (WAL) files are the primary
hours of transaction kept to provide data replica can
logs on the source to the read replicas. be truncated
DB instance. Logs The parameter value after it is
are purged from the specifies the number no longer
source DB instance of logs to keep. required for
after two hours or the secondary
after the archive replicas.
log retention hours
setting has passed, The VLF
whichever is longer. can only
Logs are purged be marked
from the read replica as inactive
after the archive when the
log retention hours log records
setting has passed have been
only if they have been hardened in
successfully applied the replicas.
to the database. Regardless
of how fast
In some cases, a the disk
primary DB instance subsystems
might have one or are in the
more cross-Region primary
read replicas. If replica, the
so, Amazon RDS transaction
for Oracle keeps log will keep
the transaction the VLFs until
341
Amazon Relational Database Service User Guide
Overview
Can a replica Yes. You can enable No. An Oracle read No. A PostgreSQL No. A SQL
be made the MySQL or replica is a physical read replica is a Server read
writable? MariaDB read replica copy, and Oracle physical copy, and replica is
to be writable. doesn't allow for PostgreSQL doesn't a physical
writes in a read allow for a read copy and also
replica. You can replica to be made doesn't allow
promote the read writable. for writes.
replica to make You can
it writable. The promote the
promoted read replica read replica
has the replicated to make it
data to the point writable. The
when the request was promoted
made to promote it. read replica
has the
replicated
data up to
the point
when the
request was
made to
promote it.
Can backups Yes. You can enable No. You can't create Yes, you can create No. You
be performed automatic backups on manual snapshots a manual snapshot can't create
on the a MySQL or MariaDB of Amazon RDS for of a PostgreSQL read manual
replica? read replica. Oracle read replicas replica, but you can't snapshots
or enable automatic enable automatic of Amazon
backups for them. backups. RDS for
SQL Server
read replicas
or enable
automatic
backups for
them.
342
Amazon Relational Database Service User Guide
Creating a read replica
Can you Yes. MySQL version Yes. Redo log data is No. PostgreSQL Yes. Redo log
use parallel 5.6 and later and all always transmitted has a single process data is always
replication? supported MariaDB in parallel from the handling replication. transmitted
versions allow for primary database to in parallel
parallel replication all of its read replicas. from the
threads. primary
database to
all of its read
replicas.
When you create a read replica, Amazon RDS takes a DB snapshot of your source DB instance and begins
replication. As a result, you experience a brief I/O suspension on your source DB instance while the DB
snapshot occurs.
Note
The I/O suspension typically lasts about one minute. You can avoid the I/O suspension if the
source DB instance is a Multi-AZ deployment, because in that case the snapshot is taken from
the secondary DB instance.
An active, long-running transaction can slow the process of creating the read replica. We recommend
that you wait for long-running transactions to complete before creating a read replica. If you create
multiple read replicas in parallel from the same source DB instance, Amazon RDS takes only one
snapshot at the start of the first create action.
When creating a read replica, there are a few things to consider. First, you must enable automatic
backups on the source DB instance by setting the backup retention period to a value other than 0. This
requirement also applies to a read replica that is the source DB instance for another read replica. To
enable automatic backups on an RDS for MySQL version 5.6 and later read replica, first create the read
replica, then modify the read replica to enable automatic backups.
Note
Within an AWS Region, we strongly recommend that you create all read replicas in the same
virtual private cloud (VPC) based on Amazon VPC as the source DB instance. If you create a read
replica in a different VPC from the source DB instance, classless inter-domain routing (CIDR)
ranges can overlap between the replica and the RDS system. CIDR overlap makes the replica
343
Amazon Relational Database Service User Guide
Creating a read replica
unstable, which can negatively impact applications connecting to it. If you receive an error when
creating the read replica, choose a different destination DB subnet group. For more information,
see Working with a DB instance in a VPC (p. 1975).
You can't create a read replica in a different AWS account from the source DB instance.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to use as the source for a read replica.
4. For Actions, choose Create read replica.
5. For DB instance identifier, enter a name for the read replica.
6. Choose your instance specifications. We recommend that you use the same DB instance class and
storage type as the source DB instance for the read replica.
7. For Multi-AZ deployment, choose Yes to create a standby of your replica in another Availability
Zone for failover support for the replica.
Note
Creating your read replica as a Multi-AZ DB instance is independent of whether the source
database is a Multi-AZ DB instance.
8. To create an encrypted read replica:
Note
The source DB instance must be encrypted. To learn more about encrypting the source DB
instance, see Encrypting Amazon RDS resources (p. 1879).
9. Choose other options, such as storage autoscaling.
10. Choose Create read replica.
After the read replica is created, you can see it on the Databases page in the RDS console. It shows
Replica in the Role column.
AWS CLI
To create a read replica from a source DB instance, use the AWS CLI command create-db-instance-
read-replica. This example also enables storage autoscaling.
Example
For Windows:
344
Amazon Relational Database Service User Guide
Promoting a read replica
RDS API
To create a read replica from a source MySQL, MariaDB, Oracle, PostgreSQL, or SQL Server DB instance,
call the Amazon RDS API CreateDBInstanceReadReplica operation with the following required
parameters:
• DBInstanceIdentifier
• SourceDBInstanceIdentifier
345
Amazon Relational Database Service User Guide
Promoting a read replica
There are several reasons you might want to promote a read replica to a standalone DB instance:
• Performing DDL operations (MySQL and MariaDB only) – DDL operations, such as creating or
rebuilding indexes, can take time and impose a significant performance penalty on your DB instance.
You can perform these operations on a MySQL or MariaDB read replica once the read replica is in sync
with its primary DB instance. Then you can promote the read replica and direct your applications to
use the promoted instance.
• Sharding – Sharding embodies the "share-nothing" architecture and essentially involves breaking a
large database into several smaller databases. One common way to split a database is splitting tables
that are not joined in the same query onto different hosts. Another method is duplicating a table
across multiple hosts and then using a hashing algorithm to determine which host receives a given
update. You can create read replicas corresponding to each of your shards (smaller databases) and
346
Amazon Relational Database Service User Guide
Promoting a read replica
promote them when you decide to convert them into standalone shards. You can then carve out the
key space (if you are splitting rows) or distribution of tables for each of the shards depending on your
requirements.
• Implementing failure recovery – You can use read replica promotion as a data recovery scheme if
the primary DB instance fails. This approach complements synchronous replication, automatic failure
detection, and failover.
If you are aware of the ramifications and limitations of asynchronous replication and you still want to
use read replica promotion for data recovery, you can. To do this, first 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.
When you promote a read replica, the new DB instance that is created retains the option group and the
parameter group of the former read replica. The promotion process can take several minutes or longer
to complete, depending on the size of the read replica. After you promote the read replica to a new DB
instance, it's just like any other DB instance. For example, you can create read replicas from the new DB
instance and perform point-in-time restore operations. Because the promoted DB instance is no longer
a read replica, you can't use it as a replication target. If a source DB instance has several read replicas,
promoting one of the read replicas to a DB instance has no effect on the other replicas.
Backup duration is a function of the number of changes to the database since the previous backup. If
you plan to promote a read replica to a standalone instance, we recommend that you enable backups
and complete at least one backup prior to promotion. In addition, you can't promote a read replica to
a standalone instance when it has the backing-up status. If you have enabled backups on your read
replica, configure the automated backup window so that daily backups don't interfere with read replica
promotion.
The following steps show the general process for promoting a read replica to a DB instance:
1. Stop any transactions from being written to the primary DB instance, and then wait for all updates to
be made to the read replica. Database updates occur on the read replica after they have occurred on
the primary DB instance, and this replication lag can vary significantly. Use the Replica Lag metric
to determine when all updates have been made to the read replica.
2. For MySQL and MariaDB only: If you need to make changes to the MySQL or MariaDB read replica, you
must set the read_only parameter to 0 in the DB parameter group for the read replica. You can then
perform all needed DDL operations, such as creating indexes, on the read replica. Actions taken on the
read replica don't affect the performance of the primary DB instance.
3. Promote the read replica by using the Promote option on the Amazon RDS console, the AWS CLI
command promote-read-replica, or the PromoteReadReplica Amazon RDS API operation.
Note
The promotion process takes a few minutes to complete. When you promote a read replica,
replication is stopped and the read replica is rebooted. When the reboot is complete, the read
replica is available as a new DB instance.
4. (Optional) Modify the new DB instance to be a Multi-AZ deployment. For more information, see
Modifying an Amazon RDS DB instance (p. 306) and Multi-AZ deployments for high availability (p. 59).
Console
To promote a read replica to a standalone DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
347
Amazon Relational Database Service User Guide
Monitoring read replication
The Databases pane appears. Each read replica shows Replica in the Role column.
3. Choose the read replica that you want to promote.
4. For Actions, choose Promote.
5. On the Promote Read Replica page, enter the backup retention period and the backup window for
the newly promoted DB instance.
6. When the settings are as you want them, choose Continue.
7. On the acknowledgment page, choose Promote Read Replica.
AWS CLI
To promote a read replica to a standalone DB instance, use the AWS CLI promote-read-replica
command.
Example
For Windows:
RDS API
To promote a read replica to a standalone DB instance, call the Amazon RDS API PromoteReadReplica
operation with the required parameter DBInstanceIdentifier.
348
Amazon Relational Database Service User Guide
Monitoring read replication
You can also see the status of a read replica using the AWS CLI describe-db-instances command or
the Amazon RDS API DescribeDBInstances operation.
The status doesn't transition from replication degraded to error, unless an error occurs during
the degraded state.
• error – An error has occurred with the replication. Check the Replication Error field in the
Amazon RDS console or the event log to determine the exact error. For more information about
troubleshooting a replication error, see Troubleshooting a MySQL read replica problem (p. 1082).
• terminated (MariaDB, MySQL, or PostgreSQL only) – Replication is terminated. This occurs if
replication is stopped for more than 30 consecutive days, either manually or due to a replication error.
In this case, Amazon RDS terminates replication between the primary DB instance and all read replicas.
Amazon RDS does this to prevent increased storage requirements on the source DB instance and long
failover times.
Broken replication can affect storage because the logs can grow in size and number due to the high
volume of errors messages being written to the log. Broken replication can also affect failure recovery
due to the time Amazon RDS requires to maintain and process the large number of logs during
recovery.
• stopped (MariaDB or MySQL only) – Replication has stopped because of a customer-initiated request.
• replication stop point set (MySQL only) – A customer-initiated stop point was set using the
mysql.rds_start_replication_until (p. 1140) stored procedure and the replication is in progress.
• replication stop point reached (MySQL only) – A customer-initiated stop point was set using the
mysql.rds_start_replication_until (p. 1140) stored procedure and replication is stopped because the
stop point was reached.
You can see where a DB instance is being replicated and if so, check its replication status. On the
Databases page in the RDS console, it shows Primary in the Role column. Choose its DB instance name.
On its detail page, on the Connectivity & security tab, its replication status is under Replication.
For MariaDB and MySQL, the ReplicaLag metric reports the value of the Seconds_Behind_Master
field of the SHOW REPLICA STATUS command. Common causes for replication lag for MySQL and
MariaDB are the following:
• A network outage.
• Writing to tables with indexes on a read replica. If the read_only parameter is not set to 0 on the
read replica, it can break replication.
• Using a nontransactional storage engine such as MyISAM. Replication is only supported for the InnoDB
storage engine on MySQL and the XtraDB storage engine on MariaDB.
Note
Previous versions of MariaDB and MySQL used SHOW SLAVE STATUS instead of SHOW REPLICA
STATUS. If you are using a MariaDB version before 10.5 or a MySQL version before 8.0.23, then
use SHOW SLAVE STATUS.
349
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
When the ReplicaLag metric reaches 0, the replica has caught up to the primary DB instance. If the
ReplicaLag metric returns -1, then replication is currently not active. ReplicaLag = -1 is equivalent
to Seconds_Behind_Master = NULL.
For Oracle, the ReplicaLag metric is the sum of the Apply Lag value and the difference between the
current time and the apply lag's DATUM_TIME value. The DATUM_TIME value is the last time the read
replica received data from its source DB instance. For more information, see V$DATAGUARD_STATS in
the Oracle documentation.
For SQL Server, the ReplicaLag metric is the maximum lag of databases that have fallen behind, in
seconds. For example, if you have two databases that lag 5 seconds and 10 seconds, respectively, then
ReplicaLag is 10 seconds. The ReplicaLag metric returns the value of the following query.
ReplicaLag returns -1 if RDS can't determine the lag, such as during replica setup, or when the read
replica is in the error state.
Note
New databases aren't included in the lag calculation until they are accessible on the read replica.
For PostgreSQL, the ReplicaLag metric returns the value of the following query.
PostgreSQL versions 9.5.2 and later use physical replication slots to manage write ahead log (WAL)
retention on the source instance. For each cross-Region read replica instance, Amazon RDS creates a
physical replication slot and associates it with the instance. Two Amazon CloudWatch metrics, Oldest
Replication Slot Lag and Transaction Logs Disk Usage, show how far behind the most
lagging replica is in terms of WAL data received and how much storage is being used for WAL data. The
Transaction Logs Disk Usage value can substantially increase when a cross-Region read replica is
lagging significantly.
For more information about monitoring a DB instance with CloudWatch, see Monitoring Amazon RDS
metrics with Amazon CloudWatch (p. 480).
350
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
Creating a read replica in a different AWS Region from the source instance is similar to creating a replica
in the same AWS Region. You can use the AWS Management Console, run the create-db-instance-
read-replica command, or call the CreateDBInstanceReadReplica API operation.
Note
To create an encrypted read replica in a different AWS Region from the source DB instance, the
source DB instance must be encrypted.
Console
You can create a read replica across AWS Regions using the AWS Management Console.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the MariaDB, MySQL, Oracle, or PostgreSQL DB instance that you want to use as the source
for a read replica.
351
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
Note
To create an encrypted read replica, the source DB instance must be encrypted. To
learn more about encrypting the source DB instance, see Encrypting Amazon RDS
resources (p. 1879).
9. Choose other options, such as storage autoscaling.
10. Choose Create read replica.
AWS CLI
To create a read replica from a source MySQL, MariaDB, Oracle, or PostgreSQL DB instance in a different
AWS Region, you can use the create-db-instance-read-replica command. In this case, you
use create-db-instance-read-replica from the AWS Region where you want the read replica
(destination Region) and specify the Amazon Resource Name (ARN) for the source DB instance. An ARN
uniquely identifies a resource created in Amazon Web Services.
For example, if your source DB instance is in the US East (N. Virginia) Region, the ARN looks similar to this
example:
arn:aws:rds:us-east-1:123456789012:db:mydbinstance
For information about ARNs, see Working with Amazon Resource Names (ARNs) in Amazon
RDS (p. 369).
To create a read replica in a different AWS Region from the source DB instance, you can use the AWS CLI
create-db-instance-read-replica command from the destination AWS Region. The following
parameters are required for creating a read replica in another AWS Region:
• --region – The destination AWS Region where the read replica is created.
• --source-db-instance-identifier – The DB instance identifier for the source DB instance. This
identifier must be in the ARN format for the source AWS Region.
• --db-instance-identifier – The identifier for the read replica in the destination AWS Region.
The following code creates a read replica in the US West (Oregon) Region from a source DB instance in
the US East (N. Virginia) Region.
352
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
--region us-west-2 \
--source-db-instance-identifier arn:aws:rds:us-east-1:123456789012:db:mydbinstance
For Windows:
The following parameters are also required for creating an encrypted read replica in another AWS
Region:
If --source-region isn't specified, you must specify a --pre-signed-url value. A presigned URL
is a URL that contains a Signature Version 4 signed request for the CreateDBInstanceReadReplica
operation that is called in the source AWS Region. For more information about presigned URLs, see
CreateDBInstanceReadReplica.
• --kms-key-id – The AWS KMS key identifier of the KMS key to use to encrypt the read replica in the
destination AWS Region.
The following code creates an encrypted read replica in the US West (Oregon) Region from a source DB
instance in the US East (N. Virginia) Region.
For Windows:
RDS API
To create a read replica from a source MySQL, MariaDB, Oracle, or PostgreSQL DB instance in a different
AWS Region, you can call the Amazon RDS API function CreateDBInstanceReadReplica. In this case, you
call CreateDBInstanceReadReplica from the AWS Region where you want the read replica (destination
Region) and specify the Amazon Resource Name (ARN) for the source DB instance. An ARN uniquely
identifies a resource created in Amazon Web Services.
To create an encrypted read replica in a different AWS Region from the source DB instance, you can use
the Amazon RDS API CreateDBInstanceReadReplica operation from the destination AWS Region. To
353
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
create an encrypted read replica in another AWS Region, you must specify a value for PreSignedURL.
PreSignedURL should contain a request for the CreateDBInstanceReadReplica operation to call
in the source AWS Region where the read replica is created in. To learn more about PreSignedUrl, see
CreateDBInstanceReadReplica.
For example, if your source DB instance is in the US East (N. Virginia) Region, the ARN looks similar to the
following.
arn:aws:rds:us-east-1:123456789012:db:mydbinstance
For information about ARNs, see Working with Amazon Resource Names (ARNs) in Amazon
RDS (p. 369).
Example
https://us-west-2.rds.amazonaws.com/
?Action=CreateDBInstanceReadReplica
&KmsKeyId=my-us-east-1-key
&PreSignedUrl=https%253A%252F%252Frds.us-west-2.amazonaws.com%252F
%253FAction%253DCreateDBInstanceReadReplica
%2526DestinationRegion%253Dus-east-1
%2526KmsKeyId%253Dmy-us-east-1-key
%2526SourceDBInstanceIdentifier%253Darn%25253Aaws%25253Ards%25253Aus-
west-2%123456789012%25253Adb%25253Amydbinstance
%2526SignatureMethod%253DHmacSHA256
%2526SignatureVersion%253D4%2526SourceDBInstanceIdentifier%253Darn%25253Aaws
%25253Ards%25253Aus-west-2%25253A123456789012%25253Ainstance%25253Amydbinstance
%2526Version%253D2014-10-31
%2526X-Amz-Algorithm%253DAWS4-HMAC-SHA256
%2526X-Amz-Credential%253DAKIADQKE4SARGYLE%252F20161117%252Fus-west-2%252Frds
%252Faws4_request
%2526X-Amz-Date%253D20161117T215409Z
%2526X-Amz-Expires%253D3600
%2526X-Amz-SignedHeaders%253Dcontent-type%253Bhost%253Buser-agent%253Bx-amz-
content-sha256%253Bx-amz-date
%2526X-Amz-Signature
%253D255a0f17b4e717d3b67fad163c3ec26573b882c03a65523522cf890a67fca613
&DBInstanceIdentifier=myreadreplica
&SourceDBInstanceIdentifier=®ion-arn;rds:us-east-1:123456789012:db:mydbinstance
&Version=2012-01-15
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2012-01-20T22%3A06%3A23.624Z
&AWSAccessKeyId=<&AWS; Access Key ID>
&Signature=<Signature>
1. Amazon RDS begins configuring the source DB instance as a replication source and sets the status to
modifying.
2. Amazon RDS begins setting up the specified read replica in the destination AWS Region and sets the
status to creating.
3. Amazon RDS creates an automated DB snapshot of the source DB instance in the source AWS Region.
The format of the DB snapshot name is rds:<InstanceID>-<timestamp>, where <InstanceID>
354
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
is the identifier of the source instance, and <timestamp> is the date and time the copy started.
For example, rds:mysourceinstance-2013-11-14-09-24 was created from the instance
mysourceinstance at 2013-11-14-09-24. During the creation of an automated DB snapshot,
the source DB instance status remains modifying, the read replica status remains creating, and the DB
snapshot status is creating. The progress column of the DB snapshot page in the console reports how
far the DB snapshot creation has progressed. When the DB snapshot is complete, the status of both
the DB snapshot and source DB instance are set to available.
4. Amazon RDS begins a cross-Region snapshot copy for the initial data transfer. The snapshot copy is
listed as an automated snapshot in the destination AWS Region with a status of creating. It has the
same name as the source DB snapshot. The progress column of the DB snapshot display indicates how
far the copy has progressed. When the copy is complete, the status of the DB snapshot copy is set to
available.
5. Amazon RDS then uses the copied DB snapshot for the initial data load on the read replica. During this
phase, the read replica is in the list of DB instances in the destination, with a status of creating. When
the load is complete, the read replica status is set to available, and the DB snapshot copy is deleted.
6. When the read replica reaches the available status, Amazon RDS starts by replicating the changes
made to the source instance since the start of the create read replica operation. During this phase, the
replication lag time for the read replica is greater than 0.
For information about replication lag time, see Monitoring read replication (p. 348).
• You can only replicate between AWS Regions when using the following Amazon RDS DB instances:
• MariaDB (all versions).
• MySQL version 5.6 and higher.
• Oracle Enterprise Edition (EE) of Oracle Database 12c Release 1 (12.1) using 12.1.0.2.v10 and higher,
Oracle Database 12c Release 2 (12.2), and Oracle Database 19c.
An Active Data Guard license is required. For information about limitations for Oracle cross-Region
read replicas, see Replica requirements for Oracle (p. 1301).
• PostgreSQL (all versions).
• A source DB instance can have cross-Region read replicas in multiple AWS Regions.
• You can only create a cross-Region Amazon RDS read replica from a source Amazon RDS DB instance
that is not a read replica of another Amazon RDS DB instance.
• You can replicate between the AWS GovCloud (US-East) and AWS GovCloud (US-West) Regions, but
not into or out of AWS GovCloud (US).
• You can expect to see a higher level of lag time for any read replica that is in a different AWS Region
than the source instance. This lag time comes from the longer network channels between regional
data centers.
• For cross-Region read replicas, any of the create read replica commands that specify the --db-
subnet-group-name parameter must specify a DB subnet group from the same VPC.
• Due to the limit on the number of access control list (ACL) entries for a VPC, we can't guarantee more
than five cross-Region read replica instances.
• The read replica uses the default DB parameter group and DB option group for the specified DB
engine.
• The read replica uses the default security group.
• For MariaDB, MySQL, and Oracle DB instances, when the source DB instance for a cross-Region read
replica is deleted, the read replica is promoted.
355
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
• For PostgreSQL DB instances, when the source DB instance for a cross-Region read replica is deleted,
the replication status of the read replica is set to terminated. The read replica isn't promoted.
Certain conditions in the requester's IAM policy can cause the request to fail. The following examples
assume that the source DB instance is in US East (Ohio) and the read replica is created in US East (N.
Virginia). These examples show conditions in the requester's IAM policy that cause the request to fail:
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": "us-east-1"
}
}
The request fails because the policy doesn't allow access to the source Region. For a successful request,
specify both the source and destination Regions.
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"us-east-1",
"us-east-2"
]
}
}
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": "arn:aws:rds:us-east-1:123456789012:db:myreadreplica"
...
For a successful request, specify both the source instance and the replica.
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": [
"arn:aws:rds:us-east-1:123456789012:db:myreadreplica",
"arn:aws:rds:us-east-2:123456789012:db:mydbinstance"
]
356
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
...
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": "*",
"Condition": {
"Bool": {"aws:ViaAWSService": "false"}
}
Communication with the source Region is made by RDS on the requester's behalf. For a successful
request, don't deny calls made by AWS services.
• The requester's policy has a condition for aws:SourceVpc or aws:SourceVpce.
These requests might fail because when RDS makes the call to the remote Region, it isn't from the
specified VPC or VPC endpoint.
If you need to use one of the previous conditions that would cause a request to fail, you can include a
second statement with aws:CalledVia in your policy to make the request succeed. For example, you
can use aws:CalledVia with aws:SourceVpce as shown here:
...
"Effect": "Allow",
"Action": "rds:CreateDBInstanceReadReplica",
"Resource": "*",
"Condition": {
"Condition" : {
"ForAnyValue:StringEquals" : {
"aws:SourceVpce": "vpce-1a2b3c4d"
}
}
},
{
"Effect": "Allow",
"Action": [
"rds:CreateDBInstanceReadReplica"
],
"Resource": "*",
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": [
"rds.amazonaws.com"
]
}
}
}
For more information, see Policies and permissions in IAM in the IAM User Guide.
357
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
RDS uses the service-linked role to verify the authorization in the source Region. If you delete the
service-linked role during the replication creation process, the creation fails.
For more information, see Using service-linked roles in the IAM User Guide.
To use the global endpoint, make sure that it's enabled for both Regions in the operations. Set the global
endpoint to Valid in all AWS Regions in the AWS STS account settings.
For more information, see Managing AWS STS in an AWS Region in the IAM User Guide.
• When you create a read replica, Amazon RDS takes a snapshot of the source instance and transfers the
snapshot to the read replica AWS Region.
• For each data modification made in the source databases, Amazon RDS transfers data from the source
AWS Region to the read replica AWS Region.
For more information about data transfer pricing, see Amazon RDS pricing.
For MySQL and MariaDB instances, you can reduce your data transfer costs by reducing the number of
cross-Region read replicas that you create. For example, suppose that you have a source DB instance in
one AWS Region and want to have three read replicas in another AWS Region. In this case, you create
only one of the read replicas from the source DB instance. You create the other two replicas from the
first read replica instead of the source DB instance.
For example, if you have source-instance-1 in one AWS Region, you can do the following:
• Create read-replica-1 in the new AWS Region, specifying source-instance-1 as the source.
• Create read-replica-2 from read-replica-1.
• Create read-replica-3 from read-replica-1.
In this example, you are only charged for the data transferred from source-instance-1 to read-
replica-1. You aren't charged for the data transferred from read-replica-1 to the other two
replicas because they are all in the same AWS Region. If you create all three replicas directly from
source-instance-1, you are charged for the data transfers to all three replicas.
358
Amazon Relational Database Service User Guide
Tagging RDS resources
In particular, you can use these tags with IAM policies to manage access to Amazon RDS resources and to
control what actions can be applied to the Amazon RDS resources. You can also use these tags to track
costs by grouping expenses for similarly tagged resources.
• DB instances
• DB clusters
• Read replicas
• DB snapshots
• DB cluster snapshots
• Reserved DB instances
• Event subscriptions
• DB option groups
• DB parameter groups
• DB cluster parameter groups
• DB security groups
• DB subnet groups
Topics
• Overview of Amazon RDS resource tags (p. 359)
• Using tags for access control with IAM (p. 360)
• Using tags to produce detailed billing reports (p. 360)
• Adding, listing, and removing tags (p. 360)
• Using the AWS Tag Editor (p. 363)
• Copying tags to DB instance snapshots (p. 363)
• Tutorial: Use tags to specify which DB instances to stop (p. 364)
• Using tags to enable backups in AWS Backup (p. 366)
Each Amazon RDS resource has a tag set, which contains all the tags that are assigned to that Amazon
RDS resource. A tag set can contain as many as 50 tags, or it can be empty. If you add a tag to an Amazon
359
Amazon Relational Database Service User Guide
Using tags for access control with IAM
RDS resource that has the same key as an existing tag on resource, the new value overwrites the old
value.
AWS does not apply any semantic meaning to your tags; tags are interpreted strictly as character strings.
Amazon RDS can set tags on a DB instance or other Amazon RDS resources, depending on the settings
that you use when you create the resource. For example, Amazon RDS might add a tag indicating that a
DB instance is for production or for testing.
• The tag key is the required name of the tag. The string value can be from 1 to 128 Unicode characters
in length and cannot be prefixed with aws: or rds:. The string can contain only the set of Unicode
letters, digits, white-space, '_', '.', ':', '/', '=', '+', '-', '@' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-
@]*)$").
• The tag value is an optional string value of the tag. The string value can be from 1 to 256 Unicode
characters in length and cannot be prefixed with aws:. The string can contain only the set of Unicode
letters, digits, white-space, '_', '.', ':', '/', '=', '+', '-', '@' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-
@]*)$").
Values do not have to be unique in a tag set and can be null. For example, you can have a key-value
pair in a tag set of project=Trinity and cost-center=Trinity.
You can use the AWS Management Console, the command line interface, or the Amazon RDS API to add,
list, and delete tags on Amazon RDS resources. When using the command line interface or the Amazon
RDS API, you must provide the Amazon Resource Name (ARN) for the Amazon RDS resource you want
to work with. For more information about constructing an ARN, see Constructing an ARN for Amazon
RDS (p. 369).
Tags are cached for authorization purposes. Because of this, additions and updates to tags on Amazon
RDS resources can take several minutes before they are available.
For information on managing access to tagged resources with IAM policies, see Identity and access
management in Amazon RDS (p. 1893).
Use tags to organize your AWS bill to reflect your own cost structure. To do this, sign up to get your AWS
account bill with tag key values included. Then, to see the cost of combined resources, organize your
billing information according to resources with the same tag key values. For example, you can tag several
resources with a specific application name, and then organize your billing information to see the total
cost of that application across several services. For more information, see Using Cost Allocation Tags in
the AWS Billing and Cost Management User Guide.
Note
You can add a tag to a snapshot, however, your bill will not reflect this grouping.
360
Amazon Relational Database Service User Guide
Adding, listing, and removing tags
Console
The process to tag an Amazon RDS resource is similar for all resources. The following procedure shows
how to tag an Amazon RDS DB instance.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
Note
To filter the list of DB instances in the Databases pane, enter a text string for Filter
databases. Only DB instances that contain the string appear.
3. Choose the name of the DB instance that you want to tag to show its details.
4. In the details section, scroll down to the Tags section.
5. Choose Add. The Add tags window appears.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
Note
To filter the list of DB instances in the Databases pane, enter a text string in the Filter
databases box. Only DB instances that contain the string appear.
3. Choose the name of the DB instance to show its details.
4. In the details section, scroll down to the Tags section.
361
Amazon Relational Database Service User Guide
Adding, listing, and removing tags
6. Choose Delete, and then choose Delete in the Delete tags window.
AWS CLI
You can add, list, or remove tags for a DB instance using the AWS CLI.
• To add one or more tags to an Amazon RDS resource, use the AWS CLI command add-tags-to-
resource.
• To list the tags on an Amazon RDS resource, use the AWS CLI command list-tags-for-resource.
• To remove one or more tags from an Amazon RDS resource, use the AWS CLI command remove-
tags-from-resource.
To learn more about how to construct the required ARN, see Constructing an ARN for Amazon
RDS (p. 369).
RDS API
You can add, list, or remove tags for a DB instance using the Amazon RDS API.
To learn more about how to construct the required ARN, see Constructing an ARN for Amazon
RDS (p. 369).
When working with XML using the Amazon RDS API, tags use the following schema:
<Tagging>
<TagSet>
<Tag>
<Key>Project</Key>
<Value>Trinity</Value>
</Tag>
<Tag>
<Key>User</Key>
<Value>Jones</Value>
</Tag>
</TagSet>
</Tagging>
The following table provides a list of the allowed XML tags and their characteristics. Values for Key and
Value are case-dependent. For example, project=Trinity and PROJECT=Trinity are two distinct tags.
362
Amazon Relational Database Service User Guide
Using the AWS Tag Editor
TagSet A tag set is a container for all tags assigned to an Amazon RDS resource.
There can be only one tag set per resource. You work with a TagSet only
through the Amazon RDS API.
Key A key is the required name of the tag. The string value can be from 1 to 128
Unicode characters in length and cannot be prefixed with aws: or rds:. The
string can only contain only the set of Unicode letters, digits, white-space,
'_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").
Keys must be unique to a tag set. For example, you cannot have a key-pair
in a tag set with the key the same but with different values, such as project/
Trinity and project/Xanadu.
Value A value is the optional value of the tag. The string value can be from 1 to
256 Unicode characters in length and cannot be prefixed with aws: or rds:.
The string can only contain only the set of Unicode letters, digits, white-
space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").
Values do not have to be unique in a tag set and can be null. For example,
you can have a key-value pair in a tag set of project/Trinity and cost-center/
Trinity.
You can specify that tags are copied to DB snapshots for the following actions:
• Creating a DB instance.
• Restoring a DB instance.
• Creating a read replica.
• Copying a DB snapshot.
Note
If you include a value for the --tag-key parameter of the create-db-snapshot AWS CLI
command (or supply at least one tag to the CreateDBSnapshot API operation) then RDS doesn't
copy tags from the source DB instance to the new DB snapshot. This functionality applies even if
the source DB instance has the --copy-tags-to-snapshot (CopyTagsToSnapshot) option
enabled. If you take this approach, you can create a copy of a DB instance from a DB snapshot
and avoid adding tags that don't apply to the new DB instance. Once you have created your DB
363
Amazon Relational Database Service User Guide
Tutorial: Use tags to specify which DB instances to stop
snapshot using the AWS CLI create-db-snapshot command (or the CreateDBSnapshot
Amazon RDS API operation) you can then add tags as described later in this topic.
The commands and APIs for tagging work with ARNs. That way, they can work seamlessly across
AWS Regions, AWS accounts, and different types of resources that might have identical short
names. You can specify the ARN instead of the DB instance ID in CLI commands that operate on
DB instances. Substitute the name of your own DB instances for dev-test-db-instance. In
subsequent commands that use ARN parameters, substitute the ARN of your own DB instance. The
ARN includes your own AWS account ID and the name of the AWS Region where your DB instance is
located.
The name for this tag is chosen by you. Using a tag like this is an alternative to devising a naming
convention that encodes all the relevant information in the name of the DB instance (or other types
of resources). Because this example treats the tag as an attribute that is either present or absent, it
omits the Value= part of the --tags parameter.
These commands retrieve the tag information for the DB instance in JSON format and in plain tab-
separated text.
}
]
}
aws rds list-tags-for-resource \
364
Amazon Relational Database Service User Guide
Tutorial: Use tags to specify which DB instances to stop
4. To stop all the DB instances that are designated as stoppable, prepare a list of all your DB
instances. Loop through the list and check if each DB instance is tagged with the relevant attribute.
This Linux example uses shell scripting to save the list of DB instance ARNs to a temporary file and
then perform CLI commands for each DB instance.
You can run a script like this at the end of each day to make sure that nonessential DB instances are
stopped. You might also schedule a job using a utility such as cron to perform such a check each night,
in case some DB instances were left running by mistake. In that case, you might fine-tune the command
that prepares the list of DB instances to check. The following command produces a list of your DB
instances, but only the ones in available state. The script can ignore DB instances that are already
stopped, because they will have different status values such as stopped or stopping.
Tip
Once you're familiar with the general procedure of assigning tags and finding DB instances that
have those tags, you can use the same technique to reduce costs in other ways. For example, in
this scenario with DB instances used for development and testing, you might designate some DB
instances to be deleted at the end of each day, or to have their DB instances changed to a small
DB instance classes during times of expected low usage.
365
Amazon Relational Database Service User Guide
Enabling backups
To enable backups in AWS Backup, you use resource tagging to associate your DB instance with a backup
plan.
This example assumes that you have already created a backup plan in AWS Backup. You use exactly the
same tag for your DB instance that is in your backup plan, as shown in the following figure.
For more information about AWS Backup, see the AWS Backup Developer Guide.
You can assign a tag to a DB instance using the AWS Management Console, the AWS CLI, or the RDS API.
The following examples are for the console and CLI.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the link for the DB instance to which you want to assign a tag.
4. On the database details page, choose the Tags tab.
5. Under Tags, choose Add tags.
6. Under Add tags:
366
Amazon Relational Database Service User Guide
Enabling backups
CLI
To assign a tag to a DB instance
For Windows:
For Windows:
367
Amazon Relational Database Service User Guide
Enabling backups
{
"TagList": [
{
"Key": "BackupPlan",
"Value": "Test"
}
]
}
368
Amazon Relational Database Service User Guide
Working with ARNs
arn:aws:rds:<region>:<account number>:<resourcetype>:<name>
rds-fips.us-east-2.amazonaws.com HTTPS
rds-fips.us-east-1.amazonaws.com HTTPS
rds-fips.us-west-1.amazonaws.com HTTPS
rds-fips.us-west-2.amazonaws.com HTTPS
369
Amazon Relational Database Service User Guide
Constructing an ARN
rds-fips.ca-central-1.amazonaws.com HTTPS
370
Amazon Relational Database Service User Guide
Constructing an ARN
The following table shows the format that you should use when constructing an ARN for a particular
Amazon RDS resource type.
DB instance arn:aws:rds:<region>:<account>:db:<name>
For example:
arn:aws:rds:us-east-2:123456789012:db:my-mysql-instance-1
For example:
arn:aws:rds:us-east-2:123456789012:es:my-subscription
For example:
arn:aws:rds:us-east-2:123456789012:og:my-og
For example:
arn:aws:rds:us-east-2:123456789012:pg:my-param-enable-logs
For example:
arn:aws:rds:us-east-2:123456789012:ri:my-reserved-
postgresql
For example:
arn:aws:rds:us-east-2:123456789012:secgrp:my-public
For example:
371
Amazon Relational Database Service User Guide
Getting an existing ARN
arn:aws:rds:us-east-2:123456789012:snapshot:rds:my-mysql-
db-2019-07-22-07-23
For example:
arn:aws:rds:us-east-2:123456789012:snapshot:my-mysql-db-
snap
For example:
arn:aws:rds:us-east-2:123456789012:subgrp:my-subnet-10
Console
To get an ARN from the AWS Management Console, navigate to the resource you want an ARN for,
and view the details for that resource. For example, you can get the ARN for a DB instance from the
Configuration tab of the DB instance details, as shown following.
372
Amazon Relational Database Service User Guide
Getting an existing ARN
AWS CLI
To get an ARN from the AWS CLI for a particular RDS resource, you use the describe command for
that resource. The following table shows each AWS CLI command, and the ARN property used with the
command to get an ARN.
describe-event-subscriptions EventSubscriptionArn
describe-certificates CertificateArn
373
Amazon Relational Database Service User Guide
Getting an existing ARN
describe-db-parameter-groups DBParameterGroupArn
describe-db-instances DBInstanceArn
describe-db-security-groups DBSecurityGroupArn
describe-db-snapshots DBSnapshotArn
describe-events SourceArn
describe-reserved-db-instances ReservedDBInstanceArn
describe-db-subnet-groups DBSubnetGroupArn
describe-option-groups OptionGroupArn
For example, the following AWS CLI command gets the ARN for a DB instance.
Example
For Windows:
[
{
"DBInstanceArn": "arn:aws:rds:us-west-2:account_id:db:instance_id",
"DBInstanceIdentifier": "instance_id"
}
]
RDS API
To get an ARN for a particular RDS resource, you can call the following RDS API operations and use the
ARN properties shown following.
DescribeEventSubscriptions EventSubscriptionArn
DescribeCertificates CertificateArn
374
Amazon Relational Database Service User Guide
Getting an existing ARN
DescribeDBParameterGroups DBParameterGroupArn
DescribeDBInstances DBInstanceArn
DescribeDBSecurityGroups DBSecurityGroupArn
DescribeDBSnapshots DBSnapshotArn
DescribeEvents SourceArn
DescribeReservedDBInstances ReservedDBInstanceArn
DescribeDBSubnetGroups DBSubnetGroupArn
DescribeOptionGroups OptionGroupArn
375
Amazon Relational Database Service User Guide
Working with storage
Topics
• Increasing DB instance storage capacity (p. 376)
• Managing capacity automatically with Amazon RDS storage autoscaling (p. 377)
• Modifying SSD storage settings for Provisioned IOPS (p. 382)
To monitor the amount of free storage for your DB instance so you can respond when necessary, we
recommend that you create an Amazon CloudWatch alarm. For more information on setting CloudWatch
alarms, see Using CloudWatch alarms.
Scaling storage usually doesn't cause any outage or performance degradation of the DB instance. After
you modify the storage size for a DB instance, the status of the DB instance is storage-optimization.
Note
Storage optimization can take several hours. You can't make further storage modifications for
either six (6) hours or until storage optimization has completed on the instance, whichever is
longer.
However, a special case is if you have a SQL Server DB instance and haven't modified the storage
configuration since November 2017. In this case, you might experience a short outage of a few minutes
when you modify your DB instance to increase the allocated storage. After the outage, the DB instance
is online but in the storage-optimization state. Performance might be degraded during storage
optimization.
Note
You can't reduce the amount of storage for a DB instance after storage has been allocated.
When you increase the allocated storage, it must be by at least 10 percent. If you try to increase
the value by less than 10 percent, you get an error.
Console
To increase storage for a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to modify.
376
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
4. Choose Modify.
5. Enter a new value for Allocated storage. It must be greater than the current value.
Or choose Apply during the next scheduled maintenance window to apply the changes during the
next maintenance window.
8. When the settings are as you want them, choose Modify DB instance.
AWS CLI
To increase the storage for a DB instance, use the AWS CLI command modify-db-instance. Set the
following parameters:
Or use --no-apply-immediately (the default) to apply the changes during the next maintenance
window. An immediate outage occurs when the changes are applied.
For more information about storage, see Amazon RDS DB instance storage (p. 48).
For more information about storage, see Amazon RDS DB instance storage (p. 48).
377
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
For example, you might use this feature for a new mobile gaming application that users are adopting
rapidly. In this case, a rapidly increasing workload might exceed the available database storage. To avoid
having to manually scale up database storage, you can use Amazon RDS storage autoscaling.
With storage autoscaling enabled, when Amazon RDS detects that you are running out of free database
space it automatically scales up your storage. Amazon RDS starts a storage modification for an
autoscaling-enabled DB instance when these factors apply:
• 5 GiB
• 10 percent of currently allocated storage
• Storage growth prediction for 7 hours based on the FreeStorageSpace metrics change in the past
hour. For more information on metrics, see Monitoring with Amazon CloudWatch.
The maximum storage threshold is the limit that you set for autoscaling the DB instance. You can't set
the maximum storage threshold for autoscaling-enabled instances to a value greater than the maximum
allocated storage.
For example, SQL Server Standard Edition on db.m5.xlarge has a default allocated storage for the
instance of 20 GiB (the minimum) and a maximum allocated storage of 16,384 GiB. The default
maximum storage threshold for autoscaling is 1,000 GiB. If you use this default, the instance doesn't
autoscale above 1,000 GiB. This is true even though the maximum allocated storage for the instance is
16,384 GiB.
Note
We recommend that you carefully choose the maximum storage threshold based on usage
patterns and customer needs. If there are any aberrations in the usage patterns, the maximum
storage threshold can prevent scaling storage to an unexpectedly high value when autoscaling
predicts a very high threshold. After a DB instance has been autoscaled, its allocated storage
can't be reduced.
Limitations
The following limitations apply to storage autoscaling:
• Autoscaling doesn't occur if the maximum storage threshold would be equaled or exceeded by the
storage increment.
• Autoscaling can't completely prevent storage-full situations for large data loads. This is because
further storage modifications can't be made for either six (6) hours or until storage optimization has
completed on the instance, whichever is longer.
If you perform a large data load, and autoscaling doesn't provide enough space, the database might
remain in the storage-full state for several hours. This can harm the database.
• If you start a storage scaling operation at the same time that Amazon RDS starts an autoscaling
operation, your storage modification takes precedence. The autoscaling operation is canceled.
• Autoscaling can't be used with magnetic storage.
• Autoscaling can't be used with the following previous-generation instance classes that have less than 6
TiB of orderable storage: db.m3.large, db.m3.xlarge, and db.m3.2xlarge.
378
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
• Autoscaling operations aren't logged by AWS CloudTrail. For more information on CloudTrail, see
Working with AWS CloudTrail and Amazon RDS (p. 632).
Although automatic scaling helps you to increase storage on your Amazon RDS DB instance dynamically,
you should still configure the initial storage for your DB instance to an appropriate size for your typical
workload.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the Amazon RDS console, choose the AWS Region where you want to
create the DB instance.
3. In the navigation pane, choose Databases.
4. Choose Create database. On the Select engine page, choose your database engine and specify your
DB instance information as described in Getting started with Amazon RDS (p. 118).
5. In the Storage autoscaling section, set the Maximum storage threshold value for the DB instance.
6. Specify the rest of your DB instance information as described in Getting started with Amazon
RDS (p. 118).
AWS CLI
To enable storage autoscaling for a new DB instance, use the AWS CLI command create-db-
instance. Set the following parameter:
• --max-allocated-storage – Turns on storage autoscaling and sets the upper limit on storage size,
in gibibytes.
To verify that Amazon RDS storage autoscaling is available for your DB instance, use the AWS CLI
describe-valid-db-instance-modifications command. To check based on the instance class
before creating an instance, use the describe-orderable-db-instance-options command. Check
the following field in the return value:
For more information about storage, see Amazon RDS DB instance storage (p. 48).
379
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
• MaxAllocatedStorage – Turns on Amazon RDS storage autoscaling and sets the upper limit on
storage size, in gibibytes.
To verify that Amazon RDS storage autoscaling is available for your DB instance, use the Amazon
RDS API DescribeValidDbInstanceModifications operation for an existing instance, or the
DescribeOrderableDBInstanceOptions operation before creating an instance. Check the following
field in the return value:
For more information about storage, see Amazon RDS DB instance storage (p. 48).
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to modify, and choose Modify. The Modify DB instance page
appears.
4. Change the storage limit in the Autoscaling section. For more information, see Modifying an
Amazon RDS DB instance (p. 306).
5. When all the changes are as you want them, choose Continue and check your modifications.
6. On the confirmation page, review your changes. If they're correct, choose Modify DB Instance to
save your changes. If they aren't correct, choose Back to edit your changes or Cancel to cancel your
changes.
Changing the storage autoscaling limit occurs immediately. This setting ignores the Apply
immediately setting.
AWS CLI
To change the storage autoscaling settings for a DB instance, use the AWS CLI command modify-db-
instance. Set the following parameter:
• --max-allocated-storage – Sets the upper limit on storage size, in gibibytes. If the value is
greater than the --allocated-storage parameter, storage autoscaling is turned on. If the value is
the same as the --allocated-storage parameter, storage autoscaling is turned off.
To verify that Amazon RDS storage autoscaling is available for your DB instance, use the AWS CLI
describe-valid-db-instance-modifications command. To check based on the instance class
before creating an instance, use the describe-orderable-db-instance-options command. Check
the following field in the return value:
For more information about storage, see Amazon RDS DB instance storage (p. 48).
380
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
To verify that Amazon RDS storage autoscaling is available for your DB instance, use the Amazon
RDS API DescribeValidDbInstanceModifications operation for an existing instance, or the
DescribeOrderableDBInstanceOptions operation before creating an instance. Check the following
field in the return value:
For more information about storage, see Amazon RDS DB instance storage (p. 48).
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the DB instance that you want to modify and choose Modify. The Modify DB instance page
appears.
4. Clear the Enable storage autoscaling check box in the Storage autoscaling section. For more
information, see Modifying an Amazon RDS DB instance (p. 306).
5. When all the changes are as you want them, choose Continue and check the modifications.
6. On the confirmation page, review your changes. If they're correct, choose Modify DB Instance to
save your changes. If they aren't correct, choose Back to edit your changes or Cancel to cancel your
changes.
Changing the storage autoscaling limit occurs immediately. This setting ignores the Apply immediately
setting.
AWS CLI
To turn off storage autoscaling for a DB instance, use the AWS CLI command modify-db-instance and
the following parameter:
For more information about storage, see Amazon RDS DB instance storage (p. 48).
381
Amazon Relational Database Service User Guide
Modifying Provisioned IOPS
For more information about storage, see Amazon RDS DB instance storage (p. 48).
Although you can reduce the amount of IOPS provisioned for your instance, you can't reduce the amount
of General Purpose SSD or magnetic storage allocated.
In most cases, scaling storage doesn't require any outage and doesn't degrade performance of the
server. After you modify the storage IOPS for a DB instance, the status of the DB instance is storage-
optimization.
Note
Storage optimization can take several hours. You can't make further storage modifications for
either six (6) hours or until storage optimization has completed on the instance, whichever is
longer.
Console
To change the Provisioned IOPS settings for a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
Note
To filter the list of DB instances, for Filter databases enter a text string for Amazon RDS to
use to filter the results. Only DB instances whose names contain the string appear.
3. Choose the DB instance with Provisioned IOPS that you want to modify.
4. Choose Modify.
5. On the Modify DB Instance page, choose Provisioned IOPS for Storage type and then provide a
Provisioned IOPS value.
If the value you specify for either Allocated storage or Provisioned IOPS is outside the limits
supported by the other parameter, a warning message is displayed. This message gives the range of
values required for the other parameter.
6. Choose Continue.
382
Amazon Relational Database Service User Guide
Modifying Provisioned IOPS
7. To apply the changes to the DB instance immediately, choose Apply immediately in the Scheduling
of modifications section. Or choose Apply during the next scheduled maintenance window to
apply the changes during the next maintenance window.
An immediate outage occurs when the storage type changes. For more information about storage,
see Amazon RDS DB instance storage (p. 48).
8. Review the parameters to be changed, and choose Modify DB instance to complete the
modification.
The new value for allocated storage or for Provisioned IOPS appears in the Status column.
AWS CLI
To change the Provisioned IOPS setting for a DB instance, use the AWS CLI command modify-db-
instance. Set the following parameters:
383
Amazon Relational Database Service User Guide
Deleting a DB instance
Deleting a DB instance
To delete a DB instance, you must do the following:
If you delete a DB instance that has read replicas in the same AWS Region, each read replica is promoted
to a standalone DB instance. For more information, see Promoting a read replica to be a standalone
DB instance (p. 345). If your DB instance has read replicas in different AWS Regions, see Cross-Region
replication considerations (p. 355) for information related to deleting the source DB instance for a cross-
Region read replica.
Note
When the status for a DB instance is deleting, its CA certificate value doesn't appear in the
RDS console or in output for AWS CLI commands or RDS API operations. For more information
about CA certificates, see Using SSL/TLS to encrypt a connection to a DB instance (p. 1883).
Deletion protection
You can only delete instances that don't have deletion protection enabled. When you create or modify a
DB instance, you have the option to enable deletion protection so that users can't delete the DB instance.
Deletion protection is disabled by default for you when you use AWS CLI and API commands. Deletion
protection is enabled for you when you use the AWS Management Console to create a production DB
instance. However, Amazon RDS enforces deletion protection when you use the console, the CLI, or the
API to delete a DB instance. To delete a DB instance that has deletion protection enabled, first modify
the instance and disable deletion protection. Enabling or disabling deletion protection doesn't cause an
outage.
384
Amazon Relational Database Service User Guide
Deleting a DB instance
Note
Automated backups that are replicated to another AWS Region are retained even if you
choose not to retain automated backups. For more information, see Replicating automated
backups to another AWS Region (p. 398).
• You typically don't need to retain automated backups if you create a final DB snapshot.
• To delete a retained automated backup, follow the instructions in Deleting retained automated
backups (p. 393).
Important
If you skip the final DB snapshot, to restore your DB instance do one of the following:
• Use an earlier manual snapshot of the DB instance to restore the DB instance to that DB
snapshot's point in time.
• Retain automated backups. You can use them to restore your DB instance during your
retention period, but not after your retention period has ended.
Note
Regardless of your choice, manual DB snapshots aren't deleted. For more information on
snapshots, see Creating a DB snapshot (p. 409).
Deleting a DB instance
You can delete a DB instance using the AWS Management Console, the AWS CLI, or the RDS API.
The time required to delete a DB instance can vary depending on the backup retention period (that is,
how many backups to delete), how much data is deleted, and whether a final snapshot is taken.
Note
You can't delete a DB instance when deletion protection is enabled for it. For more information,
see Deletion protection (p. 384).
You can disable deletion protection by modifying the DB instance. For more information, see
Modifying an Amazon RDS DB instance (p. 306).
Console
To delete a DB instance
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to delete.
3. For Actions, choose Delete.
4. To create a final DB snapshot for the DB instance, choose Create final snapshot?.
5. If you chose to create a final snapshot, enter the Final snapshot name.
6. To retain automated backups, choose Retain automated backups.
7. Enter delete me in the box.
8. Choose Delete.
AWS CLI
To delete a DB instance by using the AWS CLI, call the delete-db-instance command with the following
options:
• --db-instance-identifier
385
Amazon Relational Database Service User Guide
Deleting a DB instance
• --final-db-snapshot-identifier or --skip-final-snapshot
For Windows:
For Windows:
RDS API
To delete a DB instance by using the Amazon RDS API, call the DeleteDBInstance operation with the
following parameters:
• DBInstanceIdentifier
• FinalDBSnapshotIdentifier or SkipFinalSnapshot
386
Amazon Relational Database Service User Guide
Topics
• Working with backups (p. 388)
• Replicating automated backups to another AWS Region (p. 398)
• Creating a DB snapshot (p. 409)
• Restoring from a DB snapshot (p. 411)
• Copying a snapshot (p. 414)
• Sharing a DB snapshot (p. 428)
• Exporting DB snapshot data to Amazon S3 (p. 437)
• Restoring a DB instance to a specified time (p. 455)
• Deleting a snapshot (p. 458)
• Tutorial: Restore a DB instance from a DB snapshot (p. 460)
387
Amazon Relational Database Service User Guide
Working with backups
• Your DB instance must be in the AVAILABLE state for automated backups to occur. Automated
backups don't occur while your DB instance is in a state other than AVAILABLE, for example
STORAGE_FULL.
• Automated backups and automated snapshots don't occur while a copy is running in the same AWS
Region for the same DB instance.
You can also back up your DB instance manually, by manually creating a DB snapshot. For more
information about creating a DB snapshot, see Creating a DB snapshot (p. 409).
The first snapshot of a DB instance contains the data for the full DB instance. Subsequent snapshots of
the same DB instance are incremental, which means that only the data that has changed after your most
recent snapshot is saved.
You can copy both automatic and manual DB snapshots, and share manual DB snapshots. For more
information about copying a DB snapshot, see Copying a snapshot (p. 414). For more information
about sharing a DB snapshot, see Sharing a DB snapshot (p. 428).
Topics
• Backup storage (p. 388)
• Backup window (p. 389)
• Backup retention period (p. 390)
• Enabling automated backups (p. 390)
• Retaining automated backups (p. 392)
• Deleting retained automated backups (p. 393)
• Disabling automated backups (p. 394)
• Using AWS Backup to manage automated backups (p. 396)
• Automated backups with unsupported MySQL storage engines (p. 396)
• Automated backups with unsupported MariaDB storage engines (p. 397)
Backup storage
Your Amazon RDS backup storage for each AWS Region is composed of the automated backups and
manual DB snapshots for that Region. Total backup storage space equals the sum of the storage for all
backups in that Region. Moving a DB snapshot to another Region increases the backup storage in the
destination Region. Backups are stored in Amazon S3.
For more information about backup storage costs, see Amazon RDS pricing.
If you chose to retain automated backups when you delete a DB instance, the automated backups are
saved for the full retention period. If you don't choose Retain automated backups when you delete a DB
instance, all automated backups are deleted with the DB instance. After they are deleted, the automated
backups can't be recovered. If you choose to have Amazon RDS create a final DB snapshot before it
deletes your DB instance, you can use that to recover your DB instance. Or you can use a previously
388
Amazon Relational Database Service User Guide
Backup window
created manual snapshot. Manual snapshots are not deleted. You can have up to 100 manual snapshots
per Region.
Backup window
Automated backups occur daily during the preferred backup window. If the backup requires more time
than allotted to the backup window, the backup continues after the window ends, until it finishes. The
backup window can't overlap with the weekly maintenance window for the DB instance.
During the automatic backup window, storage I/O might be suspended briefly while the backup process
initializes (typically under a few seconds). You might experience elevated latencies for a few minutes
during backups for Multi-AZ deployments. For MariaDB, MySQL, Oracle, and PostgreSQL, I/O activity
is not suspended on your primary during backup for Multi-AZ deployments, because the backup is
taken from the standby. For SQL Server, I/O activity is suspended briefly during backup for Multi-AZ
deployments.
Automated backups might occasionally be skipped if the DB instance has a heavy workload at the time a
backup is supposed to start. If a backup is skipped, you can still do a point-in-time-recovery (PITR), and a
backup is still attempted during the next backup window. For more information on PITR, see Restoring a
DB instance to a specified time (p. 455).
If you don't specify a preferred backup window when you create the DB instance, Amazon RDS assigns a
default 30-minute backup window. This window is selected at random from an 8-hour block of time for
each AWS Region. The following table lists the time blocks for each AWS Region from which the default
backup windows are assigned.
389
Amazon Relational Database Service User Guide
Backup retention period
After you create a DB instance, you can modify the backup retention period. You can set the backup
retention period to between 0 and 35 days. Setting the backup retention period to 0 disables automated
backups. Manual snapshot limits (100 per Region) do not apply to automated backups.
Automated backups aren't created while a DB instance is stopped. Backups can be retained longer than
the backup retention period if a DB instance has been stopped. RDS doesn't include time spent in the
stopped state when the backup retention window is calculated.
Important
An outage occurs if you change the backup retention period from 0 to a nonzero value or from a
nonzero value to 0. This applies to both Single-AZ and Multi-AZ DB instances.
Console
To enable automated backups immediately
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
390
Amazon Relational Database Service User Guide
Enabling automated backups
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
modify.
3. Choose Modify. The Modify DB instance page appears.
4. For Backup retention period, choose a positive nonzero value, for example 3 days.
5. Choose Continue.
6. Choose Apply immediately.
7. On the confirmation page, choose Modify DB instance to save your changes and enable automated
backups.
AWS CLI
To enable automated backups, use the AWS CLI modify-db-instance command.
• --db-instance-identifier
• --backup-retention-period
• --apply-immediately or --no-apply-immediately
In the following example, we enable automated backups by setting the backup retention period to three
days. The changes are applied immediately.
Example
For Windows:
RDS API
To enable automated backups, use the RDS API ModifyDBInstance operation with the following
required parameters:
• DBInstanceIdentifier
• BackupRetentionPeriod
391
Amazon Relational Database Service User Guide
Retaining automated backups
Alternatively, you can describe individual snapshots associated with an automated backup. From there,
you can restore a DB instance directly from one of those snapshots.
To describe the automated backups for your existing DB instances using the AWS CLI, use one of the
following commands:
or
To describe the retained automated backups for your existing DB instances using the RDS API, call the
DescribeDBInstanceAutomatedBackups action with one of the following parameters:
• DBInstanceIdentifier
• DbiResourceId
Retained automated backups contain system snapshots and transaction logs from a DB instance. They
also include your DB instance properties like allocated storage and DB instance class, which are required
to restore it to an active instance.
You can retain automated backups for RDS instances running the MySQL, MariaDB, PostgreSQL, Oracle,
and Microsoft SQL Server engines.
You can restore or remove retained automated backups using the AWS Management Console, RDS API,
and AWS CLI.
Topics
• Retention period (p. 392)
• Viewing retained backups (p. 393)
• Restoration (p. 393)
• Retention costs (p. 393)
• Limitations and recommendations (p. 393)
Retention period
The system snapshots and transaction logs in a retained automated backup expire the same way that
they expire for the source DB instance. Because there are no new snapshots or logs created for this
instance, the retained automated backups eventually expire completely. Effectively, they live as long
their last system snapshot would have done, based on the settings for retention period the source
instance had when you deleted it. Retained automated backups are removed by the system after their
last system snapshot expires.
You can remove a retained automated backup in the same way that you can delete a DB instance.
You can remove retained automated backups using the console or the RDS API operation
DeleteDBInstanceAutomatedBackup.
392
Amazon Relational Database Service User Guide
Deleting retained automated backups
Final snapshots are independent of retained automated backups. We strongly suggest that you take
a final snapshot even if you retain automated backups, because the retained automated backups
eventually expire. The final snapshot doesn't expire.
To describe your retained automated backups using the AWS CLI, use the following command:
To describe your retained automated backups using the RDS API, call the
DescribeDBInstanceAutomatedBackups action with the DbiResourceId parameter.
Restoration
For information on restoring DB instances from automated backups, see Restoring a DB instance to a
specified time (p. 455).
Retention costs
The cost of a retained automated backup is the cost of total storage of the system snapshots that are
associated with it. There is no additional charge for transaction logs or instance metadata. All other
pricing rules for backups apply to restorable instances.
For example, suppose that your total allocated storage of running instances is 100 GB. Suppose also
that you have 50 GB of manual snapshots plus 75 GB of system snapshots associated with a retained
automated backup. In this case, you are charged only for the additional 25 GB of backup storage, like
this: (50 GB + 75 GB) – 100 GB = 25 GB.
• The maximum number of retained automated backups in one AWS Region is 40. It's not included in
the DB instances limit. You can have 40 running DB instances and an additional 40 retained automated
backups at the same time.
• Retained automated backups don't contain information about parameters or option groups.
• You can restore a deleted instance to a point in time that is within the retention period at the time of
delete.
• You can't modify a retained automated backup. That's because it consists of system backups,
transaction logs, and the DB instance properties that existed at the time that you deleted the source
instance.
393
Amazon Relational Database Service User Guide
Disabling automated backups
Console
To delete a retained automated backup
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Automated backups.
3. On the Retained tab, choose the retained automated backup that you want to delete.
4. For Actions, choose Delete.
5. On the confirmation page, enter delete me and choose Delete.
AWS CLI
You can delete a retained automated backup by using the AWS CLI command delete-db-instance-
automated-backup with the following option:
You can find the resource identifier for the source DB instance of a retained automated backup by
running the AWS CLI command describe-db-instance-automated-backups.
Example
The following example deletes the retained automated backup with source DB instance resource
identifier db-123ABCEXAMPLE.
For Windows:
RDS API
You can delete a retained automated backup by using the Amazon RDS API operation
DeleteDBInstanceAutomatedBackup with the following parameter:
You can find the resource identifier for the source DB instance of a retained automated backup using
the Amazon RDS API operation DescribeDBInstanceAutomatedBackups.
394
Amazon Relational Database Service User Guide
Disabling automated backups
instance. If you disable and then re-enable automated backups, you can restore starting only
from the time you re-enabled automated backups.
Console
To disable automated backups immediately
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
modify.
3. Choose Modify. The Modify DB instance page appears.
4. For Backup retention period, choose 0 days.
5. Choose Continue.
6. Choose Apply immediately.
7. On the confirmation page, choose Modify DB instance to save your changes and disable automated
backups.
AWS CLI
To disable automated backups immediately, use the modify-db-instance command and set the backup
retention period to 0 with --apply-immediately.
Example
For Windows:
To know when the modification is in effect, call describe-db-instances for the DB instance until the
value for backup retention period is 0 and mydbinstance status is available.
RDS API
To disable automated backups immediately, call the ModifyDBInstance operation with the following
parameters:
• DBInstanceIdentifier = mydbinstance
• BackupRetentionPeriod = 0
395
Amazon Relational Database Service User Guide
Using AWS Backup
Example
https://rds.amazonaws.com/
?Action=ModifyDBInstance
&DBInstanceIdentifier=mydbinstance
&BackupRetentionPeriod=0
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2009-10-14T17%3A48%3A21.746Z
&AWSAccessKeyId=<&AWS; Access Key ID>
&Signature=<Signature>
To enable backups in AWS Backup, you use resource tagging to associate your DB instance with a backup
plan. For more information, see Using tags to enable backups in AWS Backup (p. 366).
Note
Backups managed by AWS Backup are considered manual DB snapshots, but don't count toward
the DB snapshot quota for RDS. Backups that were created with AWS Backup have names
ending in awsbackup:backup-job-number.
For more information about AWS Backup, see the AWS Backup Developer Guide.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the Backup service tab.
Your AWS Backup backups are listed under Backup service snapshots.
• To convert existing MyISAM tables to InnoDB tables, you can use the ALTER TABLE command, for
example: ALTER TABLE table_name ENGINE=innodb, ALGORITHM=COPY;
• If you choose to use MyISAM, you can attempt to manually repair tables that become damaged after
a crash by using the REPAIR command. For more information, see REPAIR TABLE statement in the
MySQL documentation. However, as noted in the MySQL documentation, there is a good chance that
you might not be able to recover all your data.
• If you want to take a snapshot of your MyISAM tables before restoring, follow these steps:
1. Stop all activity to your MyISAM tables (that is, close all sessions).
396
Amazon Relational Database Service User Guide
Unsupported MariaDB storage engines
You can close all sessions by calling the mysql.rds_kill command for each process that is returned
from the SHOW FULL PROCESSLIST command.
2. Lock and flush each of your MyISAM tables. For example, the following commands lock and flush
two tables named myisam_table1 and myisam_table2:
3. Create a snapshot of your DB instance. When the snapshot has completed, release the locks and
resume activity on the MyISAM tables. You can release the locks on your tables using the following
command:
These steps force MyISAM to flush data stored in memory to disk, which ensures a clean start when
you restore from a DB snapshot. For more information on creating a DB snapshot, see Creating a DB
snapshot (p. 409).
• To convert existing Aria tables to InnoDB tables, you can use the ALTER TABLE command. For
example: ALTER TABLE table_name ENGINE=innodb, ALGORITHM=COPY;
• To convert existing Aria tables to XtraDB tables, you can use the ALTER TABLE command. For
example: ALTER TABLE table_name ENGINE=xtradb, ALGORITHM=COPY;
• If you choose to use Aria, you can attempt to manually repair tables that become damaged after a
crash by using the REPAIR TABLE command. For more information, see http://mariadb.com/kb/en/
mariadb/repair-table/.
• If you want to take a snapshot of your Aria tables before restoring, follow these steps:
1. Stop all activity to your Aria tables (that is, close all sessions).
2. Lock and flush each of your Aria tables.
3. Create a snapshot of your DB instance. When the snapshot has completed, release the locks and
resume activity on the Aria tables. These steps force Aria to flush data stored in memory to disk,
thereby ensuring a clean start when you restore from a DB snapshot.
397
Amazon Relational Database Service User Guide
Replicating automated backups to another Region
DB snapshot copy charges apply to the data transfer. After the DB snapshot is copied, standard charges
apply to storage in the destination Region. For more details, see RDS Pricing.
Backup replication is available for RDS DB instances running the following database engines:
For an example of using backup replication, see the AWS online tech talk Managed Disaster Recovery
with Amazon RDS for Oracle Cross-Region Automated Backups.
Topics
• AWS Region support (p. 398)
• Enabling cross-Region automated backups (p. 400)
• Finding information about replicated backups (p. 402)
• Restoring to a specified time from a replicated backup (p. 405)
• Stopping automated backup replication (p. 406)
• Deleting replicated backups (p. 407)
Asia Pacific (Singapore) Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Sydney), Asia Pacific
(Tokyo)
398
Amazon Relational Database Service User Guide
AWS Region support
Asia Pacific (Tokyo) Asia Pacific (Osaka), Asia Pacific (Seoul), Asia Pacific (Singapore)
US East (N. Virginia), US East (Ohio), US West (N. California), US West (Oregon)
Europe (Frankfurt) Europe (Ireland), Europe (London), Europe (Paris), Europe (Stockholm)
US East (N. Virginia), US East (Ohio), US West (N. California), US West (Oregon)
Europe (London) Europe (Frankfurt), Europe (Ireland), Europe (Paris), Europe (Stockholm)
Europe (Paris) Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Stockholm)
Europe (Stockholm) Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Paris)
US East (N. Virginia) Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific
(Sydney), Asia Pacific (Tokyo)
Canada (Central)
399
Amazon Relational Database Service User Guide
Enabling cross-Region automated backups
US East (Ohio) Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific
(Tokyo)
Canada (Central)
Canada (Central)
Europe (Ireland)
US West (Oregon) Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific
(Sydney), Asia Pacific (Tokyo)
Canada (Central)
You can also use the describe-source-regions AWS CLI command to find out which AWS
Regions can replicate to each other. For more information, see Finding information about replicated
backups (p. 402).
Console
You can enable backup replication for a new or existing DB instance:
• For a new DB instance, enable it when you launch the instance. For more information, see Settings for
DB instances (p. 197).
• For an existing DB instance, use the following procedure.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Automated backups.
400
Amazon Relational Database Service User Guide
Enabling cross-Region automated backups
3. On the Current Region tab, choose the DB instance for which you want to enable backup
replication.
4. For Actions, choose Manage cross-Region replication.
5. Under Backup replication, choose Enable replication to another AWS Region.
6. Choose the Destination Region.
7. Choose the Replicated backup retention period.
8. If you've enabled encryption on the source DB instance, choose the AWS KMS key for encrypting the
backups.
9. Choose Save.
In the source Region, replicated backups are listed on the Current Region tab of the Automated backups
page. In the destination Region, replicated backups are listed on the Replicated backups tab of the
Automated backups page.
AWS CLI
Enable backup replication by using the start-db-instance-automated-backups-replication
AWS CLI command.
The following CLI example replicates automated backups from a DB instance in the US West (Oregon)
Region to the US East (N. Virginia) Region. It also encrypts the replicated backups, using an AWS KMS key
in the destination Region.
Note
If you encrypt the backups, you must also include the --source-region option. Specifying the
source AWS Region autogenerates a presigned URL that is a valid request for the operation that
can be executed in the source Region.
For more information on presigned URLs, see Authenticating Requests: Using Query Parameters
(AWS Signature Version 4) in the Amazon Simple Storage Service API Reference and Signature
Version 4 signing process in the AWS General Reference.
For Windows:
401
Amazon Relational Database Service User Guide
Finding information about replicated backups
RDS API
Enable backup replication by using the StartDBInstanceAutomatedBackupsReplication RDS API
operation with the following parameters:
• Region
• SourceDBInstanceArn
• BackupRetentionPeriod
• KmsKeyId (optional)
• PreSignedUrl (required if you use KmsKeyId)
Note
If you encrypt the backups, you must also include a presigned URL. For more information on
presigned URLs, see Authenticating Requests: Using Query Parameters (AWS Signature Version
4) in the Amazon Simple Storage Service API Reference and Signature Version 4 signing process in
the AWS General Reference.
• describe-source-regions
• describe-db-instances
• describe-db-instance-automated-backups
The following describe-source-regions example lists the source AWS Regions from which
automated backups can be replicated to the US West (Oregon) destination Region.
The output shows that backups can be replicated from US East (N. Virginia), but not from US East (Ohio)
or US West (N. California), into US West (Oregon).
{
"SourceRegions": [
...
{
"RegionName": "us-east-1",
"Endpoint": "https://rds.us-east-1.amazonaws.com",
"Status": "available",
"SupportsDBInstanceAutomatedBackupsReplication": true
},
{
"RegionName": "us-east-2",
"Endpoint": "https://rds.us-east-2.amazonaws.com",
"Status": "available",
"SupportsDBInstanceAutomatedBackupsReplication": false
},
"RegionName": "us-west-1",
"Endpoint": "https://rds.us-west-1.amazonaws.com",
402
Amazon Relational Database Service User Guide
Finding information about replicated backups
"Status": "available",
"SupportsDBInstanceAutomatedBackupsReplication": false
}
]
}
The following describe-db-instances example shows the automated backups for a DB instance.
For Windows:
{
"DBInstances": [
{
"StorageEncrypted": false,
"Endpoint": {
"HostedZoneId": "Z1PVIF0B656C1W",
"Port": 1521,
...
"BackupRetentionPeriod": 7,
"DBInstanceAutomatedBackupsReplications": [{"DBInstanceAutomatedBackupsArn":
"arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE"}]
}
]
}
For Windows:
403
Amazon Relational Database Service User Guide
Finding information about replicated backups
The output shows the source DB instance and automated backups in US West (Oregon), with backups
replicated to US East (N. Virginia).
{
"DBInstanceAutomatedBackups": [
{
"DBInstanceArn": "arn:aws:rds:us-west-2:868710585169:db:mydatabase",
"DbiResourceId": "db-L2IJCEXJP7XQ7HOJ4SIEXAMPLE",
"DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-west-2:123456789012:auto-
backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE",
"BackupRetentionPeriod": 7,
"DBInstanceAutomatedBackupsReplications": [{"DBInstanceAutomatedBackupsArn":
"arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE"}]
"Region": "us-west-2",
"DBInstanceIdentifier": "mydatabase",
"RestoreWindow": {
"EarliestTime": "2020-10-26T01:09:07Z",
"LatestTime": "2020-10-31T19:09:53Z",
}
...
}
]
}
For Windows:
The output shows the source DB instance in US West (Oregon), with replicated backups in US East (N.
Virginia).
{
"DBInstanceAutomatedBackups": [
{
"DBInstanceArn": "arn:aws:rds:us-west-2:868710585169:db:mydatabase",
"DbiResourceId": "db-L2IJCEXJP7XQ7HOJ4SIEXAMPLE",
"DBInstanceAutomatedBackupsArn": "arn:aws:rds:us-east-1:123456789012:auto-
backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE",
"Region": "us-west-2",
"DBInstanceIdentifier": "mydatabase",
"RestoreWindow": {
"EarliestTime": "2020-10-26T01:09:07Z",
"LatestTime": "2020-10-31T19:01:23Z"
},
"AllocatedStorage": 50,
404
Amazon Relational Database Service User Guide
Point-in-time recovery from a replicated backup
"BackupRetentionPeriod": 7,
"Status": "replicating",
"Port": 1521,
...
}
]
}
For general information on point-in-time recovery (PITR), see Restoring a DB instance to a specified
time (p. 455).
Note
On RDS for SQL Server, option groups aren't copied across AWS Regions when automated
backups are replicated. If you've associated a custom option group with your RDS for SQL Server
DB instance, you can re-create that option group in the destination Region. Then restore the
DB instance in the destination Region and associate the custom option group with it. For more
information, see Working with option groups (p. 268).
Console
To restore a DB instance to a specified time from a replicated backup
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose the destination Region (where backups are replicated to) from the Region selector.
3. In the navigation pane, choose Automated backups.
4. On the Replicated backups tab, choose the DB instance that you want to restore.
5. For Actions, choose Restore to point in time.
6. Choose Latest restorable time to restore to the latest possible time, or choose Custom to choose a
time.
If you chose Custom, enter the date and time that you want to restore the instance to.
Note
Times are shown in your local time zone, which is indicated by an offset from Coordinated
Universal Time (UTC). For example, UTC-5 is Eastern Standard Time/Central Daylight Time.
7. For DB instance identifier, enter the name of the target restored DB instance.
8. (Optional) Choose other options as needed, such as enabling autoscaling.
9. Choose Restore to point in time.
AWS CLI
Use the restore-db-instance-to-point-in-time AWS CLI command to create a new DB instance.
405
Amazon Relational Database Service User Guide
Stopping backup replication
For Windows:
RDS API
To restore a DB instance to a specified time, call the RestoreDBInstanceToPointInTime Amazon
RDS API operation with the following parameters:
• SourceDBInstanceAutomatedBackupsArn
• TargetDBInstanceIdentifier
• RestoreTime
Replicated backups are retained, subject to the backup retention period set when they were created.
Console
Stop backup replication from the Automated backups page in the source Region.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose the source Region from the Region selector.
3. In the navigation pane, choose Automated backups.
4. On the Current Region tab, choose the DB instance for which you want to stop backup replication.
5. For Actions, choose Manage cross-Region replication.
6. Under Backup replication, clear the Enable replication to another AWS Region check box.
7. Choose Save.
Replicated backups are listed on the Retained tab of the Automated backups page in the destination
Region.
406
Amazon Relational Database Service User Guide
Deleting replicated backups
AWS CLI
Stop backup replication by using the stop-db-instance-automated-backups-replication AWS
CLI command.
The following CLI example stops automated backups of a DB instance from replicating in the US West
(Oregon) Region.
For Windows:
RDS API
Stop backup replication by using the StopDBInstanceAutomatedBackupsReplication RDS API
operation with the following parameters:
• Region
• SourceDBInstanceArn
Console
Delete replicated backups in the destination Region from the Automated backups page.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose the destination Region from the Region selector.
3. In the navigation pane, choose Automated backups.
4. On the Replicated backups tab, choose the DB instance for which you want to delete the replicated
backups.
5. For Actions, choose Delete.
6. On the confirmation page, enter delete me and choose Delete.
407
Amazon Relational Database Service User Guide
Deleting replicated backups
AWS CLI
Delete replicated backups by using the delete-db-instance-automated-backup AWS CLI
command.
You can use the describe-db-instances CLI command to find the Amazon Resource Names
(ARNs) of the replicated backups. For more information, see Finding information about replicated
backups (p. 402).
For Windows:
RDS API
Delete replicated backups by using the DeleteDBInstanceAutomatedBackup RDS API operation with
the DBInstanceAutomatedBackupsArn parameter.
408
Amazon Relational Database Service User Guide
Creating a DB snapshot
Creating a DB snapshot
Amazon RDS creates a storage volume snapshot of your DB instance, backing up the entire DB instance
and not just individual databases. Creating this DB snapshot on a Single-AZ DB instance results in a brief
I/O suspension that can last from a few seconds to a few minutes, depending on the size and class of
your DB instance. For MariaDB, MySQL, Oracle, and PostgreSQL, I/O activity is not suspended on your
primary during backup for Multi-AZ deployments, because the backup is taken from the standby. For
SQL Server, I/O activity is suspended briefly during backup for Multi-AZ deployments.
When you create a DB snapshot, you need to identify which DB instance you are going to back up, and
then give your DB snapshot a name so you can restore from it later. The amount of time it takes to create
a snapshot varies with the size your databases. Since the snapshot includes the entire storage volume,
the size of files, such as temporary files, also affects the amount of time it takes to create the snapshot.
Note
For PostgreSQL DB instances, data in unlogged tables might not be restored from snapshots.
For more information, see Best practices for working with PostgreSQL (p. 188).
Unlike automated backups, manual snapshots aren't subject to the backup retention period. Snapshots
don't expire.
For very long-term backups of MariaDB, MySQL, and PostgreSQL data, we recommend exporting
snapshot data to Amazon S3. If the major version of your DB engine is no longer supported, you can't
restore to that version from a snapshot. For more information, see Exporting DB snapshot data to
Amazon S3 (p. 437).
You can create a DB snapshot using the AWS Management Console, the AWS CLI, or the RDS API.
Console
To create a DB snapshot
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. In the list of DB instances, choose the DB instance for which you want to take a snapshot.
4. For Actions, choose Take snapshot.
409
Amazon Relational Database Service User Guide
Creating a DB snapshot
The Snapshots page appears, with the new DB snapshot's status shown as Creating. After its status is
Available, you can see its creation time.
AWS CLI
When you create a DB snapshot using the AWS CLI, you need to identify which DB instance you are going
to back up, and then give your DB snapshot a name so you can restore from it later. You can do this by
using the AWS CLI create-db-snapshot command with the following parameters:
• --db-instance-identifier
• --db-snapshot-identifier
In this example, you create a DB snapshot called mydbsnapshot for a DB instance called
mydbinstance.
Example
For Windows:
RDS API
When you create a DB snapshot using the Amazon RDS API, you need to identify which DB instance you
are going to back up, and then give your DB snapshot a name so you can restore from it later. You can do
this by using the Amazon RDS API CreateDBSnapshot command with the following parameters:
• DBInstanceIdentifier
• DBSnapshotIdentifier
410
Amazon Relational Database Service User Guide
Restoring from a DB snapshot
You can use the restored DB instance as soon as its status is available. The DB instance continues to
load data in the background. This is known as lazy loading.
If you access data that hasn't been loaded yet, the DB instance immediately downloads the requested
data from Amazon S3, and then continues loading the rest of the data in the background. For more
information, see Amazon EBS snapshots.
To help mitigate the effects of lazy loading on tables to which you require quick access, you can perform
operations that involve full-table scans, such as SELECT *. This allows Amazon RDS to download all of
the backed-up table data from S3.
You can restore a DB instance and use a different storage type than the source DB snapshot. In this case,
the restoration process is slower because of the additional work required to migrate the data to the new
storage type. If you restore to or from magnetic storage, the migration process is the slowest. That's
because magnetic storage doesn't have the IOPS capability of Provisioned IOPS or General Purpose (SSD)
storage.
You can use AWS CloudFormation to restore a DB instance from a DB instance snapshot. For more
information, see AWS::RDS::DBInstance in the AWS CloudFormation User Guide.
Note
You can't restore a DB instance from a DB snapshot that is both shared and encrypted. Instead,
you can make a copy of the DB snapshot and restore the DB instance from the copy. For more
information, see Copying a snapshot (p. 414).
• If you're using the Amazon RDS console, you can specify a custom security group to associate
with the instance or create a new VPC security group.
• If you're using the AWS CLI, you can specify a custom security group to associate with the
instance by including the --vpc-security-group-ids option in the restore-db-
instance-from-db-snapshot command.
• If you're using the Amazon RDS API, you can include the
VpcSecurityGroupIds.VpcSecurityGroupId.N parameter in the
RestoreDBInstanceFromDBSnapshot action.
As soon as the restore is complete and your new DB instance is available, you can associate any
custom security groups used by the snapshot you restored from. You must apply these changes by
411
Amazon Relational Database Service User Guide
Option groups
modifying the DB instance with the RDS console, the AWS CLI modify-db-instance command, or the
ModifyDBInstance Amazon RDS API operation. For more information, see Modifying an Amazon RDS
DB instance (p. 306).
When you assign an option group to a DB instance, the option group is also linked to the supported
platform the DB instance is on, either VPC or EC2-Classic (non-VPC). If a DB instance is in a VPC, the
option group associated with the DB instance is linked to that VPC. This means that you can't use the
option group assigned to a DB instance if you attempt to restore the instance into a different VPC or
onto a different platform. If you restore a DB instance into a different VPC or onto a different platform,
you must either assign the default option group to the instance, assign an option group that is linked
to that VPC or platform, or create a new option group and assign it to the DB instance. For persistent
or permanent options, when restoring a DB instance into a different VPC you must create a new option
group that includes the persistent or permanent option.
• The DB snapshot must have enough storage allocated for the new edition.
• Only the following edition changes are supported:
• From Standard Edition to Enterprise Edition
• From Web Edition to Standard Edition or Enterprise Edition
• From Express Edition to Web Edition, Standard Edition, or Enterprise Edition
If you want to change from one edition to a new edition that isn't supported by restoring a snapshot,
you can try using the native backup and restore feature. SQL Server verifies whether your database is
compatible with the new edition based on what SQL Server features you have enabled on the database.
For more information, see Importing and exporting SQL Server databases (p. 840).
If you restore a snapshot of a CDB instance, you can change the PDB name. You can't change the CDB
name, which is always RDSCDB. This CDB name is the same for all RDS instances that use a single-tenant
architecture. For more information, see Snapshots in a single-tenant architecture (p. 1174).
Before you restore a DB snapshot, you can upgrade it to a later release. For more information, see
Upgrading an Oracle DB snapshot (p. 1405).
412
Amazon Relational Database Service User Guide
Restoring from a snapshot
Console
To restore a DB instance from a DB snapshot
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the DB snapshot that you want to restore from.
4. For Actions, choose Restore snapshot.
5. On the Restore snapshot page, for DB instance identifier, enter the name for your restored DB
instance.
6. Choose Restore DB instance.
AWS CLI
To restore a DB instance from a DB snapshot, use the AWS CLI command restore-db-instance-from-db-
snapshot.
In this example, you restore from a previously created DB snapshot named mydbsnapshot. You restore
to a new DB instance named mynewdbinstance.
Example
For Windows:
RDS API
To restore a DB instance from a DB snapshot, call the Amazon RDS API function
RestoreDBInstanceFromDBSnapshot with the following parameters:
• DBInstanceIdentifier
• DBSnapshotIdentifier
413
Amazon Relational Database Service User Guide
Copying a snapshot
Copying a snapshot
With Amazon RDS, you can copy automated backups or manual DB snapshots. After you copy a
snapshot, the copy is a manual snapshot. You can make multiple copies of an automated backup or
manual snapshot, but each copy must have a unique identifier.
You can copy a snapshot within the same AWS Region, you can copy a snapshot across AWS Regions, and
you can copy shared snapshots.
Limitations
The following are some limitations when you copy snapshots:
• You can't copy a snapshot to or from the China (Beijing) or China (Ningxia) Regions.
• You can copy a snapshot between AWS GovCloud (US-East) and AWS GovCloud (US-West). However,
you can't copy a snapshot between these AWS GovCloud (US) Regions and commercial AWS Regions.
• If you delete a source snapshot before the target snapshot becomes available, the snapshot copy
might fail. Verify that the target snapshot has a status of AVAILABLE before you delete a source
snapshot.
• You can have up to five snapshot copy requests in progress to a single destination Region per account.
• Depending on the AWS Regions involved and the amount of data to be copied, a cross-Region
snapshot copy can take hours to complete. In some cases, there might be a large number of cross-
Region snapshot copy requests from a given source Region. In such cases, Amazon RDS might put
new cross-Region copy requests from that source Region into a queue until some in-progress copies
complete. No progress information is displayed about copy requests while they are in the queue.
Progress information is displayed when the copy starts.
Snapshot retention
Amazon RDS deletes automated backups in several situations:
If you want to keep an automated backup for a longer period, copy it to create a manual snapshot, which
is retained until you delete it. Amazon RDS storage costs might apply to manual snapshots if they exceed
your default storage space.
For more information about backup storage costs, see Amazon RDS pricing.
You can copy a shared DB snapshot across AWS Regions if the snapshot is unencrypted. However, if the
shared DB snapshot is encrypted, you can only copy it in the same Region.
Note
Copying shared incremental snapshots in the same AWS Region is supported when they're
unencrypted, or encrypted using the same KMS key as the initial full snapshot. If you use a
414
Amazon Relational Database Service User Guide
Handling encryption
different KMS key to encrypt subsequent snapshots when copying them, those shared snapshots
are full snapshots. For more information, see Incremental snapshot copying (p. 415).
Handling encryption
You can copy a snapshot that has been encrypted using a KMS key. If you copy an encrypted snapshot,
the copy of the snapshot must also be encrypted. If you copy an encrypted snapshot within the same
AWS Region, you can encrypt the copy with the same KMS key as the original snapshot. Or you can
specify a different KMS key. If you copy an encrypted snapshot across Regions, you can't use the same
KMS key for the copy as used for the source snapshot. This is because KMS keys are Region-specific.
Instead, you must specify a KMS key valid in the destination AWS Region.
The source snapshot remains encrypted throughout the copy process. For more information, see
Limitations of Amazon RDS encrypted DB instances (p. 1881).
You can also encrypt a copy of an unencrypted snapshot. This way, you can quickly add encryption to a
previously unencrypted DB instance.
That is, you can create a snapshot of your DB instance when you are ready to encrypt it. You then create
a copy of that snapshot and specify a KMS key to encrypt that snapshot copy. You can then restore an
encrypted DB instance from the encrypted snapshot.
Whether a snapshot copy is incremental is determined by the most recently completed snapshot copy. If
the most recent snapshot copy was deleted, the next copy is a full copy, not an incremental copy.
If a copy is still pending when you start another copy, the second copy doesn't start until the first copy
finishes.
When you copy a snapshot across AWS accounts, the copy is an incremental copy if the following
conditions are met:
• A different snapshot of the same source DB instance was previously copied to the destination account.
• The most recent snapshot copy still exists in the destination account.
• All copies of the snapshot in the destination account are either unencrypted, or were encrypted using
the same KMS key.
The following examples illustrate the difference between full and incremental snapshots. They apply to
both shared and unshared snapshots.
S1 K1 Full
S2 K1 Incremental of S1
415
Amazon Relational Database Service User Guide
Cross-Region copying
S3 K1 Incremental of S2
S4 K1 Incremental of S3
Note
In these examples, snapshots S2, S3, and S4 are incremental only if the previous snapshot still
exists.
The same applies to copies. Snapshot copies S3C and S4C are incremental only if the previous
copy still exists.
For information on copying incremental snapshots across AWS Regions, see Full and incremental
copies (p. 419).
Certain conditions in the requester's IAM policy can cause the request to fail. The following examples
assume that you're copying the DB snapshot from US East (Ohio) to US East (N. Virginia). These examples
show conditions in the requester's IAM policy that cause the request to fail:
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": "us-east-1"
}
}
The request fails because the policy doesn't allow access to the source Region. For a successful request,
specify both the source and destination Regions.
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
416
Amazon Relational Database Service User Guide
Cross-Region copying
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"us-east-1",
"us-east-2"
]
}
}
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
"Resource": "arn:aws:rds:us-east-1:123456789012:snapshot:target-snapshot"
...
For a successful request, specify both the source and target snapshots.
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
"Resource": [
"arn:aws:rds:us-east-1:123456789012:snapshot:target-snapshot",
"arn:aws:rds:us-east-2:123456789012:snapshot:source-snapshot"
]
...
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
"Resource": "*",
"Condition": {
"Bool": {"aws:ViaAWSService": "false"}
}
Communication with the source Region is made by RDS on the requester's behalf. For a successful
request, don't deny calls made by AWS services.
• The requester's policy has a condition for aws:SourceVpc or aws:SourceVpce.
These requests might fail because when RDS makes the call to the remote Region, it isn't from the
specified VPC or VPC endpoint.
If you need to use one of the previous conditions that would cause a request to fail, you can include a
second statement with aws:CalledVia in your policy to make the request succeed. For example, you
can use aws:CalledVia with aws:SourceVpce as shown here:
...
"Effect": "Allow",
"Action": "rds:CopyDBSnapshot",
"Resource": "*",
"Condition": {
"Condition" : {
"ForAnyValue:StringEquals" : {
"aws:SourceVpce": "vpce-1a2b3c4d"
}
}
417
Amazon Relational Database Service User Guide
Cross-Region copying
},
{
"Effect": "Allow",
"Action": [
"rds:CopyDBSnapshot"
],
"Resource": "*",
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": [
"rds.amazonaws.com"
]
}
}
}
For more information, see Policies and permissions in IAM in the IAM User Guide.
RDS doesn't have access to DB snapshots that weren't authorized previously by a CopyDBSnapshot
request. The authorization is revoked when copying completes.
RDS uses the service-linked role to verify the authorization in the source Region. If you delete the
service-linked role during the copy process, the copy fails.
For more information, see Using service-linked roles in the IAM User Guide.
To use the global endpoint, make sure that it's enabled for both Regions in the operations. Set the global
endpoint to Valid in all AWS Regions in the AWS STS account settings.
For more information, see Managing AWS STS in an AWS Region in the IAM User Guide.
In some cases, there might be a large number of cross-Region snapshot copy requests from a given
source AWS Region. In such cases, Amazon RDS might put new cross-Region copy requests from that
418
Amazon Relational Database Service User Guide
Option groups
source AWS Region into a queue until some in-progress copies complete. No progress information is
displayed about copy requests while they are in the queue. Progress information is displayed when the
copying starts.
Incremental snapshot copying across AWS Regions is supported for both unencrypted and encrypted
snapshots.
When you copy a snapshot across AWS Regions, the copy is an incremental copy if the following
conditions are met:
When you copy a snapshot across Regions, you can specify a new option group for the snapshot. We
recommend that you prepare the new option group before you copy the snapshot. In the destination
AWS Region, create an option group with the same settings as the original DB instance. If one already
exists in the new AWS Region, you can use that one.
In some cases, you might copy a snapshot and not specify a new option group for the snapshot. In these
cases, when you restore the snapshot the DB instance gets the default option group. To give the new DB
instance the same options as the original, do the following:
1. In the destination AWS Region, create an option group with the same settings as the original DB
instance . If one already exists in the new AWS Region, you can use that one.
2. After you restore the snapshot in the destination AWS Region, modify the new DB instance and add
the new or existing option group from the previous step.
1. In the destination AWS Region, create a DB parameter group with the same settings as the original DB
instance . If one already exists in the new AWS Region, you can use that one.
2. After you restore the snapshot in the destination AWS Region, modify the new DB instance and add
the new or existing parameter group from the previous step.
419
Amazon Relational Database Service User Guide
Copying a DB snapshot
Copying a DB snapshot
Use the procedures in this topic to copy a DB snapshot. For an overview of copying a snapshot, see
Copying a snapshot (p. 414)
For each AWS account, you can copy up to five DB snapshots at a time from one AWS Region to another.
If you copy a DB snapshot to another AWS Region, you create a manual DB snapshot that is retained in
that AWS Region. Copying a DB snapshot out of the source AWS Region incurs Amazon RDS data transfer
charges.
For more information about data transfer pricing, see Amazon RDS pricing.
After the DB snapshot copy has been created in the new AWS Region, the DB snapshot copy behaves the
same as all other DB snapshots in that AWS Region.
You can copy a DB snapshot using the AWS Management Console, the AWS CLI, or the RDS API.
Console
The following procedure copies an encrypted or unencrypted DB snapshot, in the same AWS Region or
across Regions, by using the AWS Management Console.
To copy a DB snapshot
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Select the DB snapshot that you want to copy.
4. For Actions, choose Copy snapshot.
420
Amazon Relational Database Service User Guide
Copying a DB snapshot
5. (Optional) To copy the DB snapshot to a different AWS Region, for Destination Region, choose the
new AWS Region.
421
Amazon Relational Database Service User Guide
Copying a DB snapshot
Note
The destination AWS Region must have the same database engine version available as the
source AWS Region.
6. For New DB Snapshot Identifier, type the name of the DB snapshot copy.
You can make multiple copies of an automated backup or manual snapshot, but each copy must
have a unique identifier.
7. (Optional) For Target Option Group, choose a new option group.
Specify this option if you are copying a snapshot from one AWS Region to another, and your DB
instance uses a nondefault option group.
If your source DB instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server,
you must specify this option when copying across Regions. For more information, see Option group
considerations (p. 419).
8. (Optional) Select Copy Tags to copy tags and values from the snapshot to the copy of the snapshot.
9. (Optional) For Encryption, do the following:
a. Choose Enable Encryption if the DB snapshot isn't encrypted but you want to encrypt the copy.
Note
If the DB snapshot is encrypted, you must encrypt the copy, so the check box is already
selected.
b. For AWS KMS key, specify the KMS key identifier to use to encrypt the DB snapshot copy.
10. Choose Copy snapshot.
AWS CLI
You can copy a DB snapshot by using the AWS CLI command copy-db-snapshot. If you are copying the
snapshot to a new AWS Region, run the command in the new AWS Region.
The following options are used to copy a DB snapshot. Not all options are required for all scenarios. Use
the descriptions and the examples that follow to determine which options to use.
Specify this option if you are copying a snapshot from one AWS Region to another, and your DB
instance uses a non-default option group.
422
Amazon Relational Database Service User Guide
Copying a DB snapshot
If your source DB instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server,
you must specify this option when copying across Regions. For more information, see Option group
considerations (p. 419).
• --kms-key-id – The KMS key identifier for an encrypted DB snapshot. The KMS key identifier is the
Amazon Resource Name (ARN), key identifier, or key alias for the KMS key.
• If you copy an encrypted DB snapshot from your AWS account, you can specify a value for this
parameter to encrypt the copy with a new KMS key. If you don't specify a value for this parameter,
then the copy of the DB snapshot is encrypted with the same KMS key as the source DB snapshot.
• If you copy an encrypted DB snapshot that is shared from another AWS account, then you must
specify a value for this parameter.
• If you specify this parameter when you copy an unencrypted snapshot, the copy is encrypted.
• If you copy an encrypted snapshot to a different AWS Region, then you must specify a KMS key for
the destination AWS Region. KMS keys are specific to the AWS Region that they are created in, and
you cannot use encryption keys from one AWS Region in another AWS Region.
• --source-region – The ID of the AWS Region of the source DB snapshot. If you copy an encrypted
snapshot to a different AWS Region, then you must specify this option.
The following code creates a copy of a snapshot, with the new name mydbsnapshotcopy, in the same
AWS Region as the source snapshot. When the copy is made, all tags on the original snapshot are copied
to the snapshot copy.
For Windows:
The following code creates a copy of a snapshot, with the new name mydbsnapshotcopy, in the AWS
Region in which the command is run.
For Windows:
423
Amazon Relational Database Service User Guide
Copying a DB snapshot
--target-db-snapshot-identifier mydbsnapshotcopy
For Windows:
RDS API
You can copy a DB snapshot by using the Amazon RDS API operation CopyDBSnapshot. If you are
copying the snapshot to a new AWS Region, perform the action in the new AWS Region.
The following parameters are used to copy a DB snapshot. Not all parameters are required for all
scenarios. Use the descriptions and the examples that follow to determine which parameters to use.
Specify this parameter if you are copying a snapshot from one AWS Region to another, and your DB
instance uses a non-default option group.
If your source DB instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server, you
must specify this parameter when copying across Regions. For more information, see Option group
considerations (p. 419).
424
Amazon Relational Database Service User Guide
Copying a DB snapshot
• KmsKeyId – The KMS key identifier for an encrypted DB snapshot. The KMS key identifier is the
Amazon Resource Name (ARN), key identifier, or key alias for the KMS key.
• If you copy an encrypted DB snapshot from your AWS account, you can specify a value for this
parameter to encrypt the copy with a new KMS key. If you don't specify a value for this parameter,
then the copy of the DB snapshot is encrypted with the same KMS key as the source DB snapshot.
• If you copy an encrypted DB snapshot that is shared from another AWS account, then you must
specify a value for this parameter.
• If you specify this parameter when you copy an unencrypted snapshot, the copy is encrypted.
• If you copy an encrypted snapshot to a different AWS Region, then you must specify a KMS key for
the destination AWS Region. KMS keys are specific to the AWS Region that they are created in, and
you cannot use encryption keys from one AWS Region in another AWS Region.
• PreSignedUrl – The URL that contains a Signature Version 4 signed request for the
CopyDBSnapshot API operation in the source AWS Region that contains the source DB snapshot to
copy.
Specify this parameter when you copy an encrypted DB snapshot from another AWS Region by using
the Amazon RDS API. You can specify the source Region option instead of this parameter when you
copy an encrypted DB snapshot from another AWS Region by using the AWS CLI.
The presigned URL must be a valid request for the CopyDBSnapshot API operation that can be run in
the source AWS Region containing the encrypted DB snapshot to be copied. The presigned URL request
must contain the following parameter values:
• DestinationRegion – The AWS Region that the encrypted DB snapshot will be copied to. This
AWS Region is the same one where the CopyDBSnapshot operation is called that contains this
presigned URL.
For example, suppose that you copy an encrypted DB snapshot from the us-west-2 Region to the us-
east-1 Region. You then call the CopyDBSnapshot operation in the us-east-1 Region and provide a
presigned URL that contains a call to the CopyDBSnapshot operation in the us-west-2 Region. For
this example, the DestinationRegion in the presigned URL must be set to the us-east-1 Region.
• KmsKeyId – The KMS key identifier for the key to use to encrypt the copy of the DB snapshot in the
destination AWS Region. This is the same identifier for both the CopyDBSnapshot operation that is
called in the destination AWS Region, and the operation contained in the presigned URL.
• SourceDBSnapshotIdentifier – The DB snapshot identifier for the encrypted snapshot to be
copied. This identifier must be in the Amazon Resource Name (ARN) format for the source AWS
Region. For example, if you are copying an encrypted DB snapshot from the us-west-2 Region,
then your SourceDBSnapshotIdentifier looks like the following example: arn:aws:rds:us-
west-2:123456789012:snapshot:mysql-instance1-snapshot-20161115.
For more information on Signature Version 4 signed requests, see the following:
• Authenticating requests: Using query parameters (AWS signature version 4) in the Amazon Simple
Storage Service API Reference
• Signature version 4 signing process in the AWS General Reference
The following code creates a copy of a snapshot, with the new name mydbsnapshotcopy, in the same
AWS Region as the source snapshot. When the copy is made, all tags on the original snapshot are copied
to the snapshot copy.
https://rds.us-west-1.amazonaws.com/
?Action=CopyDBSnapshot
&CopyTags=true
&SignatureMethod=HmacSHA256
&SignatureVersion=4
425
Amazon Relational Database Service User Guide
Copying a DB snapshot
&SourceDBSnapshotIdentifier=mysql-instance1-snapshot-20130805
&TargetDBSnapshotIdentifier=mydbsnapshotcopy
&Version=2013-09-09
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140429/us-west-1/rds/aws4_request
&X-Amz-Date=20140429T175351Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=9164337efa99caf850e874a1cb7ef62f3cea29d0b448b9e0e7c53b288ddffed2
https://rds.us-west-1.amazonaws.com/
?Action=CopyDBSnapshot
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SourceDBSnapshotIdentifier=arn%3Aaws%3Ards%3Aus-east-1%3A123456789012%3Asnapshot%3Amysql-
instance1-snapshot-20130805
&TargetDBSnapshotIdentifier=mydbsnapshotcopy
&Version=2013-09-09
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140429/us-west-1/rds/aws4_request
&X-Amz-Date=20140429T175351Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=9164337efa99caf850e874a1cb7ef62f3cea29d0b448b9e0e7c53b288ddffed2
https://rds.us-east-1.amazonaws.com/
?Action=CopyDBSnapshot
&KmsKeyId=my-us-east-1-key
&OptionGroupName=custom-option-group-name
&PreSignedUrl=https%253A%252F%252Frds.us-west-2.amazonaws.com%252F
%253FAction%253DCopyDBSnapshot
%2526DestinationRegion%253Dus-east-1
%2526KmsKeyId%253Dmy-us-east-1-key
%2526SourceDBSnapshotIdentifier%253Darn%25253Aaws%25253Ards%25253Aus-
west-2%25253A123456789012%25253Asnapshot%25253Amysql-instance1-snapshot-20161115
%2526SignatureMethod%253DHmacSHA256
%2526SignatureVersion%253D4
%2526Version%253D2014-10-31
%2526X-Amz-Algorithm%253DAWS4-HMAC-SHA256
%2526X-Amz-Credential%253DAKIADQKE4SARGYLE%252F20161117%252Fus-west-2%252Frds
%252Faws4_request
%2526X-Amz-Date%253D20161117T215409Z
%2526X-Amz-Expires%253D3600
%2526X-Amz-SignedHeaders%253Dcontent-type%253Bhost%253Buser-agent%253Bx-amz-
content-sha256%253Bx-amz-date
%2526X-Amz-Signature
%253D255a0f17b4e717d3b67fad163c3ec26573b882c03a65523522cf890a67fca613
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SourceDBSnapshotIdentifier=arn%3Aaws%3Ards%3Aus-west-2%3A123456789012%3Asnapshot
%3Amysql-instance1-snapshot-20161115
&TargetDBSnapshotIdentifier=mydbsnapshotcopy
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20161117/us-east-1/rds/aws4_request
426
Amazon Relational Database Service User Guide
Copying a DB snapshot
&X-Amz-Date=20161117T221704Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=da4f2da66739d2e722c85fcfd225dc27bba7e2b8dbea8d8612434378e52adccf
427
Amazon Relational Database Service User Guide
Sharing a snapshot
Sharing a DB snapshot
Using Amazon RDS, you can share a manual DB snapshot in the following ways:
• Sharing a manual DB snapshot, whether encrypted or unencrypted, enables authorized AWS accounts
to copy the snapshot.
• Sharing an unencrypted manual DB snapshot enables authorized AWS accounts to directly restore a
DB instance from the snapshot instead of taking a copy of it and restoring from that. However, you
can't restore a DB instance from a DB snapshot that is both shared and encrypted. Instead, you can
make a copy of the DB snapshot and restore the DB instance from the copy.
Note
To share an automated DB snapshot, create a manual DB snapshot by copying the automated
snapshot, and then share that copy. This process also applies to AWS Backup–generated
resources.
For more information on copying a snapshot, see Copying a snapshot (p. 414). For more information on
restoring a DB instance from a DB snapshot, see Restoring from a DB snapshot (p. 411).
The following limitations apply when sharing manual snapshots with other AWS accounts:
• When you restore a DB instance from a shared snapshot using the AWS Command Line Interface (AWS
CLI) or Amazon RDS API, you must specify the Amazon Resource Name (ARN) of the shared snapshot
as the snapshot identifier.
• You can't share a DB snapshot that uses an option group with permanent or persistent options, except
for Oracle DB instances that have the Timezone or OLS option (or both).
A permanent option can't be removed from an option group. Option groups with persistent options
can't be removed from a DB instance once the option group has been assigned to the DB instance.
The following table lists permanent and persistent options and their related DB engines.
For Oracle DB instances, you can copy shared DB snapshots that have the Timezone or OLS option
(or both). To do so, specify a target option group that includes these options when you copy the DB
snapshot. The OLS option is permanent and persistent only for Oracle DB instances running Oracle
version 12.2 or higher. For more information about these options, see Oracle time zone (p. 1385) and
Oracle Label Security (p. 1350).
428
Amazon Relational Database Service User Guide
Sharing public snapshots
When a snapshot is shared publicly, it gives all AWS accounts permission both to copy the snapshot and
to create DB instances from it.
You aren't billed for the backup storage of public snapshots owned by other accounts. You're billed only
for snapshots that you own.
If you copy a public snapshot, you own the copy. You're billed for the backup storage of your snapshot
copy. If you create a DB instance from a public snapshot, you're billed for that DB instance. For Amazon
RDS pricing information, see the Amazon RDS product page.
You can delete only the public snapshots that you own. To delete a shared or public snapshot, make sure
to log into the AWS account that owns the snapshot.
The public snapshots appear. You can see which account owns a public snapshot in the Owner
column.
Note
You might have to modify the page preferences, by selecting the gear icon at the upper
right of the Public snapshots list, to see this column.
The output returned is similar to the following example if you have public snapshots.
"DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mysnapshot1",
"DBSnapshotArn": "arn:aws:rds:us-east-1:123456789012:snapshot:mysnapshot2",
Note
You might see duplicate entries for DBSnapshotIdentifier or
SourceDBSnapshotIdentifier.
429
Amazon Relational Database Service User Guide
Sharing encrypted snapshots
1. Share the AWS KMS key that was used to encrypt the snapshot with any accounts that you want to be
able to access the snapshot.
You can share KMS keys with another AWS account by adding the other account to the KMS key policy.
For details on updating a key policy, see Key policies in the AWS KMS Developer Guide. For an example
of creating a key policy, see Allowing access to an AWS KMS key (p. 430) later in this topic.
2. Use the AWS Management Console, AWS CLI, or Amazon RDS API to share the encrypted snapshot
with the other accounts.
To allow another AWS account access to a KMS key, update the key policy for the KMS key. You update it
with the Amazon Resource Name (ARN) of the AWS account that you are sharing to as Principal in the
KMS key policy. Then you allow the kms:CreateGrant action.
After you have given an AWS account access to your KMS key, to copy your encrypted snapshot that AWS
account must create an AWS Identity and Access Management (IAM) role or user if it doesn't already have
one. In addition, that AWS account must also attach an IAM policy to that IAM role or user that allows
the role or user to copy an encrypted DB snapshot using your KMS key. The account must be an IAM user
and cannot be a root AWS account identity due to AWS KMS security restrictions.
In the following key policy example, user 111122223333 is the owner of the KMS key, and user
444455556666 is the account that the key is being shared with. This updated key policy gives the
AWS account access to the KMS key by including the ARN for the root AWS account identity for user
444455556666 as a Principal for the policy, and by allowing the kms:CreateGrant action.
{
"Id": "key-policy-1",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow use of the key",
"Effect": "Allow",
"Principal": {"AWS": [
"arn:aws:iam::111122223333:user/KeyUser",
"arn:aws:iam::444455556666:root"
]},
"Action": [
"kms:CreateGrant",
430
Amazon Relational Database Service User Guide
Sharing encrypted snapshots
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource": "*"
},
{
"Sid": "Allow attachment of persistent resources",
"Effect": "Allow",
"Principal": {"AWS": [
"arn:aws:iam::111122223333:user/KeyUser",
"arn:aws:iam::444455556666:root"
]},
"Action": [
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant"
],
"Resource": "*",
"Condition": {"Bool": {"kms:GrantIsForAWSResource": true}}
}
]
}
The following example shows a policy that can be attached to an IAM user for AWS account
444455556666 that enables the IAM user to copy a shared snapshot from AWS account 111122223333
that has been encrypted with the KMS key c989c1dd-a3f2-4a5d-8d96-e793d082ab26 in the us-
west-2 region.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUseOfTheKey",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey",
"kms:CreateGrant",
"kms:RetireGrant"
],
"Resource": ["arn:aws:kms:us-west-2:111122223333:key/c989c1dd-a3f2-4a5d-8d96-
e793d082ab26"]
},
{
"Sid": "AllowAttachmentOfPersistentResources",
"Effect": "Allow",
"Action": [
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant"
431
Amazon Relational Database Service User Guide
Sharing a snapshot
],
"Resource": ["arn:aws:kms:us-west-2:111122223333:key/c989c1dd-a3f2-4a5d-8d96-
e793d082ab26"],
"Condition": {
"Bool": {
"kms:GrantIsForAWSResource": true
}
}
}
]
}
For details on updating a key policy, see Key policies in the AWS KMS Developer Guide.
Sharing a snapshot
You can share a DB snapshot using the AWS Management Console, the AWS CLI, or the RDS API.
Console
Using the Amazon RDS console, you can share a manual DB snapshot with up to 20 AWS accounts. You
can also use the console to stop sharing a manual snapshot with one or more accounts.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Select the manual snapshot that you want to share.
4. For Actions, choose Share Snapshot.
5. Choose one of the following options for DB snapshot visibility.
• If the source is unencrypted, choose Public to permit all AWS accounts to restore a DB instance
from your manual DB snapshot, or choose Private to permit only AWS accounts that you specify
to restore a DB instance from your manual DB snapshot.
Warning
If you set DB snapshot visibility to Public, all AWS accounts can restore a DB instance
from your manual DB snapshot and have access to your data. Do not share any manual
DB snapshots that contain private information as Public.
• If the source is encrypted, DB snapshot visibility is set as Private because encrypted snapshots
can't be shared as public.
6. For AWS Account ID, type the AWS account identifier for an account that you want to permit
to restore a DB instance from your manual snapshot, and then choose Add. Repeat to include
additional AWS account identifiers, up to 20 AWS accounts.
If you make an error when adding an AWS account identifier to the list of permitted accounts, you
can delete it from the list by choosing Delete at the right of the incorrect AWS account identifier.
432
Amazon Relational Database Service User Guide
Sharing a snapshot
7. After you have added identifiers for all of the AWS accounts that you want to permit to restore the
manual snapshot, choose Save to save your changes.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Select the manual snapshot that you want to stop sharing.
4. Choose Actions, and then choose Share Snapshot.
5. To remove permission for an AWS account, choose Delete for the AWS account identifier for that
account from the list of authorized accounts.
433
Amazon Relational Database Service User Guide
Sharing a snapshot
AWS CLI
To share a DB snapshot, use the aws rds modify-db-snapshot-attribute command. Use the --
values-to-add parameter to add a list of the IDs for the AWS accounts that are authorized to restore
the manual snapshot.
The following example enables AWS account identifier 123456789012 to restore the DB snapshot
named db7-snapshot.
For Windows:
434
Amazon Relational Database Service User Guide
Sharing a snapshot
The following example enables two AWS account identifiers, 111122223333 and 444455556666, to
restore the DB snapshot named manual-snapshot1.
For Windows:
Note
When using the Windows command prompt, you must escape double quotes (") in JSON code by
prefixing them with a backslash (\).
To remove an AWS account identifier from the list, use the --values-to-remove parameter.
The following example prevents AWS account ID 444455556666 from restoring the snapshot.
For Windows:
To list the AWS accounts enabled to restore a snapshot, use the describe-db-snapshot-attributes
AWS CLI command.
RDS API
You can also share a manual DB snapshot with other AWS accounts by using the Amazon RDS API. To do
so, call the ModifyDBSnapshotAttribute operation. Specify restore for AttributeName, and use
the ValuesToAdd parameter to add a list of the IDs for the AWS accounts that are authorized to restore
the manual snapshot.
To make a manual snapshot public and restorable by all AWS accounts, use the value all. However,
take care not to add the all value for any manual snapshots that contain private information that you
don't want to be available to all AWS accounts. Also, don't specify all for encrypted snapshots, because
making such snapshots public isn't supported.
435
Amazon Relational Database Service User Guide
Sharing a snapshot
To remove sharing permission for an AWS account, use the ModifyDBSnapshotAttribute operation
with AttributeName set to restore and the ValuesToRemove parameter. To mark a manual
snapshot as private, remove the value all from the values list for the restore attribute.
To list all of the AWS accounts permitted to restore a snapshot, use the
DescribeDBSnapshotAttributes API operation.
436
Amazon Relational Database Service User Guide
Exporting snapshot data to Amazon S3
When you export a DB snapshot, Amazon RDS extracts data from the snapshot and stores it in an
Amazon S3 bucket. The data is stored in an Apache Parquet format that is compressed and consistent.
You can export all types of DB snapshots—including manual snapshots, automated system snapshots,
and snapshots created by the AWS Backup service. By default, all data in the snapshot is exported.
However, you can choose to export specific sets of databases, schemas, or tables.
After the data is exported, you can analyze the exported data directly through tools like Amazon Athena
or Amazon Redshift Spectrum. For more information on using Athena to read Parquet data, see Parquet
SerDe in the Amazon Athena User Guide. For more information on using Redshift Spectrum to read
Parquet data, see COPY from columnar data formats in the Amazon Redshift Database Developer Guide.
Amazon RDS supports exporting snapshots in all AWS Regions except the following:
The following table shows the engine versions that are supported for exporting snapshot data to
Amazon S3.
For complete lists of engine versions supported by Amazon RDS, see the following:
Topics
• Limitations (p. 438)
• Overview of exporting snapshot data (p. 438)
• Setting up access to an Amazon S3 bucket (p. 439)
• Using a cross-account AWS KMS key for encrypting Amazon S3 exports (p. 441)
• Exporting a snapshot to an Amazon S3 bucket (p. 442)
• Monitoring snapshot exports (p. 445)
• Canceling a snapshot export task (p. 446)
• Failure messages for Amazon S3 export tasks (p. 447)
437
Amazon Relational Database Service User Guide
Limitations
Limitations
Exporting DB snapshot data to Amazon S3 has the following limitations:
• Exporting snapshots from DB instances that use magnetic storage isn't supported.
• If a database, schema, or table has characters in its name other than the following, partial export isn't
supported. However, you can export the entire DB snapshot.
• Latin letters (A–Z)
• Digits (0–9)
• Dollar symbol ($)
• Underscore (_)
• Some characters aren't supported in database table column names. Tables with the following
characters in column names are skipped during export:
, ; { } ( ) \n \t =
• If the data contains a large object such as a BLOB or CLOB, close to or greater than 500 MB, the export
fails.
A bucket is a container for Amazon S3 objects or files. To provide the information to access a bucket,
take the following steps:
a. Identify the S3 bucket where the snapshot is to be exported to. The S3 bucket must be in the
same AWS Region as the snapshot. For more information, see Identifying the Amazon S3 bucket
for export (p. 439).
b. Create an AWS Identity and Access Management (IAM) role that grants the snapshot export task
access to the S3 bucket. For more information, see Providing access to an Amazon S3 bucket
using an IAM role (p. 439).
3. Create an AWS KMS key for the server-side encryption. The KMS key is used by the snapshot export
task to set up AWS KMS server-side encryption when writing the export data to S3. For more
information, see Encrypting Amazon RDS resources (p. 1879).
You can use a KMS key within your AWS account, or you can use a cross-account KMS key. For more
information, see Using a cross-account AWS KMS key for encrypting Amazon S3 exports (p. 441).
4. Export the snapshot to Amazon S3 using the console or the start-export-task CLI command.
For more information, see Exporting a snapshot to an Amazon S3 bucket (p. 442).
5. To access your exported data in the Amazon S3 bucket, see Uploading, downloading, and managing
objects in the Amazon Simple Storage Service User Guide.
438
Amazon Relational Database Service User Guide
Setting up access to an S3 bucket
Topics
• Identifying the Amazon S3 bucket for export (p. 439)
• Providing access to an Amazon S3 bucket using an IAM role (p. 439)
• Using a cross-account Amazon S3 bucket (p. 441)
For more information about working with Amazon S3 buckets, see the following in the Amazon Simple
Storage Service User Guide:
To do this, create an IAM policy that provides access to the bucket. Then create an IAM role and attach
the policy to the role. You later assign the IAM role to your snapshot export task.
Important
If you plan to use the AWS Management Console to export your snapshot, you can choose to
create the IAM policy and the role automatically when you export the snapshot. For instructions,
see Exporting a snapshot to an Amazon S3 bucket (p. 442).
1. Create an IAM policy. This policy provides the bucket and object permissions that allow your
snapshot export task to access Amazon S3.
Include in the policy the following required actions to allow the transfer of files from Amazon RDS
to an S3 bucket:
• s3:PutObject*
• s3:GetObject*
• s3:ListBucket
• s3:DeleteObject*
• s3:GetBucketLocation
439
Amazon Relational Database Service User Guide
Setting up access to an S3 bucket
Include in the policy the following resources to identify the S3 bucket and objects in the bucket. The
following list of resources shows the Amazon Resource Name (ARN) format for accessing Amazon S3.
• arn:aws:s3:::your-s3-bucket
• arn:aws:s3:::your-s3-bucket/*
For more information on creating an IAM policy for Amazon RDS, see Creating and using an IAM
policy for IAM database access (p. 1913). See also Tutorial: Create and attach your first customer
managed policy in the IAM User Guide.
The following AWS CLI command creates an IAM policy named ExportPolicy with these options. It
grants access to a bucket named your-s3-bucket.
Note
After you create the policy, note the ARN of the policy. You need the ARN for a subsequent
step when you attach the policy to an IAM role.
2. Create an IAM role. You do this so that Amazon RDS can assume this IAM role on your behalf to
access your Amazon S3 buckets. For more information, see Creating a role to delegate permissions
to an IAM user in the IAM User Guide.
The following example shows using the AWS CLI command to create a role named rds-s3-
export-role.
3. Attach the IAM policy that you created to the IAM role that you created.
440
Amazon Relational Database Service User Guide
Using a cross-account KMS key
The following AWS CLI command attaches the policy created earlier to the role named rds-s3-
export-role. Replace your-policy-arn with the policy ARN that you noted in an earlier step.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:role/Admin"
},
"Action": [
"s3:PutObject*",
"s3:ListBucket",
"s3:GetObject*",
"s3:DeleteObject*",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::mycrossaccountbucket",
"arn:aws:s3:::mycrossaccountbucket/*"
]
}
]
}
The following example gives ExampleRole and ExampleUser in the external account
444455556666 permissions in the local account 123456789012.
{
"Sid": "Allow an external account to use this KMS key",
"Effect": "Allow",
"Principal": {
441
Amazon Relational Database Service User Guide
Exporting a snapshot to an S3 bucket
"AWS": [
"arn:aws:iam::444455556666:role/ExampleRole",
"arn:aws:iam::444455556666:user/ExampleUser"
]
},
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:CreateGrant",
"kms:DescribeKey",
"kms:RetireGrant"
],
"Resource": "*"
}
The following example IAM policy allows the principal to use the KMS key in account 123456789012
for cryptographic operations. To give this permission to ExampleRole and ExampleUser in
account 444455556666, attach the policy to them in that account.
{
"Sid": "Allow use of KMS key in account 123456789012",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:CreateGrant",
"kms:DescribeKey",
"kms:RetireGrant"
],
"Resource": "arn:aws:kms:us-
west-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
You can export a DB snapshot to Amazon S3 using the AWS Management Console, the AWS CLI, or the
RDS API.
If you use a Lambda function to export a snapshot, add the kms:DescribeKey action to the Lambda
function policy. For more information, see AWS Lambda permissions.
442
Amazon Relational Database Service User Guide
Exporting a snapshot to an S3 bucket
Console
The Export to Amazon S3 console option appears only for snapshots that can be exported to Amazon
S3. A snapshot might not be available for export because of the following reasons:
To export a DB snapshot
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. From the tabs, choose the type of snapshot that you want to export.
4. In the list of snapshots, choose the snapshot that you want to export.
5. For Actions, choose Export to Amazon S3.
For example:
To assign the exported data to a folder path in the S3 bucket, enter the optional path for S3 prefix.
9. For IAM role, either choose a role that grants you write access to your chosen S3 bucket, or create a
new role.
• If you created a role by following the steps in Providing access to an Amazon S3 bucket using an
IAM role (p. 439), choose that role.
• If you didn't create a role that grants you write access to your chosen S3 bucket, choose Create a
new role to create the role automatically. Next, enter a name for the role in IAM role name.
10. For AWS KMS key, enter the ARN for the key to use for encrypting the exported data.
11. Choose Export to Amazon S3.
443
Amazon Relational Database Service User Guide
Exporting a snapshot to an S3 bucket
AWS CLI
To export a DB snapshot to Amazon S3 using the AWS CLI, use the start-export-task command with the
following required options:
• --export-task-identifier
• --source-arn
• --s3-bucket-name
• --iam-role-arn
• --kms-key-id
In the following examples, the snapshot export task is named my-snapshot-export, which exports a
snapshot to an S3 bucket named my-export-bucket.
Example
For Linux, macOS, or Unix:
For Windows:
{
"Status": "STARTING",
"IamRoleArn": "iam-role",
"ExportTime": "2019-08-12T01:23:53.109Z",
"S3Bucket": "my-export-bucket",
"PercentProgress": 0,
"KmsKeyId": "my-key",
"ExportTaskIdentifier": "my-snapshot-export",
"TotalExtractedDataInGB": 0,
"TaskStartTime": "2019-11-13T19:46:00.173Z",
"SourceArn": "arn:aws:rds:AWS_Region:123456789012:snapshot:snapshot-name"
}
To provide a folder path in the S3 bucket for the snapshot export, include the --s3-prefix option in
the start-export-task command.
RDS API
To export a DB snapshot to Amazon S3 using the Amazon RDS API, use the StartExportTask operation
with the following required parameters:
• ExportTaskIdentifier
444
Amazon Relational Database Service User Guide
Monitoring snapshot exports
• SourceArn
• S3BucketName
• IamRoleArn
• KmsKeyId
Console
To monitor DB snapshot exports
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. To view the list of snapshot exports, choose the Exports in Amazon S3 tab.
4. To view information about a specific snapshot export, choose the export task.
AWS CLI
To monitor DB snapshot exports using the AWS CLI, use the describe-export-tasks command.
The following example shows how to display current information about all of your snapshot exports.
Example
{
"ExportTasks": [
{
"Status": "CANCELED",
"TaskEndTime": "2019-11-01T17:36:46.961Z",
"S3Prefix": "something",
"ExportTime": "2019-10-24T20:23:48.364Z",
"S3Bucket": "examplebucket",
"PercentProgress": 0,
"KmsKeyId": "arn:aws:kms:AWS_Region:123456789012:key/K7MDENG/
bPxRfiCYEXAMPLEKEY",
"ExportTaskIdentifier": "anewtest",
"IamRoleArn": "arn:aws:iam::123456789012:role/export-to-s3",
"TotalExtractedDataInGB": 0,
"TaskStartTime": "2019-10-25T19:10:58.885Z",
"SourceArn": "arn:aws:rds:AWS_Region:123456789012:snapshot:parameter-groups-
test"
},
{
"Status": "COMPLETE",
"TaskEndTime": "2019-10-31T21:37:28.312Z",
"WarningMessage": "{\"skippedTables\":[],\"skippedObjectives\":[],\"general\":
[{\"reason\":\"FAILED_TO_EXTRACT_TABLES_LIST_FOR_DATABASE\"}]}",
"S3Prefix": "",
"ExportTime": "2019-10-31T06:44:53.452Z",
"S3Bucket": "examplebucket1",
"PercentProgress": 100,
"KmsKeyId": "arn:aws:kms:AWS_Region:123456789012:key/2Zp9Utk/
h3yCo8nvbEXAMPLEKEY",
445
Amazon Relational Database Service User Guide
Canceling a snapshot export
"ExportTaskIdentifier": "thursday-events-test",
"IamRoleArn": "arn:aws:iam::123456789012:role/export-to-s3",
"TotalExtractedDataInGB": 263,
"TaskStartTime": "2019-10-31T20:58:06.998Z",
"SourceArn":
"arn:aws:rds:AWS_Region:123456789012:snapshot:rds:example-1-2019-10-31-06-44"
},
{
"Status": "FAILED",
"TaskEndTime": "2019-10-31T02:12:36.409Z",
"FailureCause": "The S3 bucket edgcuc-export isn't located in the current AWS
Region. Please, review your S3 bucket name and retry the export.",
"S3Prefix": "",
"ExportTime": "2019-10-30T06:45:04.526Z",
"S3Bucket": "examplebucket2",
"PercentProgress": 0,
"KmsKeyId": "arn:aws:kms:AWS_Region:123456789012:key/2Zp9Utk/
h3yCo8nvbEXAMPLEKEY",
"ExportTaskIdentifier": "wednesday-afternoon-test",
"IamRoleArn": "arn:aws:iam::123456789012:role/export-to-s3",
"TotalExtractedDataInGB": 0,
"TaskStartTime": "2019-10-30T22:43:40.034Z",
"SourceArn":
"arn:aws:rds:AWS_Region:123456789012:snapshot:rds:example-1-2019-10-30-06-45"
}
]
}
RDS API
To display information about DB snapshot exports using the Amazon RDS API, use the
DescribeExportTasks operation.
To track completion of the export workflow or to trigger another workflow, you can subscribe to Amazon
Simple Notification Service topics. For more information on Amazon SNS, see Using Amazon RDS event
notification (p. 571).
Console
To cancel a snapshot export task
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the Exports in Amazon S3 tab.
4. Choose the snapshot export task that you want to cancel.
5. Choose Cancel.
446
Amazon Relational Database Service User Guide
Failure messages
AWS CLI
To cancel a snapshot export task using the AWS CLI, use the cancel-export-task command. The command
requires the --export-task-identifier option.
Example
RDS API
To cancel a snapshot export task using the Amazon RDS API, use the CancelExportTask operation with
the ExportTaskIdentifier parameter.
An unknown internal error occurred. The task has failed because of an unknown error,
exception, or failure.
An unknown internal error occurred The task has failed because of an unknown error,
writing the export task's metadata to the exception, or failure.
S3 bucket [bucket name].
The RDS export failed to write the export The export task assumes your IAM role to validate
task's metadata because it can't assume whether it is allowed to write metadata to your S3 bucket.
the IAM role [role ARN]. If the task can't assume your IAM role, it fails.
The RDS export failed to write the export One or more permissions are missing, so the export task
task's metadata to the S3 bucket [bucket can't access the S3 bucket. This failure message is raised
name] using the IAM role [role ARN] with when receiving one of the following:
the KMS key [key ID]. Error code: [error
code] • AWSSecurityTokenServiceException with the
error code AccessDenied
• AmazonS3Exception with the error
code NoSuchBucket, AccessDenied,
KMS.KMSInvalidStateException, 403 Forbidden,
or KMS.DisabledException
447
Amazon Relational Database Service User Guide
Troubleshooting PostgreSQL permissions errors
The IAM role [role ARN] isn't authorized to The IAM policy is misconfigured. Permission for the
call [S3 action] on the S3 bucket [bucket specific S3 action on the S3 bucket is missing. This causes
name]. Review your permissions and retry the export task to fail.
the export.
KMS key check failed. Check the The KMS key credential check failed.
credentials on your KMS key and try again.
The S3 bucket [bucket name] isn't located The S3 bucket is in the wrong AWS Region.
in the current AWS Region. Review your S3
bucket name and retry the export.
For more information on superuser privileges, see Master user account privileges (p. 1961).
export_identifier/database_name/schema_name.table_name/
For example:
export-1234567890123-459/rdststdb/rdststdb.DataInsert_7ADB5D19965123A2/
There are two conventions for how files are named. The current convention is the following:
partition_index/part-00000-random_uuid.format-based_extension
For example:
448
Amazon Relational Database Service User Guide
Data conversion
1/part-00000-c5a881bb-58ff-4ee6-1111-b41ecff340a3-c000.gz.parquet
2/part-00000-d7a881cc-88cc-5ab7-2222-c41ecab340a4-c000.gz.parquet
3/part-00000-f5a991ab-59aa-7fa6-3333-d41eccd340a7-c000.gz.parquet
part-partition_index-random_uuid.format-based_extension
For example:
part-00000-c5a881bb-58ff-4ee6-1111-b41ecff340a3-c000.gz.parquet
part-00001-d7a881cc-88cc-5ab7-2222-c41ecab340a4-c000.gz.parquet
part-00002-f5a991ab-59aa-7fa6-3333-d41eccd340a7-c000.gz.parquet
The file naming convention is subject to change. Therefore, when reading target tables we recommend
that you read everything inside the base prefix for the table.
• BOOLEAN
• INT32
• INT64
• INT96
• FLOAT
• DOUBLE
• BYTE_ARRAY – A variable-length byte array, also known as binary
• FIXED_LEN_BYTE_ARRAY – A fixed-length byte array used when the values have a constant size
The Parquet data types are few to reduce the complexity of reading and writing the format. Parquet
provides logical types for extending primitive types. A logical type is implemented as an annotation with
the data in a LogicalType metadata field. The logical type annotation explains how to interpret the
primitive type.
When the STRING logical type annotates a BYTE_ARRAY type, it indicates that the byte array should be
interpreted as a UTF-8 encoded character string. After an export task completes, Amazon RDS notifies
you if any string conversion occurred. The underlying data exported is always the same as the data from
the source. However, due to the encoding difference in UTF-8, some characters might appear different
from the source when read in tools such as Athena.
For more information, see Parquet logical type definitions in the Parquet documentation.
Topics
• MySQL and MariaDB data type mapping to Parquet (p. 450)
• PostgreSQL data type mapping to Parquet (p. 452)
449
Amazon Relational Database Service User Guide
Data conversion
Source data type Parquet primitive type Logical type Conversion notes
annotation
BIGINT INT64
BIT BYTE_ARRAY
DOUBLE DOUBLE
FLOAT DOUBLE
INT INT32
MEDIUMINT INT32
450
Amazon Relational Database Service User Guide
Data conversion
Source data type Parquet primitive type Logical type Conversion notes
annotation
31
INT64 DECIMAL(p,s) If the source value is 2
or greater, but less than
63
2 , it's stored as INT64.
63
FIXED_LEN_ARRAY(N) DECIMAL(p,s) If the source value is 2
or greater, it's stored as
FIXED_LEN_BYTE_ARRAY(N).
SMALLINT INT32
TINYINT INT32
BINARY BYTE_ARRAY
BLOB BYTE_ARRAY
CHAR BYTE_ARRAY
LINESTRING BYTE_ARRAY
LONGBLOB BYTE_ARRAY
MEDIUMBLOB BYTE_ARRAY
MULTILINESTRING BYTE_ARRAY
TINYBLOB BYTE_ARRAY
VARBINARY BYTE_ARRAY
451
Amazon Relational Database Service User Guide
Data conversion
Source data type Parquet primitive type Logical type Conversion notes
annotation
YEAR INT32
GEOMETRY BYTE_ARRAY
GEOMETRYCOLLECTION BYTE_ARRAY
MULTIPOINT BYTE_ARRAY
MULTIPOLYGON BYTE_ARRAY
POINT BYTE_ARRAY
POLYGON BYTE_ARRAY
PostgreSQL data type Parquet primitive type Logical type Mapping notes
annotation
BIGINT INT64
BIGSERIAL INT64
This conversion is to
avoid complications due
to data precision and
452
Amazon Relational Database Service User Guide
Data conversion
PostgreSQL data type Parquet primitive type Logical type Mapping notes
annotation
data values that are not
a number (NaN).
INTEGER INT32
REAL FLOAT
SERIAL INT32
This conversion is to
avoid complications due
to data precision, data
values that are not a
number (NaN), and time
data values.
BYTEA BINARY
453
Amazon Relational Database Service User Guide
Data conversion
PostgreSQL data type Parquet primitive type Logical type Mapping notes
annotation
BOOLEAN BOOLEAN
454
Amazon Relational Database Service User Guide
Point-in-time recovery
When you restore a DB instance to a point in time, you can choose the default VPC security group or
apply a custom VPC security group to your DB instance.
Restored DB instances are automatically associated with the default DB parameter and option groups.
However, you can apply a custom parameter group and option group by specifying them during a
restore.
RDS uploads transaction logs for DB instances to Amazon S3 every 5 minutes. To see the latest
restorable time for a DB instance, use the AWS CLI describe-db-instances command and look at the value
returned in the LatestRestorableTime field for the DB instance. To see the latest restorable time for
each DB instance in the Amazon RDS console, choose Automated backups.
You can restore to any point in time within your backup retention period. To see the earliest restorable
time for each DB instance, choose Automated backups in the Amazon RDS console.
Note
We recommend that you restore to the same or similar DB instance size—and IOPS if using
Provisioned IOPS storage—as the source DB instance. You might get an error if, for example, you
choose a DB instance size with an incompatible IOPS value.
Some of the database engines used by Amazon RDS have special considerations when restoring from a
point in time:
• When you restore an Oracle DB instance to a point in time, you can specify a different Oracle DB
engine, license model, and DBName (SID) to be used by the new DB instance.
• When you restore a SQL Server DB instance to a point in time, each database within that instance is
restored to a point in time within 1 second of each other database within the instance. Transactions
that span multiple databases within the instance might be restored inconsistently.
• For a SQL Server DB instance, the OFFLINE, EMERGENCY, and SINGLE_USER modes aren't supported.
Setting any database into one of these modes causes the latest restorable time to stop moving ahead
for the whole instance.
• Some actions, such as changing the recovery model of a SQL Server database, can break the sequence
of logs that are used for point-in-time recovery. In some cases, Amazon RDS can detect this issue
and the latest restorable time is prevented from moving forward. In other cases, such as when a SQL
Server database uses the BULK_LOGGED recovery model, the break in log sequence isn't detected. It
might not be possible to restore a SQL Server DB instance to a point in time if there is a break in the
455
Amazon Relational Database Service User Guide
Point-in-time recovery
log sequence. For these reasons, Amazon RDS doesn't support changing the recovery model of SQL
Server databases.
Note
You can also use AWS Backup to manage backups of Amazon RDS DB instances. If your
DB instance is associated with a backup plan in AWS Backup, that backup plan is used for
point-in-time recovery. Backups that were created with AWS Backup have names ending in
awsbackup:AWS-Backup-job-number. For information about AWS Backup, see the AWS
Backup Developer Guide.
You can restore a DB instance to a point in time using the AWS Management Console, the AWS CLI, or
the RDS API.
Console
To restore a DB instance to a specified time
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Automated backups.
3. Choose the DB instance that you want to restore.
4. For Actions, choose Restore to point in time.
If you chose Custom, enter the date and time to which you want to restore the instance.
Note
Times are shown in your local time zone, which is indicated by an offset from Coordinated
Universal Time (UTC). For example, UTC-5 is Eastern Standard Time/Central Daylight Time.
6. For DB instance identifier, enter the name of the target restored DB instance. The name must be
unique.
7. Choose other options as needed, such as DB instance class, storage, and whether you want to use
storage autoscaling.
8. Choose Restore to point in time.
AWS CLI
To restore a DB instance to a specified time, use the AWS CLI command restore-db-instance-to-
point-in-time to create a new DB instance. This example also enables storage autoscaling.
Example
For Windows:
456
Amazon Relational Database Service User Guide
Point-in-time recovery
RDS API
To restore a DB instance to a specified time, call the Amazon RDS API
RestoreDBInstanceToPointInTime operation with the following parameters:
• SourceDBInstanceIdentifier
• TargetDBInstanceIdentifier
• RestoreTime
457
Amazon Relational Database Service User Guide
Deleting a snapshot
Deleting a snapshot
You can delete DB snapshots managed by Amazon RDS when you no longer need them.
Note
To delete backups managed by AWS Backup, use the AWS Backup console. For information
about AWS Backup, see the AWS Backup Developer Guide.
Deleting a DB snapshot
You can delete a manual, shared, or public DB snapshot using the AWS Management Console, the AWS
CLI, or the RDS API.
To delete a shared or public snapshot, you must sign in to the AWS account that owns the snapshot.
If you have automated DB snapshots that you want to delete without deleting the DB instance, change
the backup retention period for the DB instance to 0. The automated snapshots are deleted when
the change is applied. You can apply the change immediately if you don't want to wait until the next
maintenance period. After the change is complete, you can then re-enable automatic backups by setting
the backup retention period to a number greater than 0. For information about modifying a DB instance,
see Modifying an Amazon RDS DB instance (p. 306).
If you deleted a DB instance, you can delete its automated DB snapshots by removing the automated
backups for the DB instance. For information about automated backups, see Working with
backups (p. 388).
Console
To delete a DB snapshot
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
AWS CLI
You can delete a DB snapshot by using the AWS CLI command delete-db-snapshot.
Example
458
Amazon Relational Database Service User Guide
Deleting a DB snapshot
For Windows:
RDS API
You can delete a DB snapshot by using the Amazon RDS API operation DeleteDBSnapshot.
459
Amazon Relational Database Service User Guide
Tutorial: Restore a DB instance from a DB snapshot
In the following illustration, you can see a possible scenario where an EC2 instance hosting a customer
survey website is in the same Amazon Virtual Private Cloud (Amazon VPC) as a DB instance that retains
the customer survey data. Note that each instance has its own security group; the EC2 instance security
group allows access from the internet while the DB instance security group allows access only to and
from the EC2 instance. When the survey is done, the EC2 instance can be stopped and the DB instance
can be deleted after a final DB snapshot is created. When you need to conduct another survey, you can
restart the EC2 instance and restore the DB instance from the DB snapshot.
For information about how to set up the needed VPC security groups for this scenario that allows the
EC2 instance to connect with the DB instance, see A DB instance in a VPC accessed by an EC2 instance in
the same VPC (p. 1983).
You must create a DB snapshot before you can restore a DB instance from one. When you restore the
DB instance, you provide the name of the DB snapshot to restore from, and then provide a name for the
new DB instance that is created from the restore operation. You cannot restore from a DB snapshot to an
existing DB instance; a new DB instance is created when you restore.
460
Amazon Relational Database Service User Guide
Restoring a DB instance from a DB snapshot
The following are required before you can restore a DB instance from a DB snapshot:
• You must have created a DB snapshot of a DB instance before you can restore a DB instance from that
DB snapshot. For more information about creating a DB snapshot, see Creating a DB snapshot (p. 409).
• You must retain the parameter group and security group associated with the DB instance you created
the DB snapshot from.
• You need to determine the correct option group for the restored DB instance:
• The option group associated with the DB snapshot that you restore from is associated with the
restored DB instance once it is created. For example, if the DB snapshot you restore from uses Oracle
Transparent Data Encryption (TDE), the restored DB instance uses the same option group, which had
the TDE option.
• You cannot use the option group associated with the original DB instance if you attempt to restore
that instance into a different VPC or into a different platform. This restriction occurs because when
an option group is assigned to a DB instance, it is also linked to the platform that the DB instance
is on, either VPC or EC2-Classic (non-VPC). If a DB instance is in a VPC, the option group associated
with the instance is linked to that VPC.
• If you restore a DB instance into a different VPC or onto a different platform, you must either
assign the default option group to the instance, assign an option group that is linked to that VPC or
platform, or create a new option group and assign it to the DB instance. Note that with persistent
or permanent options, such as Oracle TDE, you must create a new option group that includes
the persistent or permanent option when restoring a DB instance into a different VPC. For more
information about working with option groups, see Working with option groups (p. 268).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the DB snapshot that you want to restore from.
4. For Actions, choose Restore snapshot.
If you're restoring from a DB instance that you deleted after you made the DB snapshot, you can use
the name of that DB instance.
6. Choose additional settings as needed.
7. Choose Restore DB Instance.
461
Amazon Relational Database Service User Guide
Modifying a restored DB instance
You must apply any changes explicitly using the RDS console's Modify command, the
ModifyDBInstance API, or the aws rds modify-db-instance command line tool, once the DB
instance is available. We recommend that you retain parameter groups for any DB snapshots you have so
that you can associate a restored instance with the correct parameter file.
You can modify other settings on the restored DB instance. For example, you can use a different storage
type than the source DB snapshot. In this case the restoration process is slower because of the additional
work required to migrate the data to the new storage type. In the case of restoring to or from Magnetic
(Standard) storage, the migration process is the slowest, because Magnetic storage does not have the
IOPS capability of Provisioned IOPS or General Purpose (SSD) storage.
The next steps assume that your DB instance is in a VPC. If your DB instance is not in a VPC, use the AWS
Management Console to locate the DB security group you need for the DB instance.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the name of the DB instance created when you restored from the DB snapshot to display
its details. Choose the Connectivity tab. The security group assigned to the DB instance might not
allow access. If there are no inbound rules, no permissions exist that allow inbound access.
462
Amazon Relational Database Service User Guide
Modifying a restored DB instance
4. Choose Modify.
5. In the Network & Security section, choose the security group that you want to use for your DB
instance. If you need to add rules to create a new security group to use with an EC2 instance, see A
DB instance in a VPC accessed by an EC2 instance in the same VPC (p. 1983) for more information.
You can also remove a security group by choosing the X associated with it.
463
Amazon Relational Database Service User Guide
Modifying a restored DB instance
After the instance status is available, choose the DB instance name to display its details. Choose
the Connectivity tab, and confirm that the new security group has been applied, making the DB
instance authorized for access.
464
Amazon Relational Database Service User Guide
Topics
• Overview of monitoring Amazon RDS (p. 466)
• Viewing key monitoring information (p. 469)
• Monitoring Amazon RDS metrics with Amazon CloudWatch (p. 480)
• Monitoring DB load with Performance Insights on Amazon RDS (p. 487)
• Monitoring the OS by using Enhanced Monitoring (p. 551)
• Working with Amazon RDS events (p. 567)
• Working with Amazon RDS database log files (p. 593)
• Working with AWS CloudTrail and Amazon RDS (p. 632)
• Monitoring Amazon RDS for Oracle using Database Activity Streams (p. 636)
465
Amazon Relational Database Service User Guide
Overview of monitoring
Monitoring plan
Before you start monitoring Amazon RDS, create a monitoring plan. This plan should answer the
following questions:
Performance baseline
To achieve your monitoring goals, you need to establish a baseline. To do this, measure performance
under different load conditions at various times in your Amazon RDS environment. You can monitor
metrics such as the following:
• Network throughput
• Client connections
• I/O for read, write, or metadata operations
• Burst credit balances for your DB instances
We recommend that you store historical performance data for Amazon RDS. Using the stored data, you
can compare current performance against past trends. You can also distinguish normal performance
patterns from anomalies, and devise techniques to address issues.
Performance guidelines
In general, acceptable values for performance metrics depend on what your application is doing relative
to your baseline. Investigate consistent or trending variances from your baseline. The following metrics
are often the source of performance issues:
• High CPU or RAM consumption – High values for CPU or RAM consumption might be appropriate,
if they're in keeping with your goals for your application (like throughput or concurrency) and are
expected.
• Disk space consumption – Investigate disk space consumption if space used is consistently at or above
85 percent of the total disk space. See if it is possible to delete data from the instance or archive data
to a different system to free up space.
• Network traffic – For network traffic, talk with your system administrator to understand what
expected throughput is for your domain network and internet connection. Investigate network traffic if
throughput is consistently lower than expected.
• Database connections – If you see high numbers of user connections and also decreases in instance
performance and response time, consider constraining database connections. The best number of
user connections for your DB instance varies based on your instance class and the complexity of the
466
Amazon Relational Database Service User Guide
Monitoring tools
operations being performed. To determine the number of database connections, associate your DB
instance with a parameter group where the User Connections parameter is set to a value other
than 0 (unlimited). You can either use an existing parameter group or create a new one. For more
information, see Working with DB parameter groups (p. 284).
• IOPS metrics – The expected values for IOPS metrics depend on disk specification and server
configuration, so use your baseline to know what is typical. Investigate if values are consistently
different than your baseline. For best IOPS performance, make sure that your typical working set fits
into memory to minimize read and write operations.
When performance falls outside your established baseline, you might need to make changes to optimize
your database availability for your workload. For example, you might need to change the instance class
of your DB instance. Or you might need to change the number of DB instances and read replicas that are
available for clients.
Monitoring tools
AWS provides various tools that you can use to monitor Amazon RDS. You can configure some of these
tools to do the monitoring for you, and other tools require manual intervention.
• Amazon RDS instance status — View details about the current status of your instance by using the
Amazon RDS console, the AWS CLI command, or the RDS API.
• Amazon RDS recommendations — Respond to automated recommendations for database resources,
such as DB instances, read replicas, and DB parameter groups. For more information, see Viewing
Amazon RDS recommendations (p. 473).
• Amazon RDS Performance Insights — Assess the load on your database, and determine when and
where to take action. For more information, see Monitoring DB load with Performance Insights on
Amazon RDS (p. 487).
• Amazon RDS Enhanced Monitoring — Look at metrics in real time for the operating system. For more
information, see Monitoring the OS by using Enhanced Monitoring (p. 551).
• Amazon RDS events – Subscribe to Amazon RDS events to be notified when changes occur with a DB
instance, DB snapshot, DB parameter group, or DB security group. For more information, see Using
Amazon RDS event notification (p. 571).
• Amazon RDS database logs – View, download, or watch database log files using the Amazon
RDS console or Amazon RDS API operations. You can also query some database log files that are
loaded into database tables. For more information, see Working with Amazon RDS database log
files (p. 593).
• Amazon CloudWatch – This service monitors your AWS resources and the applications you run on AWS
in real time. You can use the following Amazon CloudWatch features with Amazon RDS:
• Amazon CloudWatch metrics – Amazon RDS automatically sends metrics to CloudWatch every
minute for each active database. You don't get additional charges for Amazon RDS metrics
467
Amazon Relational Database Service User Guide
Monitoring tools
in CloudWatch. For more information, see Monitoring Amazon RDS metrics with Amazon
CloudWatch (p. 480).
• Amazon CloudWatch alarms – You can watch a single Amazon RDS metric over a specific time
period. You can then perform one or more actions based on the value of the metric relative to a
threshold that you set. For more information, see Monitoring Amazon RDS metrics with Amazon
CloudWatch (p. 480).
• Amazon CloudWatch Logs – Most DB engines enable you to monitor, store, and access your database
log files in CloudWatch Logs. For more information, see Amazon CloudWatch Logs User Guide.
• Amazon EventBridge – is a serverless event bus service that makes it easy to connect your applications
with data from a variety of sources. EventBridge delivers a stream of real-time data from your own
applications, Software-as-a-Service (SaaS) applications, and AWS services and routes that data to
targets such as Lambda. This enables you to monitor events that happen in services, and build event-
driven architectures. For more information, see Creating a rule that triggers on an Amazon RDS
event (p. 589).
• AWS CloudTrail – You can view a record of actions taken by a user, role, or an AWS service in Amazon
RDS. CloudTrail captures all API calls for Amazon RDS as events. These captures include calls from
the Amazon RDS console and from code calls to the Amazon RDS API operations. If you create a
trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including
events for Amazon RDS. If you don't configure a trail, you can still view the most recent events in
the CloudTrail console in Event history. For more information, see Working with AWS CloudTrail and
Amazon RDS (p. 632).
• From the Amazon RDS console, you can monitor the following items for your resources:
• The number of connections to a DB instance
• The amount of read and write operations to a DB instance
• The amount of storage that a DB instance is currently using
• The amount of memory and CPU being used for a DB instance
• The amount of network traffic to and from a DB instance
• From the Trusted Advisor dashboard, you can review the following cost optimization, security, fault
tolerance, and performance improvement checks:
• Amazon RDS Idle DB Instances
• Amazon RDS Security Group Access Risk
• Amazon RDS Backups
• Amazon RDS Multi-AZ
For more information on these checks, see Trusted Advisor best practices (checks).
• CloudWatch home page shows:
• Current alarms and status
• Graphs of alarms and resources
• Service health status
468
Amazon Relational Database Service User Guide
Viewing key monitoring information
Topics
• Viewing DB instance status (p. 470)
• Viewing Amazon RDS recommendations (p. 473)
• Viewing DB instance metrics (p. 477)
469
Amazon Relational Database Service User Guide
Viewing DB instance status
Find the possible status values for DB instances in the following table. This table also shows whether you
will be billed for the DB instance and storage, billed only for storage, or not billed. For all DB instance
statuses, you are always billed for backup usage.
configuring-log-exports Billed Publishing log files to Amazon CloudWatch Logs is being enabled
or disabled for this DB instance.
converting-to-vpc Billed The DB instance is being converted from a DB instance that is not
in an Amazon Virtual Private Cloud (Amazon VPC) to a DB instance
that is in an Amazon VPC.
failed Not The DB instance has failed and Amazon RDS can't recover it.
billed Perform a point-in-time restore to the latest restorable time of the
DB instance to recover the data.
inaccessible- Not The AWS KMS key used to encrypt or decrypt the DB instance can't
encryption-credentials billed be accessed.
incompatible-option- Billed Amazon RDS attempted to apply an option group change but
group can't do so, and Amazon RDS can't roll back to the previous option
group state. For more information, check the Recent Events list
for the DB instance. This status can occur if, for example, the
470
Amazon Relational Database Service User Guide
Viewing DB instance status
incompatible- Billed Amazon RDS can't start the DB instance because the parameters
parameters specified in the DB instance's DB parameter group aren't
compatible with the DB instance. Revert the parameter changes
or make them compatible with the DB instance to regain access to
your DB instance. For more information about the incompatible
parameters, check the Recent Events list for the DB instance.
incompatible-restore Not Amazon RDS can't do a point-in-time restore. Common causes for
billed this status include using temp tables, using MyISAM tables with
MySQL, or using Aria tables with MariaDB.
insufficient-capacity Amazon RDS can’t create your instance because sufficient capacity
isn’t currently available. To create your DB instance in the same AZ
with the same instance type, delete your DB instance, wait a few
hours, and try to create again. Alternatively, create a new instance
using a different instance class or AZ.
moving-to-vpc Billed The DB instance is being moved to a new Amazon Virtual Private
Cloud (Amazon VPC).
resetting-master- Billed The master credentials for the DB instance are being reset because
credentials of a customer request to reset them.
471
Amazon Relational Database Service User Guide
Viewing DB instance status
storage-full Billed The DB instance has reached its storage capacity allocation. This
is a critical status, and we recommend that you fix this issue
immediately. To do so, scale up your storage by modifying the DB
instance. To avoid this situation, set Amazon CloudWatch alarms
to warn you when storage space is getting low.
storage-optimization Billed Your DB instance is being modified to change the storage size
or type. The DB instance is fully operational. However, while the
status of your DB instance is storage-optimization, you can't
request any changes to the storage of your DB instance. The
storage optimization process is usually short, but can sometimes
take up to and even beyond 24 hours.
472
Amazon Relational Database Service User Guide
Viewing Amazon RDS recommendations
Automated Your DB instance has We recommend that you enable Working with
backups automated backups automated backups on your DB backups (p. 388)
disabled disabled. instance. Automated backups enable
point-in-time recovery of your DB
instance. You receive backup storage
up to the storage size of your DB
instance at no additional charge.
473
Amazon Relational Database Service User Guide
Viewing Amazon RDS recommendations
Nondefault Your DB parameter Settings that diverge too much Working with
custom group sets memory from the default values can cause DB parameter
memory parameters that poor performance and errors. We groups (p. 284)
parameters diverge too much recommend setting custom memory
from the default parameters to their default values in
values. the DB parameter group used by the
DB instance.
Query cache Your DB parameter The query cache can cause the DB Best practices
enabled for group has query instance to appear to stall when for configuring
a MySQL DB cache parameter changes require the cache to be parameters for
instance enabled. purged. Most workloads don't benefit Amazon RDS for
from a query cache. The query cache MySQL, part 1:
was removed from MySQL version 8.0. Parameters related to
We recommend that you disable the performance on the
query cache parameter. AWS Database Blog
Logging to Your DB parameter Setting logging output to TABLE MySQL database log
table group sets logging uses more storage than setting this files (p. 611)
output to TABLE. parameter to FILE. To avoid reaching
the storage limit, we recommend
setting the logging output parameter
to FILE.
Amazon RDS generates recommendations for a resource when the resource is created or modified.
Amazon RDS also periodically scans your resources and generates recommendations.
474
Amazon Relational Database Service User Guide
Viewing Amazon RDS recommendations
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Recommendations.
475
Amazon Relational Database Service User Guide
Viewing Amazon RDS recommendations
• Active – Shows the current recommendations that you can apply, dismiss, or schedule.
• Dismissed – Shows the recommendations that have been dismissed. When you choose Dismissed,
you can apply these dismissed recommendations.
• Scheduled – Shows the recommendations that are scheduled but not yet applied. These
recommendations will be applied in the next scheduled maintenance window.
• Applied – Shows the recommendations that are currently applied.
From any list of recommendations, you can open a section to view the recommendations in that
section.
To configure preferences for displaying recommendations in each section, choose the Preferences
icon.
476
Amazon Relational Database Service User Guide
Viewing DB instance metrics
From the Preferences window that appears, you can set display options. These options include the
visible columns and the number of recommendations to display on the page.
4. Manage your active recommendations:
a. Choose Active and open one or more sections to view the recommendations in them.
b. Choose one or more recommendations and choose Apply now (to apply them immediately),
Schedule (to apply them in next maintenance window), or Dismiss.
If the Apply now button appears for a recommendation but is unavailable (grayed out), the DB
instance is not available. You can apply recommendations immediately only if the DB instance
status is available. For example, you can't apply recommendations immediately to the DB
instance if its status is modifying. In this case, wait for the DB instance to be available and then
apply the recommendation.
If the Apply now button doesn't appear for a recommendation, you can't apply the
recommendation using the Recommendations page. You can modify the DB instance to apply
the recommendation manually.
For more information about modifying a DB instance, see Modifying an Amazon RDS DB
instance (p. 306).
Note
When you choose Apply now, a brief DB instance outage might result.
Following, you can find details about how to view metrics for your DB instance using the RDS console
and CloudWatch. For information on monitoring metrics for your DB instance's operating system in real
time using CloudWatch Logs, see Monitoring the OS by using Enhanced Monitoring (p. 551).
477
Amazon Relational Database Service User Guide
Viewing DB instance metrics
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
3. Choose the name of the DB instance that you need information about to show its details.
4. Choose the Monitoring tab.
5. For Monitoring, choose the option for how you want to view your metrics from these:
• CloudWatch – Shows a summary of DB instance metrics available from Amazon CloudWatch. Each
metric includes a graph showing the metric monitored over a specific time span.
• Enhanced monitoring – Shows a summary of OS metrics available for a DB instance with
Enhanced Monitoring enabled. Each metric includes a graph showing the metric monitored over a
specific time span.
• OS Process list – Shows details for each process running in the selected instance.
• Performance Insights – Opens the Amazon RDS Performance Insights console for your DB
instance.
Tip
To choose the time range of the metrics represented by the graphs, you can use the time
range list.
478
Amazon Relational Database Service User Guide
Viewing DB instance metrics
To bring up a more detailed view, you can choose any graph. You can also apply metric-
specific filters to the data.
For a complete list of Amazon RDS metrics, go to Amazon RDS dimensions and metrics in the Amazon
CloudWatch User Guide.
The StartTime and EndTime values supplied in this example are for illustration only. Substitute
appropriate start and end time values for your DB instance.
• Statistics.member.1 = Average
• Namespace = AWS/RDS
• StartTime = 2009-10-16T00:00:00
• EndTime = 2009-10-16T00:02:00
• Period = 60
• MeasureName = FreeStorageSpace
479
Amazon Relational Database Service User Guide
Monitoring RDS with CloudWatch
By default, Amazon RDS automatically sends metric data to CloudWatch in 1-minute periods. Data
points with a period of 60 seconds (1 minute) are available for 15 days. This means that you can access
historical information and see how your web application or service is performing.
For more information about CloudWatch, see What is Amazon CloudWatch? in the Amazon CloudWatch
User Guide. For more information about CloudWatch metrics retention, see Metrics retention.
Note
If you are using Amazon RDS Performance Insights, additional metrics are available. For more
information, see Performance Insights metrics published to Amazon CloudWatch (p. 547).
480
Amazon Relational Database Service User Guide
Amazon RDS metrics
BinLogDiskUsage Binary Log Disk The amount of disk space occupied by Bytes
Usage (MB) binary logs. If autobackups are enabled
for MySQL and MariaDB instances,
including read replicas, binary logs are
created.
BurstBalance Burst Balance The percent of General Purpose SSD (gp2) Percent
(Percent) burst-bucket I/O credits available.
CPUCreditUsage CPU Credit Usage (T2 instances) The number of CPU credits Credits (vCPU-
(Count) spent by the instance for CPU utilization. minutes)
One CPU credit equals one vCPU running
at 100 percent utilization for one minute
or an equivalent combination of vCPUs,
utilization, and time. For example, you
might have one vCPU running at 50
percent utilization for two minutes or two
vCPUs running at 25 percent utilization
for two minutes.
481
Amazon Relational Database Service User Guide
Amazon RDS metrics
DB Connections
DatabaseConnections The number of database connections in Count
(Count) use.
482
Amazon Relational Database Service User Guide
Amazon RDS metrics
Failed SQL
FailedSQLServerAgentJobsCount The number of failed Microsoft SQL Count/Minute
Server Agent Server Agent jobs during the last minute.
Jobs Count
(Count/Minute)
Maximum Used
MaximumUsedTransactionIDs The maximum transaction IDs that have Count
Transaction IDs been used. Applies to PostgreSQL.
(Count)
Network Receive
NetworkReceiveThroughput The incoming (receive) network traffic on Bytes/Second
Throughput the DB instance, including both customer
(MB/Second) database traffic and Amazon RDS traffic
used for monitoring and replication.
Network
NetworkTransmitThroughput The outgoing (transmit) network traffic on Bytes/Second
Transmit the DB instance, including both customer
Throughput database traffic and Amazon RDS traffic
(MB/Second) used for monitoring and replication.
Oldest
OldestReplicationSlotLag The lagging size of the replica lagging the Bytes
Replication Slot most in terms of write-ahead log (WAL)
Lag (MB) data received. Applies to PostgreSQL.
ReadIOPS Read IOPS The average number of disk read I/O Count/Second
(Count/Second) operations per second.
ReadLatency Read Latency The average amount of time taken per Seconds
(Milliseconds) disk I/O operation.
ReadThroughput Read Throughput The average number of bytes read from Bytes/Second
(MB/Second) disk per second.
SwapUsage Swap Usage (MB) The amount of swap space used on the Bytes
DB instance. This metric is not available
for SQL Server.
Transaction Logs
TransactionLogsDiskUsage The disk space used by transaction logs. Bytes
Disk Usage (MB) Applies to PostgreSQL.
483
Amazon Relational Database Service User Guide
Amazon RDS dimensions
Transaction Logs
TransactionLogsGeneration The size of transaction logs generated per Bytes/Second
Generation (MB/ second. Applies to PostgreSQL.
Second)
WriteIOPS Write IOPS The average number of disk write I/O Count/Second
(Count/Second) operations per second.
WriteLatency Write Latency The average amount of time taken per Seconds
(Milliseconds) disk I/O operation.
DatabaseClass All instances in a database class. For example, you can aggregate
metrics for all instances that belong to the database class
db.r5.large.
EngineName The identified engine name only. For example, you can aggregate
metrics for all instances that have the engine name mysql.
SourceRegion The specified Region only. For example, you can aggregate metrics
for all DB instances in the us-east-1 Region.
Metrics are grouped first by the service namespace, and then by the various dimension combinations
within each namespace.
484
Amazon Relational Database Service User Guide
Viewing metrics and dimensions
485
Amazon Relational Database Service User Guide
Creating alarms
Alarms invoke actions for sustained state changes only. CloudWatch alarms don't invoke actions simply
because they are in a particular state. The state must have changed and have been maintained for a
specified number of time periods. The following procedures show how to create alarms for Amazon RDS.
1. Sign in to the AWS Management Console and open the CloudWatch console at https://
console.aws.amazon.com/cloudwatch/.
2. Choose Alarms and then choose Create Alarm. Doing this launches the Create Alarm Wizard.
3. Choose RDS Metrics and scroll through the Amazon RDS metrics to find the metric that you want
to place an alarm on. To display just Amazon RDS metrics, search for the identifier of your resource.
Choose the metric to create an alarm on and then choose Next.
4. Enter Name, Description, and Whenever values for the metric.
5. If you want CloudWatch to send you an email when the alarm state is reached, for Whenever this
alarm, choose State is ALARM. For Send notification to, choose an existing SNS topic. If you choose
Create topic, you can set the name and email addresses for a new email subscription list. This list is
saved and appears in the field for future alarms.
Note
If you use Create topic to create a new Amazon SNS topic, the email addresses must be
verified before they receive notifications. Emails are only sent when the alarm enters an
alarm state. If this alarm state change happens before the email addresses are verified, the
addresses don't receive a notification.
6. Preview the alarm that you're about to create in the Alarm Preview area, and then choose Create
Alarm.
• Call put-metric-alarm. For more information, see AWS CLI Command Reference.
• Call PutMetricAlarm. For more information, see Amazon CloudWatch API Reference
486
Amazon Relational Database Service User Guide
Monitoring with Performance Insights
Topics
• Overview of Performance Insights (p. 487)
• Enabling and disabling Performance Insights (p. 490)
• Enabling the Performance Schema for Performance Insights on Amazon RDS for MariaDB or
MySQL (p. 493)
• Configuring access policies for Performance Insights (p. 496)
• Analyzing metrics with the Performance Insights dashboard (p. 499)
• Adding counter metrics to the Performance Insights dashboard (p. 524)
• Retrieving metrics with the Performance Insights API (p. 534)
• Performance Insights metrics published to Amazon CloudWatch (p. 547)
• Logging Performance Insights calls using AWS CloudTrail (p. 549)
Topics
• Database load (p. 487)
• Maximum CPU (p. 489)
• Amazon RDS DB engine support for Performance Insights (p. 489)
• AWS Region support for Performance Insights (p. 490)
Database load
Database load (DB load) measures the level of activity in your database. The key metric in Performance
Insights is DBLoad, which is collected every second. The unit for the DBLoad metric is the average active
sessions (AAS) for the DB engine.
Topics
• Average active sessions (p. 488)
• Average active executions (p. 488)
• Dimensions (p. 488)
487
Amazon Relational Database Service User Guide
Overview of Performance Insights
To obtain the average active sessions, Performance Insights samples the number of sessions concurrently
running a query. The AAS is the total number of sessions divided by the total number of samples. The
following table shows 5 consecutive samples of a running query.
1 2 2 2 sessions / 1 sample
2 0 1 2 sessions / 2 samples
3 4 2 6 sessions / 3 samples
5 4 2 10 sessions / 5 samples
In the preceding example, the DB load for the time interval is 2 AAS. An increase in DB load means that,
on average, more sessions are running on the database.
In most cases, the AAS and AAE for a query are approximately the same. However, because the inputs to
the calculations are different data sources, the calculations often vary slightly.
Dimensions
The db.load metric is different from the other time-series metrics because you can break it into
subcomponents called dimensions. You can think of dimensions as categories or "group by" clauses for
488
Amazon Relational Database Service User Guide
Overview of Performance Insights
the different characteristics of the DB Load metric. When you are diagnosing performance issues, the
most useful dimensions are wait events and top SQL.
Wait events
A wait event causes a SQL statement to wait for a specific event to happen before it can continue
running. For example, a SQL statement might wait until a locked resource is unlocked. By combining
DB Load with wait events, you can get a complete picture of the session state. Wait events vary by DB
engine:
• For information about all MariaDB and MySQL wait events, see Wait Event Summary Tables in the
MySQL documentation.
• For information about all PostgreSQL wait events, see PostgreSQL Wait Events in the PostgreSQL
documentation.
• For information about all Oracle wait events, see Descriptions of Wait Events in the Oracle
documentation.
• For information about all SQL Server wait events, see Types of Waits in the SQL Server
documentation.
Note
For Oracle, background processes sometimes do work without an associated SQL statement. In
these cases, Performance Insights reports the type of background process concatenated with a
colon and the wait class associated with that background process. Types of background process
include LGWR, ARC0, PMON, and so on.
For example, when the archiver is performing I/O, the Performance Insights report for it is
similar to ARC1:System I/O. Occasionally, the background process type is also missing, and
Performance Insights only reports the wait class, for example :System I/O.
Top SQL
Whereas wait events show bottlenecks, top SQL shows which queries are contributing the most to DB
load. For example, many queries might be currently running on the database, but a single query might
consume 99% of the DB load. In this case, the high load might indicate a problem with the query.
By default, the Performance Insights console displays top SQL queries that are contributing to the
database load. The console also shows relevant statistics for each statement. To diagnose performance
problems for a specific statement, you can examine its execution plan.
Maximum CPU
In the dashboard, the Database load chart collects, aggregates, and displays session information. To see
whether active sessions are exceeding the maximum CPU, look at their relationship to the Max vCPU line.
The Max vCPU value is determined by the number of vCPU (virtual CPU) cores for your DB instance.
If the DB load is often above the Max vCPU line, and the primary wait state is CPU, the CPU is
overloaded. In this case, you might want to throttle connections to the instance, tune any SQL queries
with a high CPU load, or consider a larger instance class. High and consistent instances of any wait state
indicate that there might be bottlenecks or resource contention issues to resolve. This can be true even if
the DB load doesn't cross the Max vCPU line.
489
Amazon Relational Database Service User Guide
Enabling and disabling Performance Insights
Amazon RDS for Performance Insights is supported for Performance Insights isn't supported
MariaDB the following engine versions: for the following instance classes:
Amazon RDS for Performance Insights is supported for Performance Insights isn't supported
MySQL the following engine versions: for the following instance classes:
• All 13 versions
• All 12 versions
• All 11 versions
• All 10 versions
Note
Aurora Serverless doesn't support Performance Insights.
490
Amazon Relational Database Service User Guide
Enabling and disabling Performance Insights
Note
Performance Schema is an optional performance tool used by Amazon RDS for MariaDB or
MySQL. If you turn Performance Schema on or off, you need to reboot. If you turn Performance
Insights on or off, however, you don't need to reboot.
The Performance Insights agent consumes limited CPU and memory on the DB host. When the DB load is
high, the agent limits the performance impact by collecting data less frequently.
Console
In the console, you can enable or disable Performance Insights when you create or modify a new DB
instance.
When you create a new DB instance, enable Performance Insights by choosing Enable Performance
Insights in the Performance Insights section. Or choose Disable Performance Insights.
To create a DB instance, follow the instructions for your DB engine in Creating an Amazon RDS DB
instance (p. 194).
If you choose Enable Performance Insights, you have the following options:
• Retention – The amount of time to retain Performance Insights data. Choose either 7 days (the
default) or 2 years.
• AWS KMS key – Specify your AWS KMS key. Performance Insights encrypts all potentially sensitive
data using your KMS key. Data is encrypted in flight and at rest. For more information, see Configuring
an AWS KMS policy for Performance Insights (p. 498).
In the console, you can modify a DB instance to enable or disable Performance Insights using the
console.
491
Amazon Relational Database Service User Guide
Enabling and disabling Performance Insights
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Databases.
3. Choose a DB instance, and choose Modify.
4. In the Performance Insights section, choose either Enable Performance Insights or Disable
Performance Insights.
If you choose Enable Performance Insights, you have the following options:
• Retention – The amount of time to retain Performance Insights data. Choose either 7 days (the
default) or 2 years. If you chose Long Term Retention (2 years) when you enable Performance
Insights, All displays 2 years of data. If you chose Default (7 days) instead, All displays only the
past week.
• AWS KMS key – Specify your KMS key. Performance Insights encrypts all potentially sensitive data
using your KMS key. Data is encrypted in flight and at rest. For more information, see Encrypting
Amazon RDS resources (p. 1879).
5. Choose Continue.
6. For Scheduling of Modifications, choose Apply immediately. If you choose Apply during the next
scheduled maintenance window, your instance ignores this setting and enables Performance Insights
immediately.
7. Choose Modify instance.
AWS CLI
When you use the create-db-instance AWS CLI command, enable Performance Insights by specifying
--enable-performance-insights. Or disable Performance Insights by specifying --no-enable-
performance-insights.
You can also specify these values using the following AWS CLI commands:
• create-db-instance-read-replica
• modify-db-instance
• restore-db-instance-from-s3
The following procedure describes how to enable or disable Performance Insights for a DB instance using
the AWS CLI.
To enable or disable Performance Insights for a DB instance using the AWS CLI
• Call the modify-db-instance AWS CLI command and supply the following values:
492
Amazon Relational Database Service User Guide
Enabling the Performance Schema for MariaDB or MySQL
--enable-performance-insights
For Windows:
When you enable Performance Insights, you can optionally specify the amount of time, in days, to retain
Performance Insights data with the --performance-insights-retention-period option. Valid
values are 7 (the default) or 731 (2 years).
The following example enables Performance Insights for sample-db-instance and specifies that
Performance Insights data is retained for two years.
For Windows:
RDS API
When you create a new DB instance using the CreateDBInstance operation Amazon RDS API operation,
enable Performance Insights by setting EnablePerformanceInsights to True. To disable
Performance Insights, set EnablePerformanceInsights to False.
You can also specify the EnablePerformanceInsights value using the following API operations:
• ModifyDBInstance
CreateDBInstanceReadReplica
• RestoreDBInstanceFromS3
When you enable Performance Insights, you can optionally specify the amount of time, in days, to retain
Performance Insights data with the PerformanceInsightsRetentionPeriod parameter. Valid values
are 7 (the default) or 731 (2 years).
Topics
493
Amazon Relational Database Service User Guide
Enabling the Performance Schema for MariaDB or MySQL
The PERFORMANCE_SCHEMA storage engine collects event data using instrumentation in the database
source code. The engine stores collected events in tables in the performance_schema database. You
can query performance_schema just as you can query any other tables. For more information, see
MySQL Performance Schema in MySQL Reference Manual.
When the Performance Schema is enabled for Amazon RDS for MariaDB or MySQL, Performance
Insights uses it to provide more detailed information. For example, Performance Insights displays DB
load categorized by detailed wait events. You can use wait events to identify bottlenecks. Without the
Performance Schema, Performance Insights reports user states such as inserting and sending, which
don't help you identify bottlenecks.
When you create an Amazon RDS for MariaDB or MySQL DB instance with Performance Insights
enabled, the Performance Schema is also enabled. In this case, Performance Insights automatically
manages your Performance Schema parameters.
For automatic management, the performance_schema must be set to 0 and the Source
must be set to a value other than 0. By default, Source is engine-default. If you change the
performance_schema value manually, and then later want to revert to automatic management, see
Configuring the Performance Schema for automatic management (p. 495).
Important
When Performance Insights enables the Performance Schema, it doesn't change the
parameter group values. However, the values are changed on the instances that are running.
The only way to see the changed values is to run the SHOW GLOBAL VARIABLES command.
• Set the required Performance Schema parameters yourself.
For Performance Insights to list wait events, set all Performance Schema parameters as shown in the
following table.
performance-schema-consumer-events-waits- ON
current
performance-schema-instrument wait/%=ON
performance-schema-consumer-global- ON
instrumentation
494
Amazon Relational Database Service User Guide
Enabling the Performance Schema for MariaDB or MySQL
performance-schema-consumer-thread- ON
instrumentation
Note
If you enable or disable the Performance Schema, you must reboot the database. If you enable
or disable Performance Insights, you don't need to reboot the database.
For more information, see Performance Schema Command Options and Performance Schema Option
and Variable Reference in the MySQL documentation.
performance_schema is 0 or 1 performance_schema is 0
The Source column is set to user The Source column is set to system
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Parameter groups.
3. Select the name of the parameter group for your DB instance.
4. Enter performance_schema in the search bar.
5. Select the performance_schema parameter.
6. Check whether Source is system and Values is 0. If so, Performance Insights is managing the
Performance Schema automatically. If not, proceed to the next step.
495
Amazon Relational Database Service User Guide
Performance Insights policies
For more information about modifying instance parameters, see Modifying parameters in a DB
parameter group (p. 288). For more information about the dashboard, see Analyzing metrics with
the Performance Insights dashboard (p. 499). For more information about the MySQL performance
schema, see MySQL 8.0 Reference Manual.
Also, if you specified a customer managed key when you turned on Performance Insights, make sure that
users in your account have the kms:Decrypt and kms:GenerateDataKey permissions on the KMS key.
• Grants access to related services used by the Amazon RDS console. For example, this policy grants
access to event notifications using Amazon SNS.
• Grants permissions needed for using Performance Insights.
If you attach AmazonRDSFullAccess to an IAM user or role, the recipient can use Performance Insights
with other console features.
496
Amazon Relational Database Service User Guide
Performance Insights policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "pi:*",
"Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*"
},
{
"Effect": "Allow",
"Action": "rds:DescribeDBInstances",
"Resource": "*"
}
]
}
You can now attach the policy to an IAM user or role. The following procedure assumes that you already
have an IAM user available for this purpose.
497
Amazon Relational Database Service User Guide
Performance Insights policies
Amazon RDS uses the AWS managed key for your new DB instance. Amazon RDS creates an AWS
managed key for your AWS account. Your AWS account has a different AWS managed key for Amazon
RDS for each AWS Region.
• Choose a customer managed key.
If you specify a customer managed key, users in your account that call the Performance Insights API
need the kms:Decrypt and kms:GenerateDataKey permissions on the KMS key. You can configure
these permissions through IAM policies. However, we recommend that you manage these permissions
through your KMS key policy. For more information, see Using key policies in AWS KMS.
Example
The following sample key policy shows how to add statements to your KMS key policy. These statements
allow access to Performance Insights. Depending on how you use the KMS key, you might want to
change some restrictions. Before adding statements to your policy, remove all comments.
{
"Version" : "2012-10-17",
"Id" : "your-policy",
"Statement" : [ {
//This represents a statement that currently exists in your policy.
}
....,
//Starting here, add new statement to your policy for Performance Insights.
//We recommend that you add one new statement for every RDS instance
{
"Sid" : "Allow viewing RDS Performance Insights",
"Effect": "Allow",
"Principal": {
"AWS": [
//One or more principals allowed to access Performance Insights
"arn:aws:iam::444455556666:role/Role1"
]
},
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey"
],
"Resource": "*",
"Condition" : {
"StringEquals" : {
//Restrict access to only RDS APIs (including Performance Insights).
//Replace region with your AWS Region.
//For example, specify us-west-2.
"kms:ViaService" : "rds.region.amazonaws.com"
},
"ForAnyValue:StringEquals": {
//Restrict access to only data encrypted by Performance Insights.
"kms:EncryptionContext:aws:pi:service": "rds",
"kms:EncryptionContext:service": "pi",
498
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
}
}
}
499
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Topics
• Counter metrics chart (p. 500)
• Database load chart (p. 502)
• Top dimensions table (p. 504)
500
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
To change the performance counters, choose Manage Metrics. You can select multiple OS metrics or
Database metrics, as shown in the following screenshot. To see details for any metric, hover over the
metric name.
For more information, see Adding counter metrics to the Performance Insights dashboard (p. 524).
501
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
You can choose to display load as active sessions grouped by waits, SQL, users, or hosts. You can also
choose a line graph.
To see details about a DB load item such as a SQL statement, hover over the item name.
502
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
To see details for any item for the selected time period in the legend, hover over that item.
503
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
To learn how to analyze queries by using the Top SQL tab, see Overview of the Top SQL tab (p. 507).
For DB instances with Performance Insights enabled, you can also reach the dashboard by choosing
the Sessions item in the list of DB instances. Under Current activity, the Sessions item shows the
database load in average active sessions over the last five minutes. The bar graphically shows the
load. When the bar is empty, the DB instance is idle. As the load increases, the bar fills with blue.
When the load passes the number of virtual CPUs (vCPUs) on the DB instance class, the bar turns
red, indicating a potential bottleneck.
504
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
4. (Optional) Choose a different time interval by selecting a button in the upper right. For example, to
change the interval to 5 hours, select 5h.
The Performance Insight dashboard automatically refreshes with new data. The refresh rate depends
on the amount of data displayed:
505
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
DB load grouped by waits and top SQL queries is the default Performance Insights dashboard view.
This combination typically provides the most insight into performance issues. DB load grouped by waits
shows if there are any resource or concurrency bottlenecks in the database. In this case, the SQL tab of
the top load items table shows which queries are driving that load.
1. Review the Database load chart and see if there are any incidents of database load exceeding the Max
CPU line.
2. If there is, look at the Database load chart and identify which wait state or states are primarily
responsible.
3. Identify the digest queries causing the load by seeing which of the queries the SQL tab on the top
load items table are contributing most to those wait states. You can identify these by the DB Load by
Wait column.
4. Choose one of these digest queries in the SQL tab to expand it and see the child queries that it is
composed of.
For example, in the dashboard following, log file sync waits account for most of the DB load. The LGWR
all worker groups wait is also high. The Top SQL chart shows what is causing the log file sync waits:
frequent COMMIT statements. In this case, committing less frequently will reduce DB load.
506
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Topics
• Overview of the Top SQL tab (p. 507)
• Analyzing running queries in MariaDB and MySQL (p. 511)
• Analyzing running queries in Oracle (p. 514)
• Analyzing running queries in PostgreSQL (p. 518)
Topics
• SQL statistics (p. 507)
• Load by waits (AAS) (p. 508)
• SQL information (p. 508)
• Preferences (p. 509)
SQL statistics
SQL statistics are performance-related metrics about SQL queries. For example, Performance Insights
might show executions per second or rows processed per second. Performance Insights collects statistics
for only the most common queries. Typically, these match the top queries by load shown in the
Performance Insights dashboard.
A SQL digest is a composite of multiple actual queries that are structurally similar but might have
different literal values. The digest replaces hardcoded values with a question mark. For example, a
digest might be SELECT * FROM emp WHERE lname= ?. This digest might include the following child
queries:
Every line in the Top SQL table shows relevant statistics for the SQL statement or digest, as shown in the
following example.
To see the literal SQL statements in a digest, select the query, and then choose the plus symbol (+). In
the following screenshot, the selected query is a digest.
507
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Note
A SQL digest groups similar SQL statements, but does not redact sensitive information.
In Top SQL, the Load by waits (AAS) column illustrates the percentage of the database load associated
with each top load item. This column reflects the load for that item by whatever grouping is currently
selected in the DB Load Chart.
For example, you might group the DB load chart by wait states. You examine SQL queries in the top load
items table. In this case, the DB Load by Waits bar is sized, segmented, and color-coded to show how
much of a given wait state that query is contributing to. It also shows which wait states are affecting the
selected query.
SQL information
In the Top SQL table, you can open a statement to view its information. The information appears in the
bottom pane.
508
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
The following types of identifiers (IDs) that are associated with SQL statements:
• Support SQL ID – A hash value of the SQL ID. This value is only for referencing a SQL ID when you are
working with AWS Support. AWS Support doesn't have access to your actual SQL IDs and SQL text.
• Support Digest ID – A hash value of the digest ID. This value is only for referencing a digest ID when
you are working with AWS Support. AWS Support doesn't have access to your actual digest IDs and
SQL text.
Preferences
You can control the statistics displayed in the Top SQL tab by choosing the Preferences icon.
509
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
When you choose the Preferences icon, the Preferences window opens.
To enable the statistics that you want to appear in the Top SQL tab, use your mouse to scroll to the
bottom of the window, and then choose Continue.
510
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Topics
• Digest table in MariaDB and MySQL (p. 511)
• Per-second statistics for MariaDB and MySQL (p. 511)
• Per-call statistics for MariaDB and MySQL (p. 512)
• Viewing SQL statistics for MariaDB and MySQL (p. 512)
The digest table doesn't have an eviction policy. When the table is full, the AWS Management Console
shows the following message:
Performance Insights is unable to collect SQL Digest statistics on new queries because the
table events_statements_summary_by_digest is full.
Please truncate events_statements_summary_by_digest table to clear the issue. Check the
User Guide for more details.
In this situation, MariaDB and MySQL don't track SQL queries. To address this issue, Performance Insights
automatically truncates the digest table when both of the following conditions are met:
If Performance Insights isn't managing the Performance Schema automatically, see Enabling the
Performance Schema for Performance Insights on Amazon RDS for MariaDB or MySQL (p. 493).
In the AWS CLI, check the source of a parameter value by running the describe-db-parameters command.
The following SQL statistics are available for MariaDB and MySQL DB instances.
Metric Unit
db.sql_tokenized.stats.sum_select_range_check_per_sec
Select range check per second
db.sql_tokenized.stats.sum_sort_merge_passes_per_sec
Sort merge passes per second
511
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Metric Unit
db.sql_tokenized.stats.sum_created_tmp_disk_tables_per_sec
Created temporary disk tables per second
db.sql_tokenized.stats.sum_created_tmp_tables_per_sec
Created temporary tables per second
The following metrics provide per call statistics for a SQL statement.
Metric Unit
db.sql_tokenized.stats.sum_select_range_check_per_call
Select range check per call
db.sql_tokenized.stats.sum_sort_merge_passes_per_call
Sort merge passes per call
db.sql_tokenized.stats.sum_created_tmp_disk_tables_per_call
Created temporary disk tables per call
db.sql_tokenized.stats.sum_created_tmp_tables_per_call
Created temporary tables per call
The statistics are available in the Top SQL tab of the Database load chart.
512
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
4.
Choose which statistics to display by choosing the gear icon in the upper-right corner of the chart.
The following screenshot shows the preferences for MariaDB and MySQL DB instances.
513
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
If the ID is 0 at the digest level, Oracle Database has determined that this statement is not suitable for
reuse. In this case, the child SQL statements could belong to different digests. However, the statements
are grouped together under the digest_text for the first SQL collected.
Topics
• Per-second statistics for Oracle (p. 514)
• Per-call statistics for Oracle (p. 515)
• Viewing SQL statistics for Oracle (p. 516)
The following metrics provide per-second statistics for an Oracle SQL query.
Metric Unit
514
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Metric Unit
The following metrics provide per-call statistics for an Oracle SQL digest query.
Metric Unit
db.sql_tokenized.stats.physical_read_requests_per_sec
Physical reads per second
db.sql_tokenized.stats.physical_write_requests_per_sec
Physical writes per second
Metric Unit
The following metrics provide per-call statistics for an Oracle SQL digest query.
Metric Unit
515
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Metric Unit
db.sql_tokenized.stats.physical_read_requests_per_exec
Physical reads per execution
db.sql_tokenized.stats.physical_write_requests_per_exec
Physical writes per execution
The statistics are available in the Top SQL tab of the Database load chart.
5. Choose which statistics to display by choosing the gear icon in the upper-right corner of the chart.
516
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
517
Amazon Relational Database Service User Guide
Analyzing metrics with the Performance Insights dashboard
Topics
• Digest statistics for RDS PostgreSQL (p. 518)
• Per-second digest statistics for PostgreSQL (p. 518)
• Per-call digest statistics for PostgreSQL (p. 519)
• Viewing SQL statistics for PostgreSQL (p. 519)
To view SQL digest statistics, PostgreSQL must load the pg_stat_statements library. For RDS
PostgreSQL DB instances that are compatible with PostgreSQL 11 or later, the database loads this library
by default. For PostgreSQL DB instances that are compatible with PostgreSQL 10 or earlier, enable this
library manually. To enable it manually, add pg_stat_statements to shared_preload_libraries
in the DB parameter group associated with the DB instance. Then reboot your DB instance. For more
information, see Working with DB parameter groups (p. 284).
Note
Performance Insights can only collect statistics for queries in pg_stat_activity that aren't
truncated. By default, PostgreSQL databases truncate queries longer than 1,024 bytes. To
increase the query size, change the track_activity_query_size parameter in the DB
parameter group associated with your DB instance. When you change this parameter, a DB
instance reboot is required.
The following SQL digest statistics are available for PostgreSQL DB instances.
Metric Unit