Aws Dbms Book
Aws Dbms Book
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
DB instances .............................................................................................................................. 1
AWS Regions and Availability Zones ............................................................................................. 2
Security .................................................................................................................................... 2
Monitoring an Amazon RDS DB instance ....................................................................................... 3
How to work with Amazon RDS ................................................................................................... 3
AWS Management Console .................................................................................................. 3
Command line interface ...................................................................................................... 3
Programming with Amazon RDS .......................................................................................... 3
How you are charged for Amazon RDS ......................................................................................... 3
What's next? .............................................................................................................................. 3
Getting started .................................................................................................................. 4
Database engine–Specific topics ........................................................................................... 4
DB instances .............................................................................................................................. 5
DB instance classes .................................................................................................................... 7
DB instance class types ....................................................................................................... 7
Supported DB engines ........................................................................................................ 8
Determining DB instance class support in AWS Regions ......................................................... 17
Changing your DB instance class ........................................................................................ 20
Configuring the processor ................................................................................................. 20
Hardware specifications ..................................................................................................... 33
DB instance storage .................................................................................................................. 40
Storage types .................................................................................................................. 40
General Purpose SSD storage ............................................................................................. 40
Provisioned IOPS storage .................................................................................................. 42
Magnetic storage .............................................................................................................. 44
Monitoring storage performance ........................................................................................ 44
Factors that affect storage performance .............................................................................. 45
Regions, Availability Zones, and Local Zones ................................................................................ 49
AWS Regions ................................................................................................................... 49
Availability Zones ............................................................................................................. 52
Local Zones ..................................................................................................................... 52
High availability (Multi-AZ) ........................................................................................................ 53
Modifying a DB instance to be a Multi-AZ deployment .......................................................... 54
Failover process for Amazon RDS ....................................................................................... 54
DB instance billing for Amazon RDS ........................................................................................... 57
On-Demand DB instances .................................................................................................. 58
Reserved DB instances ...................................................................................................... 59
Setting up ....................................................................................................................................... 67
Sign up for AWS ...................................................................................................................... 67
Create an IAM user ................................................................................................................... 67
Determine requirements ............................................................................................................ 69
Provide access to your DB instance in your VPC by creating a security group ..................................... 70
Getting started ................................................................................................................................ 73
Creating a MariaDB DB instance and connecting to a database ....................................................... 73
Creating a MariaDB DB instance ......................................................................................... 73
Connecting to a database on a DB instance running MariaDB ................................................. 77
Deleting a DB instance ...................................................................................................... 79
Creating a SQL Server DB instance and connecting to it ................................................................ 80
Creating a sample SQL Server DB instance .......................................................................... 80
Connecting to your sample DB instance .............................................................................. 83
Exploring your sample DB instance ..................................................................................... 84
Deleting your sample DB instance ...................................................................................... 85
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
Overview
• When you buy a server, you get CPU, memory, storage, and IOPS, all bundled together. With Amazon
RDS, 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.
• Amazon RDS manages backups, software patching, automatic failure detection, and recovery.
• To deliver a managed service experience, Amazon RDS doesn't provide shell access to DB instances. It
also restricts access to certain system procedures and tables that require advanced privileges.
• You can have automated backups performed when you need them, or manually create your own
backup snapshot. You can use these backups to restore a database. The Amazon RDS restore process
works reliably and efficiently.
• You can use the database products you are already familiar with: MySQL, MariaDB, PostgreSQL, Oracle,
Microsoft SQL Server.
• 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 MariaDB, Microsoft SQL Server, MySQL, Oracle,
and PostgreSQL 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.
If you are new to AWS products and services, begin learning more with the following resources:
DB instances
The basic building block of Amazon RDS is the DB instance. A DB instance is an isolated database
environment in the AWS Cloud. Your DB instance can contain multiple user-created databases. You
can access your DB instance by using the same tools and applications that you use with a standalone
1
Amazon Relational Database Service User Guide
AWS Regions and Availability Zones
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.
Each DB instance runs a DB engine. Amazon RDS currently supports the MySQL, MariaDB, PostgreSQL,
Oracle, and Microsoft SQL Server DB engines. 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.
The computation and memory capacity of a DB instance is determined by its DB instance class. 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. 7).
Note
For pricing information on DB instance classes, see the Pricing section of the Amazon RDS
product page.
DB instance storage comes in three types: Magnetic, General Purpose (SSD), and Provisioned IOPS
(PIOPS). They differ in performance characteristics and price, allowing you to 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. 40).
You can run a DB instance on a virtual private cloud (VPC) using the Amazon Virtual Private Cloud
(Amazon VPC) service. When you use a VPC, you have control over your virtual networking environment.
You can choose your own IP address range, create subnets, and configure routing and access control lists.
The basic functionality of Amazon RDS is the same whether it's running in a VPC or not. Amazon RDS
manages backups, software patching, automatic failure detection, and recovery. There's no additional
cost to run your DB instance in a VPC. For more information on using Amazon VPC with RDS, see Amazon
Virtual Private Cloud VPCs and Amazon RDS (p. 1705).
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. 49).
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 High availability (Multi-AZ) for Amazon RDS (p. 53).
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.
2
Amazon Relational Database Service User Guide
Monitoring an Amazon RDS DB instance
For more information about security groups, see Security in Amazon RDS (p. 1617).
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?
3
Amazon Relational Database Service User Guide
Getting started
Getting started
Create a DB instance using instructions in Getting started with Amazon RDS (p. 73).
4
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 Amazon AWS command line tools, Amazon RDS
5
Amazon Relational Database Service User Guide
DB instances
API operations, or the 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.
6
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. 7)
• Supported DB engines for DB instance classes (p. 8)
• Determining DB instance class support in AWS Regions (p. 17)
• Changing your DB instance class (p. 20)
• Configuring the processor for a DB instance class (p. 20)
• Hardware specifications for DB instance classes (p. 33)
• 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.m1 – Earlier generation general-purpose instance classes.
• 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.
• 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.
7
Amazon Relational Database Service User Guide
Supported DB engines
• 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.r4 – Instance classes optimized for memory-intensive applications. These offer improved
networking and Amazon EBS performance.
• db.r3 – Instance classes that provide memory optimization.
• db.m2 – Earlier generation memory-optimized instance classes.
• 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. 33).
MariaDB
The Graviton2 instance classes db.m6g and db.r6g are supported for all MariaDB 10.5 versions and
MariaDB version 10.4.13 and higher 10.4 versions.
Microsoft SQL Server
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. 641).
MySQL
The Graviton2 instance classes db.m6g and db.r6g are supported for RDS for MySQL versions 8.0.17
and higher.
Oracle
Instance class support varies according to the version and edition of Oracle. For instance class
support by version and edition, see RDS for Oracle instance classes (p. 996).
8
Amazon Relational Database Service User Guide
Supported DB engines
PostgreSQL
PostgreSQL versions 13 and higher support the db.m6g, db.m5, db.r6g, db.r5, db.t3 instance classes.
Previous generations of classes are supported only by PostgreSQL versions lower than 13 and
include db.m4, db.m3, db.r4, db.r3, and db.t2.
In the following table, you can find details about supported Amazon RDS DB instance classes for each
Amazon RDS DB engine.
9
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
10
Amazon Relational Database Service User Guide
Supported DB engines
11
Amazon Relational Database Service User Guide
Supported DB engines
12
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
13
Amazon Relational Database Service User Guide
Supported DB engines
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
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
Determining DB instance class support in AWS Regions
Contents
• Using the Amazon RDS pricing page to determine DB instance class support in AWS
Regions (p. 17)
• Using the AWS CLI to determine DB instance class support in AWS Regions (p. 18)
• Listing the DB instance classes that are supported by a specific DB engine version in an AWS
Region (p. 18)
• Listing the DB engine versions that support a specific DB instance class in an AWS
Region (p. 19)
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.
17
Amazon Relational Database Service User Guide
Determining DB instance class support in AWS Regions
sqlserver-ex
sqlserver-web
oracle-se2
oracle-se
For information about AWS Region names, see AWS Regions (p. 49).
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. 18)
• Listing the DB engine versions that support a specific DB instance class in an AWS Region (p. 19)
18
Amazon Relational Database Service User Guide
Determining DB instance class support in AWS Regions
--output text \
--region region
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).
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).
19
Amazon Relational Database Service User Guide
Changing your DB instance class
For Windows:
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. 1722).
Topics
• Overview of configuring the processor (p. 20)
• CPU cores and threads per CPU core per DB instance class (p. 21)
• Setting the CPU cores and threads per CPU core for a DB instance class (p. 25)
• 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.
20
Amazon Relational Database Service User Guide
Configuring the processor
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.
CPU cores and threads per CPU core per DB instance class
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
21
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.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
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.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.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
22
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.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
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
23
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.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
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.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
24
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.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
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
Currently, you can configure the number of CPU cores and threads per core only when the following
conditions are met:
• You are 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. 996)
• Your instance is using the Bring Your Own License (BYOL) licensing option. For more information about
Oracle licensing options, see Oracle licensing options (p. 994).
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. 564).
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:
25
Amazon Relational Database Service User Guide
Configuring the processor
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.
26
Amazon Relational Database Service User Guide
Configuring the processor
27
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
28
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. 29)
• Setting the number of CPU cores and disabling multiple threads for a DB instance (p. 29)
• Viewing the valid processor values for a DB instance class (p. 30)
• Returning to default processor settings for a DB instance (p. 31)
• Returning to the default number of CPU cores for a DB instance (p. 31)
• Returning to the default number of threads per core for a DB instance (p. 32)
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.
29
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"
}
],
30
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.
31
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:
32
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. 1722).
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.
33
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. 40).
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. 8).
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
34
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
35
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
36
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
37
Amazon Relational Database Service User Guide
Hardware specifications
Instance class vCPU ECU Memory VPC only EBS Max. Network
(GiB) optimized bandwidth performance
(mbps)
38
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.
** 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.
39
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. 40).
• 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. 42).
• 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. 44).
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.
And baseline performance for a 5.34-TiB volume is 16,000 IOPS.
40
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. Burst
is not relevant for volumes above 1 TiB. Instance I/O credit balance determines burst performance. For
more information about instance I/O credits, see I/O credits and burst performance (p. 41).
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.
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. 322).
The following table lists several storage sizes. For each storage size, it lists the associated base
performance of the storage, which is also the rate at which it accumulates I/O credits. The table also lists
the burst duration at the 3,000 IOPS maximum, when starting with a full I/O credit balance. In addition,
the table lists the time in seconds that the storage takes to refill an empty I/O credit balance.
Note
The IOPS figure reaches its maximum value at a volume storage size of 5,334 GiB.
41
Amazon Relational Database Service User Guide
Provisioned IOPS storage
Storage size (GiB) Base performance Maximum burst Seconds to fill empty
(IOPS) duration at 3,000 IOPS I/O credit balance
(seconds)
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)
Burst duration = --------------------------------------
(Burst IOPS) - 3*(Storage size in GiB)
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. 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.
42
Amazon Relational Database Service User Guide
Provisioned IOPS storage
Note
For SQL Server, the maximum IOPS of 64,000 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, the maximum IOPS of 256,000 is guaranteed only on Nitro-based instances that are
on the r5b instance type. Other instance families guarantee performance up to 80,000 IOPS.
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.
43
Amazon Relational Database Service User Guide
Magnetic storage
because I/O requests spend less time in a queue. Decreased latency allows for faster database commits,
which improves response time and allows for higher database throughput.
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.
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 on 1-minute intervals in units of seconds. Typical values for latency are in the
millisecond (ms). For example, Amazon RDS reports 2 ms as 0.002 seconds.
• 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.
44
Amazon Relational Database Service User Guide
Factors that affect storage performance
System activities
The following system-related activities consume I/O capacity and might reduce database 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 may encounter the following workload-related situations:
If there isn't at least one system resource that is at or near a limit, and adding threads doesn't increase
the database transaction rate, 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, you should seek the advice of a database performance tuning expert.
DB instance class
To get the most performance out of your Amazon RDS database instance, choose a current generation
instance type with enough bandwidth to support your storage type. For example, you can choose 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 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.
We encourage you to use the latest generation of instances to get the best performance. Previous
generation DB instances have a lower instance storage limit. The following table shows the maximum
storage that each DB instance class can scale to for each database engine. All values are in tebibytes
(TiB).
db.m5.24xlarge 64 16 64 64 64
db.m5.16xlarge 64 16 64 64 64
db.m5.12xlarge 64 16 64 64 64
45
Amazon Relational Database Service User Guide
Factors that affect storage performance
db.m5.8xlarge 64 16 64 64 64
db.m5.4xlarge 64 16 64 64 64
db.m5.2xlarge 64 16 64 64 64
db.m5.xlarge 64 16 64 64 64
db.m5.large 64 16 64 64 64
db.m4.16xlarge 64 16 64 64 64
db.m4.10xlarge 64 16 64 64 64
db.m4.4xlarge 64 16 64 64 64
db.m4.2xlarge 64 16 64 64 64
db.m4.xlarge 64 16 64 64 64
db.m4.large 64 16 64 64 64
db.m3.2xlarge 6 16 6 6 6
db.m3.xlarge 6 16 6 6 6
db.m3.large 6 16 6 6 6
db.m3.medium 32 16 32 32 32
db.r5.24xlarge 64 16 64 64 64
db.r5.16xlarge 64 16 64 64 64
db.r5.12xlarge 64 16 64 64 64
db.r5.8xlarge 64 16 64 64 64
db.r5.4xlarge 64 16 64 64 64
db.r5.2xlarge 64 16 64 64 64
db.r5.xlarge 64 16 64 64 64
db.r5.large 64 16 64 64 64
db.r4.16xlarge 64 16 64 64 64
db.r4.8xlarge 64 16 64 64 64
db.r4.4xlarge 64 16 64 64 64
46
Amazon Relational Database Service User Guide
Factors that affect storage performance
db.r4.2xlarge 64 16 64 64 64
db.r4.xlarge 64 16 64 64 64
db.r4.large 64 16 64 64 64
db.r3.8xlarge 64 16 64 64 64
db.r3.4xlarge 64 16 64 64 64
db.r3.2xlarge 64 16 64 64 64
db.r3.xlarge 64 16 64 64 64
db.r3.large 64 16 64 64 64
db.t3.2xlarge 16 16 16 64 64
db.t3.xlarge 16 16 16 64 64
db.t3.large 16 16 16 64 64
db.t3.medium 16 16 16 32 32
db.t3.small 16 16 16 32 16
db.t3.micro 16 16 16 32 16
db.t2.2xlarge 64 16 64 64 64
db.t2.xlarge 64 16 64 64 64
db.t2.large 64 16 64 64 64
db.t2.medium 32 16 32 32 32
db.t2.small 16 16 16 16 16
db.t2.micro 16 16 16 16 16
db.x1e.32xlarge 16 64
db.x1e.16xlarge 16 64
db.x1e.8xlarge 16 64
db.x1e.4xlarge 16 64
db.x1e.2xlarge 16 64
db.x1e.xlarge 16 64
47
Amazon Relational Database Service User Guide
Factors that affect storage performance
db.x1.32xlarge 16 64
db.x1.16xlarge 16 64
For Oracle, scaling up to 80,000 IOPS is only supported on the following instance classes.
• db.m5.24xlarge
• db.r5.24xlarge
• db.x1.32xlarge
• db.x1e.32xlarge
For more details on all instance classes supported, see Previous generation DB instances.
48
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 instances that are in the same location. If you host all your instances in a single
location that is affected by such a failure, none of your instances is 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.
49
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.
50
Amazon Relational Database Service User Guide
AWS Regions
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.
51
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 High availability (Multi-AZ) for Amazon RDS (p. 53).
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. 147) and Modifying an Amazon RDS DB instance (p. 256).
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. 147).
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.
52
Amazon Relational Database Service User Guide
High availability (Multi-AZ)
In a Multi-AZ deployment, Amazon RDS automatically provisions and maintains a synchronous standby
replica in a different Availability Zone. The primary DB instance is synchronously replicated across
Availability Zones to a standby replica to provide data redundancy, eliminate I/O freezes, and minimize
latency spikes during system backups. Running a DB instance with high availability can enhance
availability during planned system maintenance, and help protect your databases against DB instance
failure and Availability Zone disruption. For more information on Availability Zones, see Regions,
Availability Zones, and Local Zones (p. 49).
Note
The high-availability feature isn't a scaling solution for read-only scenarios; you can't use a
standby replica to serve read traffic. To serve read-only traffic, you use a read replica instead. For
more information, see Working with read replicas (p. 284).
Using the RDS console, you can create a Multi-AZ deployment by simply specifying Multi-AZ
when creating a DB instance. You can use the console to convert existing DB instances to Multi-AZ
deployments by modifying the DB instance and specifying the Multi-AZ option. You can also specify a
Multi-AZ deployment with the AWS CLI or Amazon RDS API. Use the create-db-instance or modify-db-
instance CLI command, or the CreateDBInstance or ModifyDBInstance API operation.
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 deployments can have increased write and commit latency compared to a
Single-AZ deployment, due to 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
53
Amazon Relational Database Service User Guide
Modifying a DB instance to be a Multi-AZ deployment
that you use Provisioned IOPS and DB instance classes that are optimized for Provisioned IOPS for fast,
consistent performance. For more information about DB instance classes, see DB instance classes (p. 7).
For information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 256).
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 large write-intensive DB instances.
To enable Multi-AZ for a DB instance, RDS takes a snapshot of the primary DB instance's EBS
volume and restores it on the newly created standby replica, and then synchronizes both
volumes. New volumes created from existing EBS snapshots load lazily in the background.
This capability permits large volumes to be restored from a snapshot quickly, but there is
the possibility of added latency during and after the modification is 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. 493).
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.
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. 270).
The primary host of the RDS Multi-AZ instance is The Multi-AZ deployment detected an impaired
unhealthy. primary DB instance and failed over.
54
Amazon Relational Database Service User Guide
Failover process for Amazon RDS
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 deployment detected a storage issue
host of the RDS Multi-AZ instance experienced a on the primary DB instance and failed over.
failure.
The user requested a failover of the DB instance. You rebooted the DB instance and chose Reboot
with failover.
There are several ways to determine if your Multi-AZ DB instance has failed over:
• DB event subscriptions can be set up 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. 493).
• You can view your DB events by using the Amazon RDS console or API operations.
55
Amazon Relational Database Service User Guide
Failover process for Amazon RDS
• You can view the current state of your Multi-AZ deployment by using the Amazon RDS console and 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. 134).
The JVM caches DNS name lookups. When the JVM resolves a hostname 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.
java.security.Security.setProperty("networkaddress.cache.ttl" , "60");
56
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. 7).
• 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 pro-rated. For more information,
see Amazon RDS DB instance storage (p. 40).
• 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. 333).
• 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. 58)
• Reserved DB instances for Amazon RDS (p. 59)
57
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 DB instance status (p. 410).
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.
58
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.
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.
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
59
Amazon Relational Database Service User Guide
Reserved DB instances
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
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.
60
Amazon Relational Database Service User Guide
Reserved DB 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)
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.
61
Amazon Relational Database Service User Guide
Reserved DB instances
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.
Your upfront payment for a reserved DB instance reserves the resources for your use. Because these
resources are reserved for you, you are billed for the resources regardless of whether you use them.
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.
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.
62
Amazon Relational Database Service User Guide
Reserved DB instances
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.
10. Choose Continue.
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.
63
Amazon Relational Database Service User Guide
Reserved DB instances
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.
AWS CLI
You can use the AWS CLI to work with reserved DB instances as shown in the following examples.
64
Amazon Relational Database Service User Guide
Reserved DB instances
To get information about available reserved DB instance offerings, call the AWS CLI command
describe-reserved-db-instances-offerings.
After you have information about the available reserved DB instance offerings, you can use the
information to purchase an offering.
The following example purchases the reserved DB instance offering with ID 649fd0c8-cf6d-47a0-
bfa6-060f8e75e95f, and assigns the identifier of MyReservation.
For Windows:
65
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.
66
Amazon Relational Database Service User Guide
Sign up for AWS
A couple things you should know about Amazon Web Services (AWS):
• When you sign up for AWS, your AWS account automatically has access to all services in AWS,
including Amazon RDS. However, you are charged only for the services that you use.
• With Amazon RDS, you pay only for the RDS instances that are active. The Amazon RDS DB instance
that you create is live (not running in a sandbox). You incur the standard Amazon RDS usage fees for
the instance until you terminate it. For more information about Amazon RDS usage rates, see the
Amazon RDS product page.
Topics
• Sign up for AWS (p. 67)
• Create an IAM user (p. 67)
• Determine requirements (p. 69)
• Provide access to your DB instance in your VPC by creating a security group (p. 70)
If you don't have an AWS account, you can use the following procedure to create one. If you are a new
AWS customer, you can get started with Amazon RDS for free; for more information, see AWS free usage
tier.
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.
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.
67
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 below 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.
68
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 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. 7).
• VPC, subnet, and security group – Your DB instance is most likely 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, in a user-defined VPC, or
outside of a VPC.
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 information on how to determine if your account has a default VPC in a particular AWS Region, see
Determining whether you are using the EC2-VPC or EC2-Classic platform (p. 1705).
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:
• Create a VPC security group that authorizes connections from the application or service to the
Amazon RDS DB instance with the database. Use the Amazon EC2 API or the Security Group
option on the VPC console to create VPC security groups. For information, see Step 4: Create a
VPC security group (p. 1721).
• 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 with the database. Use the Amazon EC2 API or the
Security Group option on the VPC console to create VPC security groups. For information, see
Step 4: Create a VPC security group (p. 1721).
• 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. 1705).
69
Amazon Relational Database Service User Guide
Provide access to your DB instance in
your VPC by creating a security group
• 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. 1715).
• No VPC – If your AWS account doesn't have a default VPC and you don't specify a user-defined VPC,
create a DB security group. A DB security group authorizes connections from the devices and Amazon
RDS instances running the applications or utilities to access the databases in the DB instance. For
more information, see Working with DB security groups (EC2-Classic platform) (p. 1691).
• 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 High availability (Multi-AZ) for Amazon RDS (p. 53).
• 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. 1634).
• 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.
• 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. 40).
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 security group that enable you to
connect. Use your network and configuration information to create rules to allow access to your DB
instance.
Note
If your legacy DB instance was created before March 2013 and isn't in a VPC, it might not have
associated security groups. If your DB instance was created after this date, it might be inside a
default VPC.
70
Amazon Relational Database Service User Guide
Provide access to your DB instance in
your VPC by creating a security group
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.
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc.
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.
5. In the Create Security Group window, type Name tag, Group name, and Description values for your
security group. For VPC, choose the VPC that you want to create your DB instance in. Choose Yes,
Create.
6. The VPC security group that you created should still be selected. If not, locate it in the list, and
choose it. The details pane at the bottom of the console window displays the details for the security
group, and tabs for working with inbound and outbound rules. Choose the Inbound Rules tab.
7. On the Inbound Rules tab, choose Edit.
You can use the VPC security group that you just created as the security group for your DB instance when
you create it. If your DB instance isn't going to be in a VPC, see Working with DB security groups (EC2-
Classic platform) (p. 1691) to create a DB security group to use when you create your DB instance.
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 launch a DB instance using your requirements
and security group. For information on creating a DB instance, see the relevant documentation in the
following table.
Microsoft SQL Server Creating a Microsoft SQL Server DB instance and connecting to it (p. 80)
71
Amazon Relational Database Service User Guide
Provide access to your DB instance in
your VPC by creating a security group
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. 1733).
72
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. 73)
• Creating a Microsoft SQL Server DB instance and connecting to it (p. 80)
• Creating a MySQL DB instance and connecting to a database on a MySQL DB instance (p. 86)
• Creating an Oracle DB instance and connecting to a database on an Oracle DB instance (p. 93)
• Creating a PostgreSQL DB instance and connecting to a database on a PostgreSQL DB
instance (p. 99)
• Tutorial: Create a web server and an Amazon RDS DB instance (p. 108)
Topics
• Creating a MariaDB DB instance (p. 73)
• Connecting to a database on a DB instance running the MariaDB database engine (p. 77)
• Deleting a DB instance (p. 79)
73
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
Console
You can create a DB instance running MariaDB with 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.
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 Easy Create not enabled, see Creating an
Amazon RDS DB instance (p. 147).
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.
74
Amazon Relational Database Service User Guide
Creating a MariaDB DB instance
75
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 check box is chosen.
To enter your master password, clear the Auto generate a password check 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 when Easy Create is enabled. If you want to change one
or more settings during database creation, choose Standard Create to set them. The Editable after
database creation column shows which options you can change after database creation. To change
a setting with No in that column, use Standard Create. For settings with Yes in that column, you can
either use Standard Create or modify the DB instance after it's created to change the setting.
11. 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,
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. 256).
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.
76
Amazon Relational Database Service User Guide
Connecting to a database on a
DB instance running MariaDB
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 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.
77
Amazon Relational Database Service User Guide
Connecting to a database on a
DB instance running MariaDB
2. 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>,
the master user name you used for <mymasteruser>, and provide the master password you used
when prompted for a password.
78
Amazon Relational Database Service User Guide
Deleting a DB instance
After you enter the password for the user, you should see output similar to the following.
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql >
For more information about connecting to a MariaDB DB instance, see Connecting to a DB instance
running the MariaDB database engine (p. 595). For information on connection issues, see Can't connect
to Amazon RDS DB instance (p. 1733).
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.
79
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.
For this example, you use Easy create to create a DB instance running SQL Server Express Edition 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. 147).
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. Choose Easy create.
80
Amazon Relational Database Service User Guide
Creating a sample SQL Server DB instance
8. For DB instance identifier, enter a name for the DB instance, or leave the default name.
9. For Master username, enter a name for the master user, or leave the default name.
10. To use an automatically generated master password for the DB instance, choose the Auto generate
a password check box.
To enter your master password, clear the Auto generate a password check box, and then enter the
same password in Master password and Confirm password.
The Create database page should look similar to the following image.
81
Amazon Relational Database Service User Guide
Creating a sample SQL Server DB instance
You can examine the default settings used when Easy create is enabled. If you want to change one
or more settings during database creation, choose Standard create to set them. The Editable after
database is created column shows which options you can change after database creation. To change
a setting with No in that column, use Standard create. For settings with Yes in that column, you can
either use Standard create or modify the DB instance after it's created to change the setting.
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,
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. 256).
13. 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.
82
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
Before you begin, your database should have a status of Available. If it has a status of Creating or
Backing-up, wait until it's Available. The status updates without requiring you to refresh the page.
This process can take up to 20 minutes.
Also, make sure you have SSMS installed. If you can also connect to SQL Server on RDS by using a
different tools, such as an add-in for your development environment or some other database tool.
However, this tutorial only covers using SSMS. To download a stand-alone version of this SSMS, see
Download SQL Server Management Studio (SSMS) in the Microsoft documentation.
1. 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.abc2defghije.us-west-2.rds.amazonaws.com.
Also, take note of the port number. The default port for SQL Server is 1433. If yours is different,
write it down.
2. Start SQL Server Management Studio.
sample-instance.abc2defghije.us-west-2.rds.amazonaws.com,1433
83
Amazon Relational Database Service User Guide
Exploring your sample DB instance
If you can't connect to your DB instance, see Troubleshooting connections to your SQL Server DB
instance (p. 668).
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:
2. 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.
3. You can now 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.
b. Enter the following SQL query.
select @@VERSION
c. Run the query. SSMS returns the SQL Server version of your Amazon RDS DB instance.
84
Amazon Relational Database Service User Guide
Deleting your sample 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:
• Check 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.
• Type "delete me" into the box To confirm deletion, type delete me into the field.
• Choose Delete. This action can't be undone.
85
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
and connecting to a database
Topics
• Creating a MySQL DB instance (p. 86)
• Connecting to a database on a DB instance running the MySQL database engine (p. 90)
• Deleting a DB instance (p. 92)
Console
You can create a DB instance running MySQL with the AWS Management Console with Easy Create
enabled or disabled. 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.
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 Easy Create not enabled, see Creating an
Amazon RDS DB instance (p. 147).
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.
86
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
The Create database page should look similar to the following image.
87
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
88
Amazon Relational Database Service User Guide
Creating a MySQL DB instance
9. To use an automatically generated master password for the DB instance, enable Auto generate a
password.
To enter your master password, disable Auto generate a password, 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 when Easy Create is enabled. If you want to change one
or more settings during database creation, choose Standard Create to set them. The Editable after
database creation column shows which options you can change after database creation. To change
a setting with No in that column, use Standard Create. For settings with Yes in that column, you can
either use Standard Create or modify the DB instance after it is created to change the setting.
11. 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 username and password for the DB instance, choose View credential details.
You can use the username and password that appears to connect to the DB instance as the master
user.
Important
You won't be able to view 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. 256).
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
89
Amazon Relational Database Service User Guide
Connecting to a database on a DB instance running MySQL
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. 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.
90
Amazon Relational Database Service User Guide
Connecting to a database on a DB instance running MySQL
2. Download a SQL client that you can use to connect to the DB instance.
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, go to mysql - the MySQL command-line client in the
MySQL documentation. One GUI-based application you can use to connect is MySQL Workbench. For
more information, go to the Download MySQL Workbench page.
91
Amazon Relational Database Service User Guide
Deleting a DB instance
3. 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>, the master user
name you used for <mymasteruser>, and provide the master password you used when prompted
for a password.
After you enter the password for the user, you should see output similar to the following.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
If you can't connect to your MySQL DB instance, two common causes of connection failures to a new DB
instance are:
• The DB instance was created using a security group that does not authorize connections from
the device or Amazon EC2 instance where the MySQL application or utility is running. If the DB
instance was created in a VPC, it must have a VPC security group that authorizes the connections.
If the DB instance was created outside of a VPC, it must have a DB security group that authorizes
the connections. For more information, see Amazon Virtual Private Cloud VPCs and Amazon
RDS (p. 1705).
• The DB instance was created using the default port of 3306, and your company has firewall rules
blocking connections to that port from devices in your company network. To fix this failure, recreate
the instance with a different port.
For more information about connecting to a MySQL DB instance, see Connecting to a DB instance
running the MySQL database engine (p. 844). For information on connection issues, see Can't connect
to Amazon RDS DB instance (p. 1733).
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.
92
Amazon Relational Database Service User Guide
Creating an Oracle DB instance
and connecting to a database
In this topic, you create a sample Oracle DB instance. You then connect to the DB instance and run a
simple query. Finally, you delete the sample DB instance.
Console
You can create a DB instance running Oracle with 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.
For this example, you use Easy create to create a DB instance running the Oracle database engine with a
db.m4.large DB instance class.
Note
For information about creating DB instances with Easy create not enabled, see Creating an
Amazon RDS DB instance (p. 147).
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.
93
Amazon Relational Database Service User Guide
Creating a sample Oracle DB instance
The Create database page should look similar to the following image.
94
Amazon Relational Database Service User Guide
Creating a sample Oracle DB instance
95
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 check box is chosen.
To enter your master password, clear the Auto generate a password check 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 that are used when Easy create is enabled. If you want to
change one or more settings during database creation, choose Standard create to set them. The
Editable after database creation column shows which options you can change after database
creation. To change a setting with No in that column, use Standard create. For settings with Yes
in that column, you can either use Standard create or modify the DB instance after it's created to
change the setting.
11. Choose Create database.
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. 256).
12. For Databases, choose the name of the new Oracle DB instance.
96
Amazon Relational Database Service User Guide
Connecting to your sample 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. 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.
97
Amazon Relational Database Service User Guide
Connecting to your sample DB instance
You need both the DB name and the master username to connect to the DB instance.
2. 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.
• 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)))'
98
Amazon Relational Database Service User Guide
Deleting your sample DB instance
SQL>
For more information about connecting to an Oracle DB instance, see Connecting to your Oracle
DB instance (p. 1005). For information on connection issues, see Can't connect to Amazon RDS DB
instance (p. 1733).
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.
Contents
• Creating a PostgreSQL DB instance (p. 99)
• Connecting to a PostgreSQL DB instance (p. 103)
• Using pgAdmin to connect to a PostgreSQL DB instance (p. 103)
• Using psql to connect to a PostgreSQL DB instance (p. 107)
• Deleting a DB instance (p. 107)
99
Amazon Relational Database Service User Guide
Creating a PostgreSQL DB instance
You can create a DB instance running PostgreSQL with the AWS Management Console with Easy Create
enabled or disabled. 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.
In this example, you use Easy Create to create a DB instance running the PostgreSQL database engine
with a db.t2.micro DB instance class.
Note
For information about creating DB instances with Easy Create not enabled, see Creating an
Amazon RDS DB instance (p. 147).
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.
100
Amazon Relational Database Service User Guide
Creating a PostgreSQL DB instance
101
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 check box is chosen.
To enter your master password, clear the Auto generate a password check 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 when Easy Create is enabled. If you want to change one
or more settings during database creation, choose Standard Create to set them. The Editable after
database creation column shows which options you can change after database creation. To change
a setting with No in that column, use Standard Create. For settings with Yes in that column, you can
either use Standard Create or modify the DB instance after it's created to change the setting.
11. 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,
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. 256).
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.
102
Amazon Relational Database Service User Guide
Connecting to a PostgreSQL DB instance
This section shows two ways to connect to a PostgreSQL DB instance. The first example uses pgAdmin, a
popular open-source administration and development tool for PostgreSQL. You can download and use
pgAdmin without having a local instance of PostgreSQL on your client computer. The second example
uses psql, a command line utility that is part of a PostgreSQL installation. To use psql, you must have a
PostgreSQL installed on your client computer or have installed the psql client on your machine.
For more information about connecting to a PostgreSQL DB instance, see Connecting to a DB instance
running the PostgreSQL database engine (p. 1460). If you can't connect to your DB instance, see
Troubleshooting connections to your PostgreSQL instance (p. 1463).
Topics
• Using pgAdmin to connect to a PostgreSQL DB instance (p. 103)
• Using psql to connect to a PostgreSQL DB instance (p. 107)
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.
103
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.c6c8dntfzzhgv0.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.
104
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.
105
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.
106
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.
107
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. 1724).
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.
108
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. 1724). Complete the steps in Create a VPC with private and public
subnets (p. 1724), Create additional subnets (p. 1726), Create a VPC security group for a public
web server (p. 1726), and Create a VPC security group for a private DB instance (p. 1727).
Note
A new console interface is available for database creation. Choose either the New Console or
the Original Console instructions based on the console that you are using. The New Console
instructions are open by default.
New console
To create a MySQL 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 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.
109
Amazon Relational Database Service User Guide
Create a DB instance
110
Amazon Relational Database Service User Guide
Create a DB instance
111
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, open Additional connectivity configuration and 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. 1724)
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. 1728)
• Public access – No
• 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. 1727).
Remove other security groups, such as the default security group, by choosing the X associated
with each.
• Database port – 3306
112
Amazon Relational Database Service User Guide
Create a DB instance
11. Open the Additional configuration section, and enter sample for Initial database name. Keep the
default settings for the other options.
12. Choose Create database to create your MySQL DB instance.
Your new DB instance appears in the Databases list with the status Creating.
13. Wait for the Status of your new DB instance to show as Available. Then choose the DB instance
name to show its details.
14. In the Connectivity & security section, view the Endpoint and Port of the DB instance.
113
Amazon Relational Database Service User Guide
Create a DB instance
Note the endpoint and port for your DB instance. You use this information to connect your web
server to your DB instance.
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.
15. Complete Create an EC2 instance and install a web server (p. 119).
Original 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 top-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.
114
Amazon Relational Database Service User Guide
Create a DB instance
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. On the Select engine page, shown following, choose MySQL, and then choose Next.
6. On the Choose use case page, choose Free tier – MySQL, and then choose Next.
7. On the Specify DB details page, shown following, set these values:
115
Amazon Relational Database Service User Guide
Create a DB instance
116
Amazon Relational Database Service User Guide
Create a DB instance
8. Choose Next and set the following values in the Configure advanced settings page:
• 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. 1724)
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. 1728)
• Public accessibility: No
• Availability zone: No Preference
• 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. 1727).
Remove other security groups, such as the default security group, by choosing the X associated
with each.
• Database name: sample
117
Amazon Relational Database Service User Guide
Create a DB instance
118
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.
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.
12. Complete Create an EC2 instance and install a web server (p. 119).
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.
119
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.
120
Amazon Relational Database Service User Guide
Create a web server
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. 1724).
• 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. 1726).
• Auto-assign Public IP: Choose Enable.
121
Amazon Relational Database Service User Guide
Create a web server
122
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.
123
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.
124
Amazon Relational Database Service User Guide
Create a web server
• character_set_server – utf8
• collation_server – utf8_general_ci
The default settings for these parameters cause the database connection to fail. Other
parameter settings might also correct the problem. For more information about setting
parameters, see Working with DB parameter groups (p. 234).
After you reset the parameters, modify your DB instance to use the DB parameter group,
and reboot the DB instance. For more information, see Modifying an Amazon RDS DB
instance (p. 256) and Rebooting a DB instance (p. 282).
125
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.
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. 1724). 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 chkconfig command.
126
Amazon Relational Database Service User Guide
Create a web server
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.
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.
127
Amazon Relational Database Service User Guide
Create a web server
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.
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
128
Amazon Relational Database Service User Guide
Create a web server
if (strlen($employee_name) || strlen($employee_address)) {
AddEmployee($connection, $employee_name, $employee_address);
}
?>
<?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>
129
Amazon Relational Database Service User Guide
Create a web server
mysqli_free_result($result);
mysqli_close($connection);
?>
</body>
</html>
<?php
$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.
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.
130
Amazon Relational Database Service User Guide
Create a web server
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. 330). 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.
131
Amazon Relational Database Service User Guide
Tutorials in this guide
• Tutorial: Create an Amazon VPC for use with a DB instance (p. 1724)
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. 108)
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. 400)
Learn how to log a DB instance stage 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.
• 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.
132
Amazon Relational Database Service User Guide
Tutorials in other AWS guides
• 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.
133
Amazon Relational Database Service User Guide
Amazon RDS basic operational guidelines
Topics
• Amazon RDS basic operational guidelines (p. 134)
• DB instance RAM recommendations (p. 135)
• Using Enhanced Monitoring to identify operating system issues (p. 135)
• Using metrics to identify performance issues (p. 135)
• Best practices for working with MySQL storage engines (p. 140)
• Best practices for working with MariaDB storage engines (p. 141)
• Best practices for working with Oracle (p. 143)
• Best practices for working with PostgreSQL (p. 143)
• Best practices for working with SQL Server (p. 144)
• Working with DB parameter groups (p. 145)
• Amazon RDS new features and best practices presentation video (p. 145)
Note
For common recommendations for Amazon RDS, see Using Amazon RDS
recommendations (p. 413).
• 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. 40).
134
Amazon Relational Database Service User Guide
DB instance RAM recommendations
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. 42).
• 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. 555).
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
135
Amazon Relational Database Service User Guide
Viewing performance metrics
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.
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. 555).
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.
136
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.
137
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 megabytes 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. 546).
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.
138
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. 234).
• 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. 139)
If your queries are tuned and an issue persists, consider upgrading your Amazon RDS DB instance
classes (p. 7) 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.
Go to Optimizing SELECT statements in the MySQL documentation for more information on writing
queries for better performance. You can also go to MySQL performance tuning and optimization
resources for additional query tuning resources.
Go to the Database SQL Tuning Guide in the Oracle documentation for more information on writing and
analyzing queries for better performance.
Go to Analyzing a query in the SQL Server documentation to improve queries for SQL Server DB
instances. You can also use the execution-, index- and I/O-related data management views (DMVs)
described in the Dynamic management views and functions documentation to troubleshoot SQL Server
query issues.
A common aspect of query tuning is creating effective indexes. You can use the Database engine Tuning
Advisor to get potential index improvements for your DB instance. For more information, see Analyzing
your database workload on an Amazon RDS DB instance with SQL Server Tuning Advisor (p. 816).
Go to 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. You
139
Amazon Relational Database Service User Guide
Best practices for working with MySQL storage engines
can also go to Controlling the planner with explicit JOIN clauses to get tips about how to specify joins in
your query for the best performance.
Go to Query optimizations in the MariaDB documentation for more information on writing queries for
better performance.
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. 954).
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.
140
Amazon Relational Database Service User Guide
Storage engine
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.
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. 342) 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
141
Amazon Relational Database Service User Guide
Number of tables
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:
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 (for version 10.2 and higher) and XtraDB (for version 10.0 and 10.1) are the
recommended and supported storage engines 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. 342) 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.
142
Amazon Relational Database Service User Guide
Best practices for working with Oracle
A 2020 AWS virtual workshop included a presentation on running production Oracle databases on
Amazon RDS. A video of the presentation is available here.
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 checkpoint_segments and checkpoint_timeout parameters to reduce
the number of writes to the wal log.
• Disable the synchronous_commit parameter (do not turn off FSYNC).
• 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 Routine vacuuming.
143
Amazon Relational Database Service User Guide
Best practices for working with SQL Server
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
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. The
autovacuum_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 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. 493).
• 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.
144
Amazon Relational Database Service User Guide
Amazon RDS for SQL Server best practices video
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. 333).
145
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. 147)
• Connecting to an Amazon RDS DB instance (p. 168)
• Working with option groups (p. 218)
• Working with DB parameter groups (p. 234)
146
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. 73). For an example that
uses the original console to create a DB instance, see Original console example (p. 163).
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.
147
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:
148
Amazon Relational Database Service User Guide
Creating a DB instance
By default, the new DB instance uses an automatically generated password for the master user.
11. For the remaining sections, specify your DB instance settings. For information about each setting,
see Settings for DB instances (p. 151).
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. 256).
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.
149
Amazon Relational Database Service User Guide
Creating a DB instance
AWS CLI
To create a DB instance by using the AWS CLI, call the create-db-instance command with the following
parameters. This example uses Microsoft SQL Server.
For information about each setting, see Settings for DB instances (p. 151).
• --db-instance-identifier
• --db-instance-class
• --vpc-security-group-ids
• --db-subnet-group
• --engine
• --master-username
• --master-user-password
• --allocated-storage
• --backup-retention-period
Example
For Linux, macOS, or Unix:
For Windows:
RDS API
To create a DB instance by using the Amazon RDS API, call the CreateDBInstance operation with the
following parameters.
150
Amazon Relational Database Service User Guide
Available settings
For information about each setting, see Settings for DB instances (p. 151).
• AllocatedStorage
• BackupRetentionPeriod
• DBInstanceClass
• DBInstanceIdentifier
• VpcSecurityGroupIds
• DBSubnetGroup
• Engine
• MasterUsername
• MasterUserPassword
You can create a DB instance using the console, the create-db-instance CLI command, or the
CreateDBInstance RDS API operation.
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
Auto minor Enable auto minor version upgrade CLI option: All except
version upgrade to enable your DB instance to SQL Server
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
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. 49).
151
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
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.
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.
152
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
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
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.
153
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
EngineVersion
154
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
155
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
StorageEncrypted
MonitoringInterval
MonitoringRoleArn
156
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:
157
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
158
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.
159
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
160
Amazon Relational Database Service User Guide
Available settings
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
161
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. 40). RDS API parameter:
StorageType
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. 653).
Virtual Private This setting depends on the For the CLI and API, you specify the VPC All
Cloud (VPC) platform that you are on. If you are security group IDs.
a new customer to AWS, choose
the default VPC shown. If you are
creating a DB instance on the earlier
E2-Classic platform that doesn't use
a VPC, choose Not in VPC.
162
Amazon Relational Database Service User Guide
Original console example
Console setting Setting description CLI option and RDS API parameter Supported
DB engines
VPC security If you are a new customer to AWS, CLI option: All
group Create new to create a new VPC
security group. Otherwise, Choose --vpc-security-group-ids
existing, then choose from security
groups that you previously created. RDS API parameter:
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.
163
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:
164
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. 151).
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. 151).
165
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.
166
Amazon Relational Database Service User Guide
Original console example
167
Amazon Relational Database Service User Guide
Connecting to a DB instance
Topics
• Finding the connection information for an Amazon RDS DB instance (p. 168)
• Database authentication options (p. 171)
• Encrypted connections (p. 172)
• Scenarios for accessing a DB instance in a VPC (p. 172)
• Connecting to a DB instance that is running a specific DB engine (p. 172)
• Managing connections with RDS Proxy (p. 173)
• Managing connections with Amazon RDS Proxy (p. 173)
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.
168
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.
169
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.
170
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.
For more information, see Database authentication with Amazon RDS (p. 1618).
171
Amazon Relational Database Service User Guide
Encrypted connections
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. 1624).
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. 1733).
• 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. 1707).
172
Amazon Relational Database Service User Guide
Managing connections with 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
• RDS Proxy concepts and terminology (p. 173)
• Planning for and setting up RDS Proxy (p. 177)
• Connecting to a database through RDS Proxy (p. 188)
• Managing an RDS Proxy (p. 190)
• Monitoring RDS Proxy using Amazon CloudWatch (p. 198)
• Endpoints for Amazon RDS Proxy (p. 203)
• Command-line examples for RDS Proxy (p. 209)
• Troubleshooting for RDS Proxy (p. 211)
• Using RDS Proxy with AWS CloudFormation (p. 217)
173
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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. 174)
• Connection pooling (p. 175)
• RDS Proxy security (p. 175)
• Failover (p. 176)
• Transactions (p. 177)
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 form 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.
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. 203).
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.
174
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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 perform 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
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.
175
Amazon Relational Database Service User Guide
Managing connections with RDS 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
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.
176
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
• 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. 196).
177
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
Topics
• Limits for RDS Proxy (p. 178)
• Identifying DB instances, clusters, and applications to use with RDS Proxy (p. 179)
• Setting up network prerequisites (p. 180)
• Setting up database credentials in AWS Secrets Manager (p. 181)
• Setting up AWS Identity and Access Management (IAM) policies (p. 182)
• Creating an RDS Proxy (p. 184)
• Viewing an RDS Proxy (p. 187)
• RDS Proxy is available only in certain AWS Regions only. For more information, see Amazon RDS Proxy.
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. 203).
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.
• You can't use RDS Proxy with Aurora clusters that are part of an Aurora global database.
• Your RDS Proxy must be in the same VPC as the database. The proxy can't be publicly accessible,
although the database can be.
Note
For Aurora DB clusters, you can enable cross-VPC access by creating an additional endpoint
for a proxy and specifying a different VPC, subnets, and security groups with that endpoint.
For more information, see Accessing Aurora and RDS databases across VPCs (p. 204).
• You can't use RDS Proxy with a VPC that has dedicated tenancy.
• 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. 182) 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.
• For RDS for MySQL, RDS Proxy supports MySQL 5.6 and 5.7. For Aurora MySQL, RDS Proxy supports
version 1 (compatible with MySQL 5.6) and version 2 (compatible with MySQL 5.7).
178
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• Currently, all proxies listen on port 3306 for MySQL. The proxies still connect to your database using
the port that you specified in the database settings.
• You can't use RDS Proxy with RDS for MySQL 8.0.
• You can't use RDS Proxy with self-managed MySQL databases in EC2 instances.
• Proxies don't support MySQL compressed mode. For example, they don't support the compression
used by the --compress or -C options of the mysql command.
• Some SQL statements and functions can change the connection state without causing pinning. For the
most current pinning behavior, see Avoiding pinning (p. 196).
• For RDS PostgreSQL, RDS Proxy supports version 10.10 and higher minor versions, and version 11.5
and higher minor versions. For Aurora PostgreSQL, RDS Proxy supports version 10.11 and higher minor
versions, and 11.6 and higher minor versions.
• Currently, all proxies listen on port 5432 for PostgreSQL.
• Query cancellation isn't supported for PostgreSQL.
• The results of the PostgreSQL function lastval aren't always accurate. As a work-around, use the
INSERT statement with the RETURNING clause.
• 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.
• 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. 198).
• 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.
179
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• 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
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.
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.
$ # 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-id 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-id 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.
180
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
subnet_id_4
subnet_id_5
subnet_id_6
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.
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.
181
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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\"}",
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 customer master key (CMK) or your own AWS KMS CMK, 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",
182
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
"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
183
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
"kms:Enable*",
"kms:List*",
"kms:Put*",
"kms:Update*",
"kms:Revoke*",
"kms:Disable*",
"kms:Get*",
"kms:Delete*",
"kms:TagResource",
"kms:UntagResource",
"kms:ScheduleKeyDeletion",
"kms:CancelKeyDeletion"
],
"Resource":"*"
},
{
"Sid":"Allow use of the key",
"Effect":"Allow",
"Principal":{"AWS":"$ROLE_ARN"},
"Action":["kms:Decrypt","kms:DescribeKey"],
"Resource":"*"
}
]
}
"""
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.
184
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• 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. 147) . 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. 195).
• 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. 196).
• 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
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.
• Secrets Manager ARNs. 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.
• Enable enhanced logging. You can enable this setting to troubleshoot proxy compatibility or
performance issues.
185
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
AWS CLI
To create a proxy, use the AWS CLI command create-db-proxy. The --engine-family value is case-
sensitive.
Example
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. 180) for examples of how to find the subnet IDs that you
can use.
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.
186
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
[--target-group-name target_group_name]
[--db-instance-identifiers space_separated_list] # rds db instances, or
[--db-cluster-identifiers cluster_id] # rds db cluster (all instances), or
[--db-cluster-endpoint endpoint_name] # rds db cluster endpoint (all
instances)
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:
187
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
2. To show connection parameters such as the maximum percentage of connections that the proxy can
use, run describe-db-proxy-target-groups --db-proxy-name and use the name of the proxy as the
parameter value.
3. To see the details of the RDS DB instance or Aurora DB cluster associated with the returned target
group, run describe-db-proxy-targets.
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. 188)
• Connecting to a proxy using IAM authentication (p. 189)
• Considerations for connecting to a proxy with PostgreSQL (p. 189)
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.
188
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
"Endpoint": "the-proxy-t3.proxy-demo.us-east-1.rds.amazonaws.com",
"DBProxyName": "the-proxy-t3"
}
]
]
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.
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. 1617).
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.
Important
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. When you use IAM for the connection to a proxy, make sure
that the underlying RDS DB instance or Aurora DB cluster doesn't have IAM enabled.
• 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. 1658).
• In the direct DB IAM auth case, you selectively pick database users and configure them to be identified
with a special auth plugin. You can then connect to those users using IAM auth.
In the proxy use case, you need to provide the proxy with Secrets that contain some user's username
and password (native auth). You then connect to the proxy using IAM auth (by generating an auth
token with the proxy endpoint, not the database endpoint) and using a username which matches one
of the usernames for the secrets you previously 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:
189
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• user
• database
• replication
The startup message can also include the following additional runtime parameters:
• 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. 196). For more information about connecting using
JDBC, see Connecting to the database in the PostgreSQL documentation.
Topics
• Modifying an RDS Proxy (p. 191)
• Adding a new database user (p. 195)
• Changing the password for a database user (p. 195)
• Controlling connection limits and timeouts (p. 195)
• Managing and monitoring connection pooling (p. 195)
• Avoiding pinning (p. 196)
• Deleting an RDS Proxy (p. 198)
190
Amazon Relational Database Service User Guide
Managing connections with 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 do 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.
191
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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
}
]
}
192
Amazon Relational Database Service User Guide
Managing connections with 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,
"RdsResourceId": "instance-4330"
193
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
}
]
}
{
"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.
194
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• Create a new Secrets Manager secret, using the procedure described in Setting up database credentials
in AWS Secrets Manager (p. 181).
• 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. 234). 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 connections used by the connection
pool. 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. For MySQL, 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 for connections that don't go through a proxy. In some cases, the proxy might keep
195
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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 connection to become available for use by your application. This
setting is represented by the Connection borrow timeout option when you create a proxy. 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 writer instance is available because 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.
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.
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:
196
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• If you use SET statements to perform identical initialization for each client connection, you can do so
while preserving transaction-level multiplexing. In this case, you move the statements that set up the
initial session state into the initialization query used by a proxy. This property is a string containing
one or more SQL statements, separated by semicolons.
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. 184).
• 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.
197
Amazon Relational Database Service User Guide
Managing connections with 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. 198).
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.
198
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
Some of these metrics might not be visible until after the first successful connection by a 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.
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 Endpoints for Amazon RDS
Proxy (p. 203).
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.
199
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
The number of
ClientConnectionsSetupFailedAuth 1 minute and above Dimension set
client connection 1 (p. 199), Dimension
attempts that failed set 2 (p. 199)
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. 199), Dimension
successfully established set 2 (p. 199)
with any authentication
mechanism with or
without TLS. The most
useful statistic for this
metric is Sum.
200
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
The time in
DatabaseConnectionsBorrowLatency 1 minute and above Dimension set
microseconds that it 1 (p. 199), Dimension
takes for the proxy set 2 (p. 199)
being monitored
to get a database
connection. The most
useful statistic for this
metric is Average.
The number of
DatabaseConnectionsSetupFailed 1 minute and above Dimension set
database connection 1 (p. 199), Dimension
requests that failed. set 3 (p. 199),
The most useful Dimension set
statistic for this metric 4 (p. 199)
is Sum.
The number of
DatabaseConnectionsSetupSucceeded 1 minute and above Dimension set
database connections 1 (p. 199), Dimension
successfully established set 3 (p. 199),
with or without TLS. Dimension set
The most useful 4 (p. 199)
statistic for this metric
is Sum.
201
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
The maximum
MaxDatabaseConnectionsAllowed 1 minute Dimension set
number of database 1 (p. 199), Dimension
connections allowed. set 3 (p. 199),
This metric is reported Dimension set
every minute. The most 4 (p. 199)
useful statistic for this
metric is Sum.
The time in
QueryDatabaseResponseLatency 1 minute and above Dimension set
microseconds that 1 (p. 199), Dimension
the database took set 2 (p. 199),
to respond to the Dimension set
query. The most useful 3 (p. 199), Dimension
statistic for this metric set 4 (p. 199)
is Average.
202
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
• 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. 203)
• Reader endpoints (p. 204)
• Accessing Aurora and RDS databases across VPCs (p. 204)
• Creating a proxy endpoint (p. 205)
• Viewing proxy endpoints (p. 207)
• Modifying a proxy endpoint (p. 207)
• Deleting a proxy endpoint (p. 208)
• Limits for proxy endpoints (p. 209)
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.
203
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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. Both VPCs must be owned by
the same AWS account.
For information about limits associated with proxy endpoints, see Limits for proxy endpoints (p. 209).
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
or read-only endpoints of a proxy. For more information, see Monitoring RDS Proxy using Amazon
CloudWatch (p. 198).
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 use cross-VPC
capability with RDS Proxy, all the VPCs must be owned by the same AWS account.
To enable cross-VPC access, you create a new endpoint for the proxy. If you aren't familiar with creating
proxy endpoints, see Endpoints for Amazon RDS Proxy (p. 203) 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. )
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. 184).
204
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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. 205).
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 SageMaker 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.
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.
205
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
For more information about cross-VPC access, see Accessing Aurora and RDS databases across
VPCs (p. 204).
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.
AWS CLI
• --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
For Windows:
206
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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 Proxies.
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.
207
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
6. Change the values of the parameters that you want to modify.
7. Choose Save changes.
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 Linux, macOS, or Unix:
For Windows:
RDS API
To modify a proxy endpoint, use the RDS API ModifyDBProxyEndpoint operation.
208
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
Console
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.
To use cross-VPC capability with RDS Proxy, all the VPCs must be owned by the same AWS account.
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.
209
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
Examples
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-id 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>
[1]+ Stopped mysql -h the-proxy.proxy-demo.us-east-1.rds.amazonaws.com -
u admin_user -p
$ aws rds failover-db-cluster --db-cluster-id cluster-56-2019-11-14-1399
JSON output
$ # After a short time, the console shows that the failover operation is complete.
$ # Now instance-9814 is the writer again.
$ fg
mysql -h the-proxy.proxy-demo.us-east-1.rds.amazonaws.com -u admin_user -p
210
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
| Variable_name | Value |
+---------------+---------------+
| hostname | ip-10-1-3-178 |
+---------------+---------------+
1 row in set (0.02 sec)
This example demonstrates how you can adjust the max_connections setting for an Aurora
MySQL DB cluster. To do so, you create your own DB cluster parameter group based on the default
parameter settings for clusters that are compatible with MySQL 5.6 or 5.7. You specify a value for the
max_connections setting, overriding the formula that sets the default value. You associate the DB
cluster parameter group with your DB cluster.
export REGION=us-east-1
export CLUSTER_PARAM_GROUP=rds-proxy-mysql-56-max-connections-demo
export CLUSTER_NAME=rds-proxy-mysql-56
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
Endpoints for Amazon RDS Proxy (p. 203).
211
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
Topics
• Common issues and solutions (p. 212)
• Working with CloudWatch logs for RDS Proxy (p. 216)
• Verifying connectivity for a proxy (p. 216)
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.
authentication
rate limit
exceeded
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.
212
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
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.
213
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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 messaging PostgreSQL psql CLI, use a
protocol. version greater than or equal to
7.4.
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.
214
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
Unknown error. An unknown error occurred. Reach out to AWS Support for us
to investigate the issue.
215
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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.
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.
216
Amazon Relational Database Service User Guide
Managing connections with RDS Proxy
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
}
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
InstanceIdentifiers:
- Fn::ImportValue: DBInstanceName
DependsOn: DBProxy
For more information about the Amazon RDS and Aurora resources that you can create using AWS
CloudFormation, see RDS resource type reference.
217
Amazon Relational Database Service User Guide
Working with option groups
Microsoft SQL Server Options for the Microsoft SQL Server database engine (p. 753)
PostgreSQL PostgreSQL does not use options and option groups. PostgreSQL
uses extensions and modules to provide additional features.
For more information, see Supported PostgreSQL features and
extensions (p. 1587).
To associate an option group with a DB instance, modify the DB instance. For more information, see
Modifying an Amazon RDS DB instance (p. 256).
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.
218
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. 1204) and
Oracle Label Security (p. 1170).
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. 1153) and Oracle Management Agent for Enterprise
Manager Cloud Control (p. 1157).
• Oracle native network encryption (p. 1179) and Oracle Secure Sockets Layer (p. 1185).
219
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. 222). 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. 218).
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.
220
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.
221
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.
222
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.
223
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.
224
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.
225
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
226
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
227
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:
228
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:
229
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.
230
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
If you try to delete an option group that is associated with an Amazon RDS resource, an error similar to
the following is returned.
231
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. 256).
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
232
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
233
Amazon Relational Database Service User Guide
Working with parameter groups
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:
• 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 change the DB parameter group associated with a DB instance, you must manually reboot
the instance before the DB instance can use the new DB parameter group. For more information about
changing the DB parameter group, see Modifying an Amazon RDS DB instance (p. 256).
• 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. 246).
• 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.
234
Amazon Relational Database Service User Guide
Creating a DB parameter group
You can change character set or collation values for an existing database using the ALTER DATABASE
command, for example:
• 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. 245).
Topics
• Creating a DB parameter group (p. 235)
• Associating a DB parameter group with a DB instance (p. 237)
• Modifying parameters in a DB parameter group (p. 238)
• Resetting parameters in a DB parameter group to their default values (p. 240)
• Copying a DB parameter group (p. 242)
• Listing DB parameter groups (p. 244)
• Viewing parameter values for a DB parameter group (p. 245)
• Comparing DB parameter groups (p. 246)
• Specifying DB parameters (p. 246)
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 Parameter groups.
3. Choose Create parameter group.
235
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.
• DBParameterGroupName
• DBParameterGroupFamily
• Description
236
Amazon Relational Database Service User Guide
Associating a DB parameter group with a DB instance
For information about creating a DB parameter group, see Creating a DB parameter group (p. 235).
For information about creating a DB instance, see Creating an Amazon RDS DB instance (p. 147). For
information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 256).
Note
When you change the DB parameter group associated with a DB instance, you must manually
reboot the instance before the DB instance can use the new DB parameter group.
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. 257).
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-
immediately to apply the changes during the next maintenance window. For more information, see
Using the Apply Immediately setting (p. 257).
Example
237
Amazon Relational Database Service User Guide
Modifying parameters in a DB parameter group
--db-parameter-group-name mydbpg \
--apply-immediately
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.
238
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
239
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.
240
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.
241
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.
242
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:
243
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.
244
Amazon Relational Database Service User Guide
Viewing parameter values for a DB parameter group
--db-parameter-group-name mydbparamgroup1
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.
245
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. 247).
For the PostgreSQL engine, you can use an expression to specify a Boolean DB parameter. See Boolean
DB parameter expressions (p. 249).
Contents
246
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. 1105).
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.
247
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. 1105).
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.
248
Amazon Relational Database Service User Guide
Specifying DB parameters
SUM
Syntax
SUM(argument1, argument2,...argumentn)
Returns an integer.
Syntax
Syntax
Syntax
Syntax
Syntax
249
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. 247).
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)
250
Amazon Relational Database Service User Guide
Topics
• Stopping an Amazon RDS DB instance temporarily (p. 252)
• Starting an Amazon RDS DB instance that was previously stopped (p. 255)
• Modifying an Amazon RDS DB instance (p. 256)
• Maintaining a DB instance (p. 270)
• Upgrading a DB instance engine version (p. 277)
• Renaming a DB instance (p. 280)
• Rebooting a DB instance (p. 282)
• Working with read replicas (p. 284)
• Tagging Amazon RDS resources (p. 305)
• Working with Amazon Resource Names (ARNs) in Amazon RDS (p. 315)
• Working with storage for Amazon RDS DB instances (p. 322)
• Deleting a DB instance (p. 330)
251
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
252
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.
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 changes 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.
AWS CLI
To stop a DB instance by using the AWS CLI, call the stop-db-instance command with the following
option:
253
Amazon Relational Database Service User Guide
Stopping a DB instance
Example
RDS API
To stop a DB instance by using the Amazon RDS API, call the StopDBInstance operation with the
following parameter:
254
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:
255
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 an outage 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. 257).
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 an outage in some cases. For more information, see Using the Apply Immediately
setting (p. 257).
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. 257).
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. 257).
256
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. 257).
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 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. 257).
You can modify a DB instance using the console, the modify-db-instance CLI command, or the
ModifyDBInstance RDS API operation.
257
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 An outage doesn't Only
immediately. This occur during this MariaDB,
Yes to enable your DB instance --auto-minor- setting ignores the change. MySQL,
to receive preferred minor version- apply immediately Oracle,
DB engine version upgrades upgrade|--no- setting. and
automatically when they auto-minor- PostgreSQL
become available. Amazon version-upgrade
RDS performs automatic
minor version upgrades in RDS API parameter:
the maintenance window.
Otherwise, No. AutoMinorVersionUpgrade
Backup retention period CLI option: If you choose to An outage occurs if All DB
apply the change you change from 0 engines
to a nonzero value,
258
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
The number of days that --backup- immediately, it or from a nonzero
automatic backups are retained. retention-period occurs immediately. value to 0.
To disable automatic backups,
set the backup retention period RDS API parameter:If you don't choose This applies to both
to 0. to apply the change Single-AZ and Multi-
BackupRetentionPeriod
immediately, AZ DB instances.
For more information, see and you change
Working with backups (p. 334). the setting
from a nonzero
Note
value to another
If you use AWS Backup
nonzero value, the
to manage your
change is applied
backups, this option
asynchronously, as
doesn't appear. For
soon as possible.
information about AWS
Otherwise, the
Backup, see the AWS
change occurs
Backup Developer Guide.
during the next
maintenance
window.
259
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 An outage 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. 305).
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.
For more information, see DB RDS API parameter: If you don't choose
instance classes (p. 7). to apply the change
DBInstanceClass immediately, it
occurs during the
next maintenance
window.
260
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
Working with
DB parameter
groups (p. 234) and
Rebooting a DB
instance (p. 282).
Deletion protection CLI option: The change occurs An outage 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. 330).
DeletionProtection
Enhanced Monitoring CLI option: The change occurs An outage 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
261
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
Kerberos authentication CLI option: If you choose to A brief outage occurs Only
apply the change during this change. Microsoft
Choose the Active Directory to --domain and -- immediately, it SQL
move the DB instance to. The domain-iam-role- occurs immediately. Server,
directory must exist prior to name MySQL,
this operation. If a directory is If you don't choose Oracle,
already selected, you can specify RDS API parameter: to apply the change and
None to remove the DB instance immediately, it PostgreSQL
from its current directory. Domain and occurs during the
DomainIAMRoleName next maintenance
For more information, window.
see Kerberos
authentication (p. 1619).
Log exports CLI option: The change occurs An outage 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. 512).
262
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
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 an outage, 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 an outage
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.
New master password CLI option: The change An outage 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
263
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 CLI option: The change occurs An outage 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.
Performance Insights Master CLI option: The change occurs An outage 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 customer master key (CMK) key-id setting.
for encryption of Performance
Insights data. The key identifier RDS API parameter:
is the Amazon Resource Name
(ARN), AWS KMS key identifier, PerformanceInsightsKMSKeyId
or the key alias for the CMK.
Performance Insights Retention CLI option: The change occurs An outage 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:
264
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
ProcessorFeatures
and
UseDefaultProcessorFeatures
265
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 An outage 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. 1733).
266
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 An outage 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
267
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
268
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
269
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. 256).
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.
270
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. 274).
271
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.
272
Amazon Relational Database Service User Guide
Maintenance for Multi-AZ deployments
Example
For Linux, macOS, or Unix:
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 Linux, macOS, or Unix:
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.
273
Amazon Relational Database Service User Guide
The maintenance window
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 High availability (Multi-AZ) for Amazon RDS (p. 53).
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.
274
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.
275
Amazon Relational Database Service User Guide
Adjusting the maintenance window for a DB instance
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
276
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. 277)
• Automatically upgrading the minor engine version (p. 279)
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.
277
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:
278
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. 270).
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.
279
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. 291).
280
Amazon Relational Database Service User Guide
Renaming to replace an existing DB instance
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. 256).
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:
281
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. 234).
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 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 High availability
(Multi-AZ) for Amazon RDS (p. 53).
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 is not 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.
282
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.
283
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
284
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. 1122).
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. 296).
You can configure a read replica for a DB instance that also has a standby replica configured for high
availability. 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 High availability (Multi-AZ) for
Amazon RDS (p. 53).
285
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
286
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. 330). For information about read replica promotion,
see Promoting a read replica to be a standalone DB instance (p. 291). If you have cross-Region read
replicas, see Cross-Region replication considerations (p. 301) for considerations related to deleting the
source 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
logs on the source the slowest
287
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.
288
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. For
MySQL DB instances, automatic backups are supported only for read replicas running MySQL 5.6 and
later, but not for MySQL versions 5.5. 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)
289
Amazon Relational Database Service User Guide
Creating a read replica
ranges can overlap between the replica and the RDS system. CIDR overlap makes the 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. 1714).
You can't create a read replica in a different AWS account from the source DB instance.
Console
To create a read replica from a source 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 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. 1620).
9. Choose other options, such as storage autoscaling.
10. Choose Create read replica.
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:
290
Amazon Relational Database Service User Guide
Promoting a read replica
--db-instance-identifier myreadreplica ^
--source-db-instance-identifier mydbinstance ^
--max-allocated-storage 1000
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
291
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
292
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. 256) and High availability (Multi-AZ) for Amazon
RDS (p. 53).
293
Amazon Relational Database Service User Guide
Monitoring read replication
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 Amazon RDS console, choose Databases.
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.
294
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. 912).
• 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. 969) 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. 969) stored procedure and replication is stopped because the
stop point was reached.
295
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
For MySQL and MariaDB, the ReplicaLag metric reports the value of the Seconds_Behind_Master
field of the SHOW SLAVE 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.
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. 546).
296
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.
4. For Actions, choose Create read replica.
297
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. 1620).
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. 315).
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. The AWS Region specified in
source-db-instance-identifier must match the AWS Region specified in --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.
298
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
--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 for the customer master key (CMK) 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
create an encrypted read replica in another AWS Region, you must specify a value for PreSignedURL.
299
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
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. 315).
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=arn:aws: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>
is the identifier of the source instance, and <timestamp> is the date and time the copy started.
300
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
For information about replication lag time, see Monitoring read replication (p. 294).
• You can only replicate between AWS Regions when using the following Amazon RDS DB instances:
• MariaDB (all versions).
• MySQL version 5.6 and later.
• Oracle Enterprise Edition (EE) engine version 12.1.0.2.v10 and higher 12.1 versions, and all versions
of 12.2, 18c, and 19c.
An Active Data Guard license is required. For information about limitations for Oracle cross-Region
read replicas, see Replica requirements for Oracle (p. 1122).
• 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.
• You can create a cross-Region read replica:
• In a VPC from a source DB instance that is in a VPC in another AWS Region
• In a VPC from a source DB instance that isn't in a VPC
• That isn't in a VPC from a source DB instance that is in a 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 for the specified DB engine.
• The read replica uses the default security group.
301
Amazon Relational Database Service User Guide
Creating a read replica in a different AWS Region
• For MariaDB, MySQL, and Oracle DB instances, when the source for a cross-Region read replica is
deleted, the read replica is promoted.
• For PostgreSQL DB instances, when the source 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"
]
302
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.
303
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.
304
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. 305)
• Using tags for access control with IAM (p. 306)
• Using tags to produce detailed billing reports (p. 306)
• Adding, listing, and removing tags (p. 306)
• Using the AWS Tag Editor (p. 309)
• Copying tags to DB instance snapshots (p. 309)
• Tutorial: Use tags to specify which DB instances to stop (p. 310)
• Using tags to enable backups in AWS Backup (p. 312)
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
305
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. 315).
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. 1634).
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 Cost Allocation and Tagging in
About AWS Billing and Cost Management.
Note
You can add a tag to a snapshot, however, your bill will not reflect this grouping.
306
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.
307
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. 315).
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. 315).
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.
308
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 "rds:" or "aws:".
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 "rds:" or
"aws:". 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
309
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 \
310
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.
311
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:
312
Amazon Relational Database Service User Guide
Enabling backups
CLI
To assign a tag to a DB instance
For Windows:
For Windows:
313
Amazon Relational Database Service User Guide
Enabling backups
{
"TagList": [
{
"Key": "BackupPlan",
"Value": "Test"
}
]
}
314
Amazon Relational Database Service User Guide
Working with ARNs
arn:aws:rds:<region>:<account number>:<resourcetype>:<name>
315
Amazon Relational Database Service User Guide
Constructing an ARN
316
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:
arn:aws:rds:us-east-2:123456789012:snapshot:rds:my-mysql-
db-2019-07-22-07-23
For example:
317
Amazon Relational Database Service User Guide
Getting an existing ARN
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.
318
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
319
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
320
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
321
Amazon Relational Database Service User Guide
Working with storage
Topics
• Increasing DB instance storage capacity (p. 322)
• Managing capacity automatically with Amazon RDS storage autoscaling (p. 323)
• Modifying SSD storage settings for Provisioned IOPS (p. 328)
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.
In most cases, scaling storage doesn't require any outage and doesn't degrade performance of the
server. After you modify the storage size for a DB instance, the status of the DB instance is storage-
optimization. The DB instance is fully operational after a storage modification.
Note
You can't make further storage modifications until six (6) hours after storage optimization has
completed on the instance.
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
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.
322
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
AWS CLI
To increase the storage for a DB instance, use the AWS CLI command modify-db-instance. Set the
following parameters:
For more information about storage, see Amazon RDS DB instance storage (p. 40).
For more information about storage, see Amazon RDS DB instance storage (p. 40).
323
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.
• Autoscaling doesn't occur if the maximum storage threshold would be exceeded by the storage
increment.
• Autoscaling can't completely prevent storage-full situations for large data loads, because further
storage modifications can't be made until six hours after storage optimization has completed on the
instance. 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.
• Autoscaling operations aren't logged by AWS CloudTrail. For more information on CloudTrail, see
Working with AWS CloudTrail and Amazon RDS (p. 564).
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.
324
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
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. 73).
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. 73).
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. 40).
To enable storage autoscaling for a new DB instance, use the Amazon RDS API operation
CreateDBInstance. Set the following parameter:
• 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
325
Amazon Relational Database Service User Guide
Managing capacity automatically with storage autoscaling
For more information about storage, see Amazon RDS DB instance storage (p. 40).
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. 256).
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. 40).
326
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. 40).
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. 256).
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. 40).
To turn off storage autoscaling for a DB instance, use the Amazon RDS API operation
ModifyDBInstance. Set the following parameter:
For more information about storage, see Amazon RDS DB instance storage (p. 40).
327
Amazon Relational Database Service User Guide
Modifying Provisioned IOPS
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. The DB instance is fully operational after a storage modification.
Note
You can't make further storage modifications until six (6) hours after storage optimization has
completed on the instance.
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.
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. 40).
328
Amazon Relational Database Service User Guide
Modifying Provisioned IOPS
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:
329
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 the DB instance that you want to delete has a read replica, you should either promote the read replica
or delete it. For more information, see Promoting a read replica to be a standalone DB instance (p. 291).
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. 1624).
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.
330
Amazon Relational Database Service User Guide
Deleting a DB instance
• To delete a retained automated backup, follow the instructions in Deleting retained automated
backups (p. 339).
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. 352).
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. 330).
You can disable deletion protection by modifying the DB instance. For more information, see
Modifying an Amazon RDS DB instance (p. 256).
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
• --final-db-snapshot-identifier or --skip-final-snapshot
331
Amazon Relational Database Service User Guide
Deleting a DB instance
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
332
Amazon Relational Database Service User Guide
Topics
• Working with backups (p. 334)
• Replicating automated backups to another AWS Region (p. 344)
• Creating a DB snapshot (p. 352)
• Restoring from a DB snapshot (p. 355)
• Copying a snapshot (p. 358)
• Sharing a DB snapshot (p. 371)
• Exporting DB snapshot data to Amazon S3 (p. 379)
• Restoring a DB instance to a specified time (p. 395)
• Deleting a snapshot (p. 398)
• Tutorial: Restore a DB instance from a DB snapshot (p. 400)
333
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. 352).
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. 358). For more information
about sharing a DB snapshot, see Sharing a DB snapshot (p. 371).
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
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
334
Amazon Relational Database Service User Guide
Backup window
taken from the standby. For SQL Server, I/O activity is suspended briefly during backup for Multi-AZ
deployments.
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.
335
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/.
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.
336
Amazon Relational Database Service User Guide
Retaining automated backups
• --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
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. 338)
• Viewing retained backups (p. 338)
• Restoration (p. 338)
• Retention costs (p. 338)
• Limitations and recommendations (p. 339)
337
Amazon Relational Database Service User Guide
Retaining automated backups
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.
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 one of the following commands:
or
To describe your retained automated backups using the RDS API, call the
DescribeDBInstanceAutomatedBackups action with one of the following parameters:
• DBInstanceIdentifier
• DbiResourceId
Restoration
For information on restoring DB instances from automated backups, see Restoring a DB instance to a
specified time (p. 395).
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.
338
Amazon Relational Database Service User Guide
Deleting retained automated backups
• 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.
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:
339
Amazon Relational Database Service User Guide
Disabling automated backups
--dbi-resource-id db-123ABCEXAMPLE
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.
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
340
Amazon Relational Database Service User Guide
Using AWS Backup
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
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. 312).
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:AWS-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.
341
Amazon Relational Database Service User Guide
Unsupported MySQL storage engines
• 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).
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. 352).
• 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/.
342
Amazon Relational Database Service User Guide
Unsupported MariaDB storage engines
• 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.
343
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:
You can use the describe-source-regions CLI command to list the source AWS Regions that can
replicate automated backups to a particular destination Region. For more information, see Finding
information about replicated backups (p. 345).
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. 151).
• 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.
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. Choose Save.
344
Amazon Relational Database Service User Guide
Finding information about replicated backups
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.
For Windows:
RDS API
Enable backup replication by using the StartDBInstanceAutomatedBackupsReplication RDS API
operation with the following parameters:
• Region
• SourceDBInstanceArn
• BackupRetentionPeriod
• 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.
345
Amazon Relational Database Service User Guide
Finding information about replicated backups
The output shows that backups can be replicated from Asia Pacific (Tokyo), but not from Asia Pacific
(Seoul), into US West (Oregon).
{
"SourceRegions": [
{
"RegionName": "ap-northeast-1",
"Endpoint": "https://rds.ap-northeast-1.amazonaws.com",
"Status": "available",
"SupportsDBInstanceAutomatedBackupsReplication": true
},
{
"RegionName": "ap-northeast-2",
"Endpoint": "https://rds.ap-northeast-2.amazonaws.com",
"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"}]
}
]
}
346
Amazon Relational Database Service User Guide
Finding information about replicated backups
For Windows:
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:
347
Amazon Relational Database Service User Guide
Point-in-time recovery from a replicated backup
--db-instance-automated-backups-arn "arn:aws:rds:us-east-1:123456789012:auto-backup:ab-
L2IJCEXJP7XQ7HOJ4SIEXAMPLE"
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,
"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. 395).
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.
348
Amazon Relational Database Service User Guide
Stopping backup replication
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.
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/.
349
Amazon Relational Database Service User Guide
Deleting replicated backups
Replicated backups are listed on the Retained tab of the Automated backups page in the destination
Region.
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.
350
Amazon Relational Database Service User Guide
Deleting replicated backups
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.
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. 345).
For Windows:
RDS API
Delete replicated backups by using the DeleteDbInstanceAutomatedBackup RDS API operation with
the DbInstanceAutomatedBackupsArn parameter.
351
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. 143).
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. 379).
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.
352
Amazon Relational Database Service User Guide
Creating a DB snapshot
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:
353
Amazon Relational Database Service User Guide
Creating a DB snapshot
• DBInstanceIdentifier
• DBSnapshotIdentifier
354
Amazon Relational Database Service User Guide
Restoring from a DB snapshot
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.
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. 358).
• 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
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. 256).
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
355
Amazon Relational Database Service User Guide
Microsoft SQL Server
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 is not supported by restoring a snapshot,
you can try using the native backup and restore feature. SQL Server verifies whether or not 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. 678).
Oracle considerations
If you use Oracle GoldenGate, always retain the parameter group with the compatible parameter.
When you restore a DB instance from a DB snapshot, you must specify the parameter group that has a
matching or greater compatible parameter value.
You can upgrade a DB snapshot while it is still a DB snapshot, before you restore it. For more
information, see Upgrading an Oracle DB snapshot (p. 1220).
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 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.
356
Amazon Relational Database Service User Guide
Restoring from a snapshot
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
357
Amazon Relational Database Service User Guide
Copying a snapshot
Copying a snapshot
With Amazon RDS, you can copy automated or manual DB snapshots. After you copy a snapshot, the
copy is a manual snapshot.
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 snapshots in several situations:
If you want to keep an automated snapshot 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 AWS KMS key as the initial full snapshot. If you use a
358
Amazon Relational Database Service User Guide
Handling encryption
different KMS key to encrypt subsequent snapshots when copying them, those shared snapshots
are full snapshots.
Handling encryption
You can copy a snapshot that has been encrypted using an AWS KMS customer master key (CMK). 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 AWS KMS CMK as the
original snapshot. Or you can specify a different CMK. If you copy an encrypted snapshot across Regions,
you can't use the same AWS KMS CMK for the copy as used for the source snapshot. This is because AWS
KMS CMKs are Region-specific. Instead, you must specify an AWS KMS CMK 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. 1622).
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 an AWS KMS CMK 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:
For shared snapshots, copying incremental snapshots across AWS accounts is only supported when
they're unencrypted.
For information on copying incremental snapshots across AWS Regions, see Full and incremental
copies (p. 362).
359
Amazon Relational Database Service User Guide
Cross-Region copying
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",
"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",
360
Amazon Relational Database Service User Guide
Cross-Region copying
"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"
}
}
},
{
"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.
361
Amazon Relational Database Service User Guide
Option groups
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
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.
362
Amazon Relational Database Service User Guide
Parameter groups
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.
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. 358)
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.
363
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.
364
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.
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. 362).
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 Master key, specify the AWS 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.
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. 362).
365
Amazon Relational Database Service User Guide
Copying a DB snapshot
• --kms-key-id – The AWS KMS key identifier for an encrypted DB snapshot. The AWS KMS key
identifier is the Amazon Resource Name (ARN), key identifier, or key alias for the AWS KMS CMK.
• 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 AWS KMS CMK. If you don't specify a value for this
parameter, then the copy of the DB snapshot is encrypted with the same AWS KMS CMK 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 an AWS KMS
CMK for the destination AWS Region. AWS KMS CMKs 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:
366
Amazon Relational Database Service User Guide
Copying a DB snapshot
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. 362).
• KmsKeyId – The AWS KMS key identifier for an encrypted DB snapshot. The AWS KMS key identifier is
the Amazon Resource Name (ARN), key identifier, or key alias for the AWS KMS CMK.
367
Amazon Relational Database Service User Guide
Copying a DB snapshot
• 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 AWS KMS CMK. If you don't specify a value for this
parameter, then the copy of the DB snapshot is encrypted with the same AWS KMS CMK 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 an AWS KMS
CMK for the destination AWS Region. AWS KMS CMKs 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 AWS 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
&SourceDBSnapshotIdentifier=mysql-instance1-snapshot-20130805
368
Amazon Relational Database Service User Guide
Copying a DB snapshot
&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
&X-Amz-Date=20161117T221704Z
369
Amazon Relational Database Service User Guide
Copying a DB snapshot
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=da4f2da66739d2e722c85fcfd225dc27bba7e2b8dbea8d8612434378e52adccf
370
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. 358). For more information on
restoring a DB instance from a DB snapshot, see Restoring from a DB snapshot (p. 355).
You can share a manual snapshot with up to 20 other AWS accounts. You can also share an unencrypted
manual snapshot as public, which makes the snapshot available to all AWS accounts. Take care when
sharing a snapshot as public so that none of your private information is included in any of your public
snapshots.
You can use the following AWS CLI command (Unix only) to find the public snapshots for your AWS
account in a particular AWS Region:
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.
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 cannot 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 cannot be removed from an option group. Option groups with persistent options
cannot 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.
371
Amazon Relational Database Service User Guide
Sharing an encrypted snapshot
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. 1204) and
Oracle Label Security (p. 1170).
1. Share the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to
encrypt the snapshot with any accounts that you want to be able to access the snapshot.
You can share AWS KMS CMKs with another AWS account by adding the other account to the AWS
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 customer master key
(CMK) (p. 372) 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.
After you have given an AWS account access to your AWS KMS CMK, to copy your encrypted snapshot,
that AWS account must create an AWS Identity and Access Management (IAM) user if it doesn't already
have one. In addition, that AWS account must also attach an IAM policy to that IAM user that allows the
IAM user to copy an encrypted DB snapshot using your AWS KMS CMK. The account must be an IAM user
and cannot be a root AWS account identity due to AWS KMS security restrictions.
372
Amazon Relational Database Service User Guide
Sharing an encrypted snapshot
In the following key policy example, user 111122223333 is the owner of the AWS KMS CMK, and user
444455556666 is the account that the key is being shared with. This updated key policy gives the AWS
account access to the AWS KMS CMK 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",
"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 AWS KMS CMK c989c1dd-a3f2-4a5d-8d96-e793d082ab26 in the
us-west-2 region.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUseOfTheKey",
"Effect": "Allow",
373
Amazon Relational Database Service User Guide
Sharing a snapshot
"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"
],
"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.
374
Amazon Relational Database Service User Guide
Sharing a snapshot
• 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.
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.
375
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:
376
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.
377
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.
378
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 in your account. 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.
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.
10.1.26 and higher 5.6.40 and higher 9.6.6–9.6.9, 9.6.12 and higher
For complete lists of engine versions supported by Amazon RDS, see the following:
Topics
• Limitations (p. 380)
• Overview of exporting snapshot data (p. 380)
• Setting up access to an Amazon S3 bucket (p. 380)
• Exporting a snapshot to an Amazon S3 bucket (p. 383)
• Monitoring snapshot exports (p. 385)
• Canceling a snapshot export task (p. 386)
• Troubleshooting PostgreSQL permissions errors (p. 387)
• File naming convention (p. 388)
• Data conversion when exporting to an Amazon S3 bucket (p. 388)
379
Amazon Relational Database Service User Guide
Limitations
Limitations
Exporting DB snapshot data to 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 huge value 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. 381).
b. Create an AWS Key Management Service (AWS KMS) customer master key (CMK) for the
server-side encryption. The AWS KMS CMK 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. 1620).
c. 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. 381).
3. 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. 383).
4. To access your exported data in the Amazon S3 bucket, see Uploading, downloading, and managing
objects in the Amazon Simple Storage Service Console User Guide.
380
Amazon Relational Database Service User Guide
Setting up access to an S3 bucket
Topics
• Identifying the Amazon S3 bucket for export (p. 381)
• Providing access to an Amazon S3 bucket using an IAM role (p. 381)
For more information about working with Amazon S3 buckets, see the following in the Amazon Simple
Storage Service Console 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. 383).
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
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/*
381
Amazon Relational Database Service User Guide
Setting up access to an 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. 1654). 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.
382
Amazon Relational Database Service User Guide
Exporting a snapshot to an S3 bucket
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.
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.
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.
383
Amazon Relational Database Service User Guide
Exporting a snapshot to an S3 bucket
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. 381), 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 Master key, enter the ARN for the key to use for encrypting the exported data.
11. Choose Export to Amazon S3.
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": "master_key",
384
Amazon Relational Database Service User Guide
Monitoring snapshot exports
"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
• 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",
385
Amazon Relational Database Service User Guide
Canceling a snapshot export
"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",
"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. 493).
386
Amazon Relational Database Service User Guide
Troubleshooting PostgreSQL permissions errors
Note
Canceling a snapshot export task doesn't remove any data that was exported to Amazon S3. For
information about how to delete the data using the console, see How do I delete objects from
an S3 bucket? To delete the data using the CLI, use the delete-object command.
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.
6. Choose Cancel export task on the confirmation page.
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.
For more information on superuser privileges, see Master user account privileges (p. 1699).
387
Amazon Relational Database Service User Guide
File naming convention
export_identifier/database_name/schema_name.table_name/
For example:
export-1234567890123-459/rdststdb/rdststdb.DataInsert_7ADB5D19965123A2/
• part-partition_index-random_uuid.format-based_extension
• partition_index/part-00000-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
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
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.
388
Amazon Relational Database Service User Guide
Data conversion
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. 389)
• PostgreSQL data type mapping to Parquet (p. 391)
Source data type Parquet primitive type Logical type Conversion notes
annotation
BIGINT INT64
BIT BYTE_ARRAY
DOUBLE DOUBLE
FLOAT DOUBLE
389
Amazon Relational Database Service User Guide
Data conversion
Source data type Parquet primitive type Logical type Conversion notes
annotation
INT INT32
MEDIUMINT INT32
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
390
Amazon Relational Database Service User Guide
Data conversion
Source data type Parquet primitive type Logical type Conversion notes
annotation
TINYBLOB BYTE_ARRAY
VARBINARY BYTE_ARRAY
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
391
Amazon Relational Database Service User Guide
Data conversion
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
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
392
Amazon Relational Database Service User Guide
Data conversion
PostgreSQL data type Parquet primitive type Logical type Mapping notes
annotation
BOOLEAN BOOLEAN
393
Amazon Relational Database Service User Guide
Data conversion
PostgreSQL data type Parquet primitive type Logical type Mapping notes
annotation
394
Amazon Relational Database Service User Guide
Point-in-time recovery
When you restore a DB instance to a point in time, the default DB security group is applied to the new
DB instance. If you need custom DB security groups applied to your DB instance, you must apply them
explicitly using the AWS Management Console, the AWS CLI modify-db-instance command, or the
Amazon RDS API ModifyDBInstance operation after the DB instance is available.
Restored DB instances are automatically associated with the default 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
395
Amazon Relational Database Service User Guide
Point-in-time recovery
might not be possible to restore a SQL Server DB instance to a point in time if there is a break in the
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.
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:
396
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
397
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. 256).
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. 334).
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
398
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.
399
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. 1707).
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.
400
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. 352).
• 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. 218).
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.
401
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.
402
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. 1707) for more information.
You can also remove a security group by choosing the X associated with it.
403
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.
404
Amazon Relational Database Service User Guide
Topics
• Overview of monitoring Amazon RDS (p. 406)
• DB instance status (p. 410)
• Using Amazon RDS recommendations (p. 413)
• Using Performance Insights on Amazon RDS (p. 418)
• Using Enhanced Monitoring (p. 477)
• Using Amazon RDS event notification (p. 493)
• Viewing Amazon RDS events (p. 509)
• Accessing Amazon RDS database log files (p. 510)
• Monitoring Amazon RDS metrics with Amazon CloudWatch (p. 546)
• Publishing database engine logs to Amazon CloudWatch Logs (p. 554)
• Getting CloudWatch Events and Amazon EventBridge events for Amazon RDS (p. 558)
• Working with AWS CloudTrail and Amazon RDS (p. 564)
405
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
406
Amazon Relational Database Service User Guide
Monitoring tools
user connections for your DB instance varies based on your instance class and the complexity of the
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. 234).
• 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 Using
Amazon RDS recommendations (p. 413).
• Amazon RDS Performance Insights — Assess the load on your database, and determine when and
where to take action. For more information, see Using Performance Insights on Amazon RDS (p. 418).
• Amazon RDS Enhanced Monitoring — Look at metrics in real time for the operating system. For more
information, see Using Enhanced Monitoring (p. 477).
• 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. 493).
• 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 Accessing Amazon RDS database log files (p. 510).
• 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
407
Amazon Relational Database Service User Guide
Monitoring tools
in CloudWatch. For more information, see Monitoring Amazon RDS metrics with Amazon
CloudWatch (p. 546).
• 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. 546).
• 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 Getting CloudWatch Events and Amazon EventBridge
events for Amazon RDS (p. 558).
• 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. 564).
• 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
408
Amazon Relational Database Service User Guide
Monitoring tools
409
Amazon Relational Database Service User Guide
DB instance status
DB instance status
The status of a DB instance indicates the health of the DB instance. You can view the status of a DB
instance by using the Amazon RDS console, the AWS CLI command describe-db-instances, or the API
operation DescribeDBInstances.
Note
Amazon RDS also uses another status called maintenance status, which is shown in the
Maintenance column of the Amazon RDS console. This value indicates the status of any
maintenance patches that need to be applied to a DB instance. Maintenance status is
independent of DB instance status. For more information on maintenance status, see Applying
updates for a DB instance (p. 272).
Find the possible status values for DB instances in the following table, which also shows how you are
billed for each status. It shows if 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.
backtracking Billed The DB instance is currently being backtracked. This status only
applies to Aurora MySQL.
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 customer master key (CMK) used to encrypt or
encryption-credentials billed decrypt the DB instance can't be accessed.
410
Amazon Relational Database Service User Guide
DB instance status
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
option group contains an option such as TDE and the DB instance
doesn't contain encrypted information.
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.
411
Amazon Relational Database Service User Guide
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.
412
Amazon Relational Database Service User Guide
Using 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. 334)
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.
413
Amazon Relational Database Service User Guide
Using 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. 234)
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. 525)
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.
414
Amazon Relational Database Service User Guide
Responding to 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.
415
Amazon Relational Database Service User Guide
Responding to 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.
416
Amazon Relational Database Service User Guide
Responding to recommendations
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. 256).
Note
When you choose Apply now, a brief DB instance outage might result.
417
Amazon Relational Database Service User Guide
Using Performance Insights
Topics
• Overview of Performance Insights (p. 418)
• Enabling and disabling Performance Insights (p. 421)
• Accessing Performance Insights (p. 425)
• Monitoring with the Performance Insights dashboard (p. 427)
• Customizing the Performance Insights dashboard (p. 450)
• Retrieving data with the Performance Insights API (p. 460)
• Performance Insights metrics published to Amazon CloudWatch (p. 473)
• Logging Performance Insights calls by using AWS CloudTrail (p. 474)
Topics
• DB load (p. 418)
• Maximum CPU (p. 420)
• Supported DB engines for Performance Insights (p. 420)
DB load
The central metric for Performance Insights is DB Load. The DB Load metric is collected every second.
Active Sessions
An active session is a connection that has submitted work to the DB engine and is waiting for a response.
The DB load represents the average active sessions (AAS) for the DB engine. For example, if you submit a
SQL query to the DB engine, the database session is active while the engine is processing the query.
To obtain the AAS, 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
418
Amazon Relational Database Service User Guide
Overview
5 4 2 10 sessions / 5 samples
Related to AAS is the average active executions (AAE) per second. To calculate the AAE, Performance
Insights divides the total execution time of a query by the time interval. The following table shows the
AAE calculation for the same query in the preceding table.
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 has subcomponents called dimensions. You can think of dimensions as categories
for 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
419
Amazon Relational Database Service User Guide
Overview
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 load is often above the Max vCPU line, and the primary wait state is CPU, the system CPU is
overloaded. In these cases, 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 load doesn't cross the Max vCPU line.
Amazon Aurora MySQL- 2.04.2 and higher 2.x versions (compatible with MySQL 5.7), and 1.17.3
Compatible Edition and higher 1.x versions (compatible with MySQL 5.6).
Amazon RDS for MariaDB All 10.5 versions, all 10.4 versions, 10.3.13 and higher 10.3 versions,
and 10.2.21 and higher 10.2 versions.
Not supported for MariaDB version 10.0 or 10.1. Not supported for
MariaDB version 10.3.13 DB instances in the Europe (Frankfurt) and
Europe (Stockholm) AWS Regions. Not supported on the following DB
instance classes: db.t2.micro, db.t2.small, db.t3.micro, and db.t3.small.
Amazon RDS for MySQL 8.0.17 and higher 8.0 versions, version 5.7.22 and higher 5.7 versions,
and version 5.6.41 and higher 5.6 versions.
420
Amazon Relational Database Service User Guide
Enabling and Disabling Performance Insights
Amazon RDS for Microsoft All versions except SQL Server 2008.
SQL Server
Amazon RDS for PostgreSQL Versions 10, 11, 12, and 13.
Note
Amazon RDS Performance Insights isn't supported in the Middle East (Bahrain) Region, Africa
(Cape Town) Region, or in AWS GovCloud (US) Regions.
Important
This guide describes using Amazon RDS Performance Insights with non-Aurora DB engines. For
information about using Amazon RDS Performance Insights with Amazon Aurora, see the Using
Amazon RDS Performance Insights in the Amazon Aurora User Guide.
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. 147).
421
Amazon Relational Database Service User Guide
Enabling and Disabling 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.
• Master key – Specify your AWS Key Management Service (AWS KMS) customer master key (CMK).
Performance Insights encrypts all potentially sensitive data using your AWS KMS CMK. Data is
encrypted in flight and at rest. For more information, see Encrypting Amazon RDS resources (p. 1620).
In the console, you can modify a DB instance to enable or disable Performance Insights 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. 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.
• Master key – Specify your AWS Key Management Service (AWS KMS) customer master key
(CMK). Performance Insights encrypts all potentially sensitive data using your AWS KMS CMK.
Data is encrypted in flight and at rest. For more information, see Encrypting Amazon RDS
resources (p. 1620).
5. Choose Continue.
6. For Scheduling of Modifications, choose one of the following:
422
Amazon Relational Database Service User Guide
Enabling and Disabling Performance Insights
• Apply during the next scheduled maintenance window – Wait to apply the Performance
Insights modification until the next maintenance window.
• Apply immediately – Apply the Performance Insights modification as soon as possible.
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:
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.
423
Amazon Relational Database Service User Guide
Enabling and Disabling Performance Insights
--db-instance-identifier sample-db-instance \
--enable-performance-insights \
--performance-insights-retention-period 731
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).
Performance Schema is enabled automatically when you create an Amazon RDS for MariaDB or MySQL
DB instance with Performance Insights enabled. In this case, Performance Insights automatically
manages the parameters in the following table.
performance-schema-consumer-events-waits- ON
current
performance-schema-instrument wait/%=ON
performance-schema-consumer-global- ON
instrumentation
performance-schema-consumer-thread- ON
instrumentation
424
Amazon Relational Database Service User Guide
Accessing Performance Insights
Important
When Performance Schema is enabled automatically, Performance Insights changes schema-
related parameters on the DB instance. These changes aren't visible in the parameter group
associated with the DB instance.
For more information, see Performance Schema Command Options and Performance Schema Option
and Variable Reference in the MySQL documentation.
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. Choose Edit parameters.
5. Enter perf in the search bar.
6. Select the performance_schema parameter.
7. Choose Reset.
8. Choose Reset parameters.
9. Restart the DB instance.
For more information about modifying instance parameters, see Modifying parameters in a DB
parameter group (p. 238). For more information about the dashboard, see Monitoring with the
Performance Insights dashboard (p. 427). For more information about the MySQL performance
schema, see MySQL 8.0 Reference Manual.
In addition, AmazonRDSFullAccess contains all the permissions needed for using Performance
Insights. If you attach this policy to an IAM user or role, the recipient can use Performance Insights. along
with other console features.
425
Amazon Relational Database Service User Guide
Accessing Performance Insights
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "pi:*",
"Resource": "arn:aws:pi:*:*:metrics/rds/*"
}
]
}
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.
426
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
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.
427
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
The following screenshot shows the dashboard for a DB instance. By default, the Performance
Insights dashboard shows data for the last hour.
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.
428
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
The Performance Insight dashboard automatically refreshes with new data. The refresh rate depends
on the amount of data displayed:
429
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Change the performance counters by choosing 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 Customizing the Performance Insights dashboard (p. 450).
430
Amazon Relational Database Service User Guide
Monitoring 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.
431
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
To see details for any item for the selected time period in the legend, hover over that item.
432
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
By default, the console displays top SQL queries that are contributing to the database load. Every line in
the table shows relevant statistics for the SQL statement:
To see the components of a query, select the query, and then choose the +. A SQL digest is a composite
of multiple actual queries that are structurally similar but that possibly have different literal values. In
the following screenshot, the selected query is a digest. The digest replaces hardcoded values with a
question mark.
433
Amazon Relational Database Service User Guide
Monitoring 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 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.
In the Top sql table, you can open a statement to view its information. The information appears in the
bottom pane.
434
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
In the Top sql tab, you can view 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.
You can control the statistics displayed in the Top sql tab by choosing the Preferences icon.
435
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
When you choose the Preferences icon, the Preferences window opens.
Enable the statistics that you want to have visible in the Top sql tab, use your mouse to scroll to the
bottom of the window, and then choose Continue.
436
Amazon Relational Database Service User Guide
Monitoring 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 Average Active Sessions chart and see if there are any incidents of database load
exceeding the Max CPU line.
2. If there is, look at the Average Active Sessions 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.
437
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Topics
• Statistics for MariaDB and MySQL (p. 438)
• Statistics for Oracle (p. 441)
• Statistics for PostgreSQL (p. 444)
Performance Insights automatically truncates the table only if your parameter group doesn't
have an explicitly set value for the performance_schema parameter. You can examine the
performance_schema parameter, and if the value of source is user, then you set a value. If
you want Performance Insights to truncate the table automatically, then reset the value for the
performance_schema parameter. You can view the source of a parameter value by viewing the
parameter in the AWS Management Console or by running the AWS CLI describe-db-parameters
command. The following message is shown in the AWS Management Console when the table is full:
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.
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
438
Amazon Relational Database Service User Guide
Monitoring 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
Using the AWS Management Console, you can view the metrics for a running SQL query by choosing the
SQL tab and expanding the query.
439
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
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.
440
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Metric Unit
The following metrics provide per call statistics for a SQL statement.
Metric Unit
441
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Metric Unit
Using the AWS Management Console, you can view the metrics for a running SQL query by choosing the
SQL tab and expanding the query.
Choose which statistics to display by choosing the gear icon in the upper-right corner of the chart.
442
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
443
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
The following SQL Digest statistics are available for PostgreSQL DB instances.
Metric Unit
The following metrics provide per call statistics for a SQL statement.
Metric Unit
444
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Metric Unit
For more information about these metrics, see pg_stat_statements in the PostgreSQL documentation.
Using the AWS Management Console, you can view the metrics for a running SQL query by choosing the
SQL tab.
445
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
Choose which statistics to display by choosing the gear icon in the upper-right corner of the chart.
446
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
You can copy the text that is displayed on the dashboard, or choose Download.
Amazon RDS for PostgreSQL handles text differently. Using the Performance Insights dashboard, you
can view and download up to 500 bytes. To access more than 500 bytes, set the size limit with the DB
instance parameter track_activity_query_size. The maximum value is 102,400 bytes. To view
or download text over 500 bytes, use the AWS Management Console, not the Performance Insights
447
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
CLI or API. For more information, see Setting the SQL text limit for Amazon RDS for PostgreSQL DB
instances (p. 448).
SQL statements with text larger than 500 bytes look similar to the following image.
4. Examine the SQL information section to view more of the SQL text.
The Performance Insights dashboard can display up to 4,096 bytes for each SQL statement.
5. (Optional) Choose Copy to copy the displayed SQL statement, or choose Download to download the
SQL statement to view the SQL text up to the DB engine limit.
Note
To copy or download the SQL statement, disable pop-up blockers.
Setting the SQL text limit for Amazon RDS for PostgreSQL DB instances
For Amazon RDS for PostgreSQL DB instances, you can control the limit for the SQL text that can be
shown on the Performance Insights dashboard.
To do so, modify the track_activity_query_size DB instance parameter. The default setting for the
track_activity_query_size parameter is 1,024 bytes.
448
Amazon Relational Database Service User Guide
Monitoring with the Performance Insights dashboard
You can increase the number of bytes to increase the SQL text size visible in the Performance
Insights dashboard. The limit for the parameter is 102,400 bytes. For more information about the
track_activity_query_size DB instance parameter, see Run-time Statistics in the PostgreSQL
documentation.
To modify the parameter, change the parameter setting in the parameter group that is associated with
the Amazon RDS for PostgreSQL DB instance.
If the Amazon RDS for PostgreSQL DB instance is using the default parameter group, complete the
following steps:
1. Create a new DB instance parameter group for the appropriate DB engine and DB engine version.
2. Set the parameter in the new parameter group.
3. Associate the new parameter group with the DB instance.
For information about setting a DB instance parameter, see Modifying parameters in a DB parameter
group (p. 238).
Click-and-Drag Zoom In
In the Performance Insights interface, you can choose a small portion of the load chart and zoom in on
the detail.
To zoom in on a portion of the load chart, choose the start time and drag to the end of the time period
you want. When you do this, the selected area is highlighted. When you release the mouse, the load
chart zooms in on the selected AWS Region, and the Top items table is recalculated.
449
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
Topics
• Performance Insights operating system counters (p. 450)
• Performance Insights counters for Amazon RDS for MariaDB and MySQL (p. 453)
• Performance Insights counters for Amazon RDS for Microsoft SQL Server (p. 456)
• Performance Insights counters for Amazon RDS for Oracle (p. 457)
• Performance Insights counters for Amazon RDS for PostgreSQL (p. 458)
450
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
451
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
in swap os.swap.in
rx network os.network.rx
tx network os.network.tx
452
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
Topics
• Native counters for RDS for MariaDB and RDS for MySQL (p. 453)
• Non-native counters for Amazon RDS for MariaDB and MySQL (p. 454)
Native counters for RDS for MariaDB and RDS for MySQL
For definitions of these native metrics, see Server Status Variables in the MySQL documentation.
453
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
Innodb_buffer_pool_pages_data
Cache Pages db.Cache.Innodb_buffer_pool_pages_d
Innodb_buffer_pool_pages_total
Cache Pages db.Cache.Innodb_buffer_pool_pages_t
Innodb_buffer_pool_read_requests
Cache Pages per second db.Cache.Innodb_buffer_pool_read_req
innodb_buffer_pool_hits
Cache db.Cache.innodb_buffer_pool_hits
The number of reads that innodb_buffer_pool_read_requests
InnoDB could satisfy from -
the buffer pool. innodb_buffer_pool_reads
innodb_buffer_pool_hit_rate
Cache db.Cache.innodb_buffer_pool_hit_rate
The percentage of reads 100 *
that InnoDB could satisfy innodb_buffer_pool_read_requests
from the buffer pool. (innodb_buffer_pool_read_request
+
innodb_buffer_pool_reads)
454
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
innodb_buffer_pool_usage
Cache db.Cache.innodb_buffer_pool_usage
The percentage of the Innodb_buffer_pool_pages_data /
InnoDB buffer pool that Innodb_buffer_pool_pages_total
contains data (pages). * 100.0
Note
When using
compressed tables,
this value can
vary. For more
information,
see the
information about
Innodb_buffer_pool_pages_data
and
Innodb_buffer_pool_pages_total
in Server Status
Variables in
the MySQL
documentation.
query_cache_hit_rate
Cache db.Cache.query_cache_hit_rate
MySQL result set cache Qcache_hits /
(query cache) hit ratio. (QCache_hits +
Com_select) * 100
innodb_datafile_writes_to_disk
I/O db.IO.innodb_datafile_writes_to_disk
The number of InnoDB data Innodb_data_writes -
file writes to disk, excluding Innodb_log_writes -
double write and redo Innodb_dblwr_writes
logging write operations.
innodb_rows_changed
SQL db.SQL.innodb_rows_changed
The total InnoDB row db.SQL.Innodb_rows_inserted
operations. +
db.SQL.Innodb_rows_deleted
+
db.SQL.Innodb_rows_updated
active_transactions
Transactions db.Transactions.active_transactions
The total active SELECT COUNT(1) AS
transactions. active_transactions
FROM
INFORMATION_SCHEMA.INNODB_TRX
innodb_deadlocks
Locks db.Locks.innodb_deadlocks
The total number of SELECT COUNT AS
deadlocks. innodb_deadlocks FROM
INFORMATION_SCHEMA.INNODB_METRIC
WHERE
NAME='lock_deadlocks'
innodb_lock_timeouts
Locks db.Locks.innodb_lock_timeouts
The total number of locks SELECT COUNT AS
that timed out. innodb_lock_timeouts
FROM
INFORMATION_SCHEMA.INNODB_METRIC
WHERE
NAME='lock_timeouts'
455
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
innodb_row_lock_waits
Locks db.Locks.innodb_row_lock_waits
The total number of row SELECT COUNT AS
locks that resulted in a innodb_row_lock_waits
wait. FROM
INFORMATION_SCHEMA.INNODB_METRIC
WHERE
NAME='lock_row_lock_waits'
456
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
457
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
Bytes sent via SQL*Net User Bytes per second db.User.bytes sent via
to client SQL*Net to client
Table scan rows gotten SQL Rows per second db.SQL.table scan rows
gotten
DB block gets from Cache Gets per second db.Cache.db block gets
cache from cache
Topics
• Native counters for Amazon RDS for PostgreSQL (p. 459)
• Non-native counters for Amazon RDS for PostgreSQL (p. 460)
458
Amazon Relational Database Service User Guide
Customizing the Performance Insights dashboard
459
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
checkpoint_sync_latency
Checkpoint db.Checkpoint.checkpoint_sync_latency
The total amount of time checkpoint_sync_time /
that has been spent in (checkpoints_timed +
the portion of checkpoint checkpoints_req)
processing where files are
synchronized to disk.
checkpoint_write_latency
Checkpoint db.Checkpoint.checkpoint_write_latency
The total amount of time checkpoint_write_time /
that has been spent in (checkpoints_timed +
the portion of checkpoint checkpoints_req)
processing where files are
written to disk.
Performance Insights offers a domain-specific view of database load measured as average active
sessions (AAS). This metric appears to API consumers as a two-dimensional time-series dataset. The time
dimension of the data provides DB load data for each time point in the queried time range. Each time
point decomposes overall load in relation to the requested dimensions, such as SQL, Wait-event, User,
or Host, measured at that time point.
Amazon RDS Performance Insights monitors your Amazon RDS DB instance so that you can analyze
and troubleshoot database performance. One way to view Performance Insights data is in the AWS
Management Console. Performance Insights also provides a public API so that you can query your
own data. You can use the API to offload data into a database, add Performance Insights data to
existing monitoring dashboards, or to build monitoring tools. To use the Performance Insights API,
enable Performance Insights on one of your Amazon RDS DB instances. For information about enabling
Performance Insights, see Enabling and disabling Performance Insights (p. 421).
460
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
For more information about the Performance Insights API, see the Amazon RDS Performance Insights
API Reference.
aws pi help
If you don't have the AWS CLI installed, see Installing the AWS Command Line Interface in the AWS CLI
User Guide for information about installing it.
For example, the AWS Management Console uses GetResourceMetrics in two places in the
Performance Insights dashboard. GetResourceMetrics is used to populate the Counter Metrics chart
and in the Database Load chart, as seen in the following image.
461
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
All the metrics returned by GetResourceMetrics are standard time-series metrics with one exception.
The exception is db.load, which is the core metric in Performance Insights. This metric is displayed in
the Database Load chart. The db.load metric is different from the other time-series metrics because
you can break it into subcomponents called dimensions. In the previous image, db.load is broken down
and grouped by the waits states that make up the db.load.
Note
GetResourceMetrics can also return the db.sampleload metric, but the db.load metric is
appropriate in most cases.
For information about the counter metrics returned by GetResourceMetrics, see Customizing the
Performance Insights dashboard (p. 450).
• Average – The average value for the metric over a period of time. Append .avg to the metric name.
• Minimum – The minimum value for the metric over a period of time. Append .min to the metric name.
• Maximum – The maximum value for the metric over a period of time. Append .max to the metric
name.
• Sum – The sum of the metric values over a period of time. Append .sum to the metric name.
• Sample count – The number of times the metric was collected over a period of time. Append
.sample_count to the metric name.
For example, assume that a metric is collected for 300 seconds (5 minutes), and that the metric is
collected one time each minute. The values for each minute are 1, 2, 3, 4, and 5. In this case, the
following calculations are returned:
• Average – 3
• Minimum – 1
• Maximum – 5
• Sum – 15
• Sample count – 5
462
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
For information about using the get-resource-metrics AWS CLI command, see get-resource-
metrics.
For the --metric-queries option, specify one or more queries that you want to get results for. Each
query consists of a mandatory Metric and optional GroupBy and Filter parameters. The following is
an example of a --metric-queries option specification.
{
"Metric": "string",
"GroupBy": {
"Group": "string",
"Dimensions": ["string", ...],
"Limit": integer
},
"Filter": {"string": "string"
...}
}
Topics
• Retrieving counter metrics (p. 463)
• Retrieving the DB load average for top wait events (p. 466)
• Retrieving the DB load average for top SQL (p. 468)
• Retrieving the DB Load Average Filtered by SQL (p. 470)
The following example shows how to gather the same data that the AWS Management Console uses to
generate the two counter metric charts.
463
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
aws pi get-resource-metrics \
--service-type RDS \
--identifier db-ID \
--start-time 2018-10-30T00:00:00Z \
--end-time 2018-10-30T01:00:00Z \
--period-in-seconds 60 \
--metric-queries '[{"Metric": "os.cpuUtilization.user.avg" },
{"Metric": "os.cpuUtilization.idle.avg"}]'
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
--start-time 2018-10-30T00:00:00Z ^
--end-time 2018-10-30T01:00:00Z ^
--period-in-seconds 60 ^
--metric-queries '[{"Metric": "os.cpuUtilization.user.avg" },
{"Metric": "os.cpuUtilization.idle.avg"}]'
You can also make a command easier to read by specifying a file for the --metrics-query option. The
following example uses a file called query.json for the option. The file has the following contents.
[
{
"Metric": "os.cpuUtilization.user.avg"
},
{
"Metric": "os.cpuUtilization.idle.avg"
}
]
aws pi get-resource-metrics \
--service-type RDS \
--identifier db-ID \
--start-time 2018-10-30T00:00:00Z \
--end-time 2018-10-30T01:00:00Z \
--period-in-seconds 60 \
--metric-queries file://query.json
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
--start-time 2018-10-30T00:00:00Z ^
--end-time 2018-10-30T01:00:00Z ^
464
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
--period-in-seconds 60 ^
--metric-queries file://query.json
The preceding example specifies the following values for the options:
The metric name uses dots to classify the metric in a useful category, with the final element being
a function. In the example, the function is avg for each query. As with Amazon CloudWatch, the
supported functions are min, max, total, and avg.
{
"Identifier": "db-XXX",
"AlignedStartTime": 1540857600.0,
"AlignedEndTime": 1540861200.0,
"MetricList": [
{ //A list of key/datapoints
"Key": {
"Metric": "os.cpuUtilization.user.avg" //Metric1
},
"DataPoints": [
//Each list of datapoints has the same timestamps and same number of items
{
"Timestamp": 1540857660.0, //Minute1
"Value": 4.0
},
{
"Timestamp": 1540857720.0, //Minute2
"Value": 4.0
},
{
"Timestamp": 1540857780.0, //Minute 3
"Value": 10.0
}
//... 60 datapoints for the os.cpuUtilization.user.avg metric
]
},
{
"Key": {
"Metric": "os.cpuUtilization.idle.avg" //Metric2
},
"DataPoints": [
{
"Timestamp": 1540857660.0, //Minute1
"Value": 12.0
},
{
"Timestamp": 1540857720.0, //Minute2
465
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
"Value": 13.5
},
//... 60 datapoints for the os.cpuUtilization.idle.avg metric
]
}
] //end of MetricList
} //end of response
The MetricList in the response has a number of entries, each with a Key and a DataPoints entry.
Each DataPoint has a Timestamp and a Value. Each Datapoints list has 60 data points because the
queries are for per-minute data over an hour, with Timestamp1/Minute1, Timestamp2/Minute2, and
so on, up to Timestamp60/Minute60.
Because the query is for two different counter metrics, there are two elements in the response
MetricList.
[
{
"Metric": "db.load.avg",
"GroupBy": { "Group": "db.wait_event", "Limit": 7 }
}
]
aws pi get-resource-metrics \
--service-type RDS \
--identifier db-ID \
--start-time 2018-10-30T00:00:00Z \
--end-time 2018-10-30T01:00:00Z \
--period-in-seconds 60 \
--metric-queries file://query.json
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
--start-time 2018-10-30T00:00:00Z ^
--end-time 2018-10-30T01:00:00Z ^
--period-in-seconds 60 ^
--metric-queries file://query.json
466
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
The example specifies the metric of db.load.avg and a GroupBy of the top seven wait events.
For details about valid values for this example, see DimensionGroup in the Performance Insights API
Reference.
{
"Identifier": "db-XXX",
"AlignedStartTime": 1540857600.0,
"AlignedEndTime": 1540861200.0,
"MetricList": [
{ //A list of key/datapoints
"Key": {
//A Metric with no dimensions. This is the total db.load.avg
"Metric": "db.load.avg"
},
"DataPoints": [
//Each list of datapoints has the same timestamps and same number of items
{
"Timestamp": 1540857660.0, //Minute1
"Value": 0.5166666666666667
},
{
"Timestamp": 1540857720.0, //Minute2
"Value": 0.38333333333333336
},
{
"Timestamp": 1540857780.0, //Minute 3
"Value": 0.26666666666666666
}
//... 60 datapoints for the total db.load.avg key
]
},
{
"Key": {
//Another key. This is db.load.avg broken down by CPU
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.name": "CPU",
"db.wait_event.type": "CPU"
}
},
"DataPoints": [
{
"Timestamp": 1540857660.0, //Minute1
"Value": 0.35
},
{
"Timestamp": 1540857720.0, //Minute2
"Value": 0.15
},
//... 60 datapoints for the CPU key
]
},
//... In total we have 8 key/datapoints entries, 1) total, 2-8) Top Wait Events
] //end of MetricList
} //end of response
In this response, there are eight entries in the MetricList. There is one entry for the total
db.load.avg, and seven entries each for the db.load.avg divided according to one of the top seven
wait events. Unlike in the first example, because there was a grouping dimension, there must be one
key for each grouping of the metric. There can't be only one key for each metric, as in the basic counter
metric use case.
467
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
• db.sql – The full SQL statement, such as select * from customers where customer_id =
123
• db.sql_tokenized – The tokenized SQL statement, such as select * from customers where
customer_id = ?
When analyzing database performance, it can be useful to consider SQL statements that only differ
by their parameters as one logic item. So, you can use db.sql_tokenized when querying. However,
especially when you are interested in explain plans, sometimes it's more useful to examine full SQL
statements with parameters, and query grouping by db.sql. There is a parent-child relationship
between tokenized and full SQL, with multiple full SQL (children) grouped under the same tokenized
SQL (parent).
The command in this example is the similar to the command in Retrieving the DB load average for top
wait events (p. 466). However, the query.json file has the following contents.
[
{
"Metric": "db.load.avg",
"GroupBy": { "Group": "db.sql_tokenized", "Limit": 10 }
}
]
aws pi get-resource-metrics \
--service-type RDS \
--identifier db-ID \
--start-time 2018-10-29T00:00:00Z \
--end-time 2018-10-30T00:00:00Z \
--period-in-seconds 3600 \
--metric-queries file://query.json
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
--start-time 2018-10-29T00:00:00Z ^
--end-time 2018-10-30T00:00:00Z ^
--period-in-seconds 3600 ^
--metric-queries file://query.json
The example specifies the metric of db.load.avg and a GroupBy of the top seven wait events.
For details about valid values for this example, see DimensionGroup in the Performance Insights API
Reference.
468
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
{
"AlignedStartTime": 1540771200.0,
"AlignedEndTime": 1540857600.0,
"Identifier": "db-XXX",
This response has 11 entries in the MetricList (1 total, 10 top tokenized SQL), with each entry having
24 per-hour DataPoints.
For tokenized SQL, there are three entries in each dimensions list:
In the AWS Management Console, this ID is called the Support ID. It's named this because the ID is
data that AWS Support can examine to help you troubleshoot an issue with your database. AWS takes
the security and privacy of your data extremely seriously, and almost all data is stored encrypted with
your AWS KMS customer master key (CMK). Therefore, nobody inside AWS can look at this data. In
the example preceding, both the tokenized.statement and the tokenized.db_id are stored
encrypted. If you have an issue with your database, AWS Support can help you by referencing the
Support ID.
When querying, it might be convenient to specify a Group in GroupBy. However, for finer-grained
control over the data that's returned, specify the list of dimensions. For example, if all that is needed is
the db.sql_tokenized.statement, then a Dimensions attribute can be added to the query.json file.
[
{
469
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
"Metric": "db.load.avg",
"GroupBy": {
"Group": "db.sql_tokenized",
"Dimensions":["db.sql_tokenized.statement"],
"Limit": 10
}
}
]
The preceding image shows that a particular query is selected, and the top average active sessions
stacked area line graph is scoped to that query. Although the query is still for the top seven overall wait
events, the value of the response is filtered. The filter causes it to take into account only sessions that are
a match for the particular filter.
The corresponding API query in this example is similar to the command in Retrieving the DB load average
for top SQL (p. 468). However, the query.json file has the following contents.
[
{
"Metric": "db.load.avg",
"GroupBy": { "Group": "db.wait_event", "Limit": 5 },
"Filter": { "db.sql_tokenized.id": "AKIAIOSFODNN7EXAMPLE" }
}
]
aws pi get-resource-metrics \
--service-type RDS \
--identifier db-ID \
--start-time 2018-10-30T00:00:00Z \
--end-time 2018-10-30T01:00:00Z \
--period-in-seconds 60 \
--metric-queries file://query.json
470
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
--start-time 2018-10-30T00:00:00Z ^
--end-time 2018-10-30T01:00:00Z ^
--period-in-seconds 60 ^
--metric-queries file://query.json
{
"Identifier": "db-XXX",
"AlignedStartTime": 1556215200.0,
"MetricList": [
{
"Key": {
"Metric": "db.load.avg"
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 1.4878117913832196
},
{
"Timestamp": 1556222400.0,
"Value": 1.192823803967328
}
]
},
{
"Key": {
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.type": "io",
"db.wait_event.name": "wait/io/aurora_redo_log_flush"
}
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 1.1360544217687074
},
{
"Timestamp": 1556222400.0,
"Value": 1.058051341890315
}
]
},
{
"Key": {
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.type": "io",
"db.wait_event.name": "wait/io/table/sql/handler"
}
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 0.16241496598639457
},
{
471
Amazon Relational Database Service User Guide
Retrieving data with the Performance Insights API
"Timestamp": 1556222400.0,
"Value": 0.05163360560093349
}
]
},
{
"Key": {
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.type": "synch",
"db.wait_event.name": "wait/synch/mutex/innodb/
aurora_lock_thread_slot_futex"
}
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 0.11479591836734694
},
{
"Timestamp": 1556222400.0,
"Value": 0.013127187864644107
}
]
},
{
"Key": {
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.type": "CPU",
"db.wait_event.name": "CPU"
}
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 0.05215419501133787
},
{
"Timestamp": 1556222400.0,
"Value": 0.05805134189031505
}
]
},
{
"Key": {
"Metric": "db.load.avg",
"Dimensions": {
"db.wait_event.type": "synch",
"db.wait_event.name": "wait/synch/mutex/innodb/lock_wait_mutex"
}
},
"DataPoints": [
{
"Timestamp": 1556218800.0,
"Value": 0.017573696145124718
},
{
"Timestamp": 1556222400.0,
"Value": 0.002333722287047841
}
]
}
],
"AlignedEndTime": 1556222400.0
} //end of response
472
Amazon Relational Database Service User Guide
Metrics published to CloudWatch
In this response, all values are filtered according to the contribution of tokenized SQL
AKIAIOSFODNN7EXAMPLE specified in the query.json file. The keys also might follow a different order
than a query without a filter, because it's the top five wait events that affected the filtered SQL.
Metric Description
Note
These metrics are published to CloudWatch only if there is load on the DB instance.
You can examine these metrics using the CloudWatch console, the AWS CLI, or the CloudWatch API.
For example, you can get the statistics for the DBLoad metric by running the get-metric-statistics
command.
{
"Datapoints": [
{
"Timestamp": "2018-07-19T21:30:00Z",
"Unit": "None",
"Average": 2.1
},
473
Amazon Relational Database Service User Guide
Logging Performance Insights
calls by using AWS CloudTrail
{
"Timestamp": "2018-07-19T21:34:00Z",
"Unit": "None",
"Average": 1.7
},
{
"Timestamp": "2018-07-19T21:35:00Z",
"Unit": "None",
"Average": 2.8
},
{
"Timestamp": "2018-07-19T21:31:00Z",
"Unit": "None",
"Average": 1.5
},
{
"Timestamp": "2018-07-19T21:32:00Z",
"Unit": "None",
"Average": 1.8
},
{
"Timestamp": "2018-07-19T21:29:00Z",
"Unit": "None",
"Average": 3.0
},
{
"Timestamp": "2018-07-19T21:33:00Z",
"Unit": "None",
"Average": 2.4
}
],
"Label": "DBLoad"
}
For more information about CloudWatch, see What is Amazon CloudWatch? in the Amazon CloudWatch
User Guide.
If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket,
including events for Performance Insights. If you don't configure a trail, you can still view the most
recent events in the CloudTrail console in Event history. Using the data collected by CloudTrail, you can
determine certain information. This information includes the request that was made to Performance
Insights, the IP address the request was made from, who made the request, and when it was made. It
also includes additional details.
To learn more about CloudTrail, see the AWS CloudTrail User Guide.
474
Amazon Relational Database Service User Guide
Logging Performance Insights
calls by using AWS CloudTrail
account. For more information, see Viewing Events with CloudTrail Event History in AWS CloudTrail User
Guide.
For an ongoing record of events in your AWS account, including events for Performance Insights, create a
trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a
trail in the console, the trail applies to all AWS Regions. The trail logs events from all AWS Regions in the
AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can
configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs.
For more information, see the following topics in AWS CloudTrail User Guide:
All Performance Insights operations are logged by CloudTrail and are documented in the Performance
Insights API Reference. For example, calls to the DescribeDimensionKeys and GetResourceMetrics
operations generate entries in the CloudTrail log files.
Every event or log entry contains information about who generated the request. The identity
information helps you determine the following:
• Whether the request was made with root or IAM user credentials.
• Whether the request was made with temporary security credentials for a role or federated user.
• Whether the request was made by another AWS service.
The following example shows a CloudTrail log entry that demonstrates the GetResourceMetrics
operation.
{
"eventVersion": "1.05",
"userIdentity": {
"type": "IAMUser",
"principalId": "AKIAIOSFODNN7EXAMPLE",
"arn": "arn:aws:iam::123456789012:user/johndoe",
"accountId": "123456789012",
"accessKeyId": "AKIAI44QH8DHBEXAMPLE",
"userName": "johndoe"
},
"eventTime": "2019-12-18T19:28:46Z",
"eventSource": "pi.amazonaws.com",
"eventName": "GetResourceMetrics",
"awsRegion": "us-east-1",
"sourceIPAddress": "72.21.198.67",
"userAgent": "aws-cli/1.16.240 Python/3.7.4 Darwin/18.7.0 botocore/1.12.230",
"requestParameters": {
475
Amazon Relational Database Service User Guide
Logging Performance Insights
calls by using AWS CloudTrail
"identifier": "db-YTDU5J5V66X7CXSCVDFD2V3SZM",
"metricQueries": [
{
"metric": "os.cpuUtilization.user.avg"
},
{
"metric": "os.cpuUtilization.idle.avg"
}
],
"startTime": "Dec 18, 2019 5:28:46 PM",
"periodInSeconds": 60,
"endTime": "Dec 18, 2019 7:28:46 PM",
"serviceType": "RDS"
},
"responseElements": null,
"requestID": "9ffbe15c-96b5-4fe6-bed9-9fccff1a0525",
"eventID": "08908de0-2431-4e2e-ba7b-f5424f908433",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012"
}
476
Amazon Relational Database Service User Guide
Using Enhanced Monitoring
By default, Enhanced Monitoring metrics are stored for 30 days in the CloudWatch Logs, which are
different from typical CloudWatch metrics. To modify the amount of time the metrics are stored in the
CloudWatch Logs, change the retention for the RDSOSMetrics log group in the CloudWatch console.
For more information, see Change log data retention in CloudWatch logs in the Amazon CloudWatch Logs
User Guide.
Because Enhanced Monitoring metrics are stored in the CloudWatch logs instead of in Cloudwatch
metrics, the cost of Enhanced Monitoring depends on several factors:
• You are only charged for Enhanced Monitoring that exceeds the free tier provided by Amazon
CloudWatch Logs.
• MariaDB
• Microsoft SQL Server
• MySQL version 5.5 or later
• Oracle
• PostgreSQL
Enhanced Monitoring is available for all DB instance classes except for the db.m1.small instance class.
477
Amazon Relational Database Service User Guide
Setting up and enabling Enhanced Monitoring
1. Follow the steps in Enabling and disabling Enhanced Monitoring (p. 478).
2. Set Monitoring Role to Default in the step where you choose a role.
The user that enables Enhanced Monitoring must be granted the PassRole permission. For more
information, see Example 2 in Granting a user permissions to pass a role to an AWS service in the IAM
User Guide.
The trusted entity for your role is the AWS service monitoring.rds.amazonaws.com.
9. Choose Create role.
Console
You can enable Enhanced Monitoring when you create a DB instance or read replica, or when you modify
a DB instance. If you modify a DB instance to enable Enhanced Monitoring, you don't need to reboot
your DB instance for the change to take effect.
478
Amazon Relational Database Service User Guide
Setting up and enabling Enhanced Monitoring
You can enable Enhanced Monitoring in the RDS console when you do one of the following actions:
• Create a DB instance – You can enable Enhanced Monitoring in the Monitoring section under
Additional configuration.
• Create a read replica – You can enable Enhanced Monitoring in the Monitoring section.
• Modify a DB instance – You can enable Enhanced Monitoring in the Monitoring section.
3. Set the Monitoring Role property to the IAM role that you created to permit Amazon RDS to
communicate with Amazon CloudWatch Logs for you, or choose Default to have RDS create a role
for you named rds-monitoring-role.
4. Set the Granularity property to the interval, in seconds, between points when metrics are collected
for your DB instance or read replica. The Granularity property can be set to one of the following
values: 1, 5, 10, 15, 30, or 60.
Note
The fastest that the RDS console refreshes is every 5 seconds. If you set the granularity to 1
second in the RDS console, you still see updated metrics only every 5 seconds. You can retrieve
1-second metric updates by using CloudWatch Logs.
AWS CLI
To enable Enhanced Monitoring using the AWS CLI, in the following commands, set the --monitoring-
interval option to a value other than 0 and set the --monitoring-role-arn option to the role you
created in Creating an IAM role for Enhanced Monitoring (p. 478).
• create-db-instance
• create-db-instance-read-replica
• modify-db-instance
479
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring
The --monitoring-interval option specifies the interval, in seconds, between points when Enhanced
Monitoring metrics are collected. Valid values for the option are 0, 1, 5, 10, 15, 30, and 60.
To disable Enhanced Monitoring using the AWS CLI, set the --monitoring-interval option to 0 in
the these commands.
Example
For Windows:
RDS API
To enable Enhanced Monitoring using the RDS API, set the MonitoringInterval parameter to a value
other than 0 and set the MonitoringRoleArn parameter to the role you created in Creating an IAM role
for Enhanced Monitoring (p. 478). Set these parameters in the following actions:
• CreateDBInstance
• CreateDBInstanceReadReplica
• ModifyDBInstance
The MonitoringInterval parameter specifies the interval, in seconds, between points when Enhanced
Monitoring metrics are collected. Valid values are 0, 1, 5, 10, 15, 30, and 60.
480
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring
Some DB instances use more than one disk for the DB instance's data storage volume. On those
DB instances, the Physical Devices graphs show metrics for each one of the disks. For example, the
following graph shows metrics for four disks.
Note
Currently, Physical Devices graphs are not available for Microsoft SQL Server DB instances.
When you are viewing aggregated Disk I/O and File system graphs, the rdsdev device relates to the /
rdsdbdata file system, where all database files and logs are stored. The filesystem device relates to the
/ file system (also known as root), where files related to the operating system are stored.
481
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring
If the DB instance is a Multi-AZ deployment, you can view the OS metrics for the primary DB instance
and its Multi-AZ standby replica. In the Enhanced monitoring view, choose primary to view the OS
metrics for the primary DB instance, or choose secondary to view the OS metrics for the standby replica.
For more information about Multi-AZ deployments, see High availability (Multi-AZ) for Amazon
RDS (p. 53).
Note
Currently, viewing OS metrics for a Multi-AZ standby replica is not supported for MariaDB or
Microsoft SQL Server DB instances.
If you want to see details for the processes running on your DB instance, choose OS process list for
Monitoring.
482
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring
The Enhanced Monitoring metrics shown in the Process list view are organized as follows:
• RDS child processes – Shows a summary of the RDS processes that support the DB instance, for
example mysqld for MySQL DB instances. Process threads appear nested beneath the parent process.
Process threads show CPU utilization only as other metrics are the same for all threads for the process.
The console displays a maximum of 100 processes and threads. The results are a combination of
the top CPU consuming and memory consuming processes and threads. If there are more than 50
processes and more than 50 threads, the console displays the top 50 consumers in each category. This
display helps you identify which processes are having the greatest impact on performance.
• RDS processes – Shows a summary of the resources used by the RDS management agent, diagnostics
monitoring processes, and other AWS processes that are required to support RDS DB instances.
• OS processes – Shows a summary of the kernel and system processes, which generally have minimal
impact on performance.
The monitoring data that is shown in the RDS console is retrieved from Amazon CloudWatch Logs.
You can also retrieve the metrics for a DB instance as a log stream from CloudWatch Logs. For more
information, see Viewing Enhanced Monitoring by using CloudWatch Logs (p. 484).
Enhanced Monitoring metrics are returned during a reboot of a DB instance because only the database
engine is rebooted. Metrics for the operating system are still reported.
483
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
In a Multi-AZ deployment, log files with -secondary appended to the name are for the Multi-AZ
standby replica.
5. Choose the log stream that you want to view from the list of log streams.
Available OS metrics
The following tables list the OS metrics available using Amazon CloudWatch Logs.
Not
instanceResourceID An immutable identifier for the DB instance that is unique
applicable to an AWS Region, also used as the log stream identifier.
484
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
uptime Not The amount of time that the DB instance has been active.
applicable
cpuUtilization
guest CPU Guest The percentage of CPU in use by guest programs.
steal CPU Steal The percentage of CPU in use by other virtual machines.
total CPU Total The total percentage of the CPU in use. This value
includes the nice value.
wait CPU Wait The percentage of CPU unused while waiting for I/O
access.
diskIO avgQueueLen Avg Queue The number of requests waiting in the I/O device's queue.
Size
readLatency Read The elapsed time between the submission of a read I/O
Latency request and its completion, in milliseconds.
Read
readThroughput The amount of network throughput used by requests to
Throughput the DB cluster, in bytes per second.
rrqmPS Rrqms The number of merged read requests queued per second.
485
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
util Disk I/O The percentage of CPU time during which requests were
Util issued.
Write
writeThroughput The amount of network throughput used by responses
Throughput from the DB cluster, in bytes per second.
wrqmPS Wrqms The number of merged write requests queued per second.
avgQueueLen Physical
physicalDeviceIO The number of requests waiting in the I/O device's queue.
Devices Avg
Queue Size
rrqmPS Physical The number of merged read requests queued per second.
Devices
Rrqms
486
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
util Physical The percentage of CPU time during which requests were
Devices Disk issued.
I/O Util
wrqmPS Physical The number of merged write requests queued per second.
Devices
Wrqms
fileSys maxFiles Max Inodes The maximum number of files that can be created for the
file system.
total Total The total number of disk space available for the file
Filesystem system, in kilobytes.
used Used The amount of disk space used by files in the file system,
Filesystem in kilobytes.
Used %
usedFilePercent The percentage of available files in use.
usedPercent Used Inodes The percentage of the file-system disk space in use.
%
loadAverageMinute
fifteen Load Avg 15 The number of processes requesting CPU time over the
min last 15 minutes.
five Load Avg 5 The number of processes requesting CPU time over the
min last 5 minutes.
one Load Avg 1 The number of processes requesting CPU time over the
min last minute.
buffers Buffered The amount of memory used for buffering I/O requests
Memory prior to writing to the storage device, in kilobytes.
487
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
cached Cached The amount of memory used for caching file system–
Memory based I/O.
dirty Dirty The amount of memory pages in RAM that have been
Memory modified but not written to their related data block in
storage, in kilobytes.
Huge Pages
hugePagesFree The number of free huge pages. Huge pages are a feature
Free of the Linux kernel.
Huge Pages
hugePagesRsvd The number of committed huge pages.
Rsvd
Huge Pages
hugePagesSize The size for each huge pages unit, in kilobytes.
Size
Huge Pages
hugePagesSurp The number of available surplus huge pages over the
Surp total.
Huge Pages
hugePagesTotal The total number of huge pages.
Total
pageTables Page Tables The amount of memory used by page tables, in kilobytes.
writeback Writeback The amount of dirty pages in RAM that are still being
Memory written to the backing storage, in kilobytes.
network interface Not The identifier for the network interface being used for the
applicable DB instance.
488
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
parentID Not The process identifier for the parent process of the
applicable process.
swap out Swaps out The amount of memory, in kilobytes, swapped out to
disk.
zombie Tasks The number of child tasks that are inactive with an active
Zombie parent task.
General engine Not applicable The database engine for the DB instance.
Not applicable
instanceResourceID An immutable identifier for the DB instance that
is unique to an AWS Region, also used as the log
stream identifier.
numVCPUs Not applicable The number of virtual CPUs for the DB instance.
489
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
timestamp Not applicable The time at which the metrics were taken.
uptime Not applicable The amount of time that the DB instance has been
active.
kernTotKb Total Kernel The sum of the memory in the paged and
Memory nonpaged kernel pools, in kilobytes.
kernPagedKb Paged Kernel The amount of memory in the paged kernel pool,
Memory in kilobytes.
490
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
network interface Not applicable The identifier for the network interface being
used for the DB instance.
pid Not applicable The identifier of the process. This value is not
present for processes that are owned by Amazon
RDS.
ppid Not applicable The process identifier for the parent of this
process. This value is only present for child
processes.
tid Not applicable The thread identifier. This value is only present for
threads. The owning process can be identified by
using the pid value.
workingSetKb Not applicable The amount of memory in the private working set
plus the amount of memory that is in use by the
process and can be shared with other processes, in
kilobytes.
Not applicable
workingSetPrivKb The amount of memory that is in use by a process,
but can't be shared with other processes, in
kilobytes.
Not applicable
workingSetShareableKb The amount of memory that is in use by a process
and can be shared with other processes, in
kilobytes.
491
Amazon Relational Database Service User Guide
Viewing Enhanced Monitoring by using CloudWatch Logs
virtKb Not applicable The amount of virtual address space the process
is using, in kilobytes. Use of virtual address space
doesn't necessarily imply corresponding use of
either disk or main memory pages.
system handles Handles The number of handles that the system is using.
492
Amazon Relational Database Service User Guide
Using Amazon RDS event notification
Amazon RDS uses the Amazon Simple Notification Service (Amazon SNS) to provide notification when an
Amazon RDS event occurs. These notifications can be in any notification form supported by Amazon SNS
for an AWS Region, such as an email, a text message, or a call to an HTTP endpoint.
Amazon RDS groups these events into categories that you can subscribe to so that you can be notified
when an event in that category occurs. You can subscribe to an event category for a DB instance, DB
snapshot, DB parameter group, or DB security group. For example, if you subscribe to the Backup
category for a given DB instance, you are notified whenever a backup-related event occurs that affects
the DB instance. If you subscribe to a configuration change category for a DB security group, you are
notified when the DB security group is changed. You also receive notification when an event notification
subscription changes.
Event notifications are sent to the addresses that you provide when you create the subscription. You
might want to create several different subscriptions, such as one subscription receiving all event
notifications and another subscription that includes only critical events for your production DB instances.
You can easily turn off notification without deleting a subscription by choosing No for Enabled in the
Amazon RDS console or by setting the Enabled parameter to false using the AWS CLI or Amazon RDS
API.
Important
Amazon RDS doesn't guarantee the order of events sent in an event stream. The event order is
subject to change.
Note
For more information on using text messages with SNS, see Mobile text messaging (SMS) in the
Amazon Simple Notification Service Developer Guide.
Amazon RDS uses the ARN of an Amazon SNS topic to identify each subscription. The Amazon RDS
console creates the ARN for you when you create the subscription. If you use the CLI or API, you create
the ARN by using the Amazon SNS console or the Amazon SNS API when you create a subscription.
Billing for Amazon RDS event notification is through the Amazon Simple Notification Service (Amazon
SNS). Amazon SNS fees apply when using event notification. For more information on Amazon SNS
billing, see Amazon Simple Notification Service pricing.
1. Create an Amazon RDS event notification subscription by using the Amazon RDS console, AWS CLI, or
API.
2. Amazon RDS sends an approval email or SMS message to the addresses you submitted with your
subscription. To confirm your subscription, choose the link in the notification you were sent.
3. When you have confirmed the subscription, the status of your subscription is updated in the Amazon
RDS console's My Event Subscriptions section.
4. You then begin to receive event notifications.
493
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
Note
When Amazon SNS sends a notification to a subscribed HTTP or HTTPS endpoint, the POST
message sent to the endpoint has a message body that contains a JSON document. For more
information, see Amazon SNS message and JSON formats in the Amazon Simple Notification
Service Developer Guide.
You can use AWS Lambda to process event notifications from a DB instance. For more
information, see Using AWS Lambda with Amazon RDS in the AWS Lambda Developer Guide.
The following section lists all categories and events that you can be notified of. It also provides
information about subscribing to and working with Amazon RDS event subscriptions.
• DB instance
• DB security group
• DB parameter group
The following table shows the event category and a list of events when a DB instance is the source type.
configuration RDS-EVENT-0018 The current storage settings for this DB instance are
change being changed.
494
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
configuration RDS-EVENT-0033 There are [count] users that match the master user
change name. Users not tied to a specific host have been
reset.
configuration RDS-EVENT-0016 The master password for the DB instance has been
change reset.
495
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
failure RDS-EVENT-0081 The IAM role that you use to access your Amazon
S3 bucket for SQL Server native backup and restore
is configured incorrectly. For more information, see
Setting up for native backup and restore (p. 679).
low storage RDS-EVENT-0089 The DB instance has consumed more than 90% of
its allocated storage. You can monitor the storage
space for a DB instance using the Free Storage
Space metric. For more information, see Viewing DB
instance metrics (p. 555).
low storage RDS-EVENT-0007 The allocated storage for the DB instance has been
consumed. To resolve this issue, allocate additional
storage for the DB instance. For more information,
see the RDS FAQ. You can monitor the storage
space for a DB instance using the Free Storage
Space metric. For more information, see Viewing DB
instance metrics (p. 555).
496
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
notification RDS-EVENT-0054 The MySQL storage engine you are using is not
InnoDB, which is the recommended MySQL storage
engine for Amazon RDS. For information about
MySQL storage engines, see Supported storage
engines for MySQL on Amazon RDS.
notification RDS-EVENT-0055 The number of tables you have for your DB instance
exceeds the recommended best practices for Amazon
RDS. Please reduce the number of tables on your DB
instance.
notification RDS-EVENT-0064 The TDE key has been rotated. For information about
recommended best practices, see Amazon RDS basic
operational guidelines (p. 134).
497
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
read replica RDS-EVENT-0045 An error has occurred in the read replication process.
For more information, see the event message.
read replica RDS-EVENT-0046 The read replica has resumed replication. This
message appears when you first create a read
replica, or as a monitoring message confirming that
replication is functioning properly. If this message
follows an RDS-EVENT-0045 notification, then
replication has resumed following an error or after
replication was stopped.
read replica RDS-EVENT-0062 Replication on the read replica was manually stopped.
498
Amazon Relational Database Service User Guide
Amazon RDS event categories and event messages
The following table shows the event category and a list of events when a DB parameter group is the
source type.
The following table shows the event category and a list of events when a DB security group is the source
type.
failure RDS-EVENT-0039 The security group owned by [user] does not exist;
authorization for the security group has been
revoked.
The following table shows the event category and a list of events when a DB snapshot is the source type.
499
Amazon Relational Database Service User Guide
Subscribing to Amazon RDS event notification
You can specify the type of source you want to be notified of and the Amazon RDS source that triggers
the event. These are defined by the SourceType (type of source) and the SourceIdentifier (the Amazon
RDS source generating the event). If you specify both the SourceType and SourceIdentifier, such as
SourceType = db-instance and SourceIdentifier = myDBInstance1, you receive all the DB
instance events for the specified source. If you specify a SourceType but don't specify a SourceIdentifier,
you receive notice of the events for that source type for all your Amazon RDS sources. If you don't specify
either the SourceType or the SourceIdentifier, you are notified of events generated from all Amazon
RDS sources belonging to your customer account.
Note
Event notifications might take up to five minutes to be delivered.
Amazon RDS event notification is only available for unencrypted SNS topics. If you specify an
encrypted SNS topic, event notifications aren't sent for the topic.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In navigation pane, choose Event subscriptions.
3. In the Event subscriptions pane, choose Create event subscription.
4. In the Create event subscription dialog box, do the following:
500
Amazon Relational Database Service User Guide
Subscribing to Amazon RDS event notification
d. Choose Yes to enable the subscription. If you want to create the subscription but to not have
notifications sent yet, choose No.
e. Depending on the source type you selected, choose the event categories and sources that you
want to receive event notifications for.
f. Choose Create.
The Amazon RDS console indicates that the subscription is being created.
AWS CLI
To subscribe to RDS event notification, use the AWS CLI create-event-subscription command.
Include the following required parameters:
• --subscription-name
• --sns-topic-arn
Example
For Windows:
API
To subscribe to Amazon RDS event notification, call the Amazon RDS API function
CreateEventSubscription. Include the following required parameters:
• SubscriptionName
• SnsTopicArn
501
Amazon Relational Database Service User Guide
Listing Amazon RDS event notification subscriptions
Console
To list your current Amazon RDS event notification subscriptions
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 Event subscriptions. The Event subscriptions pane shows all your
event notification subscriptions.
AWS CLI
To list your current Amazon RDS event notification subscriptions, use the AWS CLI describe-event-
subscriptions command.
Example
API
To list your current Amazon RDS event notification subscriptions, call the Amazon RDS API
DescribeEventSubscriptions action.
502
Amazon Relational Database Service User Guide
Modifying an Amazon RDS event notification subscription
Console
To modify an Amazon RDS event notification subscription
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 Event subscriptions.
3. In the Event subscriptions pane, choose the subscription that you want to modify and choose Edit.
4. Make your changes to the subscription in either the Target or Source section.
5. Choose Edit. The Amazon RDS console indicates that the subscription is being modified.
AWS CLI
To modify an Amazon RDS event notification subscription, use the AWS CLI modify-event-
subscription command. Include the following required parameter:
• --subscription-name
Example
For Windows:
API
To modify an Amazon RDS event, call the Amazon RDS API operation ModifyEventSubscription.
Include the following required parameter:
503
Amazon Relational Database Service User Guide
Modifying an Amazon RDS event notification subscription
• SubscriptionName
504
Amazon Relational Database Service User Guide
Adding a source identifier to an Amazon
RDS event notification subscription
Console
You can easily add or remove source identifiers using the Amazon RDS console by selecting or
deselecting them when modifying a subscription. For more information, see Modifying an Amazon RDS
event notification subscription (p. 503).
AWS CLI
To add a source identifier to an Amazon RDS event notification subscription, use the AWS CLI add-
source-identifier-to-subscription command. Include the following required parameters:
• --subscription-name
• --source-identifier
Example
The following example adds the source identifier mysqldb to the myrdseventsubscription
subscription.
For Windows:
API
To add a source identifier to an Amazon RDS event notification subscription, call the Amazon RDS API
AddSourceIdentifierToSubscription. Include the following required parameters:
• SubscriptionName
• SourceIdentifier
505
Amazon Relational Database Service User Guide
Removing a source identifier from an
Amazon RDS event notification subscription
Console
You can easily add or remove source identifiers using the Amazon RDS console by selecting or
deselecting them when modifying a subscription. For more information, see Modifying an Amazon RDS
event notification subscription (p. 503).
AWS CLI
To remove a source identifier from an Amazon RDS event notification subscription, use the AWS CLI
remove-source-identifier-from-subscription command. Include the following required
parameters:
• --subscription-name
• --source-identifier
Example
The following example removes the source identifier mysqldb from the myrdseventsubscription
subscription.
For Windows:
API
To remove a source identifier from an Amazon RDS event notification subscription, use the Amazon
RDS API RemoveSourceIdentifierFromSubscription command. Include the following required
parameters:
• SubscriptionName
• SourceIdentifier
506
Amazon Relational Database Service User Guide
Listing the Amazon RDS event notification categories
Console
When you create or modify an event notification subscription, the event categories are displayed in
the Amazon RDS console. For more information, see Modifying an Amazon RDS event notification
subscription (p. 503).
AWS CLI
To list the Amazon RDS event notification categories, use the AWS CLI describe-event-categories
command. This command has no required parameters.
Example
API
To list the Amazon RDS event notification categories, use the Amazon RDS API
DescribeEventCategories command. This command has no required parameters.
507
Amazon Relational Database Service User Guide
Deleting an Amazon RDS event notification subscription
Console
To delete an Amazon RDS event notification subscription
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 DB Event Subscriptions.
3. In the My DB Event Subscriptions pane, choose the subscription that you want to delete.
4. Choose Delete.
5. The Amazon RDS console indicates that the subscription is being deleted.
AWS CLI
To delete an Amazon RDS event notification subscription, use the AWS CLI delete-event-
subscription command. Include the following required parameter:
• --subscription-name
Example
API
To delete an Amazon RDS event notification subscription, use the RDS API DeleteEventSubscription
command. Include the following required parameter:
• SubscriptionName
508
Amazon Relational Database Service User Guide
Viewing Amazon RDS events
You can retrieve events for your RDS resources through the AWS Management Console, which shows
events from the past 24 hours. You can also retrieve events for your RDS resources by using the describe-
events AWS CLI command, or the DescribeEvents RDS API operation. If you use the AWS CLI or the RDS
API to view events, you can retrieve events for up to the past 14 days.
Note
If you need to store events for longer periods of time, you can send Amazon RDS events
to CloudWatch Events. For more information, see Getting CloudWatch Events and Amazon
EventBridge events for Amazon RDS (p. 558)
Console
To view all Amazon RDS instance events for the past 24 hours
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 Events. The available events appear in a list.
3. Use the Filter list to filter the events by type, and use the text box to the right of the Filter list to
further filter your results. For example, the following screenshot shows a list of events filtered by the
characters stopped.
AWS CLI
You can view all Amazon RDS instance events for the past 7 days by calling the describe-events AWS CLI
command and setting the --duration parameter to 10080.
API
You can view all Amazon RDS instance events for the past 14 days by calling the DescribeEvents RDS API
operation and setting the Duration parameter to 20160.
509
Amazon Relational Database Service User Guide
Accessing database logs
Console
To view a database log file
AWS CLI
To list the available database log files for a DB instance, use the AWS CLI describe-db-log-files
command.
The following example returns a list of log files for a DB instance named my-db-instance.
Example
RDS API
To list the available database log files for a DB instance, use the Amazon RDS API
DescribeDBLogFiles action.
510
Amazon Relational Database Service User Guide
Downloading a database log file
Console
To download a database log file
AWS CLI
To download a database log file, use the AWS CLI command download-db-log-file-portion. By
default, this command downloads only the latest portion of a log file. However, you can download an
entire file by specifying the parameter --starting-token 0.
The following example shows how to download the entire contents of a log file called log/ERROR.4 and
store it in a local file called errorlog.txt.
Example
For Linux, macOS, or Unix:
For Windows:
RDS API
To download a database log file, use the Amazon RDS API DownloadDBLogFilePortion action.
511
Amazon Relational Database Service User Guide
Watching a database log file
Console
To watch a database log file
• the section called “Publishing MariaDB logs to Amazon CloudWatch Logs” (p. 515)
• the section called “Publishing MySQL logs to Amazon CloudWatch Logs” (p. 527)
• the section called “Publishing Oracle logs to Amazon CloudWatch Logs” (p. 535)
• the section called “Publishing PostgreSQL logs to Amazon CloudWatch Logs” (p. 543)
• the section called “Publishing SQL Server logs to Amazon CloudWatch Logs” (p. 522)
• DBInstanceIdentifier—the name of the DB instance that contains the log file you want to
download.
• LogFileName—the name of the log file to be downloaded.
The response contains the contents of the requested log file, as a stream.
512
Amazon Relational Database Service User Guide
Reading log file contents using REST
The following example downloads the log file named log/ERROR.6 for the DB instance named sample-sql
in the us-west-2 region.
If you specify a nonexistent DB instance, the response consists of the following error:
513
Amazon Relational Database Service User Guide
MariaDB database log files
You can monitor the MariaDB logs directly through the Amazon RDS console, Amazon RDS API, Amazon
RDS CLI, or AWS SDKs. You can also access MariaDB logs by directing the logs to a database table in the
main database and querying that table. You can use the mysqlbinlog utility to download a binary log.
For more information about viewing, downloading, and watching file-based database logs, see Accessing
Amazon RDS database log files (p. 510).
MariaDB writes to the error log only on startup, shutdown, and when it encounters errors. A DB instance
can go hours or days without new entries being written to the error log. If you see no recent entries, it's
because the server did not encounter an error that resulted in a log entry.
You can control MariaDB logging by using the parameters in this list:
514
Amazon Relational Database Service User Guide
MariaDB database log files
When logging is enabled, Amazon RDS rotates table logs or deletes log files at regular intervals. This
measure is a precaution to reduce the possibility of a large log file either blocking database use or
affecting performance. FILE and TABLE logging approach rotation and deletion as follows:
• When FILE logging is enabled, log files are examined every hour and log files older than 24 hours
are deleted. In some cases, the remaining combined log file size after the deletion might exceed
the threshold of 2 percent of a DB instance's allocated space. In these cases, the largest log files are
deleted until the log file size no longer exceeds the threshold.
• When TABLE logging is enabled, in some cases log tables are rotated every 24 hours. This rotation
occurs if the space used by the table logs is more than 20 percent of the allocated storage space or the
size of all logs combined is greater than 10 GB. If the amount of space used for a DB instance is greater
than 90 percent of the DB instance's allocated storage space, then the thresholds for log rotation are
reduced. Log tables are then rotated if the space used by the table logs is more than 10 percent of the
allocated storage space or the size of all logs combined is greater than 5 GB.
When log tables are rotated, the current log table is copied to a backup log table and the entries in
the current log table are removed. If the backup log table already exists, then it is deleted before the
current log table is copied to the backup. You can query the backup log table if needed. The backup
log table for the mysql.general_log table is named mysql.general_log_backup. The backup
log table for the mysql.slow_log table is named mysql.slow_log_backup.
Amazon RDS records both TABLE and FILE log rotation in an Amazon RDS event and sends you a
notification.
To work with the logs from the Amazon RDS console, Amazon RDS API, Amazon RDS CLI, or AWS SDKs,
set the log_output parameter to FILE. Like the MariaDB error log, these log files are rotated hourly. The
log files that were generated during the previous 24 hours are retained.
For more information about the slow query and general logs, go to the following topics in the MariaDB
documentation:
Amazon RDS publishes each MariaDB database log as a separate database stream in the log group. For
example, if you configure the export function to include the slow query log, slow query data is stored in
a slow query log stream in the /aws/rds/instance/my_instance/slowquery log group.
The error log is enabled by default. The following table summarizes the requirements for the other
MariaDB logs.
515
Amazon Relational Database Service User Guide
MariaDB database log files
Log Requirement
Console
AWS CLI
You can publish a MariaDB logs with the AWS CLI. You can call the modify-db-instance command
with the following parameters:
• --db-instance-identifier
• --cloudwatch-logs-export-configuration
Note
A change to the --cloudwatch-logs-export-configuration option is always applied
to the DB instance immediately. Therefore, the --apply-immediately and --no-apply-
immediately options have no effect.
You can also publish MariaDB logs by calling the following AWS CLI commands:
• create-db-instance
• restore-db-instance-from-db-snapshot
• restore-db-instance-from-s3
• restore-db-instance-to-point-in-time
Run one of these AWS CLI commands with the following options:
• --db-instance-identifier
516
Amazon Relational Database Service User Guide
MariaDB database log files
• --enable-cloudwatch-logs-exports
• --db-instance-class
• --engine
Other options might be required depending on the AWS CLI command you run.
Example
The following example modifies an existing MariaDB DB instance to publish log files to CloudWatch Logs.
The --cloudwatch-logs-export-configuration value is a JSON object. The key for this object is
EnableLogTypes, and its value is an array of strings with any combination of audit, error, general,
and slowquery.
For Windows:
Example
The following command creates a MariaDB DB instance and publishes log files to CloudWatch Logs.
The --enable-cloudwatch-logs-exports value is a JSON array of strings. The strings can be any
combination of audit, error, general, and slowquery.
For Windows:
RDS API
You can publish MariaDB logs with the RDS API. You can call the ModifyDBInstance operation with the
following parameters:
517
Amazon Relational Database Service User Guide
MariaDB database log files
• DBInstanceIdentifier
• CloudwatchLogsExportConfiguration
Note
A change to the CloudwatchLogsExportConfiguration parameter is always applied to the
DB instance immediately. Therefore, the ApplyImmediately parameter has no effect.
You can also publish MariaDB logs by calling the following RDS API operations:
• CreateDBInstance
• RestoreDBInstanceFromDBSnapshot
• RestoreDBInstanceFromS3
• RestoreDBInstanceToPointInTime
Run one of these RDS API operations with the following parameters:
• DBInstanceIdentifier
• EnableCloudwatchLogsExports
• Engine
• DBInstanceClass
Other parameters might be required depending on the AWS CLI command you run.
Both the general log and the slow query logs are disabled by default. In order to enable logging to
tables, you must also set the general_log and slow_query_log server parameters to 1.
Log tables keep growing until the respective logging activities are turned off by resetting the appropriate
parameter to 0. A large amount of data often accumulates over time, which can use up a considerable
percentage of your allocated storage space. Amazon RDS does not allow you to truncate the log tables,
but you can move their contents. Rotating a table saves its contents to a backup table and then creates
a new empty log table. You can manually rotate the log tables with the following command line
procedures, where the command prompt is indicated by PROMPT>:
518
Amazon Relational Database Service User Guide
MariaDB database log files
To completely remove the old data and reclaim the disk space, call the appropriate procedure twice in
succession.
If you plan to use replication, the binary logging format is important because it determines the record of
data changes that is recorded in the source and sent to the replication targets. For information about the
advantages and disadvantages of different binary logging formats for replication, see Advantages and
disadvantages of statement-based and row-based replication in the MySQL documentation.
Important
Setting the binary logging format to row-based can result in very large binary log files. Large
binary log files reduce the amount of storage available for a DB instance and can increase the
amount of time to perform a restore operation of a DB instance.
Statement-based replication can cause inconsistencies between the source DB instance and a
read replica. For more information, see Unsafe statements for statement-based replication in
the MariaDB documentation.
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 the parameter group that is used by the DB instance that you want to modify.
You can't modify a default parameter group. If the DB instance is using a default parameter group,
create a new parameter group and associate it with the DB instance.
For more information on DB parameter groups, see Working with DB parameter groups (p. 234).
4. For Parameter group actions, choose Edit.
5. Set the binlog_format parameter to the binary logging format of your choice (ROW, STATEMENT,
or MIXED).
6. Choose Save changes to save the updates to the DB parameter group.
To run the mysqlbinlog utility against an Amazon RDS instance, use the following options:
519
Amazon Relational Database Service User Guide
MariaDB database log files
For more information about mysqlbinlog options, go to mysqlbinlog options in the MariaDB
documentation.
mysqlbinlog \
--read-from-remote-server \
--host=mariadbinstance1.1234abcd.region.rds.amazonaws.com \
--port=3306 \
--user ReplUser \
--password <password> \
--result-file=/tmp/binlog.txt
For Windows:
mysqlbinlog ^
--read-from-remote-server ^
--host=mariadbinstance1.1234abcd.region.rds.amazonaws.com ^
--port=3306 ^
--user ReplUser ^
--password <password> ^
--result-file=/tmp/binlog.txt
Amazon RDS normally purges a binary log as soon as possible, but the binary log must still be available
on the instance to be accessed by mysqlbinlog. To specify the number of hours for RDS to retain binary
logs, use the mysql.rds_set_configuration stored procedure and specify a period with enough
time for you to download the logs. After you set the retention period, monitor storage usage for the DB
instance to ensure that the retained binary logs do not take up too much storage.
call mysql.rds_show_configuration;
You can enable binary log annotations globally by creating a custom parameter group and
setting the binlog_annotate_row_events parameter to 1. You can also enable annotations
at the session level, by calling SET SESSION binlog_annotate_row_events = 1. Use the
replicate_annotate_row_events to replicate binary log annotations to the slave instance if binary
logging is enabled on it. No special privileges are required to use these settings.
The following is an example of a row-based transaction in MariaDB. The use of row-based logging is
triggered by setting the transaction isolation level to read-committed.
520
Amazon Relational Database Service User Guide
MariaDB database log files
Without annotations, the binary log entries for the transaction look like the following:
BEGIN
/*!*/;
# at 1163
# at 1209
#150922 7:55:57 server id 1855786460 end_log_pos 1209 Table_map: `test`.`square`
mapped to number 76
#150922 7:55:57 server id 1855786460 end_log_pos 1247 Write_rows: table id 76
flags: STMT_END_F
### INSERT INTO `test`.`square`
### SET
### @1=5
### @2=25
# at 1247
#150922 7:56:01 server id 1855786460 end_log_pos 1274 Xid = 62
COMMIT/*!*/;
The following statement enables session-level annotations for this same transaction, and disables them
after committing the transaction:
With annotations, the binary log entries for the transaction look like the following:
BEGIN
/*!*/;
# at 423
# at 483
# at 529
#150922 8:04:24 server id 1855786460 end_log_pos 483 Annotate_rows:
#Q> INSERT INTO square(x, y) VALUES(5, 5 * 5)
#150922 8:04:24 server id 1855786460 end_log_pos 529 Table_map: `test`.`square` mapped
to number 76
#150922 8:04:24 server id 1855786460 end_log_pos 567 Write_rows: table id 76 flags:
STMT_END_F
### INSERT INTO `test`.`square`
### SET
### @1=5
### @2=25
# at 567
#150922 8:04:26 server id 1855786460 end_log_pos 594 Xid = 88
COMMIT/*!*/;
521
Amazon Relational Database Service User Guide
Microsoft SQL Server database log files
Retention schedule
Log files are rotated each day and whenever your DB instance is restarted. The following is the retention
schedule for Microsoft SQL Server logs on Amazon RDS.
Error logs A maximum of 30 error logs are retained. Amazon RDS might delete error
logs older than 7 days.
Agent logs A maximum of 10 agent logs are retained. Amazon RDS might delete agent
logs older than 7 days.
Trace files Trace files are retained according to the trace file retention period of your DB
instance. The default trace file retention period is 7 days. To modify the trace
file retention period for your DB instance, see Setting the retention period
for trace and dump files (p. 828).
Dump files Dump files are retained according to the dump file retention period of your
DB instance. The default dump file retention period is 7 days. To modify the
dump file retention period for your DB instance, see Setting the retention
period for trace and dump files (p. 828).
• Store logs in highly durable storage space with a retention period that you define.
• Search and filter log data.
• Share log data between accounts.
• Export logs to Amazon S3.
• Stream data to Amazon Elasticsearch Service.
• Process log data in real time with Amazon Kinesis Data Streams.
Amazon RDS publishes each SQL Server database log as a separate database stream in the log group.
For example, if you publish error logs, error data is stored in an error log stream in the /aws/rds/
instance/my_instance/error log group.
522
Amazon Relational Database Service User Guide
Microsoft SQL Server database log files
Note
Publishing SQL Server logs to CloudWatch Logs isn't enabled by default. Publishing trace and
dump files isn't supported. Publishing SQL Server logs to CloudWatch Logs is supported in all
regions, except for Asia Pacific (Hong Kong).
Console
To publish SQL Server DB logs to CloudWatch Logs from the AWS Management Console
AWS CLI
To publish SQL Server logs, you can use the modify-db-instance command with the following
parameters:
• --db-instance-identifier
• --cloudwatch-logs-export-configuration
Note
A change to the --cloudwatch-logs-export-configuration option is always applied
to the DB instance immediately. Therefore, the --apply-immediately and --no-apply-
immediately options have no effect.
You can also publish SQL Server logs using the following commands:
• create-db-instance
• restore-db-instance-from-db-snapshot
• restore-db-instance-to-point-in-time
Example
The following example creates an SQL Server DB instance with CloudWatch Logs publishing enabled.
The --enable-cloudwatch-logs-exports value is a JSON array of strings that can include error,
agent, or both.
For Windows:
523
Amazon Relational Database Service User Guide
Microsoft SQL Server database log files
--db-instance-identifier mydbinstance ^
--enable-cloudwatch-logs-exports "[\"error\",\"agent\"]" ^
--db-instance-class db.m4.large ^
--engine sqlserver-se
Note
When using the Windows command prompt, you must escape double quotes (") in JSON code by
prefixing them with a backslash (\).
Example
The following example modifies an existing SQL Server DB instance to publish log files to CloudWatch
Logs. The --cloudwatch-logs-export-configuration value is a JSON object. The key for this
object is EnableLogTypes, and its value is an array of strings that can include error, agent, or both.
For Windows:
Note
When using the Windows command prompt, you must escape double quotes (") in JSON code by
prefixing them with a backslash (\).
Example
The following example modifies an existing SQL Server DB instance to disable publishing agent log files
to CloudWatch Logs. The --cloudwatch-logs-export-configuration value is a JSON object. The
key for this object is DisableLogTypes, and its value is an array of strings that can include error,
agent, or both.
For Windows:
Note
When using the Windows command prompt, you must escape double quotes (") in JSON code by
prefixing them with a backslash (\).
524
Amazon Relational Database Service User Guide
MySQL database log files
You can monitor the MySQL logs directly through the Amazon RDS console, Amazon RDS API, AWS
CLI, or AWS SDKs. You can also access MySQL logs by directing the logs to a database table in the main
database and querying that table. You can use the mysqlbinlog utility to download a binary log.
For more information about viewing, downloading, and watching file-based database logs, see Accessing
Amazon RDS database log files (p. 510).
Topics
• Accessing MySQL error logs (p. 525)
• Accessing the MySQL slow query and general logs (p. 525)
• Accessing the MySQL audit log (p. 527)
• Publishing MySQL logs to Amazon CloudWatch Logs (p. 527)
• Log file size (p. 529)
• Managing table-based MySQL logs (p. 530)
• Binary logging format (p. 530)
• Accessing MySQL binary logs (p. 531)
Each log file has the hour it was generated (in UTC) appended to its name. The log files also have a
timestamp that helps you determine when the log entries were written.
MySQL writes to the error log only on startup, shutdown, and when it encounters errors. A DB instance
can go hours or days without new entries being written to the error log. If you see no recent entries, it's
because the server did not encounter an error that would result in a log entry.
You can control MySQL logging by using the parameters in this list:
525
Amazon Relational Database Service User Guide
MySQL database log files
• long_query_time: To prevent fast-running queries from being logged in the slow query log, specify
a value for the shortest query run time to be logged, in seconds. The default is 10 seconds; the
minimum is 0. If log_output = FILE, you can specify a floating point value that goes to microsecond
resolution. If log_output = TABLE, you must specify an integer value with second resolution. Only
queries whose run time exceeds the long_query_time value are logged. For example, setting
long_query_time to 0.1 prevents any query that runs for less than 100 milliseconds from being
logged.
• log_queries_not_using_indexes: To log all queries that do not use an index to the slow query
log, set to 1. The default is 0. Queries that do not use an index are logged even if their run time is less
than the value of the long_query_time parameter.
• log_output option: You can specify one of the following options for the log_output parameter.
• TABLE (default) – Write general queries to the mysql.general_log table, and slow queries to the
mysql.slow_log table.
• FILE – Write both general and slow query logs to the file system. Log files are rotated hourly.
• NONE – Disable logging.
When logging is enabled, Amazon RDS rotates table logs or deletes log files at regular intervals. This
measure is a precaution to reduce the possibility of a large log file either blocking database use or
affecting performance. FILE and TABLE logging approach rotation and deletion as follows:
• When FILE logging is enabled, log files are examined every hour and log files older than 24 hours
are deleted. In some cases, the remaining combined log file size after the deletion might exceed
the threshold of 2 percent of a DB instance's allocated space. In these cases, the largest log files are
deleted until the log file size no longer exceeds the threshold.
• When TABLE logging is enabled, in some cases log tables are rotated every 24 hours. This rotation
occurs if the space used by the table logs is more than 20 percent of the allocated storage space or the
size of all logs combined is greater than 10 GB. If the amount of space used for a DB instance is greater
than 90 percent of the DB instance's allocated storage space, then the thresholds for log rotation are
reduced. Log tables are then rotated if the space used by the table logs is more than 10 percent of
the allocated storage space or the size of all logs combined is greater than 5 GB. You can subscribe to
the low_free_storage event to be notified when log tables are rotated to free up space. For more
information, see Using Amazon RDS event notification (p. 493).
When log tables are rotated, the current log table is copied to a backup log table and the entries in
the current log table are removed. If the backup log table already exists, then it is deleted before the
current log table is copied to the backup. You can query the backup log table if needed. The backup
log table for the mysql.general_log table is named mysql.general_log_backup. The backup
log table for the mysql.slow_log table is named mysql.slow_log_backup.
To work with the logs from the Amazon RDS console, Amazon RDS API, Amazon RDS CLI, or AWS SDKs,
set the log_output parameter to FILE. Like the MySQL error log, these log files are rotated hourly. The
log files that were generated during the previous 24 hours are retained. Note that the retention period is
different between Amazon RDS and Aurora.
For more information about the slow query and general logs, go to the following topics in the MySQL
documentation:
526
Amazon Relational Database Service User Guide
MySQL database log files
Amazon RDS publishes each MySQL database log as a separate database stream in the log group. For
example, if you configure the export function to include the slow query log, slow query data is stored in
a slow query log stream in the /aws/rds/instance/my_instance/slowquery log group.
The error log is enabled by default. The following table summarizes the requirements for the other
MySQL logs.
Log Requirement
Note
Publishing log files to CloudWatch Logs is only supported for MySQL versions 5.6, 5.7, and 8.0.
Console
AWS CLI
You can publish MySQL logs with the AWS CLI. You can call the modify-db-instance command with
the following parameters:
527
Amazon Relational Database Service User Guide
MySQL database log files
• --db-instance-identifier
• --cloudwatch-logs-export-configuration
Note
A change to the --cloudwatch-logs-export-configuration option is always applied
to the DB instance immediately. Therefore, the --apply-immediately and --no-apply-
immediately options have no effect.
You can also publish MySQL logs by calling the following AWS CLI commands:
• create-db-instance
• restore-db-instance-from-db-snapshot
• restore-db-instance-from-s3
• restore-db-instance-to-point-in-time
Run one of these AWS CLI commands with the following options:
• --db-instance-identifier
• --enable-cloudwatch-logs-exports
• --db-instance-class
• --engine
Other options might be required depending on the AWS CLI command you run.
Example
The following example modifies an existing MySQL DB instance to publish log files to CloudWatch Logs.
The --cloudwatch-logs-export-configuration value is a JSON object. The key for this object is
EnableLogTypes, and its value is an array of strings with any combination of audit, error, general,
and slowquery.
For Windows:
Example
The following example creates a MySQL DB instance and publishes log files to CloudWatch Logs. The
--enable-cloudwatch-logs-exports value is a JSON array of strings. The strings can be any
combination of audit, error, general, and slowquery.
528
Amazon Relational Database Service User Guide
MySQL database log files
For Windows:
RDS API
You can publish MySQL logs with the RDS API. You can call the ModifyDBInstance action with the
following parameters:
• DBInstanceIdentifier
• CloudwatchLogsExportConfiguration
Note
A change to the CloudwatchLogsExportConfiguration parameter is always applied to the
DB instance immediately. Therefore, the ApplyImmediately parameter has no effect.
You can also publish MySQL logs by calling the following RDS API operations:
• CreateDBInstance
• RestoreDBInstanceFromDBSnapshot
• RestoreDBInstanceFromS3
• RestoreDBInstanceToPointInTime
Run one of these RDS API operations with the following parameters:
• DBInstanceIdentifier
• EnableCloudwatchLogsExports
• Engine
• DBInstanceClass
Other parameters might be required depending on the AWS CLI command you run.
For MySQL, there is a size limit on BLOBs written to the redo log. To account for this limit, ensure
that the innodb_log_file_size parameter for your MySQL DB instance is 10 times larger than the
529
Amazon Relational Database Service User Guide
MySQL database log files
largest BLOB data size found in your tables, plus the length of other variable length fields (VARCHAR,
VARBINARY, TEXT) in the same tables. For information on how to set parameter values, see Working
with DB parameter groups (p. 234). For information on the redo log BLOB size limit, go to Changes in
MySQL 5.6.20.
Both the general log and the slow query logs are disabled by default. In order to enable logging to
tables, you must also set the general_log and slow_query_log server parameters to 1.
Log tables keep growing until the respective logging activities are turned off by resetting the appropriate
parameter to 0. A large amount of data often accumulates over time, which can use up a considerable
percentage of your allocated storage space. Amazon RDS does not allow you to truncate the log tables,
but you can move their contents. Rotating a table saves its contents to a backup table and then creates
a new empty log table. You can manually rotate the log tables with the following command line
procedures, where the command prompt is indicated by PROMPT>:
To completely remove the old data and reclaim the disk space, call the appropriate procedure twice in
succession.
If you plan to use replication, the binary logging format is important because it determines the record of
data changes that is recorded in the source and sent to the replication targets. For information about the
advantages and disadvantages of different binary logging formats for replication, see Advantages and
disadvantages of statement-based and row-based replication in the MySQL documentation.
Important
Setting the binary logging format to row-based can result in very large binary log files. Large
binary log files reduce the amount of storage available for a DB instance and can increase the
amount of time to perform a restore operation of a DB instance.
Statement-based replication can cause inconsistencies between the source DB instance and a
read replica. For more information, see Determination of safe and unsafe statements in binary
logging in the MySQL documentation.
You can't modify a default parameter group. If the DB instance is using a default parameter group,
create a new parameter group and associate it with the DB instance.
530
Amazon Relational Database Service User Guide
MySQL database log files
For more information on parameter groups, see Working with DB parameter groups (p. 234).
4. From Parameter group actions, choose Edit.
5. Set the binlog_format parameter to the binary logging format of your choice (ROW, STATEMENT,
or MIXED).
6. Choose Save changes to save the updates to the DB parameter group.
Important
Changing a DB parameter group affects all DB instances that use that parameter group. If you
want to specify different binary logging formats for different MySQL DB instances in an AWS
Region, the DB instances must use different DB parameter groups. These parameter groups
identify different logging formats. Assign the appropriate DB parameter group to the each DB
instance.
To run the mysqlbinlog utility against an Amazon RDS instance, use the following options:
For more information about mysqlbinlog options, go to mysqlbinlog - utility for processing binary log
files.
mysqlbinlog \
--read-from-remote-server \
--host=MySQL56Instance1.cg034hpkmmjt.region.rds.amazonaws.com \
--port=3306 \
--user ReplUser \
--password \
--raw \
--result-file=/tmp/ \
binlog.00098
For Windows:
531
Amazon Relational Database Service User Guide
MySQL database log files
mysqlbinlog ^
--read-from-remote-server ^
--host=MySQL56Instance1.cg034hpkmmjt.region.rds.amazonaws.com ^
--port=3306 ^
--user ReplUser ^
--password ^
--raw ^
--result-file=/tmp/ ^
binlog.00098
Amazon RDS normally purges a binary log as soon as possible, but the binary log must still be available
on the instance to be accessed by mysqlbinlog. To specify the number of hours for RDS to retain binary
logs, use the mysql.rds_set_configuration stored procedure and specify a period with enough
time for you to download the logs. After you set the retention period, monitor storage usage for the DB
instance to ensure that the retained binary logs don't take up too much storage.
Note
The mysql.rds_set_configuration stored procedure is only available for MySQL version
5.6 or later.
call mysql.rds_show_configuration;
532
Amazon Relational Database Service User Guide
Oracle database log files
The Oracle audit files provided are the standard Oracle auditing files. Amazon RDS supports the Oracle
fine-grained auditing (FGA) feature. However, log access doesn't provide access to FGA events that are
stored in the SYS.FGA_LOG$ table and that are accessible through the DBA_FGA_AUDIT_TRAIL view.
The DescribeDBLogFiles API operation that lists the Oracle log files that are available for a
DB instance ignores the MaxRecords parameter and returns up to 1,000 records. The call returns
LastWritten as a POSIX date in milliseconds.
Retention schedule
The Oracle database engine might rotate log files if they get very large. To retain audit or trace files,
download them. If you store the files locally, you reduce your Amazon RDS storage costs and make more
space available for your data.
The following table shows the retention schedule for Oracle alert logs, audit files, and trace files on
Amazon RDS.
Alert logs The text alert log is rotated daily with 30-day retention managed by Amazon
RDS. The XML alert log is retained for at least seven days. You can access this
log by using the ALERTLOG view.
Audit files The default retention period for au