Aurora Ug
Aurora Ug
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 Aurora User Guide for Aurora
Table of Contents
What Is Aurora? ................................................................................................................................. 1
Aurora DB Clusters ..................................................................................................................... 3
Regions and Availability Zones ..................................................................................................... 5
Region Availability .............................................................................................................. 5
Local Time Zone for DB Clusters .......................................................................................... 9
Aurora Connection Management ................................................................................................ 12
Types of Aurora Endpoints ................................................................................................ 12
Viewing Endpoints ............................................................................................................ 14
Using the Cluster Endpoint ................................................................................................ 14
Using the Reader Endpoint ................................................................................................ 15
Using Custom Endpoints ................................................................................................... 15
Creating a Custom Endpoint .............................................................................................. 17
Viewing Custom Endpoints ................................................................................................ 19
Editing a Custom Endpoint ................................................................................................ 24
Deleting a Custom Endpoint .............................................................................................. 26
End-to-End AWS CLI Example for Custom Endpoints ............................................................. 27
Using the Instance Endpoints ..................................................................................................... 31
Endpoints and High Availability ................................................................................................. 31
DB Instance Classes .................................................................................................................. 33
DB Instance Class Types .................................................................................................... 33
Terminology .................................................................................................................... 33
Hardware Specifications .................................................................................................... 34
Aurora Storage and Reliability ................................................................................................... 37
Overview of Aurora Storage .............................................................................................. 37
Cluster Volume Contents ................................................................................................... 38
Storage Growth ................................................................................................................ 38
Data Billing ..................................................................................................................... 38
Reliability ........................................................................................................................ 38
Aurora Security ........................................................................................................................ 40
Using SSL with Aurora DB Clusters ..................................................................................... 40
High Availability for Aurora ....................................................................................................... 40
Aurora Global Database ............................................................................................................ 41
Overview of Global Database ............................................................................................. 42
Creating a Global Database ............................................................................................... 43
Adding an AWS Region ..................................................................................................... 50
Removing a Cluster .......................................................................................................... 52
Deleting an Aurora Global Database ................................................................................... 54
Importing Data into a Global Database ............................................................................... 56
Connecting to an Aurora Global Database ........................................................................... 57
Failover for Global Database .............................................................................................. 57
Performance Insights for Global Database ........................................................................... 58
Multiple Secondary Regions ............................................................................................... 58
Using Global Database with Other AWS Services .................................................................. 58
Replication with Aurora ............................................................................................................. 60
Aurora Replicas ................................................................................................................ 60
Aurora MySQL .................................................................................................................. 60
Aurora PostgreSQL ........................................................................................................... 61
DB Instance Billing for Aurora ................................................................................................... 61
On-Demand DB Instances .................................................................................................. 62
Reserved DB Instances ...................................................................................................... 63
Setting Up Your Environment ............................................................................................................ 74
Sign Up for AWS ...................................................................................................................... 74
Create an IAM User .................................................................................................................. 74
Determine Requirements ........................................................................................................... 76
iii
Amazon Aurora User Guide for Aurora
Provide Access to the DB Cluster in the VPC by Creating a Security Group ........................................ 77
Getting Started ................................................................................................................................ 79
Creating an Aurora MySQL DB Cluster and Connecting to It ........................................................... 79
Create an Aurora MySQL DB Cluster ................................................................................... 79
Connect to an Instance in a DB Cluster ............................................................................... 86
Delete the Sample DB Cluster, DB Subnet Group, and VPC ..................................................... 88
Creating an Aurora PostgreSQL DB Cluster and Connecting to It ..................................................... 88
Create an Aurora PostgreSQL DB Cluster ............................................................................. 89
Connect to an Instance in an Aurora PostgreSQL DB Cluster .................................................. 97
Delete the Sample DB Cluster, DB Subnet Group, and VPC ..................................................... 98
Configuring Your Aurora DB Cluster .................................................................................................. 100
Creating a DB Cluster .............................................................................................................. 101
Prerequisites .................................................................................................................. 101
Creating a DB Cluster ...................................................................................................... 102
Available Settings ........................................................................................................... 111
Using Aurora Serverless ........................................................................................................... 117
Advantages of Aurora Serverless ...................................................................................... 117
Use Cases for Aurora Serverless ....................................................................................... 117
Limitations of Aurora Serverless ....................................................................................... 118
Using TLS/SSL with Aurora Serverless ............................................................................... 119
How Aurora Serverless Works .......................................................................................... 120
Creating an Aurora Serverless DB Cluster ........................................................................... 125
Restoring an Aurora Serverless DB Cluster ......................................................................... 130
Modifying an Aurora Serverless DB Cluster ........................................................................ 133
Setting the Capacity of an Aurora Serverless DB Cluster ...................................................... 134
Viewing Aurora Serverless DB Clusters .............................................................................. 136
Using the Data API ......................................................................................................... 140
Logging Data API Calls with AWS CloudTrail ...................................................................... 162
Using the Query Editor ................................................................................................... 164
Connecting to a DB Cluster ...................................................................................................... 169
Connecting to Aurora MySQL ........................................................................................... 169
Connecting to Aurora PostgreSQL .................................................................................... 172
Troubleshooting Connections ........................................................................................... 174
Managing Connections with RDS Proxy (Preview) ................................................................ 175
Working with Parameter Groups ............................................................................................... 205
DB Cluster and DB Instance Parameters ............................................................................. 207
Creating a DB Parameter Group ....................................................................................... 208
Creating a DB Cluster Parameter Group ............................................................................. 209
Modifying Parameters in a DB Parameter Group ................................................................. 210
Modifying Parameters in a DB Cluster Parameter Group ...................................................... 213
Copying a DB Parameter Group ........................................................................................ 215
Copying a DB Cluster Parameter Group ............................................................................. 216
Listing DB Parameter Groups ........................................................................................... 217
Listing DB Cluster Parameter Groups ................................................................................ 218
Viewing Parameter Values for a DB Parameter Group .......................................................... 219
Viewing Parameter Values for a DB Cluster Parameter Group ............................................... 220
Comparing Parameter Groups .......................................................................................... 222
DB Parameter Values ...................................................................................................... 222
Migrating Data to a DB Cluster ................................................................................................ 226
Aurora MySQL ................................................................................................................ 226
Aurora PostgreSQL ......................................................................................................... 226
Managing an Aurora DB Cluster ....................................................................................................... 227
Stopping and Starting a Cluster ............................................................................................... 228
Overview of Stopping and Starting a Cluster ..................................................................... 228
Limitations ..................................................................................................................... 228
Stopping a DB Cluster ..................................................................................................... 229
While a DB Cluster Is Stopped ......................................................................................... 230
iv
Amazon Aurora User Guide for Aurora
v
Amazon Aurora User Guide for Aurora
vi
Amazon Aurora User Guide for Aurora
vii
Amazon Aurora User Guide for Aurora
viii
Amazon Aurora User Guide for Aurora
ix
Amazon Aurora User Guide for Aurora
x
Amazon Aurora User Guide for Aurora
xi
Amazon Aurora User Guide for Aurora
Aurora is part of the managed database service Amazon Relational Database Service (Amazon RDS).
Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in
the cloud. If you are not already familiar with Amazon RDS, see the Amazon Relational Database Service
User Guide.
The following points illustrate how Aurora relates to the standard MySQL and PostgreSQL engines
available in Amazon RDS:
• You choose Aurora as a DB engine option when setting up new database servers through Amazon RDS.
• Aurora takes advantage of the familiar Amazon Relational Database Service (Amazon RDS) features for
management and administration. Aurora uses the Amazon RDS AWS Management Console interface,
AWS CLI commands, and API operations to handle routine database tasks such as provisioning,
patching, backup, recovery, failure detection, and repair.
• Aurora management operations typically involve entire clusters of database servers that are
synchronized through replication, instead of individual database instances. The automatic clustering,
replication, and storage allocation make it simple and cost-effective to set up, operate, and scale your
largest MySQL and PostgreSQL deployments.
• You can bring data from Amazon RDS for MySQL and Amazon RDS for PostgreSQL into Aurora by
creating and restoring snapshots, or by setting up one-way replication. You can use push-button
migration tools to convert your existing Amazon RDS for MySQL and Amazon RDS for PostgreSQL
applications to Aurora.
Before using Amazon Aurora, you should complete the steps in Setting Up Your Environment for
Amazon Aurora (p. 74), and then review the concepts and features of Aurora in Amazon Aurora DB
Clusters (p. 3).
Topics
• Amazon Aurora DB Clusters (p. 3)
• Regions and Availability Zones (p. 5)
• Amazon Aurora Connection Management (p. 12)
• Using the Instance Endpoints (p. 31)
• How Aurora Endpoints Work with High Availability (p. 31)
• DB Instance Classes (p. 33)
• Amazon Aurora Storage and Reliability (p. 37)
• Amazon Aurora Security (p. 40)
1
Amazon Aurora User Guide for Aurora
2
Amazon Aurora User Guide for Aurora
Aurora DB Clusters
• Primary DB instance – Supports read and write operations, and performs all of the data modifications
to the cluster volume. Each Aurora DB cluster has one primary DB instance.
• Aurora Replica – Connects to the same storage volume as the primary DB instance and supports
only read operations. Each Aurora DB cluster can have up to 15 Aurora Replicas in addition to the
primary DB instance. Maintain high availability by locating Aurora Replicas in separate Availability
Zones. Aurora automatically fails over to an Aurora Replica in case the primary DB instance becomes
unavailable. You can specify the failover priority for Aurora Replicas. Aurora Replicas can also offload
read workloads from the primary DB instance.
• For Aurora multi-master clusters, all DB instances have read-write capability. In this case, the
distinction between primary instance and Aurora Replica doesn't apply. For discussing replication
topology where the clusters can use either single-master or multi-master replication, we call these
writer and reader DB instances.
The following diagram illustrates the relationship between the cluster volume, the primary DB instance,
and Aurora Replicas in an Aurora DB cluster.
Note
The preceding information applies to all the Aurora clusters that use single-master replication.
These include provisioned clusters, parallel query clusters, global database clusters, serverless
clusters, and all MySQL 5.7-compatible and PostgreSQL-compatible clusters.
Aurora clusters that use multi-master replication have a different arrangement of read-write and
read-only DB instances. All DB instances in a multi-master cluster can perform write operations.
There isn't a single DB instance that performs all the write operations, and there aren't any
read-only DB instances. Therefore, the terms primary instance and Aurora Replica don't apply
3
Amazon Aurora User Guide for Aurora
Aurora DB Clusters
to multi-master clusters. When we discuss clusters that might use multi-master replication, we
refer to writer DB instances and reader DB instances.
The Aurora cluster illustrates the separation of compute capacity and storage. For example, an Aurora
configuration with only a single DB instance is still a cluster, because the underlying storage volume
involves multiple storage nodes distributed across multiple Availability Zones (AZs).
4
Amazon Aurora User Guide for Aurora
Regions and Availability Zones
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 would be available.
It is important to remember that each AWS Region is completely independent. Any Amazon RDS activity
you initiate (for example, creating database instances or listing available database instances) runs only
in your current default AWS Region. The default AWS Region can be changed in the console, by setting
the EC2_REGION environment variable, or it can be overridden by using the --region parameter with
the AWS Command Line Interface. See Configuring the AWS Command Line Interface, specifically, the
sections on Environment Variables and Command Line Options for more information.
Amazon RDS supports a special AWS Region called AWS GovCloud (US-West) that is designed to
allow US government agencies and customers to move more sensitive workloads into the cloud. AWS
GovCloud (US-West) addresses the US government's specific regulatory and compliance requirements.
For more information about AWS GovCloud (US-West), see What Is AWS GovCloud (US-West)?
To create or work with an Amazon RDS DB instance in a specific AWS Region, use the corresponding
regional service endpoint.
Region Availability
Note
Aurora MySQL version 5.7 and Aurora PostgreSQL version 10.7 don’t have time zone data that
reflect recent changes to Daylight Saving Time (DST) in Brazil. For a workaround until updated
versions are available, reset the DB cluster’s time zone parameter if the expected time doesn't
show correctly for the recently changed Brazil time zone. Do the following:
• South America (Sao Paulo) region – set the time zone to America/Fortaleza.
• South America (Cuiaba) region – set the time zone to America/Manaus.
To change the time zone, see Modifying Parameters in a DB Parameter Group (p. 210).
5
Amazon Aurora User Guide for Aurora
Region Availability
Topics
• Aurora MySQL Region Availability (p. 6)
• Aurora PostgreSQL Region Availability (p. 7)
6
Amazon Aurora User Guide for Aurora
Region Availability
7
Amazon Aurora User Guide for Aurora
Region Availability
8
Amazon Aurora User Guide for Aurora
Local Time Zone for DB Clusters
To set the local time zone for a DB cluster, set the time_zone parameter in the cluster parameter
group for your DB cluster to one of the supported values listed later in this section. When you set the
time_zone parameter for a DB cluster, all instances in the DB cluster change to use the new local time
zone. If other Aurora DB clusters are using the same cluster parameter group, then all instances in those
DB clusters change to use the new local time zone also. For information on cluster-level parameters, see
Amazon Aurora DB Cluster and DB Instance Parameters (p. 207).
After you set the local time zone, all new connections to the database reflect the change. If you have any
open connections to your database when you change the local time zone, you won't see the local time
zone update until after you close the connection and open a new connection.
If you are replicating across AWS Regions, then the replication master DB cluster and the replica use
different parameter groups (parameter groups are unique to an AWS Region). To use the same local time
zone for each instance, you must set the time_zone parameter in the parameter groups for both the
replication master and the replica.
When you restore a DB cluster from a DB cluster snapshot, the local time zone is set to UTC. You can
update the time zone to your local time zone after the restore is complete. If you restore a DB cluster
to a point in time, then the local time zone for the restored DB cluster is the time zone setting from the
parameter group of the restored DB cluster.
You can set your local time zone to one of the values listed in the following table. For some time zones,
time values for certain date ranges can be reported incorrectly as noted in the table. For Australia time
zones, the time zone abbreviation returned is an outdated value as noted in the table.
Africa/Harare This time zone setting can return incorrect values from 28 Feb 1903
21:49:40 GMT to 28 Feb 1903 21:55:48 GMT.
Africa/Monrovia
Africa/Nairobi This time zone setting can return incorrect values from 31 Dec 1939
21:30:00 GMT to 31 Dec 1959 21:15:15 GMT.
Africa/Windhoek
9
Amazon Aurora User Guide for Aurora
Local Time Zone for DB Clusters
America/Bogota This time zone setting can return incorrect values from 23 Nov 1914
04:56:16 GMT to 23 Nov 1914 04:56:20 GMT.
America/Caracas
America/Chihuahua
America/Cuiaba
America/Denver
America/Fortaleza If your DB cluster is in the South America (Sao Paulo) region and the
expected time doesn't show correctly for the recently changed Brazil time
zone, reset the DB cluster's time zone parameter to America/Fortaleza.
America/Guatemala
America/Halifax This time zone setting can return incorrect values from 27 Oct 1918
05:00:00 GMT to 31 Oct 1918 05:00:00 GMT.
America/Manaus If your DB cluster is in the South America (Cuiaba) region and the expected
time doesn't show correctly for the recently changed Brazil time zone, reset
the DB cluster's time zone parameter to America/Manaus.
America/Matamoros
America/Monterrey
America/Montevideo
America/Phoenix
America/Tijuana
Asia/Ashgabat
Asia/Baghdad
Asia/Baku
Asia/Bangkok
Asia/Beirut
Asia/Calcutta
Asia/Kabul
Asia/Karachi
Asia/Kathmandu
Asia/Muscat This time zone setting can return incorrect values from 31 Dec 1919
20:05:36 GMT to 31 Dec 1919 20:05:40 GMT.
Asia/Riyadh This time zone setting can return incorrect values from 13 Mar 1947
20:53:08 GMT to 31 Dec 1949 20:53:08 GMT.
Asia/Seoul This time zone setting can return incorrect values from 30 Nov 1904
15:30:00 GMT to 07 Sep 1945 15:00:00 GMT.
10
Amazon Aurora User Guide for Aurora
Local Time Zone for DB Clusters
Asia/Shanghai This time zone setting can return incorrect values from 31 Dec 1927
15:54:08 GMT to 02 Jun 1940 16:00:00 GMT.
Asia/Singapore
Asia/Taipei This time zone setting can return incorrect values from 30 Sep 1937
16:00:00 GMT to 29 Sep 1979 15:00:00 GMT.
Asia/Tehran
Asia/Tokyo This time zone setting can return incorrect values from 30 Sep 1937
15:00:00 GMT to 31 Dec 1937 15:00:00 GMT.
Asia/Ulaanbaatar
Atlantic/Azores This time zone setting can return incorrect values from 24 May 1911
01:54:32 GMT to 01 Jan 1912 01:54:32 GMT.
Australia/Adelaide The abbreviation for this time zone is returned as CST instead of ACDT/ACST.
Australia/Brisbane The abbreviation for this time zone is returned as EST instead of AEDT/AEST.
Australia/Darwin The abbreviation for this time zone is returned as CST instead of ACDT/ACST.
Australia/Hobart The abbreviation for this time zone is returned as EST instead of AEDT/AEST.
Australia/Perth The abbreviation for this time zone is returned as WST instead of AWDT/
AWST.
Australia/Sydney The abbreviation for this time zone is returned as EST instead of AEDT/AEST.
Brazil/East
Canada/ This time zone setting can return incorrect values from 27 Oct 1918
Saskatchewan 08:00:00 GMT to 31 Oct 1918 08:00:00 GMT.
Europe/Amsterdam
Europe/Athens
Europe/Dublin
Europe/Helsinki This time zone setting can return incorrect values from 30 Apr 1921
22:20:08 GMT to 30 Apr 1921 22:20:11 GMT.
Europe/Paris
Europe/Prague
Europe/Sarajevo
Pacific/Auckland
Pacific/Guam
Pacific/Honolulu This time zone setting can return incorrect values from 21 May 1933
11:30:00 GMT to 30 Sep 1945 11:30:00 GMT.
Pacific/Samoa This time zone setting can return incorrect values from 01 Jan 1911
11:22:48 GMT to 01 Jan 1950 11:30:00 GMT.
11
Amazon Aurora User Guide for Aurora
Aurora Connection Management
US/Alaska
US/Central
US/Eastern
US/East-Indiana
US/Pacific
UTC
For certain Aurora tasks, different instances or groups of instances perform different roles. For example,
the primary instance handles all data definition language (DDL) and data manipulation language (DML)
statements. Up to 15 Aurora Replicas handle read-only query traffic.
Using endpoints, you can map each connection to the appropriate instance or group of instances based
on your use case. For example, to perform DDL statements you can connect to whichever instance is the
primary instance. To perform queries, you can connect to the reader endpoint, with Aurora automatically
performing load-balancing among all the Aurora Replicas. For clusters with DB instances of different
capacities or configurations, you can connect to custom endpoints associated with different subsets of
DB instances. For diagnosis or tuning, you can connect to a specific instance endpoint to examine details
about a specific DB instance.
Topics
• Types of Aurora Endpoints (p. 12)
• Viewing the Endpoints for an Aurora Cluster (p. 14)
• Using the Cluster Endpoint (p. 14)
• Using the Reader Endpoint (p. 15)
• Using Custom Endpoints (p. 15)
• Creating a Custom Endpoint (p. 17)
• Viewing Custom Endpoints (p. 19)
• Editing a Custom Endpoint (p. 24)
• Deleting a Custom Endpoint (p. 26)
• End-to-End AWS CLI Example for Custom Endpoints (p. 27)
12
Amazon Aurora User Guide for Aurora
Types of Aurora Endpoints
Cluster endpoint
A cluster endpoint (or writer endpoint) for an Aurora DB cluster connects to the current primary DB
instance for that DB cluster. This endpoint is the only one that can perform write operations such as
DDL statements. Because of this, the cluster endpoint is the one that you connect to when you first
set up a cluster or when your cluster only contains a single DB instance.
Each Aurora DB cluster has one cluster endpoint and one primary DB instance.
You use the cluster endpoint for all write operations on the DB cluster, including inserts, updates,
deletes, and DDL changes. You can also use the cluster endpoint for read operations, such as queries.
The cluster endpoint provides failover support for read/write connections to the DB cluster. If the
current primary DB instance of a DB cluster fails, Aurora automatically fails over to a new primary
DB instance. During a failover, the DB cluster continues to serve connection requests to the cluster
endpoint from the new primary DB instance, with minimal interruption of service.
The following example illustrates a cluster endpoint for an Aurora MySQL DB cluster.
mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com:3306
Reader endpoint
A reader endpoint for an Aurora DB cluster provides load-balancing support for read-only
connections to the DB cluster. Use the reader endpoint for read operations, such as queries. By
processing those statements on the read-only Aurora Replicas, this endpoint reduces the overhead
on the primary instance. It also helps the cluster to scale the capacity to handle simultaneous
SELECT queries, proportional to the number of Aurora Replicas in the cluster. Each Aurora DB cluster
has one reader endpoint.
If the cluster contains one or more Aurora Replicas, the reader endpoint load-balances each
connection request among the Aurora Replicas. In that case, you can only perform read-only
statements such as SELECT in that session. If the cluster only contains a primary instance and no
Aurora Replicas, the reader endpoint connects to the primary instance. In that case, you can perform
write operations through the endpoint.
The following example illustrates a reader endpoint for an Aurora MySQL DB cluster.
mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com:3306
Custom endpoint
A custom endpoint for an Aurora cluster represents a set of DB instances that you choose. When you
connect to the endpoint, Aurora performs load balancing and chooses one of the instances in the
group to handle the connection. You define which instances this endpoint refers to, and you decide
what purpose the endpoint serves.
An Aurora DB cluster has no custom endpoints until you create one. You can create up to five custom
endpoints for each provisioned Aurora cluster. You can't use custom endpoints for Aurora Serverless
clusters.
The custom endpoint provides load-balanced database connections based on criteria other than
the read-only or read-write capability of the DB instances. For example, you might define a custom
endpoint to connect to instances that use a particular AWS instance class or a particular DB
parameter group. Then you might tell particular groups of users about this custom endpoint. For
example, you might direct internal users to low-capacity instances for report generation or ad hoc
(one-time) querying, and direct production traffic to high-capacity instances.
Because the connection can go to any DB instance that is associated with the custom endpoint,
we recommend that you make sure that all the DB instances within that group share some similar
characteristic. Doing so ensures that the performance, memory capacity, and so on, are consistent
for everyone who connects to that endpoint.
13
Amazon Aurora User Guide for Aurora
Viewing Endpoints
This feature is intended for advanced users with specialized kinds of workloads where it isn't
practical to keep all the Aurora Replicas in the cluster identical. With custom endpoints, you can
predict the capacity of the DB instance used for each connection. When you use custom endpoints,
you typically don't use the reader endpoint for that cluster.
The following example illustrates a custom endpoint for a DB instance in an Aurora MySQL DB
cluster.
myendpoint.cluster-custom-123456789012.us-east-1.rds.amazonaws.com:3306
Instance endpoint
An instance endpoint connects to a specific DB instance within an Aurora cluster. Each DB instance in
a DB cluster has its own unique instance endpoint. So there is one instance endpoint for the current
primary DB instance of the DB cluster, and there is one instance endpoint for each of the Aurora
Replicas in the DB cluster.
The instance endpoint provides direct control over connections to the DB cluster, for scenarios where
using the cluster endpoint or reader endpoint might not be appropriate. For example, your client
application might require more fine-grained load balancing based on workload type. In this case, you
can configure multiple clients to connect to different Aurora Replicas in a DB cluster to distribute
read workloads. For an example that uses instance endpoints to improve connection speed after a
failover for Aurora PostgreSQL, see Fast Failover with Amazon Aurora PostgreSQL (p. 932). For
an example that uses instance endpoints to improve connection speed after a failover for Aurora
MySQL, see MariaDB Connector/J failover support – case Amazon Aurora.
The following example illustrates an instance endpoint for a DB instance in an Aurora MySQL DB
cluster.
mydbinstance.123456789012.us-east-1.rds.amazonaws.com:3306
With the AWS CLI, you see the writer, reader, and any custom endpoints in the output of the describe-db-
clusters command. For example, the following command shows the endpoint attributes for all clusters in
your current AWS Region.
With the Amazon RDS API, you retrieve the endpoints by calling the DescribeDbClusterEndpoints
function.
You use the cluster endpoint when you administer your cluster, perform extract, transform, load (ETL)
operations, or develop and test applications. The cluster endpoint connects to the primary instance of
the cluster. The primary instance is the only DB instance where you can create tables and indexes, run
INSERT statements, and perform other DDL and DML operations.
14
Amazon Aurora User Guide for Aurora
Using the Reader Endpoint
The physical IP address pointed to by the cluster endpoint changes when the failover mechanism
promotes a new DB instance to be the read-write primary instance for the cluster. If you use any form
of connection pooling or other multiplexing, be prepared to flush or reduce the time-to-live for any
cached DNS information. Doing so ensures that you don't try to establish a read-write connection to a DB
instance that became unavailable or is now read-only after a failover.
The reader endpoint load-balances connections to available Aurora Replicas in an Aurora DB cluster. It
doesn't load-balance individual queries. If you want to load-balance each query to distribute the read
workload for a DB cluster, open a new connection to the reader endpoint for each query.
Each Aurora cluster has a single built-in reader endpoint, whose name and other attributes are managed
by Aurora. You can't create, delete, or modify this kind of endpoint.
If your cluster contains only a primary instance and no Aurora Replicas, the reader endpoint connects to
the primary instance. In that case, you can perform write operations through this endpoint.
Previously, you might have used the CNAMES mechanism to set up Domain Name Service (DNS) aliases
from your own domain to achieve similar results. By using custom endpoints, you can avoid updating
CNAME records when your cluster grows or shrinks. Custom endpoints also mean that you can use
encrypted Transport Layer Security/Secure Sockets Layer (TLS/SSL) connections.
Instead of using one DB instance for each specialized purpose and connecting to its instance endpoint,
you can have multiple groups of specialized DB instances. In this case, each group has its own custom
endpoint. This way, Aurora can perform load balancing among all the instances dedicated to tasks such
as reporting or handling production or internal queries. The custom endpoints provide load balancing
and high availability for each group of DB instances within your cluster. If one of the DB instances within
a group becomes unavailable, Aurora directs subsequent custom endpoint connections to one of the
other DB instances associated with the same endpoint.
Topics
• Specifying Properties for Custom Endpoints (p. 15)
• Membership Rules for Custom Endpoints (p. 16)
• Managing Custom Endpoints (p. 17)
endpointName.cluster-custom-customerDnsIdentifier.dnsSuffix
Because custom endpoint names don't include the name of your cluster, you don't have to change those
names if you rename a cluster. You can't reuse the same custom endpoint name for more than one
cluster in the same region. Give each custom endpoint a name that is unique across the clusters owned
by your user ID within a particular region.
15
Amazon Aurora User Guide for Aurora
Using Custom Endpoints
Each custom endpoint has an associated type that determines which DB instances are eligible to be
associated with that endpoint. Currently, the type can be READER, WRITER, or ANY. The following
considerations apply to the custom endpoint types:
• Only DB instances that are read-only Aurora Replicas can be part of a READER custom endpoint.
The READER type applies only to clusters using single-master replication, because those clusters can
include multiple read-only DB instances.
• Both read-only Aurora Replicas and the read-write primary instance can be part of an ANY custom
endpoint. Aurora directs connections to cluster endpoints with type ANY to any associated DB instance
with equal probability. Because you can't determine in advance if you are connecting to the primary
instance of a read-only Aurora Replica, use this kind of endpoint for read-only connections only. The
ANY type applies to clusters using any replication topology.
• The WRITER type applies only to multi-master clusters, because those clusters can include multiple
read-write DB instances.
• If you try to create a custom endpoint with a type that isn't appropriate based on the replication
configuration for a cluster, Aurora returns an error.
You can define a list of DB instances to include in, or exclude from, a custom endpoint. We refer to these
lists as static and exclusion lists, respectively. You can use the inclusion/exclusion mechanism to further
subdivide the groups of DB instances, and to make sure that the set of custom endpoints covers all the
DB instances in the cluster. Each custom endpoint can contain only one of these list types.
In the AWS Management Console, the choice is represented by the check box Attach future instances
added to this cluster. When you keep check box clear, the custom endpoint uses a static list containing
only the DB instances specified in the dialog. When you choose the check box, the custom endpoint uses
an exclusion list. In this case, the custom endpoint represents all DB instances in the cluster (including
any that you add in the future) except the ones left unselected in the dialog. The AWS CLI and Amazon
RDS API have parameters representing each kind of list. When you use the AWS CLI or Amazon RDS API,
you can't add or remove individual members to the lists; you always specify the entire new list.
Aurora doesn't change the DB instances specified in the static or exclusion lists when DB instances
change roles between primary instance and Aurora Replica due to failover or promotion. For example,
a custom endpoint with type READER might include a DB instance that was an Aurora Replica and
then was promoted to a primary instance. The type of a custom endpoint (READER, WRITER, or ANY)
determines what kinds of operations you can perform through that endpoint.
You can associate a DB instance with more than one custom endpoint. For example, suppose that
you add a new DB instance to a cluster, or that Aurora adds a DB instance automatically through the
autoscaling mechanism. In these cases, the DB instance is added to all custom endpoints for which
it is eligible. Which endpoints the DB instance is added to is based on the custom endpoint type of
READER , WRITER, or ANY, plus any static or exclusion lists defined for each endpoint. For example, if
the endpoint includes a static list of DB instances, newly added Aurora Replicas aren't added to that
endpoint. Conversely, if the endpoint has an exclusion list, newly added Aurora Replicas are added to
the endpoint, if they aren't named in the exclusion list and their roles match the type of the custom
endpoint.
If an Aurora Replica becomes unavailable, it remains associated with any custom endpoints. For example,
it remains part of the custom endpoint when it is unhealthy, stopped, rebooting, and so on. However,
you can't connect to it through those endpoints until it becomes available again.
16
Amazon Aurora User Guide for Aurora
Creating a Custom Endpoint
To work with custom endpoints from the AWS Management Console, you navigate to the details page for
your Aurora cluster and use the controls under the Custom Endpoints section.
To work with custom endpoints from the AWS CLI, you can use these operations:
• create-db-cluster-endpoint
• describe-db-cluster-endpoints
• modify-db-cluster-endpoint
• delete-db-cluster-endpoint
To work with custom endpoints through the Amazon RDS API, you can use the following functions:
• CreateDBClusterEndpoint
• DescribeDBClusterEndpoints
• ModifyDBClusterEndpoint
• DeleteDBClusterEndpoint
17
Amazon Aurora User Guide for Aurora
Creating a Custom Endpoint
18
Amazon Aurora User Guide for Aurora
Viewing Custom Endpoints
You can't select the custom endpoint type of ANY or READER in the AWS Management Console. All the
custom endpoints you create through the AWS Management Console have a type of ANY.
AWS CLI
To create a custom endpoint with the AWS CLI, run the create-db-cluster-endpoint command.
The following command creates a custom endpoint attached to a specific cluster. Initially, the endpoint is
associated with all the Aurora Replica instances in the cluster. A subsequent command associates it with
a specific set of DB instances in the cluster.
For Windows:
RDS API
To create a custom endpoint with the RDS API, run the CreateDBClusterEndpoint operation.
The following screenshot shows how the list of custom endpoints for an Aurora cluster is initially empty.
19
Amazon Aurora User Guide for Aurora
Viewing Custom Endpoints
After you create some custom endpoints for that cluster, they are shown under the Endpoints section.
20
Amazon Aurora User Guide for Aurora
Viewing Custom Endpoints
Clicking through to the detail page shows which DB instances the endpoint is currently associated with.
21
Amazon Aurora User Guide for Aurora
Viewing Custom Endpoints
22
Amazon Aurora User Guide for Aurora
Viewing Custom Endpoints
To see the additional detail of whether new DB instances added to the cluster are automatically added to
the endpoint also, bring up the Edit dialog for the endpoint.
AWS CLI
To view custom endpoints with the AWS CLI, run the describe-db-cluster-endpoints command.
The following command shows the custom endpoints associated with a specified cluster in a specified
region. The output includes both the built-in endpoints and any custom endpoints.
For Windows:
{
"DBClusterEndpoints": [
{
"Endpoint": "custom-endpoint-demo.cluster-123456789012.ca-central-1.rds.amazonaws.com",
"Status": "available",
"DBClusterIdentifier": "custom-endpoint-demo",
"EndpointType": "WRITER"
},
{
"Endpoint": "custom-endpoint-demo.cluster-ro-123456789012.ca-
central-1.rds.amazonaws.com",
"Status": "available",
"DBClusterIdentifier": "custom-endpoint-demo",
"EndpointType": "READER"
},
{
"CustomEndpointType": "ANY",
"DBClusterEndpointIdentifier": "powers-of-2",
"ExcludedMembers": [],
"DBClusterIdentifier": "custom-endpoint-demo",
"Status": "available",
"EndpointType": "CUSTOM",
"Endpoint": "powers-of-2.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com",
"StaticMembers": [
"custom-endpoint-demo-04",
"custom-endpoint-demo-08",
"custom-endpoint-demo-01",
23
Amazon Aurora User Guide for Aurora
Editing a Custom Endpoint
"custom-endpoint-demo-02"
],
"DBClusterEndpointResourceIdentifier": "cluster-endpoint-W7PE3TLLFNSHXQKFU6J6NV5FHU",
"DBClusterEndpointArn": "arn:aws:rds:ca-central-1:111122223333:cluster-endpoint:powers-
of-2"
},
{
"CustomEndpointType": "ANY",
"DBClusterEndpointIdentifier": "eight-and-higher",
"ExcludedMembers": [
"custom-endpoint-demo-04",
"custom-endpoint-demo-02",
"custom-endpoint-demo-07",
"custom-endpoint-demo-05",
"custom-endpoint-demo-03",
"custom-endpoint-demo-06",
"custom-endpoint-demo-01"
],
"DBClusterIdentifier": "custom-endpoint-demo",
"Status": "available",
"EndpointType": "CUSTOM",
"Endpoint": "eight-and-higher.cluster-custom-123456789012.ca-
central-1.rds.amazonaws.com",
"StaticMembers": [],
"DBClusterEndpointResourceIdentifier": "cluster-endpoint-W7PE3TLLFNSHYQKFU6J6NV5FHU",
"DBClusterEndpointArn": "arn:aws:rds:ca-central-1:111122223333:cluster-endpoint:eight-
and-higher"
}
]
}
RDS API
To view custom endpoints with the RDS API, run the DescribeDBClusterEndpoints.html operation.
You can't connect to or use a custom endpoint while the changes from an edit action are in progress. It
might take some minutes before the endpoint status returns to Available and you can connect again.
Console
To edit a custom endpoint with the AWS Management Console, you can select the endpoint on the
cluster detail page, or bring up the detail page for the endpoint, and choose the Edit action.
24
Amazon Aurora User Guide for Aurora
Editing a Custom Endpoint
25
Amazon Aurora User Guide for Aurora
Deleting a Custom Endpoint
AWS CLI
To edit a custom endpoint with the AWS CLI, run the modify-db-cluster-endpoint command.
The following commands change the set of DB instances that apply to a custom endpoint and optionally
switches between the behavior of a static or exclusion list. The --static-members and --excluded-
members parameters take a space-separated list of DB instance identifiers.
For Windows:
RDS API
To edit a custom endpoint with the RDS API, run the ModifyDBClusterEndpoint.html operation.
AWS CLI
To delete a custom endpoint with the AWS CLI, run the delete-db-cluster-endpoint command.
26
Amazon Aurora User Guide for Aurora
End-to-End AWS CLI Example for Custom Endpoints
The following command deletes a custom endpoint. You don't need to specify the associated cluster, but
you must specify the region.
For Windows:
RDS API
To delete a custom endpoint with the RDS API, run the DeleteDBClusterEndpoint operation.
This example demonstrates the initial setup steps: creating an Aurora cluster and adding DB instances
to it. This is a heterogeneous cluster, meaning not all the DB instances have the same capacity.
Most instances use the AWS instance class db.r4.4xlarge, but the last two DB instances use
db.r4.16xlarge. Each of these sample create-db-instance commands prints its output to the
screen and saves a copy of the JSON in a file for later inspection.
for i in 01 02 03 04 05 06 07 08
do
aws rds create-db-instance --db-instance-identifier custom-endpoint-demo-${i} \
--engine aurora --db-cluster-identifier custom-endpoint-demo --db-instance-class
db.r4.4xlarge \
--region $REGION \
| tee custom-endpoint-demo-${i}.json
done
for i in 09 10
do
aws rds create-db-instance --db-instance-identifier custom-endpoint-demo-${i} \
--engine aurora --db-cluster-identifier custom-endpoint-demo --db-instance-class
db.r4.16xlarge \
--region $REGION \
| tee custom-endpoint-demo-${i}.json
done
27
Amazon Aurora User Guide for Aurora
End-to-End AWS CLI Example for Custom Endpoints
The larger instances are reserved for specialized kinds of reporting queries. To make it unlikely for them
to be promoted to the primary instance, the following example changes their promotion tier to the
lowest priority.
for i in 09 10
do
aws rds modify-db-instance --db-instance-id custom-endpoint-demo-${i} \
--region $REGION --promotion-tier 15
done
Suppose you want to use the two "bigger" instances only for the most resource-intensive queries. You
can create a custom read-only endpoint, and then add a static list of members so that the endpoint
connects only to those DB instances. Those instances are already in the lowest promotion tier, making it
unlikely either of them would ever be promoted to the primary instance. If one of them was promoted
to the primary instance, it would become unreachable through this endpoint because we specified the
READER type instead of the ANY type. The following example demonstrates the create and modify
endpoint commands, and sample JSON output showing the initial and modified state of the custom
endpoint.
The default READER endpoint for the cluster can connect to either the "small" or "big" DB instances,
making it impractical to predict query performance and scalability when the cluster becomes busy.
To divide the workload cleanly between the sets of DB instances, you can ignore the default READER
endpoint and create a second custom endpoint that connects to all other DB instances. The following
28
Amazon Aurora User Guide for Aurora
End-to-End AWS CLI Example for Custom Endpoints
example does so by creating a custom endpoint and then adding an exclusion list. Any other DB
instances you add to the cluster later will be added to this endpoint automatically. The ANY type means
that this endpoint is associated with eight instances in total: the primary instance and another seven
Aurora Replicas. If the example used the READER type, the custom endpoint would only be associated
with the seven Aurora Replicas.
The following example checks the state of the endpoints for this cluster. The cluster still has its original
cluster endpoint, with EndPointType of WRITER, which you would still use for administration, ETL, and
other write operations. It still has its original READER endpoint, which you wouldn't use because each
connection to it might be directed to a "small" or "big" DB instance. The custom endpoints make this
behavior predictable, with connections guaranteed to use one of the "small" or "big" DB instances based
on the endpoint you specify.
29
Amazon Aurora User Guide for Aurora
End-to-End AWS CLI Example for Custom Endpoints
{
"EndpointType": "READER",
"Endpoint": "custom-endpoint-demo.cluster-ro-123456789012.ca-
central-1.rds.amazonaws.com",
"Status": "available",
"DBClusterIdentifier": "custom-endpoint-demo"
},
{
"Endpoint": "small-instances.cluster-custom-123456789012.ca-
central-1.rds.amazonaws.com",
"CustomEndpointType": "ANY",
"DBClusterEndpointArn": "arn:aws:rds:ca-central-1:111122223333:cluster-
endpoint:small-instances",
"ExcludedMembers": [
"custom-endpoint-demo-09",
"custom-endpoint-demo-10"
],
"DBClusterEndpointResourceIdentifier": "cluster-
endpoint-6RDDXQOC3AKKZT2PRD7ST37BMY",
"DBClusterIdentifier": "custom-endpoint-demo",
"StaticMembers": [],
"EndpointType": "CUSTOM",
"DBClusterEndpointIdentifier": "small-instances",
"Status": "modifying"
},
{
"Endpoint": "big-instances.cluster-custom-123456789012.ca-
central-1.rds.amazonaws.com",
"CustomEndpointType": "READER",
"DBClusterEndpointArn": "arn:aws:rds:ca-central-1:111122223333:cluster-
endpoint:big-instances",
"ExcludedMembers": [],
"DBClusterEndpointResourceIdentifier": "cluster-endpoint-
W7PE3TLLFNSHXQKFU6J6NV5FHU",
"DBClusterIdentifier": "custom-endpoint-demo",
"StaticMembers": [
"custom-endpoint-demo-10",
"custom-endpoint-demo-09"
],
"EndpointType": "CUSTOM",
"DBClusterEndpointIdentifier": "big-instances",
"Status": "available"
}
]
}
The final examples demonstrate how successive database connections to the custom endpoints connect
to the various DB instances in the Aurora cluster. The small-instances endpoint always connects to
the db.r4.4xlarge DB instances, which are the lower-numbered hosts in this cluster.
$ mysql -h small-instances.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com -u
$MYUSER -p
mysql> select @@aurora_server_id;
+-------------------------+
| @@aurora_server_id |
+-------------------------+
| custom-endpoint-demo-02 |
+-------------------------+
$ mysql -h small-instances.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com -u
$MYUSER -p
mysql> select @@aurora_server_id;
+-------------------------+
30
Amazon Aurora User Guide for Aurora
Using the Instance Endpoints
| @@aurora_server_id |
+-------------------------+
| custom-endpoint-demo-07 |
+-------------------------+
$ mysql -h small-instances.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com -u
$MYUSER -p
mysql> select @@aurora_server_id;
+-------------------------+
| @@aurora_server_id |
+-------------------------+
| custom-endpoint-demo-01 |
+-------------------------+
The big-instances endpoint always connects to the db.r4.16xlarge DB instances, which are the
two highest-numbered hosts in this cluster.
$ mysql -h big-instances.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com -u
$MYUSER -p
mysql> select @@aurora_server_id;
+-------------------------+
| @@aurora_server_id |
+-------------------------+
| custom-endpoint-demo-10 |
+-------------------------+
$ mysql -h big-instances.cluster-custom-123456789012.ca-central-1.rds.amazonaws.com -u
$MYUSER -p
mysql> select @@aurora_server_id;
+-------------------------+
| @@aurora_server_id |
+-------------------------+
| custom-endpoint-demo-09 |
+-------------------------+
In advanced use cases, you might configure some DB instances differently than others. In this case, use
the instance endpoint to connect directly to an instance that is smaller, larger, or otherwise has different
characteristics than the others. Also, set up failover priority so that this special DB instance is the last
choice to take over as the primary instance. We recommend that you use custom endpoints instead of
the instance endpoint in such cases. Doing so simplifies connection management and high availability as
you add more DB instances to your cluster.
Each DB instance in an Aurora cluster has its own built-in instance endpoint, whose name and other
attributes are managed by Aurora. You can't create, delete, or modify this kind of endpoint.
31
Amazon Aurora User Guide for Aurora
Endpoints and High Availability
better than instance endpoints do. The instance endpoints connect to a specific DB instance in a DB
cluster, requiring logic in your application to choose a different endpoint if the DB instance becomes
unavailable.
If the primary DB instance of a DB cluster fails, Aurora automatically fails over to a new primary DB
instance. It does so by either promoting an existing Aurora Replica to a new primary DB instance or
creating a new primary DB instance. If a failover occurs, you can use the cluster endpoint to reconnect to
the newly promoted or created primary DB instance, or use the reader endpoint to reconnect to one of
the Aurora Replicas in the DB cluster. During a failover, the reader endpoint might direct connections to
the new primary DB instance of a DB cluster for a short time after an Aurora Replica is promoted to the
new primary DB instance.
If you design your own application logic to manage connections to instance endpoints, you can manually
or programmatically discover the resulting set of available DB instances in the DB cluster. You can then
confirm their instance classes after failover and connect to an appropriate instance endpoint.
For more information about failovers, see Fault Tolerance for an Aurora DB Cluster (p. 287).
32
Amazon Aurora User Guide for Aurora
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. 33)
• Terminology for DB Instance Class Hardware Specifications (p. 33)
• Hardware Specifications for All Available DB Instance Classes for Aurora (p. 34)
• db.r5 – Latest-generation instance classes optimized for memory-intensive applications. These offer
improved networking performance. They are powered by the AWS Nitro System, a combination of
dedicated hardware and lightweight hypervisor.
• db.r4 – Current-generation instance classes optimized for memory-intensive applications. These offer
improved networking performance.
• db.r3 – Previous-generation instance classes that provide memory optimization. The db.r3 instances
classes are not available in the Europe (Paris) region.
• db.t3 – Latest-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 – Current-generation instance classes that provide a baseline performance level, with the ability
to burst to full CPU usage. We recommend using these instance classes only for development and test
servers, or other nonproduction servers.
Note
The DB instance classes that use the AWS Nitro System (db.r5, db.t3) are throttled on combined
read plus write workload.
• 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.
33
Amazon Aurora User Guide for Aurora
Hardware Specifications
• 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.
• Max. Bandwidth (Mbps) – The maximum bandwidth in megabits per second. Divide by 8 to get the
expected throughput in megabytes per second.
Note
This figure refers to I/O bandwidth for local storage within the DB instance. It doesn't apply to
communication with the Aurora cluster volume.
• Network Performance – The network speed relative to other DB instance classes.
• Aurora Support for db.r5 – These instance classes are available in all Aurora regions except AWS
GovCloud (US-West), AWS GovCloud (US-East), and China (Beijing).
• Aurora MySQL versions support the db.r5 instance classes as specified in the following table.
• For Aurora PostgreSQL, the versions that support db.r5 instance classes depend on the AWS Region
that your DB cluster is in. To determine which Aurora PostgreSQL versions support db.r5 instance
classes for a specific AWS Region, use the CLI command describe-orderable-db-instance-
options. Enter the AWS Region of your cluster for the --region parameter in the following
command.
For Windows:
34
Amazon Aurora User Guide for Aurora
Hardware Specifications
• For Aurora MySQL db.r5, db.r4, and db.t3 DB instance classes, no instances in the cluster can have
pending instance-level system updates. To see pending system updates, use the following AWS CLI
command.
• Aurora PostgreSQL supports only the db.t3.medium instance class for versions compatible with
PostgreSQL 10.7 or later. These instance classes are available for Aurora PostgreSQL in all Aurora
regions except China (Ningxia).
35
Amazon Aurora User Guide for Aurora
Hardware Specifications
db.t3.2xlarge* 8 Variable 32 Up to Up to 5 No No
2,048 Gbps
db.t3.xlarge* 4 Variable 16 Up to Up to 5 No No
2,048 Gbps
db.t3.large* 2 Variable 8 Up to Up to 5 No No
2,048 Gbps
36
Amazon Aurora User Guide for Aurora
Aurora Storage and Reliability
db.t3.micro* 2 Variable 1 Up to Up to 5 No No
1,536 Gbps
* 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.
Topics
• Overview of Aurora Storage (p. 37)
• What the Cluster Volume Contains (p. 38)
• How Aurora Storage Grows (p. 38)
• How Aurora Data Storage is Billed (p. 38)
• Amazon Aurora Reliability (p. 38)
37
Amazon Aurora User Guide for Aurora
Cluster Volume Contents
The Aurora shared storage architecture makes your data independent from the DB instances in the
cluster. For example, you can add a DB instance quickly because Aurora doesn't make a new copy of the
table data. Instead, the DB instance connects to the shared volume that already contains all your data.
You can remove a DB instance from a cluster without removing any of the underlying data from the
cluster. Only when you delete the entire cluster does Aurora remove the data.
This automatic storage scaling, combined with the high-performance and highly distributed storage
subsystem, makes Aurora a good choice for your important enterprise data when your main objectives
are reliability and high availability. See the following sections for ways to balance storage costs against
these other priorities.
If removing data from an Aurora cluster results in a substantial amount of allocated but unused space,
resetting the high water mark requires doing a logical data dump and restore to a new cluster, using
a tool such as mysqldump. Creating and restoring a snapshot does not reduce the allocated storage
because the physical layout of the underlying storage remains the same in the restored snapshot.
For pricing information about Aurora data storage, see Amazon RDS for Aurora Pricing.
Topics
• Storage Auto-Repair (p. 39)
• Survivable Cache Warming (p. 39)
• Crash Recovery (p. 39)
38
Amazon Aurora User Guide for Aurora
Reliability
Storage Auto-Repair
Because Aurora maintains multiple copies of your data in three Availability Zones, the chance of losing
data as a result of a disk failure is greatly minimized. Aurora automatically detects failures in the disk
volumes that make up the cluster volume. When a segment of a disk volume fails, Aurora immediately
repairs the segment. When Aurora repairs the disk segment, it uses the data in the other volumes that
make up the cluster volume to ensure that the data in the repaired segment is current. As a result, Aurora
avoids data loss and reduces the need to perform a point-in-time restore to recover from a disk failure.
The Aurora page cache is managed in a separate process from the database, which allows the page cache
to survive independently of the database. In the unlikely event of a database failure, the page cache
remains in memory, which ensures that the buffer pool is warmed with the most current state when the
database restarts.
Crash Recovery
Aurora is designed to recover from a crash almost instantaneously and continue to serve your application
data without the binary log. Aurora performs crash recovery asynchronously on parallel threads, so that
your database is open and available immediately after a crash.
For more information about crash recovery, see Fault Tolerance for an Aurora DB Cluster (p. 287).
The following are considerations for binary logging and crash recovery on Aurora MySQL:
• Enabling binary logging on Aurora directly affects the recovery time after a crash, because it forces the
DB instance to perform binary log recovery.
• The type of binary logging used affects the size and efficiency of logging. For the same amount of
database activity, some formats log more information than others in the binary logs. The following
settings for the binlog_format parameter result in different amounts of log data:
• ROW – The most log data
• STATEMENT – The least log data
• MIXED – A moderate amount of log data that usually provides the best combination of data integrity
and performance
The amount of binary log data affects recovery time. If there is more data logged in the binary logs,
the DB instance must process more data during recovery, which increases recovery time.
• Aurora does not need the binary logs to replicate data within a DB cluster or to perform point in time
restore (PITR).
• If you don't need the binary log for external replication (or an external binary log stream), we
recommend that you set the binlog_format parameter to OFF to disable binary logging. Doing so
reduces recovery time.
For more information about Aurora binary logging and replication, see Replication with Amazon
Aurora (p. 60). For more information about the implications of different MySQL replication types,
see Advantages and Disadvantages of Statement-Based and Row-Based Replication in the MySQL
documentation.
39
Amazon Aurora User Guide for Aurora
Aurora Security
• To control who can perform Amazon RDS management actions on Aurora DB clusters and DB
instances, you use AWS Identity and Access Management (IAM). When you connect to AWS using IAM
credentials, your AWS account must have IAM policies that grant the permissions required to perform
Amazon RDS management operations. For more information, see Identity and Access Management in
Amazon Aurora (p. 1019).
If you are using IAM to access the Amazon RDS console, you must first log on to the AWS Management
Console with your IAM user credentials, and then go to the Amazon RDS console at https://
console.aws.amazon.com/rds.
• Aurora DB clusters must be created in an Amazon Virtual Private Cloud (VPC). To control which devices
and Amazon EC2 instances can open connections to the endpoint and port of the DB instance for
Aurora DB clusters in a VPC, you use a VPC security group. You can make these endpoint and port
connections using Transport Layer Security (TLS) / Secure Sockets Layer (SSL). In addition, firewall
rules at your company can control whether devices running at your company can open connections
to a DB instance. For more information on VPCs, see Amazon Virtual Private Cloud VPCs and Amazon
Aurora (p. 1067).
• To authenticate logins and permissions for an Amazon Aurora DB cluster, you can take either of the
following approaches, or a combination of them.
• You can take the same approach as with a stand-alone DB instance of MySQL or PostgreSQL.
Techniques for authenticating logins and permissions for stand-alone DB instances of MySQL or
PostgreSQL, such as using SQL commands or modifying database schema tables, also work with
Aurora. For more information, see Security with Amazon Aurora MySQL (p. 508) or Security with
Amazon Aurora PostgreSQL (p. 823).
• You can also use IAM database authentication for Aurora MySQL.
With IAM database authentication, you authenticate to your Aurora MySQL DB cluster by using an
IAM user or IAM role and an authentication token. An authentication token is a unique value that is
generated using the Signature Version 4 signing process. By using IAM database authentication, you
can use the same credentials to control access to your AWS resources and your databases. For more
information, see IAM Database Authentication (p. 1035).
For information about configuring security, see Security in Amazon Aurora (p. 1001).
40
Amazon Aurora User Guide for Aurora
Aurora Global Database
Aurora stores copies of the data in a DB cluster across multiple Availability Zones in a single AWS
Region, regardless of whether the instances in the DB cluster span multiple Availability Zones. For more
information on Aurora, see Managing an Amazon Aurora DB Cluster (p. 227). When data is written to
the primary DB instance, Aurora synchronously replicates the data across Availability Zones to six storage
nodes associated with your cluster volume. Doing so provides data redundancy, eliminates I/O freezes,
and minimizes 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 failure
and Availability Zone disruption. For more information on Availability Zones, see Regions and Availability
Zones (p. 5).
For a cluster using single-master replication, after you create the primary instance, you can create
up to 15 Aurora Replicas. These read-only DB instances support SELECT queries for read-intensive
applications. We recommend that you distribute the primary instance and Aurora Replicas in your DB
cluster over multiple Availability Zones to improve the availability of your DB cluster. When you create
reader instances across Availability Zones, Amazon RDS automatically provisions them and keeps them
up-to-date with the primary instance.
Using the RDS console, you can create a Multi-AZ deployment by simply specifying Multi-AZ when
creating a DB cluster. If a DB cluster is in a single Availability Zone, you can make it a Multi-AZ DB cluster
adding another DB instance in a different Availability Zone.
You can specify a Multi-AZ deployment using the CLI as well. Use the AWS CLI describe-db-instances
command, or the Amazon RDS API DescribeDBInstances operation to show the Availability Zone of the
standby replica (called the secondary AZ).
For more information, see Region Availability (p. 5). Call the create-db-instance AWS CLI command to
create an Aurora Replica in your DB cluster. Include the name of the DB cluster as the --db-cluster-
identifier parameter value. You can optionally specify an Availability Zone for the Aurora Replica
using the --availability-zone parameter.
For more information about failover to Aurora Replicas, see Amazon Aurora Connection
Management (p. 12). For more information about creating a DB cluster, see Creating an Amazon Aurora
DB Cluster (p. 101).
Topics
• Overview of Aurora Global Database (p. 42)
• Creating an Aurora Global Database (p. 43)
• Adding an AWS Region to an Aurora Global Database (p. 50)
• Removing a Cluster from an Aurora Global Database (p. 52)
• Deleting an Aurora Global Database (p. 54)
• Importing Data into an Aurora Global Database (p. 56)
• Connecting to an Aurora Global Database (p. 57)
• Failover for Aurora Global Database (p. 57)
• Performance Insights for Aurora Global Database (p. 58)
• Using Multiple Secondary Regions with Aurora Global Database (p. 58)
• Using Aurora Global Database with Other AWS Services (p. 58)
41
Amazon Aurora User Guide for Aurora
Overview of Global Database
The Aurora cluster in the primary AWS Region where your data is mastered performs both read and
write operations. The clusters in the secondary regions enable low-latency reads. You can scale up
the secondary clusters independently by adding one of more DB instances (Aurora Replicas) to serve
read-only workloads. For disaster recovery, you can remove a secondary cluster from the Aurora global
database and promote it to allow full read and write operations.
Only the primary cluster performs write operations. Clients that perform write operations connect to the
DB cluster endpoint of the primary cluster.
Topics
• Advantages of Aurora Global Database (p. 42)
• Limitations of Aurora Global Database (p. 42)
• Secondary clusters provide scaling of reads far beyond the capacity of a single Aurora cluster.
Each secondary cluster can have up to 16 read-only Aurora Replica instances instead of the limit of 15
for a single Aurora cluster.
• The replication performed by an Aurora global database has little performance impact on the primary
DB cluster. The resources of the DB instances are fully devoted to serve application read and write
workloads.
• Changes are replicated between AWS Regions with minimal lag time, typically less than 1 second.
• The secondary clusters enable fast failover for disaster recovery. You can typically promote a
secondary cluster and make it available for writes in under a minute.
• Applications in remote AWS Regions experience lower query latency when they read from a secondary
cluster.
42
Amazon Aurora User Guide for Aurora
Creating a Global Database
• Cloning. For information about cloning, see Cloning Databases in an Aurora DB Cluster (p. 254).
• Backtrack. For information about backtracking, see Backtracking an Aurora DB Cluster (p. 552).
• Parallel query. For information about parallel query, see Working with Parallel Query for Amazon
Aurora MySQL (p. 570).
• Aurora Serverless. For information about Aurora Serverless, see Using Amazon Aurora
Serverless (p. 117).
• Database Activity Streams. For information about Database Activity Streams, see Using Database
Activity Streams with Aurora PostgreSQL (p. 447).
• Stopping and starting the DB clusters within the global database. See Stopping and Starting an
Amazon Aurora DB Cluster (p. 228) for information about stopping and starting Aurora clusters.
When specifying names for the primary and secondary clusters, choose names that are different than
your existing Aurora clusters, even if those clusters are in other AWS Regions.
Important
Before you create an Aurora global database, complete the setup tasks for your account,
network, and security settings in Setting Up for Amazon RDS in the Amazon Relational Database
Service User Guide.
43
Amazon Aurora User Guide for Aurora
Creating a Global Database
Console
To use the console to create a global database for Aurora MySQL version 5.6.10a, see the second process.
1. Start with an existing Aurora cluster or create a new cluster. Use Aurora MySQL version 1.22.0 or
higher, Aurora MySQL version 2.07 or higher, or Aurora PostgreSQL version 10.11. For more about
creating a cluster, see Creating a DB Cluster and Connecting to a Database on an Aurora MySQL DB
Cluster (p. 79) or Creating a DB Cluster and Connecting to a Database on an Aurora PostgreSQL
DB Cluster (p. 88).
2. After your Aurora cluster is created and available, create one or more secondary clusters. To do so,
follow the steps in Adding an AWS Region to an Aurora Global Database (p. 50). Each secondary
cluster is in a different AWS Region than the original cluster.
To create an Aurora MySQL global database using the AWS Management Console (version
5.6.10a only)
Aurora MySQL version 5.6.10a requires choosing to make the cluster compatible with Aurora global
database at cluster creation time. You see the Global choice in the AWS Management Console only when
creating a cluster with this Aurora MySQL version. For Aurora MySQL version 1.22 and higher, you can
use any cluster with an Aurora global database without making any special choice when creating the
cluster.
For Aurora MySQL versions between 5.6.10a and 1.22, you don't make any special choice when creating
the cluster. However, to use such a cluster in an Aurora global database, you must upgrade it to Aurora
MySQL version 1.22 or higher first.
1. Sign in to the AWS Management Console and open the Amazon RDS console for a region where
Aurora global databases are available. (See also Limitations of Aurora Global Database (p. 42).)
2. Choose Create Database.
3. On the Select engine page, choose the Aurora engine and Global for Database location. For an
example, see the following images.
Note
Make sure that Standard Create is chosen. Standard create makes visible the choices that
you need for Aurora global databases. Don't choose Easy Create.
44
Amazon Aurora User Guide for Aurora
Creating a Global Database
Note
Choosing Global sets up the global database and the primary Aurora cluster. Once the
global database is created and available, you can add a secondary AWS Region.
4. Fill in the remaining settings using the same decision process as for other Aurora clusters. For
more information about creating an Aurora DB cluster, see Creating an Amazon Aurora DB
Cluster (p. 101).
5. Choose Create.
When the primary DB cluster is created and available, create one or more secondary clusters by following
the steps in Adding an AWS Region to an Aurora Global Database (p. 50).
AWS CLI
To create an Aurora global database using the CLI, use either of the following procedures:
• Create an Aurora global database and then add a primary AWS Region and a DB instance in that AWS
Region.
45
Amazon Aurora User Guide for Aurora
Creating a Global Database
• Alternatively, you can create the primary cluster first, then create the global database afterwards,
specifying which cluster to use as the primary cluster.
To create an Aurora global database and then add a primary AWS Region and DB instance
1. Create an Aurora global database and then add a primary AWS Region cluster.
a. Create the Aurora global database itself. Initially, no clusters are associated with it. Use the
following values:
For Windows:
46
Amazon Aurora User Guide for Aurora
Creating a Global Database
For Windows:
Note
For Aurora MySQL version 5.6.10a, you need to also specify global for the --engine-
mode parameter.
For Windows:
47
Amazon Aurora User Guide for Aurora
Creating a Global Database
4. When the describe-db-clusters results show a status of available, create the primary
instance for the primary cluster so that replication can begin. To do so, use the AWS CLI create-
db-instance command as shown in the following example.
For Windows:
When the DB instance is created and available, replication begins. You can determine if the DB
instance is available by calling the AWS CLI describe-db-instances command.
As an alternative procedure, you can create the primary DB cluster first and then create the
global database afterwards
• For Aurora MySQL version 5.6.10a, specify the following parameters and values:
• --engine aurora
• --engine-version 5.6.10a
• --engine-mode global
Use this setting only in combination with the aurora --engine setting.
• For Aurora PostgreSQL, specify the following parameters and values:
• --engine aurora-postgresql
• --engine-version 10.11
48
Amazon Aurora User Guide for Aurora
Creating a Global Database
For Windows:
• For Aurora MySQL version 5.6.10a, specify --engine aurora and --engine-mode global.
• For Aurora PostgreSQL, specify --engine aurora-postgresql.
For Windows:
3. After the primary DB cluster and DB instance are created and available, create the Aurora global
database by calling the AWS CLI create-global-cluster command in the AWS Region where
you want to create the Aurora global database. Use the --source-db-cluster-identifier
parameter to specify the primary DB cluster created earlier.
49
Amazon Aurora User Guide for Aurora
Adding an AWS Region
For Windows:
RDS API
To create an Aurora global database with the RDS API, run the CreateGlobalCluster operation.
Console
To add an AWS Region to an Aurora global database using the AWS Management Console
50
Amazon Aurora User Guide for Aurora
Adding an AWS Region
5. Complete the remaining fields for the secondary Aurora cluster in the new AWS Region, and then
choose Add region.
AWS CLI
To add an AWS Region to an Aurora global database with the AWS CLI, run the create-db-cluster
command.
The following commands create a new Aurora cluster, attach it to a global database as a read-
only secondary cluster, and then add a DB instance to the new cluster. The --global-cluster-
identifier option for the create-db-cluster command specifies the global database to which to
attach the new cluster. Specify the --engine parameter as follows:
For an encrypted cluster, specify the --source-region option with a value that matches the primary
AWS Region.
51
Amazon Aurora User Guide for Aurora
Removing a Cluster
--engine-version version
For Windows:
RDS API
To add a new AWS Region to an Aurora global database with the RDS API, run the CreateDBCluster
operation. Specify the identifier of the existing global database using the GlobalClusterIdentifier
parameter.
You might remove an Aurora cluster from a global database in case the primary cluster becomes
degraded or isolated. Performing a failover for an Aurora global database involves removing one of the
secondary clusters from the original global database, and then using it as the primary cluster in a new
Aurora global database. For more information, see Failover for Aurora Global Database (p. 57).
If you no longer need the global database, you must remove all secondary clusters and then the primary
cluster before deleting the global database itself. You can then delete some or all of the clusters you
removed, or continue to use some or all as single-region Aurora clusters. For more information, see
Deleting an Aurora Global Database (p. 54).
Console
To remove an Aurora cluster from an Aurora global database with the AWS Management
Console
52
Amazon Aurora User Guide for Aurora
Removing a Cluster
If any secondary clusters are still associated with the global database, you can't remove the primary
cluster.
After you remove or delete all secondary clusters, then you can remove the primary cluster the same
way.
After clusters are removed from an Aurora global database, you still see them in the Databases page, but
without the Global, Primary, and Secondary labels.
AWS CLI
To remove an Aurora cluster from an Aurora global database with the AWS CLI, run the remove-from-
global-cluster command.
The following commands remove a secondary cluster and then the primary cluster from an Aurora global
database. The clusters to remove are identified by the --db-cluster-identifier parameter in each
case. The Aurora global database is identified by the --global-cluster-identifier parameter.
53
Amazon Aurora User Guide for Aurora
Deleting an Aurora Global Database
For Windows:
RDS API
To remove an Aurora cluster from an Aurora global database with the RDS API, run the
RemoveFromGlobalCluster action.
Console
To delete an Aurora global database with the AWS Management Console, you first remove or delete all
secondary clusters associated with the global database, then remove the primary cluster, and finally
delete the global database itself. Deleting the writer instance from an Aurora cluster deletes the cluster
itself. Because a global database typically holds business-critical data, you can't delete the global
database and the associated clusters in a single step. See Removing a Cluster from an Aurora Global
Database (p. 52) for instructions on removing clusters from a global database. See Deleting a DB
Instance in an Aurora DB Cluster (p. 338) for the procedure to delete clusters once they are removed.
Deleting the primary instance from an Aurora cluster deletes the cluster itself.
1. Confirm that all other clusters are removed from the Aurora global database.
If the global database includes any clusters nested underneath it, as in the following screenshot, you
can't delete the global database yet. Follow the procedure in Removing a Cluster from an Aurora
Global Database (p. 52) for each cluster associated with the global database.
54
Amazon Aurora User Guide for Aurora
Deleting an Aurora Global Database
After the global database has no associated clusters, you can proceed to delete it. The following
screenshot shows how the global-db-demo cluster is no longer associated with the global
database after being removed.
2. From the Databases page, or the detail page for the global database, choose Actions and then
choose Delete.
AWS CLI
To delete a cluster that is part of an Aurora global database with the AWS CLI, run the delete-global-
cluster command.
The following command deletes the Aurora global database with the specified global cluster ID:
For Windows:
55
Amazon Aurora User Guide for Aurora
Importing Data into a Global Database
RDS API
To delete a cluster that is part of an Aurora global database with the RDS API, run the
DeleteGlobalCluster action.
• Create a snapshot of an Aurora cluster or Amazon RDS DB instance and restore it to the primary cluster
of an Aurora global database. Currently, any snapshot must be from a source that is compatible with
Aurora MySQL version 1, Aurora MySQL version 2, or Aurora PostgreSQL 10.11.
• Use point-in-time restore on the primary cluster to restore the cluster data to a previous state. For
more information, see Restoring a DB Cluster to a Specified Time (p. 325).
The crucial distinction for an Aurora global database is that you always import the data to the cluster
that you designate as the primary cluster. You can do the initial data import before or after adding that
cluster to the Aurora Global Database. All the data from the primary cluster is automatically replicated to
any secondary clusters.
56
Amazon Aurora User Guide for Aurora
Connecting to an Aurora Global Database
To run data manipulation language (DML) or data definition language (DDL) statements, you connect to
the cluster endpoint for the primary cluster. This endpoint might be in a different AWS Region than your
application.
When you view the Aurora global database in the AWS Management Console, you can see all the
general-purpose endpoints associated with all of its clusters, as shown in the following screenshot. There
is a single cluster endpoint, associated with the primary cluster, that you use for write operations. The
primary cluster and each secondary cluster has a reader endpoint, which you use for read-only queries.
Choose whichever reader endpoint is in your AWS Region or the AWS Region closest to you, to minimize
latency. The following shows an Aurora MySQL example.
You can manually activate the failover mechanism if a cluster in a different AWS Region is a better choice
to be the primary cluster. For example, you might increase the capacity of one of the secondary clusters
and then promote it to be the primary cluster. Or the balance of activity among the AWS Regions might
change, so that switching the primary cluster to a different AWS Region might give lower latency for
write operations.
The following steps outline the sequence of events when you promote one of the secondary clusters in
an Aurora global database:
57
Amazon Aurora User Guide for Aurora
Performance Insights for Global Database
6. When the outage is resolved and you are ready to assign your original AWS Region as the primary
cluster again, you perform the same steps in reverse:
a. You remove one of the secondary clusters from the Aurora global database.
b. You make that cluster the primary cluster of a new Aurora global database in the original AWS
Region.
c. You redirect all the write traffic to the primary cluster in the original AWS Region.
d. You add an AWS Region to set up one or more secondary clusters in the same AWS Regions as
before.
You can switch AWS Regions while viewing the Performance Insights page for a DB instance that's
attached to a global database. However, you might not see performance information immediately after
switching AWS Regions. Although the DB instances might have identical names in each AWS Region, the
associated Performance Insights URL is different for each DB instance. After switching AWS Regions,
choose the name of the DB instance again in the Performance Insights navigation pane.
For DB instances associated with a global database, the factors affecting performance might be different
in each AWS Region. For example, the DB instances in each region might have different capacity.
For information about using Performance Insights, see Using Amazon RDS Performance
Insights (p. 398).
When your global database has multiple secondary regions, you must detach all the secondary regions if
the primary region experiences an outage. Then, you promote one of those secondary regions to be the
new primary region. Finally, you create new clusters in each of the other secondary regions and attach
those clusters to the global database.
58
Amazon Aurora User Guide for Aurora
Using Global Database with Other AWS Services
only replication target, you might later promote it to the primary cluster. To prepare for that possibility,
set up any necessary write privileges for other services ahead of time, for all Aurora clusters in the global
database.
The following list summarizes the actions to take for each AWS service.
For all the Aurora clusters that make up the Aurora global database, perform the procedures in
Invoking a Lambda Function from an Amazon Aurora MySQL DB Cluster (p. 678).
For each cluster in the Aurora global database, set the aws_default_lambda_role cluster
parameter to the Amazon Resource Name (ARN) of the new IAM role.
To permit database users in an Aurora global database to invoke Lambda functions, associate
the role that you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS
Services (p. 660) with each cluster in the Aurora global database.
Configure each cluster in the Aurora global database to allow outbound connections to Lambda.
For instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
Loading data from S3
For all the Aurora clusters that make up the Aurora global database, perform the procedures
in Loading Data into an Amazon Aurora MySQL DB Cluster from Text Files in an Amazon S3
Bucket (p. 665).
For each Aurora cluster in the global database, set either the aurora_load_from_s3_role or
aws_default_s3_role DB cluster parameter to the Amazon Resource Name (ARN) of the new
IAM role. If an IAM role isn't specified for aurora_load_from_s3_role, Aurora uses the IAM role
specified in aws_default_s3_role.
To permit database users in an Aurora global database to access Amazon S3, associate the role that
you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS Services (p. 660) with
each Aurora cluster in the global database.
Configure each Aurora cluster in the global database to allow outbound connections to Amazon S3.
For instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
Saving queried data to S3
For all the Aurora clusters that make up the Aurora global database, perform the procedures
in Saving Data from an Amazon Aurora MySQL DB Cluster into Text Files in an Amazon S3
Bucket (p. 673).
For each Aurora cluster in the global database, set either the aurora_select_into_s3_role or
aws_default_s3_role DB cluster parameter to the Amazon Resource Name (ARN) of the new IAM
role. If an IAM role isn't specified for aurora_select_into_s3_role, Aurora uses the IAM role
specified in aws_default_s3_role.
To permit database users in an Aurora global database to access Amazon S3, associate the role that
you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS Services (p. 660) with
each Aurora cluster in the global database.
Configure each Aurora cluster in the global database to allow outbound connections to Amazon S3.
For instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
59
Amazon Aurora User Guide for Aurora
Replication with Aurora
Aurora Replicas
Aurora Replicas are independent endpoints in an Aurora DB cluster, best used for scaling read operations
and increasing availability. Up to 15 Aurora Replicas can be distributed across the Availability Zones that
a DB cluster spans within an AWS Region. The DB cluster volume is made up of multiple copies of the
data for the DB cluster. However, the data in the cluster volume is represented as a single, logical volume
to the primary instance and to Aurora Replicas in the DB cluster.
As a result, all Aurora Replicas return the same data for query results with minimal replica lag—usually
much less than 100 milliseconds after the primary instance has written an update. Replica lag varies
depending on the rate of database change. That is, during periods where a large amount of write
operations occur for the database, you might see an increase in replica lag.
Aurora Replicas work well for read scaling because they are fully dedicated to read operations on your
cluster volume. Write operations are managed by the primary instance. Because the cluster volume is
shared among all DB instances in your DB cluster, minimal additional work is required to replicate a copy
of the data for each Aurora Replica.
To increase availability, you can use Aurora Replicas as failover targets. That is, if the primary instance
fails, an Aurora Replica is promoted to the primary instance. There is a brief interruption during which
read and write requests made to the primary instance fail with an exception, and the Aurora Replicas
are rebooted. If your Aurora DB cluster doesn't include any Aurora Replicas, then your DB cluster will
be unavailable for the duration it takes your DB instance to recover from the failure event. However,
promoting an Aurora Replica is much faster than recreating the primary instance. For high-availability
scenarios, we recommend that you create one or more Aurora Replicas. These should be of the same
DB instance class as the primary instance and in different Availability Zones for your Aurora DB cluster.
For more information on Aurora Replicas as failover targets, see Fault Tolerance for an Aurora DB
Cluster (p. 287).
Note
You can't create an encrypted Aurora Replica for an unencrypted Aurora DB cluster. You can't
create an unencrypted Aurora Replica for an encrypted Aurora DB cluster.
For details on how to create an Aurora Replica, see Adding Aurora Replicas to a DB Cluster (p. 248).
• Two Aurora MySQL DB clusters in different AWS Regions, by creating an Aurora Read Replica of an
Aurora MySQL DB cluster in a different AWS Region.
• Two Aurora MySQL DB clusters in the same region, by using MySQL binary log (binlog) replication.
• An Amazon RDS MySQL DB instance as the master and an Aurora MySQL DB cluster, by creating
an Aurora Read Replica of an Amazon RDS MySQL DB instance. Typically, this approach is used for
migration to Aurora MySQL, rather than for ongoing replication.
For more information about replication with Aurora MySQL, see Single-Master Replication with Amazon
Aurora MySQL (p. 598).
60
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL
For more information about replication with Aurora PostgreSQL, see Replication with Amazon Aurora
PostgreSQL (p. 859).
• 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. 33).
• I/O requests (per 1 million requests per month) – Total number of storage I/O requests that you have
made in a billing cycle.
• 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 Aurora DB Cluster (p. 286).
• 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.
Topics
• On-Demand DB Instances for Aurora (p. 62)
• Reserved DB Instances for Aurora (p. 63)
61
Amazon Aurora User Guide for Aurora
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. 374).
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.
62
Amazon Aurora User Guide for Aurora
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
63
Amazon Aurora User Guide for Aurora
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.
Size-flexible reserved DB instances are available for the following Aurora database engines:
• Aurora MySQL
• Aurora PostgreSQL
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
8xlarge 64 128
10xlarge 80 160
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.
64
Amazon Aurora User Guide for Aurora
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 Aurora MySQL reserved Single-AZ db.r4.large DB instance class in US East (N. Virginia) at a cost of
$0.19 per hour, or $138.70 per month
• Aurora storage at a cost of $0.10 per GiB per month (assume $45.60 per month for this example)
• Aurora I/O at a cost of $0.20 per 1 million requests (assume $20 per month for this example)
• Aurora backup storage at $0.021 per GiB per month (assume $30 per month for this example)
Add all of these options ($138.70 + $45.60 + $20 + $30) with the reserved DB instance, and the total
cost per month is $234.30.
If you chose to use an on-demand DB instance instead of a reserved DB instance, an Aurora MySQL
Single-AZ db.r4.large DB instance class in US East (N. Virginia) costs $0.29 per hour, or $217.50 per
month. So, for an on-demand DB instance, add all of these options ($217.50 + $45.60 + $20 + $30), and
the total cost per month is $313.10.
Note
The prices in this example are sample prices and might not match actual prices.
For Aurora pricing information, see the Aurora pricing 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).
65
Amazon Aurora User Guide for Aurora
Reserved DB Instances
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.
Note
Reserved Amazon Aurora instances always have the Multi-AZ deployment option set to
No. When you create an Amazon Aurora DB cluster from your reserved DB instance, the DB
cluster is automatically created as Multi-AZ.
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.
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.
Note
Reserved Amazon Aurora instances always have the Multi-AZ deployment option set to
No. When you create an Amazon Aurora DB cluster from your reserved DB instance, the DB
cluster is automatically created as Multi-AZ.
7. For Term, choose the length of time you want the DB instance reserved.
8. For Offering type, choose the offering type.
After you choose the offering type, you can see the pricing information, as shown following.
66
Amazon Aurora User Guide for Aurora
Reserved DB Instances
67
Amazon Aurora User Guide for Aurora
Reserved DB Instances
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 Instance dialog box appears, with a summary of the reserved DB
instance attributes that you've selected and the payment due, as shown following.
68
Amazon Aurora User Guide for Aurora
Reserved DB Instances
11. On the confirmation page, review your reserved DB instance. If the information is correct, choose
Purchase 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.
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 as shown in the following example.
69
Amazon Aurora User Guide for Aurora
Reserved DB Instances
The following example purchases the reserved DB instance offering with ID 649fd0c8-cf6d-47a0-
bfa6-060f8e75e95f, and assigns the identifier of MyReservation.
For Windows:
After you have purchased reserved DB instances, you can get information about your reserved DB
instances as shown in the following example.
RDS API
You can use the RDS API to work with reserved DB instances as shown in the following examples.
https://rds.us-east-1.amazonaws.com/
?Action=DescribeReservedDBInstancesOfferings
&SignatureMethod=HmacSHA256
&SignatureVersion=4
70
Amazon Aurora User Guide for Aurora
Reserved DB Instances
&Version=2014-09-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140411/us-east-1/rds/aws4_request
&X-Amz-Date=20140411T203327Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=545f04acffeb4b80d2e778526b1c9da79d0b3097151c24f28e83e851d65422e2
<DescribeReservedDBInstancesOfferingsResponse xmlns="http://rds.amazonaws.com/
doc/2014-10-31/">
<DescribeReservedDBInstancesOfferingsResult>
<ReservedDBInstancesOfferings>
<ReservedDBInstancesOffering>
<Duration>31536000</Duration>
<OfferingType>Partial Upfront</OfferingType>
<CurrencyCode>USD</CurrencyCode>
<RecurringCharges/>
<FixedPrice>1820.0</FixedPrice>
<ProductDescription>mysql</ProductDescription>
<UsagePrice>0.368</UsagePrice>
<MultiAZ>true</MultiAZ>
<ReservedDBInstancesOfferingId>438012d3-4052-4cc7-b2e3-8d3372e0e706</
ReservedDBInstancesOfferingId>
<DBInstanceClass>db.m1.large</DBInstanceClass>
</ReservedDBInstancesOffering>
<ReservedDBInstancesOffering>
<Duration>31536000</Duration>
<OfferingType>Partial Upfront</OfferingType>
<CurrencyCode>USD</CurrencyCode>
<RecurringCharges/>
<FixedPrice>227.5</FixedPrice>
<ProductDescription>mysql</ProductDescription>
<UsagePrice>0.046</UsagePrice>
<MultiAZ>false</MultiAZ>
<ReservedDBInstancesOfferingId>649fd0c8-cf6d-47a0-bfa6-060f8e75e95f</
ReservedDBInstancesOfferingId>
<DBInstanceClass>db.m1.small</DBInstanceClass>
</ReservedDBInstancesOffering>
</ReservedDBInstancesOfferings>
</DescribeReservedDBInstancesOfferingsResult>
<ResponseMetadata>
<RequestId>5e4ec40b-2978-11e1-9e6d-771388d6ed6b</RequestId>
</ResponseMetadata>
</DescribeReservedDBInstancesOfferingsResponse>
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 example.
The following example purchases the reserved DB instance offering with ID 649fd0c8-cf6d-47a0-
bfa6-060f8e75e95f, and assigns the identifier of MyReservation.
71
Amazon Aurora User Guide for Aurora
Reserved DB Instances
https://rds.us-east-1.amazonaws.com/
?Action=PurchaseReservedDBInstancesOffering
&ReservedDBInstanceId=MyReservation
&ReservedDBInstancesOfferingId=438012d3-4052-4cc7-b2e3-8d3372e0e706
&DBInstanceCount=10
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-09-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140415/us-east-1/rds/aws4_request
&X-Amz-Date=20140415T232655Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=c2ac761e8c8f54a8c0727f5a87ad0a766fbb0024510b9aa34ea6d1f7df52fb11
<PurchaseReservedDBInstancesOfferingResponse xmlns="http://rds.amazonaws.com/
doc/2014-10-31/">
<PurchaseReservedDBInstancesOfferingResult>
<ReservedDBInstance>
<OfferingType>Partial Upfront</OfferingType>
<CurrencyCode>USD</CurrencyCode>
<RecurringCharges/>
<ProductDescription>mysql</ProductDescription>
<ReservedDBInstancesOfferingId>649fd0c8-cf6d-47a0-bfa6-060f8e75e95f</
ReservedDBInstancesOfferingId>
<MultiAZ>true</MultiAZ>
<State>payment-pending</State>
<ReservedDBInstanceId>MyReservation</ReservedDBInstanceId>
<DBInstanceCount>10</DBInstanceCount>
<StartTime>2011-12-18T23:24:56.577Z</StartTime>
<Duration>31536000</Duration>
<FixedPrice>123.0</FixedPrice>
<UsagePrice>0.123</UsagePrice>
<DBInstanceClass>db.m1.small</DBInstanceClass>
</ReservedDBInstance>
</PurchaseReservedDBInstancesOfferingResult>
<ResponseMetadata>
<RequestId>7f099901-29cf-11e1-bd06-6fe008f046c3</RequestId>
</ResponseMetadata>
</PurchaseReservedDBInstancesOfferingResponse>
After you have purchased reserved DB instances, you can get information about your reserved DB
instances as shown in the following example.
https://rds.us-west-2.amazonaws.com/
?Action=DescribeReservedDBInstances
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-09-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140420/us-west-2/rds/aws4_request
&X-Amz-Date=20140420T162211Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=3312d17a4c43bcd209bc22a0778dd23e73f8434254abbd7ac53b89ade3dae88e
72
Amazon Aurora User Guide for Aurora
Reserved DB Instances
<DescribeReservedDBInstancesResponse xmlns="http://rds.amazonaws.com/doc/2014-10-31/">
<DescribeReservedDBInstancesResult>
<ReservedDBInstances>
<ReservedDBInstance>
<OfferingType>Partial Upfront</OfferingType>
<CurrencyCode>USD</CurrencyCode>
<RecurringCharges/>
<ProductDescription>mysql</ProductDescription>
<ReservedDBInstancesOfferingId>649fd0c8-cf6d-47a0-bfa6-060f8e75e95f</
ReservedDBInstancesOfferingId>
<MultiAZ>false</MultiAZ>
<State>payment-failed</State>
<ReservedDBInstanceId>MyReservation</ReservedDBInstanceId>
<DBInstanceCount>1</DBInstanceCount>
<StartTime>2010-12-15T00:25:14.131Z</StartTime>
<Duration>31536000</Duration>
<FixedPrice>227.5</FixedPrice>
<UsagePrice>0.046</UsagePrice>
<DBInstanceClass>db.m1.small</DBInstanceClass>
</ReservedDBInstance>
<ReservedDBInstance>
<OfferingType>Partial Upfront</OfferingType>
<CurrencyCode>USD</CurrencyCode>
<RecurringCharges/>
<ProductDescription>mysql</ProductDescription>
<ReservedDBInstancesOfferingId>649fd0c8-cf6d-47a0-bfa6-060f8e75e95f</
ReservedDBInstancesOfferingId>
<MultiAZ>false</MultiAZ>
<State>payment-failed</State>
<ReservedDBInstanceId>MyReservation</ReservedDBInstanceId>
<DBInstanceCount>1</DBInstanceCount>
<StartTime>2010-12-15T01:07:22.275Z</StartTime>
<Duration>31536000</Duration>
<FixedPrice>227.5</FixedPrice>
<UsagePrice>0.046</UsagePrice>
<DBInstanceClass>db.m1.small</DBInstanceClass>
</ReservedDBInstance>
</ReservedDBInstances>
</DescribeReservedDBInstancesResult>
<ResponseMetadata>
<RequestId>23400d50-2978-11e1-9e6d-771388d6ed6b</RequestId>
</ResponseMetadata>
</DescribeReservedDBInstancesResponse>
73
Amazon Aurora User Guide for Aurora
Sign Up for AWS
With Amazon RDS, you pay only for the resources you use. The Amazon RDS DB cluster that you create is
live (not running in a sandbox). You incur the standard Amazon RDS usage fees for the cluster until you
terminate it. For more information about Amazon RDS usage rates, see the Amazon RDS product page. If
you are a new AWS customer, you can get started with Amazon RDS for free; for more information, see
AWS Free Usage Tier.
If you have an AWS account already, skip to the next task. If you don't have an AWS account, use the
following procedure to create one.
1. Open https://portal.aws.amazon.com/billing/signup.
2. Follow the online instructions.
Part of the sign-up procedure involves receiving a phone call and entering a verification code on the
phone keypad.
Note your AWS account number, because you'll need it for the next task.
If you signed up for AWS but have not created an IAM user for yourself, you can create one using the IAM
console.
74
Amazon Aurora User Guide for Aurora
Create an IAM User
To create an administrator user for yourself and add the user to an administrators group
(console)
1. Use your AWS account email address and password to sign in as the AWS account root user to the
IAM console at https://console.aws.amazon.com/iam/.
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 this new IAM user, sign out of the AWS 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/
Enter 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 enter an alias, such as your company
name. To sign in after you create an account alias, use the following URL:
75
Amazon Aurora User Guide for Aurora
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.
Determine Requirements
The basic building block of Aurora is the DB cluster. One or more DB instances can belong to a DB cluster.
A DB cluster provides a network address called the Cluster Endpoint. Your applications connect to the
cluster endpoint exposed by the DB cluster whenever they need to access the databases created in that
DB cluster. The information you specify when you create the DB cluster controls configuration elements
such as memory, database engine and version, network configuration, security, and maintenance periods.
You must know your DB cluster and network needs before you create a security group and before you
create a DB cluster. For example, you must know the following:
• What are the memory and processor requirements for your application or service? You will use these
settings when you determine what DB instance class you will use when you create your DB cluster. For
specifications about DB instance classes, see DB Instance Classes (p. 33).
• Your DB cluster is in a virtual private cloud (VPC). Security group rules must be configured to connect
to a DB cluster. The follow list describes the rules for each VPC option:
• Default VPC — If your AWS account has a default VPC in the region, that VPC is configured to
support DB clusters. If you specify the default VPC when you create the DB cluster:
• You must create a VPC security group that authorizes connections from the application or service
to the Aurora DB cluster with the database. Note that you must 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. 1081).
• You must specify the default DB subnet group. If this is the first DB cluster you have created in the
region, Amazon RDS will create the default DB subnet group when it creates the DB cluster.
• User-defined VPC — If you want to specify a user-defined VPC when you create a DB cluster:
• You must create a VPC security group that authorizes connections from the application or service
to the Aurora DB cluster with the database. Note that you must 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. 1081)..
• The VPC must meet certain requirements in order to host DB clusters, such as having at least two
subnets, each in a separate availability zone. For information, see Amazon Virtual Private Cloud
VPCs and Amazon Aurora (p. 1067).
• You must specify a DB subnet group that defines which subnets in that VPC can be used by the
DB cluster. For information, see the DB Subnet Group section in Working with a DB Instance in a
VPC (p. 1078).
• Do you need failover support? On Aurora, a Multi-AZ deployment creates a primary instance and
Aurora Replicas. You can configure the primary instance and Aurora Replicas to be in different
Availability Zones for failover support. We recommend Multi-AZ deployments for production
workloads to maintain high availability. For development and test purposes, you can use a non-Multi-
AZ deployment. For more information, see High Availability for Aurora (p. 40).
• 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 Aurora (p. 1019).
• What TCP/IP port will your database be listening on? The firewall at some companies may block
connections to the default port for your database engine. If your company firewall blocks the default
76
Amazon Aurora User Guide for Aurora
Provide Access to the DB Cluster in
the VPC by Creating a Security Group
port, choose another port for the new DB cluster. Note that once you create a DB cluster that listens
on a port you specify, you can change the port by modifying the DB cluster.
• What region do you want your database in? Having the database close in proximity to the application
or web service could reduce network latency.
Once you have the information you need to create the security group and the DB cluster, continue to the
next step.
The security group you need to create is a VPC security group, unless you have a legacy DB cluster not in
a VPC that requires a DB security group. If you created your AWS account after March 2013, chances are
very good that you have a default VPC, and your DB cluster will be created in that VPC. DB clusters in a
VPC require that you add rules to a VPC security group to allow access to the cluster.
For example, if you have an application that will access a database on your DB cluster in a VPC, you must
add a Custom TCP rule that specifies the port range and IP addresses that application will use to access
the database. If you have an application on an Amazon EC2 cluster, you can use the VPC security group
you set up for the Amazon EC2 cluster.
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, select the region in which you want to
create the VPC security group and the DB cluster. In the list of Amazon VPC resources for that
region, it should show that you have at least one VPC and several Subnets. If it does not, you do not
have a default VPC in that region.
3. In the navigation pane, choose Security Groups.
4. Choose Create Security Group.
5. In the Create Security Group window, type the Name tag, Group name, and Description of your
security group. Select the VPC that you want to create your DB cluster in. Choose Yes, Create.
6. The VPC security group you created should still be selected. 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. Select Custom TCP Rule from the Type list. Type the port
value you will use for your DB cluster in the Port Range text box, and then type the IP address range
(CIDR value) from where you will access the cluster, or select a security group name in the Source
text box.
8. If you need to add more IP addresses or different port ranges, choose Add another rule.
9. If you need to, you can use the Outbound Rules tab to add rules for outbound traffic.
10. When you have finished, choose Save on each tab with changes.
77
Amazon Aurora User Guide for Aurora
Provide Access to the DB Cluster in
the VPC by Creating a Security Group
You will use the VPC security group you just created as the security group for your DB cluster when
you create it.
Finally, a quick note about VPC subnets: If you use a default VPC, a default subnet group spanning
all of the VPC's subnets has already been created for you. When you create a DB cluster, you can
select the default VPC and use default for the DB Subnet Group.
Once you have completed the setup requirements, you can use your requirements and the security
group you created to launch a DB cluster. For information on creating a DB cluster, see the relevant
documentation in the following table:
After setting up, you can create a test Amazon Aurora DB cluster. For instructions, see Creating a DB
Cluster and Connecting to a Database on an Aurora MySQL DB Cluster (p. 79).
78
Amazon Aurora User Guide for Aurora
Creating an Aurora MySQL DB Cluster and Connecting to It
These procedures are tutorials that demonstrate the basics of getting started with Aurora. Subsequent
sections introduce more advanced Aurora concepts and procedures, such as the different kinds of
endpoints and how to scale Aurora clusters up and down.
Important
You must complete the tasks in the Setting Up Your Environment for Amazon Aurora (p. 74)
section before you can create a DB cluster.
Topics
• Creating a DB Cluster and Connecting to a Database on an Aurora MySQL DB Cluster (p. 79)
• Creating a DB Cluster and Connecting to a Database on an Aurora PostgreSQL DB Cluster (p. 88)
Topics
• Create an Aurora MySQL DB Cluster (p. 79)
• Connect to an Instance in a DB Cluster (p. 86)
• Delete the Sample DB Cluster, DB Subnet Group, and VPC (p. 88)
If you want to create a VPC and DB subnet group for use with your Aurora DB cluster yourself, rather
than having Amazon RDS create the VPC and DB subnet group for you, then follow the instructions in
How to Create a VPC for Use with Amazon Aurora (p. 1067). Otherwise, follow the instructions in this
topic to create your DB cluster and have Amazon RDS create a VPC and DB subnet group for you.
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.
79
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
New Console
You can create an Aurora with MySQL compatibility DB cluster 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 disabled, you specify more configuration options when you create a database,
including ones for availability, security, backups, and maintenance.
Note
For this example, Easy Create is enabled. For information about creating an Aurora MySQL DB
cluster with Easy Create not enabled, see Creating an Amazon Aurora DB Cluster (p. 101).
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.
Aurora is not available in all AWS Regions. For a list of AWS Regions where Aurora is available, see
Region Availability (p. 5).
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:
80
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
81
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
10. To use an automatically generated master password for the DB cluster, make sure that the Auto
generate a password 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.
11. (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.
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 Aurora DB Cluster (p. 232).
13. For Databases, choose the name of the new Aurora MySQL DB cluster.
On the RDS console, the details for new DB cluster appear. The DB cluster and its DB instance have a
status of creating until the DB cluster is ready to use. When the state changes to available for both,
you can connect to the DB cluster. Depending on the DB instance class and the amount of storage, it
can take up to 20 minutes before the new DB cluster is available.
82
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
Original Console
To launch an Aurora MySQL DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the top-right corner of the AWS Management Console, choose the AWS Region that you want
to create your DB cluster in. For a list of AWS Regions where Aurora is available, see Region
Availability (p. 5).
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. On the Select engine page, choose Amazon Aurora and choose the MySQL-compatible edition.
83
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
6. Choose Next.
7. Set the following values on the Specify DB details page:
• DB instance class: db.r4.large
• DB instance identifier: gs-db-instance1
• Master username: Using alphanumeric characters, type a master user name, used to log on to your
DB instances in the DB cluster.
• Master password and Confirm Password: Type a password in the Master Password box that
contains from 8 to 41 printable ASCII characters (excluding /,", and @) for your master user
password, used to log on to your database. Then type the password again in the Confirm Password
box.
84
Amazon Aurora User Guide for Aurora
Create an Aurora MySQL DB Cluster
8. Choose Next and set the following values on the Configure Advanced Settings page:
• Virtual Private Cloud (VPC): If you have an existing VPC, then you can use that VPC with
your Amazon Aurora DB cluster by choosing your VPC identifier, for example vpc-a464d1c1.
For information on using an existing VPC, see How to Create a VPC for Use with Amazon
Aurora (p. 1067).
Otherwise, you can choose to have Amazon RDS create a VPC for you by choosing Create a new
VPC. This example uses the Create a new VPC option.
85
Amazon Aurora User Guide for Aurora
Connect to an Instance in a DB Cluster
• Subnet group: If you have an existing subnet group, then you can use that subnet group with your
Amazon Aurora DB cluster by choosing your subnet group identifier, for example, gs-subnet-
group1.
Otherwise, you can choose to have Amazon RDS create a subnet group for you by choosing Create a
new subnet group. This example uses the Create a new subnet group option.
• Public accessibility: Yes
Note
Your production DB cluster might not need to be in a public subnet, because only your
application servers require access to your DB cluster. If your DB cluster doesn't need to be in
a public subnet, set Publicly Accessible to No.
• Availability zone: No Preference
• VPC security groups: If you have one or more existing VPC security groups, then you can use one
or more of those VPC security groups with your Amazon Aurora DB cluster by choosing your VPC
security group identifiers, for example, gs-security-group1.
Otherwise, you can choose to have Amazon RDS create a VPC security group for you by choosing
Create new VPC security group. This example uses the Create new VPC security group option.
• DB cluster identifier: gs-db-cluster1
• Database name: sampledb
Note
This creates the default database. To create additional databases, connect to the DB cluster
and use the SQL command CREATE DATABASE.
• Database port: 3306
Note
You might be behind a corporate firewall that does not allow access to default ports
such as the Aurora MySQL default port, 3306. In this case, provide a port value that your
corporate firewall allows. Remember that port value later when you connect to the Aurora
DB cluster.
9. Leave the rest of the values as their defaults, and choose Create database to create the DB cluster and
primary instance.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Databases and then choose the DB cluster name to show its details. On the Connectivity
& security tab, copy the value for the Endpoint name of the Writer endpoint. Also, note the port
number for the endpoint.
86
Amazon Aurora User Guide for Aurora
Connect to an Instance in a DB Cluster
3. Type the following command at a command prompt on a client computer to connect to a database
on an Aurora MySQL DB cluster using the MySQL monitor. Use the cluster endpoint to connect to
the primary instance, and the master user name that you created previously. (You are prompted for a
password.) If you supplied a port value other than 3306, use that for the -P parameter instead.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
For more information about connecting to the DB cluster, see Connecting to an Amazon Aurora MySQL
DB Cluster (p. 169).
87
Amazon Aurora User Guide for Aurora
Delete the Sample DB Cluster, DB Subnet Group, and VPC
To delete a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Databases and then choose the DB instance associated with the DB cluster.
3. For Actions, choose Delete.
4. Choose Delete.
After all of the DB instances associated with a DB cluster are deleted, the DB cluster is deleted
automatically.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Subnet groups and then choose the DB subnet group.
3. Choose Delete.
4. Choose Delete.
To delete a VPC
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc/.
2. Choose Your VPCs and then choose the VPC that was created for this procedure.
3. For Actions, choose Delete VPC.
4. Choose Delete.
Topics
• Create an Aurora PostgreSQL DB Cluster (p. 89)
• Connect to an Instance in an Aurora PostgreSQL DB Cluster (p. 97)
• Delete the Sample DB Cluster, DB Subnet Group, and VPC (p. 98)
88
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
If you want to create a VPC and DB subnet group for use with your Amazon Aurora DB cluster yourself,
rather than having Amazon RDS create the VPC and DB subnet group for you, follow the instructions in
How to Create a VPC for Use with Amazon Aurora (p. 1067). Otherwise, follow the instructions in this
topic to create your DB cluster and have Amazon RDS create a VPC and DB subnet group for you.
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
You can create an Aurora PostgreSQL DB cluster 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 disabled, you specify more configuration options when you create a database, including
ones for availability, security, backups, and maintenance.
Note
For this example, Easy Create is enabled. For information about creating an Aurora PostgreSQL
DB cluster with Easy Create not enabled, see Creating an Amazon Aurora DB Cluster (p. 101).
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.
Aurora is not available in all AWS Regions. For a list of AWS Regions where Aurora is available, see
Region Availability (p. 5).
3. In the navigation pane, choose Databases.
4. Choose Create database and make sure that Easy Create is chosen.
89
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
The Create database page should look similar to the following image.
90
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
91
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
10. To use an automatically generated master password for the DB cluster, 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.
11. (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 can be changed 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 you can modify the DB instance after it is 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 Aurora DB Cluster (p. 232).
13. For Databases, choose the name of the new Aurora PostgreSQL DB cluster.
On the RDS console, the details for new DB cluster appear. The DB cluster and its DB instance have a
status of creating until the DB cluster is ready to use. When the state changes to available for both,
you can connect to the DB cluster. Depending on the DB instance class and the amount of storage, it
can take up to 20 minutes before the new DB cluster is available.
92
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
Original Console
To launch an Aurora PostgreSQL DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the top-right corner of the AWS Management Console, choose the AWS Region that you want
to create your DB cluster in. For a list of AWS Regions where Aurora is available, see Region
Availability (p. 5).
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. On the Select engine page, choose Amazon Aurora and choose the PostgreSQL-compatible edition.
93
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
6. Choose Next.
7. Set the following values on the Specify DB details page:
94
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
95
Amazon Aurora User Guide for Aurora
Create an Aurora PostgreSQL DB Cluster
96
Amazon Aurora User Guide for Aurora
Connect to an Instance in an Aurora PostgreSQL DB Cluster
8. Choose Next and set the following values on the Configure Advanced Settings page:
• Virtual Private Cloud (VPC): If you have an existing VPC, then you can use that VPC with
your Amazon Aurora DB cluster by choosing your VPC identifier, for example vpc-a464d1c1.
For information on using an existing VPC, see How to Create a VPC for Use with Amazon
Aurora (p. 1067).
Otherwise, you can choose to have Amazon RDS create a VPC for you by choosing Create a new
VPC. This example uses the Create a new VPC option.
• Subnet group: If you have an existing subnet group, then you can use that subnet group with your
Amazon Aurora DB cluster by choosing your subnet group identifier, for example, gs-subnet-
group1.
Otherwise, you can choose to have Amazon RDS create a subnet group for you by choosing Create a
new subnet group. This example uses the Create a new subnet group option.
• Public accessibility: Yes
Note
Your production DB cluster might not need to be in a public subnet, because only your
application servers require access to your DB cluster. If your DB cluster doesn't need to be in
a public subnet, set Publicly Accessible to No.
• Availability zone: No Preference
• VPC security groups: If you have one or more existing VPC security groups, then you can use one
or more of those VPC security groups with your Amazon Aurora DB cluster by choosing your VPC
security group identifiers, for example, gs-security-group1.
Otherwise, you can choose to have Amazon RDS create a VPC security group for you by choosing
Create new VPC security group. This example uses the Create new VPC security group option.
• DB cluster identifier: aurora-postgres-db-cluster1
• Database name: sampledb
Note
This creates the default database. To create additional databases, connect to the DB cluster
and use the SQL command CREATE DATABASE.
• Database port: 5432
Note
You might be behind a corporate firewall that does not allow access to default ports such
as the Aurora PostgreSQL default port, 5432. In this case, provide a port value that your
corporate firewall allows. Remember that port value later when you connect to the Aurora
DB cluster.
9. Leave the rest of the values as their defaults, and choose Create database to create the DB cluster and
primary instance.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
97
Amazon Aurora User Guide for Aurora
Delete the Sample DB Cluster, DB Subnet Group, and VPC
2. Choose Databases and then choose the DB cluster name to show its details. On the Connectivity
& security tab, copy the value for the Endpoint name of the Writer endpoint. Also, note the port
number for the endpoint.
3. For information about connecting to the DB cluster using the endpoint and port, see Connecting to
an Amazon Aurora PostgreSQL DB Cluster (p. 172)
To delete a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Databases and then choose the DB instance associated with the DB cluster.
3. For Actions, choose Delete.
4. Choose Delete.
After all of the DB instances associated with a DB cluster are deleted, the DB cluster is deleted
automatically.
98
Amazon Aurora User Guide for Aurora
Delete the Sample DB Cluster, DB Subnet Group, and VPC
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Subnet groups and then choose the DB subnet group.
3. Choose Delete.
4. Choose Delete.
To delete a VPC
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc/.
2. Choose Your VPCs and then choose the VPC that was created for this procedure.
3. For Actions, choose Delete VPC.
4. Choose Delete.
99
Amazon Aurora User Guide for Aurora
Topics
• Creating an Amazon Aurora DB Cluster (p. 101)
• Using Amazon Aurora Serverless (p. 117)
• Connecting to an Amazon Aurora DB Cluster (p. 169)
• Working with DB Parameter Groups and DB Cluster Parameter Groups (p. 205)
• Migrating Data to an Amazon Aurora DB Cluster (p. 226)
100
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
In the following topic, you can find out how to create an Aurora DB cluster. To get started, first see DB
Cluster Prerequisites (p. 101).
For simple instructions on connecting to your Aurora DB cluster, see Connecting to an Amazon Aurora DB
Cluster (p. 169).
DB Cluster Prerequisites
Important
Before you can create an Aurora DB cluster, you must complete the tasks in Setting Up Your
Environment for Amazon Aurora (p. 74).
VPC
You can only create an Amazon Aurora DB cluster in a virtual private cloud (VPC) based on the Amazon
VPC service, in an AWS Region that has at least two Availability Zones. The DB subnet group that you
choose for the DB cluster must cover at least two Availability Zones. This configuration ensures that
your DB cluster always has at least one DB instance available for failover, in the unlikely event of an
Availability Zone failure.
If you are using the AWS Management Console to create your Aurora DB cluster, you can have Amazon
RDS automatically create a VPC for you. Or you can use an existing VPC or create a new VPC for your
Aurora DB cluster. Your VPC must have at least one subnet in each of at least two Availability Zones for
you to use it with an Amazon Aurora DB cluster. For more information, see How to Create a VPC for Use
with Amazon Aurora (p. 1067). For information on VPCs, see Amazon Virtual Private Cloud VPCs and
Amazon Aurora (p. 1067).
Note
You can communicate with an EC2 instance that is not in a VPC and an Amazon Aurora DB
cluster using ClassicLink. For more information, see A DB Instance in a VPC Accessed by an EC2
Instance Not in a VPC (p. 1076).
If you don't have a default VPC or you haven't created a VPC, you can have Amazon RDS automatically
create a VPC for you when you create an Aurora DB cluster using the console. Otherwise, you must do
the following:
• Create a VPC with at least one subnet in each of at least two of the Availability Zones in the AWS
Region where you want to deploy your DB cluster. For more information, see How to Create a VPC for
Use with Amazon Aurora (p. 1067).
• Specify a VPC security group that authorizes connections to your Aurora DB cluster. For more
information, see Working with a DB Instance in a VPC (p. 1078).
• Specify an RDS DB subnet group that defines at least two subnets in the VPC that can be used by the
Aurora DB cluster. For more information, see Working with DB Subnet Groups (p. 1078).
101
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
Additional Prerequisites
If you are connecting to AWS using AWS Identity and Access Management (IAM) credentials, your AWS
account must have IAM policies that grant the permissions required to perform Amazon RDS operations.
For more information, see Identity and Access Management in Amazon Aurora (p. 1019).
If you are using IAM to access the Amazon RDS console, you must first sign on to the AWS
Management Console with your IAM user credentials. Then go to the Amazon RDS console at https://
console.aws.amazon.com/rds/.
If you want to tailor the configuration parameters for your DB cluster, you must specify a DB cluster
parameter group and DB parameter group with the required parameter settings. For information about
creating or modifying a DB cluster parameter group or DB parameter group, see Working with DB
Parameter Groups and DB Cluster Parameter Groups (p. 205).
You must determine the TCP/IP port number to specify for your DB cluster. The firewalls at some
companies block connections to the default ports (3306 for MySQL, 5432 for PostgreSQL) for Aurora. If
your company firewall blocks the default port, choose another port for your DB cluster. All instances in a
DB cluster use the same port.
Creating a DB Cluster
You can create an Aurora DB cluster using the AWS Management Console, the AWS CLI, or the RDS API.
Note
If you are using the console, 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
You can create a DB instance running MySQL 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.
Note
For this example, Standard Create is enabled, and Easy Create isn't enabled. For information
about creating an Aurora MySQL DB cluster with Easy create enabled, see Getting Started with
Amazon Aurora (p. 79).
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the upper-right corner of the AWS Management Console, choose the AWS Region in which you
want to create the DB cluster.
Aurora is not available in all AWS Regions. For a list of AWS Regions where Aurora is available, see
Region Availability (p. 5).
3. In the navigation pane, choose Databases.
4. Choose Create database.
5. In Choose a database creation method, choose Standard Create.
6. In Engine options, choose Amazon Aurora.
102
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
103
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
For more information, see Using Amazon Aurora Serverless (p. 117).
9. In Templates, choose the template that matches your use case.
10. To enter your master password, do the following:
By default, the new DB instance uses an automatically generated password for the master user.
11. For the remaining sections, specify your DB cluster settings. For information about each setting, see
Settings for Aurora DB Clusters (p. 111).
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 cluster, 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 Aurora DB Cluster (p. 232).
13. For Databases, choose the name of the new Aurora DB cluster.
On the RDS console, the details for new DB cluster appear. The DB cluster and its DB instance have a
status of creating until the DB cluster is ready to use. When the state changes to available for both,
you can connect to the DB cluster. Depending on the DB instance class and the amount of storage, it
can take up to 20 minutes before the new DB cluster is available.
104
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
When the state changes to available, you can connect to the primary instance for your DB cluster.
Depending on the DB instance class and store allocated, it can take several minutes for the new
instance to be available.
To view the newly created cluster, choose Databases from the navigation pane in the Amazon
RDS console. Then choose the DB cluster to show the DB cluster details. For more information, see
Viewing an Amazon Aurora DB Cluster (p. 366).
On the Connectivity & security tab, note the port and the endpoint of the writer DB instance. Use
the endpoint and port of the cluster in your JDBC and ODBC connection strings for any application
that performs write or read operations.
105
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
Original Console
To create an Aurora DB cluster 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 top-right corner of the AWS Management Console, choose the AWS Region in which you want
to create the Aurora DB cluster.
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. On the Select engine page, choose an edition of Aurora. Choose either MySQL 5.6-compatible,
MySQL 5.7-compatible, or PostgreSQL-compatible.
6. Choose Next.
7. On the Specify DB details page, specify your DB instance information. For information about each
setting, see Settings for Aurora DB Clusters (p. 111).
106
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
On the Amazon RDS console, the new DB cluster appears in the list of DB clusters. The DB cluster
will have a status of creating until the DB cluster is created and ready for use. When the state
107
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
changes to available, you can connect to the writer instance for your DB cluster. Depending on the
DB cluster class and store allocated, it can take several minutes for the new cluster to be available.
To view the newly created cluster, choose Databases from the navigation pane in the Amazon RDS
console and choose the DB cluster to show the DB cluster details. For more information, see Viewing
an Amazon Aurora DB Cluster (p. 366).
Note the ports and the endpoints of the cluster. Use the endpoint and port of the writer DB
cluster in your JDBC and ODBC connection strings for any application that performs write or read
operations.
108
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
AWS CLI
Note
Before you can create an Aurora DB cluster using the AWS CLI, you must fulfill the required
prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB
Cluster Prerequisites (p. 101).
You can use the AWS CLI to create an Aurora MySQL DB cluster or an Aurora PostgreSQL DB cluster.
When you create an Aurora MySQL DB cluster or DB instance, ensure that you specify the correct value
for the --engine option value based on the MySQL compatibility of the DB cluster or DB instance.
• When you create an Aurora MySQL 5.7 DB cluster or DB instance, you must specify aurora-mysql for
the --engine option.
• When you create an Aurora MySQL 5.6 DB cluster or DB instance, you must specify aurora for the --
engine option.
1. Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the
create-db-cluster AWS CLI command to create the Aurora MySQL DB cluster.
For example, the following command creates a new MySQL 5.7–compatible DB cluster named
sample-cluster.
For Windows:
The following command creates a new MySQL 5.6–compatible DB cluster named sample-cluster.
For Windows:
109
Amazon Aurora User Guide for Aurora
Creating a DB Cluster
2. If you use the console to create a DB cluster, then Amazon RDS automatically creates the primary
instance (writer) for your DB cluster. If you use the AWS CLI to create a DB cluster, you must explicitly
create the primary instance for your DB cluster. The primary instance is the first instance that is
created in a DB cluster.
Call the create-db-instance AWS CLI command to create the primary instance for your DB cluster.
Include the name of the DB cluster as the --db-cluster-identifier option value.
For example, the following command creates a new MySQL 5.7–compatible DB instance named
sample-instance.
For Windows:
The following command creates a new MySQL 5.6–compatible DB instance named sample-
instance.
For Windows:
1. Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the
create-db-cluster AWS CLI command to create the Aurora PostgreSQL DB cluster.
For example, the following command creates a new DB cluster named sample-cluster.
For Windows:
110
Amazon Aurora User Guide for Aurora
Available Settings
2. If you use the console to create a DB cluster, then Amazon RDS automatically creates the primary
instance (writer) for your DB cluster. If you use the AWS CLI to create a DB cluster, you must explicitly
create the primary instance for your DB cluster. The primary instance is the first instance that is
created in a DB cluster.
Call the create-db-instance AWS CLI command to create the primary instance for your DB cluster.
Include the name of the DB cluster as the --db-cluster-identifier option value.
For Windows:
RDS API
Note
Before you can create an Aurora DB cluster using the AWS CLI, you must fulfill the required
prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB
Cluster Prerequisites (p. 101).
Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the
CreateDBInstance operation to create the DB cluster.
When you create an Aurora MySQL DB cluster or DB instance, ensure that you specify the correct value
for the Engine parameter value based on the MySQL compatibility of the DB cluster or DB instance.
• When you create an Aurora MySQL 5.7 DB cluster or DB instance, you must specify aurora-mysql for
the Engine parameter.
• When you create an Aurora MySQL 5.6 DB cluster or DB instance, you must specify aurora for the
Engine parameter.
When you create an Aurora PostgreSQL DB cluster or DB instance, specify aurora-postgresql for the
Engine parameter.
111
Amazon Aurora User Guide for Aurora
Available Settings
Auto minor version upgrade Choose Enable auto minor version upgrade if you want to
enable your Aurora DB cluster to receive preferred minor
version upgrades to the DB engine automatically when they
become available.
Copy tags to snapshots Choose this option to copy any DB instance tags to a DB
snapshot when you create a snapshot.
Database port Specify the port for applications and utilities to use to
access the database. Aurora MySQL DB clusters default to
the default MySQL port, 3306, and Aurora PostgreSQL DB
clusters default to the default PostgreSQL port, 5432. The
firewalls at some companies block connections to these
default ports. If your company firewall blocks the default
port, choose another port for the new DB cluster.
DB cluster identifier Enter a name for your DB cluster that is unique for your
account in the AWS Region that you chose. This identifier
is used in the cluster endpoint address for your DB cluster.
112
Amazon Aurora User Guide for Aurora
Available Settings
DB cluster parameter group Choose a DB cluster parameter group. Aurora has a default
DB cluster parameter group you can use, or you can
create your own DB cluster parameter group. For more
information about DB cluster parameter groups, see Working
with DB Parameter Groups and DB Cluster Parameter
Groups (p. 205).
DB engine version Applies only to the provisioned capacity type. Choose the
version number of your DB engine.
DB instance identifier Enter a name for the primary instance in your DB cluster.
This identifier is used in the endpoint address for the
primary instance of your DB cluster.
113
Amazon Aurora User Guide for Aurora
Available Settings
Failover priority Choose a failover priority for the instance. If you don't
choose a value, the default is tier-1. This priority determines
the order in which Aurora Replicas are promoted when
recovering from a primary instance failure. For more
information, see Fault Tolerance for an Aurora DB
Cluster (p. 287).
Initial database name Enter a name for your default database. If you don't provide
a name, Amazon RDS doesn't create a database on the DB
cluster you are creating.
Log exports Choose the types of MySQL or PostgreSQL database log files
to generate. For more information, see MySQL Database Log
Files (p. 493) and PostgreSQL Database Log Files (p. 498).
Maintenance window Choose Select window and specify the weekly time range
during which system maintenance can occur. Or choose No
preference for Amazon RDS to assign a period randomly.
114
Amazon Aurora User Guide for Aurora
Available Settings
Master username Enter a name to use as the master user name to log on to
your DB cluster:
115
Amazon Aurora User Guide for Aurora
Available Settings
Retention period Choose the length of time, from 1 to 35 days, that Aurora
retains backup copies of the database. Backup copies can be
used for point-in-time restores (PITR) of your database down
to the second.
Subnet group Choose the DB subnet group to use for the DB cluster. For
more information, see DB Cluster Prerequisites (p. 101).
Select the log types to publish to Applies only to Aurora MySQL. In the Log exports section,
Amazon CloudWatch Logs choose the logs that you want to start publishing to Amazon
CloudWatch Logs. For more about publishing to CloudWatch
Logs, see Publishing Amazon Aurora MySQL Logs to Amazon
CloudWatch Logs (p. 685).
Virtual Private Cloud (VPC) Choose the VPC to host the DB cluster. Choose Create a New
VPC to have Amazon RDS create a VPC for you. For more
information, see DB Cluster Prerequisites (p. 101).
VPC security group Choose Create new to have Amazon RDS create a VPC
security group for you. Or choose Choose existing and
specify one or more VPC security groups to secure network
access to the DB cluster.
116
Amazon Aurora User Guide for Aurora
Using Aurora Serverless
Topics
• Advantages of Aurora Serverless (p. 117)
• Use Cases for Aurora Serverless (p. 117)
• Limitations of Aurora Serverless (p. 118)
• Using TLS/SSL with Aurora Serverless (p. 119)
• How Aurora Serverless Works (p. 120)
• Creating an Aurora Serverless DB Cluster (p. 125)
• Restoring an Aurora Serverless DB Cluster (p. 130)
• Modifying an Aurora Serverless DB Cluster (p. 133)
• Setting the Capacity of an Aurora Serverless DB Cluster (p. 134)
• Viewing Aurora Serverless DB Clusters (p. 136)
• Using the Data API for Aurora Serverless (p. 140)
• Logging Data API Calls with AWS CloudTrail (p. 162)
• Using the Query Editor for Aurora Serverless (p. 164)
Simpler
Aurora Serverless removes much of the complexity of managing DB instances and capacity.
Scalable
Aurora Serverless seamlessly scales compute and memory capacity as needed, with no disruption to
client connections.
Cost-effective
When you use Aurora Serverless, you pay for only the database resources that you consume, on a
per-second basis.
Highly available storage
Aurora Serverless uses the same fault-tolerant, distributed storage system with six-way replication
as Aurora to protect against data loss.
117
Amazon Aurora User Guide for Aurora
Limitations of Aurora Serverless
You have an application that is only used for a few minutes several times per day or week, such as
a low-volume blog site. With Aurora Serverless, you pay for only the database resources that you
consume on a per-second basis.
New applications
You are deploying a new application and are unsure about which instance size you need. With Aurora
Serverless, you can create a database endpoint and have the database autoscale to the capacity
requirements of your application.
Variable workloads
You're running a lightly used application, with peaks of 30 minutes to several hours a few times
each day, or several times per year. Examples are applications for human resources, budgeting, and
operational reporting applications. With Aurora Serverless, you no longer need to provision to either
peak or average capacity.
Unpredictable workloads
You're running workloads where there is database usage throughout the day, but also peaks of
activity that are hard to predict. An example is a traffic site that sees a surge of activity when it
starts raining. With Aurora Serverless, your database autoscales capacity to meet the needs of the
application's peak load and scales back down when the surge of activity is over.
Development and test databases
Your developers use databases during work hours but don't need them on nights or weekends. With
Aurora Serverless, your database automatically shuts down when it's not in use.
Multi-tenant applications
With Aurora Serverless, you don't have to individually manage database capacity for each
application in your fleet. Aurora Serverless manages individual database capacity for you.
118
Amazon Aurora User Guide for Aurora
Using TLS/SSL with Aurora Serverless
Note
You can access an Aurora Serverless DB cluster from AWS Lambda. For more information about
working with AWS Lambda, see Configuring a Lambda Function to Access Resources in an
Amazon VPC in the AWS Lambda Developer Guide.
You can ensure that your session uses TLS between your client and the Aurora Serverless VPC endpoint.
To do so, specify the requirement on the client side with the --ssl-mode parameter. SSL session
variables are not set for SSL connections to an Aurora Serverless DB cluster.
Aurora Serverless supports TLS protocol version 1.0, 1.1, and 1.2. However, you don't need to configure
an Aurora Serverless database for TLS. In particular, don't use the REQUIRE clause on your database user
privileges for SSL. Doing so prevents that user from connecting.
By default, client programs establish an encrypted connection with Aurora Serverless, with further
control available through the --ssl-mode option. From the client side, Aurora Serverless supports all
SSL modes.
Note
TLS support for Aurora Serverless clusters currently isn't available in the China (Beijing) AWS
Region.
For the mysql and psql client, the SSL modes are the following:
PREFERRED
No SSL is allowed.
REQUIRED
Enforce SSL.
119
Amazon Aurora User Guide for Aurora
How Aurora Serverless Works
VERIFY_CA
When using a mysql or psql 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.
Aurora Serverless uses wildcard certificates. If you use the mysql client to connect with SSL mode
VERIFY_IDENTITY, currently you must use the MySQL 8.0-compatible mysql command.
However, in some environments, workloads can be intermittent and unpredictable. There can be periods
of heavy workloads that might last only a few minutes or hours, and also long periods of light activity, or
even no activity. Some examples are retail websites with intermittent sales events, reporting databases
that produce reports when needed, development and testing environments, and new applications with
uncertain requirements. In these cases and many others, it can be difficult to configure the correct
capacity at the right times. It can also result in higher costs when you pay for capacity that isn't used.
With Aurora Serverless, you can create a database endpoint without specifying the DB instance class size.
You set the minimum and maximum capacity. With Aurora Serverless, the database endpoint connects to
a proxy fleet that routes the workload to a fleet of resources that are automatically scaled. Because of the
proxy fleet, connections are continuous as Aurora Serverless scales the resources automatically based on
the minimum and maximum capacity specifications. Database client applications don't need to change
to use the proxy fleet. Aurora Serverless manages the connections automatically. Scaling is rapid because
it uses a pool of "warm" resources that are always ready to service requests. Storage and processing are
separate, so you can scale down to zero processing and pay only for storage.
Aurora Serverless introduces a new serverless DB engine mode for Aurora DB clusters. Non-Serverless
DB clusters use the provisioned DB engine mode.
Topics
• Aurora Serverless Architecture (p. 120)
• Autoscaling for Aurora Serverless (p. 121)
• Automatic Pause and Resume for Aurora Serverless (p. 122)
• Timeout Action for Capacity Changes (p. 122)
• Aurora Serverless and Parameter Groups (p. 122)
• Aurora Serverless and Maintenance (p. 125)
• Aurora Serverless and Failover (p. 125)
• Aurora Serverless and Snapshots (p. 125)
120
Amazon Aurora User Guide for Aurora
How Aurora Serverless Works
Instead of provisioning and managing database servers, you specify Aurora capacity units (ACUs). Each
ACU is a combination of processing and memory capacity. Database storage automatically scales from 10
GiB to 64 TiB, the same as storage in a standard Aurora DB cluster.
You can specify the minimum and maximum ACU. The minimum Aurora capacity unit is the lowest ACU
to which the DB cluster can scale down. The maximum Aurora capacity unit is the highest ACU to which
the DB cluster can scale up. Based on your settings, Aurora Serverless automatically creates scaling rules
for thresholds for CPU utilization, connections, and available memory.
Aurora Serverless manages the warm pool of resources in an AWS Region to minimize scaling time. When
Aurora Serverless adds new resources to the Aurora DB cluster, it uses the proxy fleet to switch active
client connections to the new resources. At any specific time, you are only charged for the ACUs that are
being actively used in your Aurora DB cluster.
Aurora Serverless scales up when capacity constraints are seen in CPU or connections. It also scales up
when it detects performance issues that can be resolved by scaling up.
After scaling up, the cooldown period for scaling down is 15 minutes. After scaling down, the cooldown
period for scaling down again is 310 seconds.
Note
There is no cooldown period for scaling up. Aurora Serverless can scale up whenever necessary,
including immediately after scaling up or scaling down.
A scaling point is a point in time at which the database can safely initiate the scaling operation. Under
the following conditions, Aurora Serverless might not be able to find a scaling point:
121
Amazon Aurora User Guide for Aurora
How Aurora Serverless Works
In these cases, Aurora Serverless continues to try to find a scaling point so that it can initiate the scaling
operation. It does this for as long as it determines that the DB cluster should be scaled.
You can see scaling events in the details for a DB cluster in the AWS Management Console. You can also
monitor the current capacity allocated to the DB cluster by using the ServerlessDatabaseCapacity
metric for Amazon CloudWatch.
During autoscaling, Aurora Serverless resets the EngineUptime metric. The reset metric value doesn't
indicate any issues with seamless scaling and doesn't mean that any connections were dropped. For more
information about metrics, see Monitoring Amazon Aurora DB Cluster Metrics (p. 377).
When the DB cluster is paused, no compute or memory activity occurs, and you are charged only for
storage. If database connections are requested when an Aurora Serverless DB cluster is paused, the DB
cluster automatically resumes and services the connection requests.
Note
If a DB cluster is paused for more than seven days, the DB cluster might be backed up with a
snapshot. In this case, the DB cluster is restored when there is a request to connect to it.
• Force the capacity change – Set the capacity to the specified value as soon as possible.
• Roll back the capacity change – Cancel the capacity change.
Important
If you force the capacity change, connections that prevent Aurora Serverless from finding a
scaling point might be dropped.
For information about changing the capacity, see Modifying an Aurora Serverless DB Cluster (p. 133).
The DB instances in an Aurora Serverless cluster only have associated DB cluster parameter groups, not
DB parameter groups. Serverless clusters rely on DB cluster parameter groups because DB instances are
not permanently associated with Aurora Serverless clusters. Aurora scales the associated DB instance
automatically as needed. The scaling operation involves modifying parameter values to be suitable for
the larger or smaller capacity.
To customize configuration settings for an Aurora Serverless cluster, you can define your own DB
cluster parameter group and modify the parameters it contains. You can modify both cluster-level
122
Amazon Aurora User Guide for Aurora
How Aurora Serverless Works
parameters, and parameters that apply at the instance level in other kinds of Aurora clusters. However,
when you modify a DB cluster parameter group that's associated with an Aurora Serverless DB cluster,
modifications apply differently than for other DB cluster parameter groups.
When you save changes to a DB cluster parameter group for an Aurora Serverless DB cluster, changes are
applied immediately. In doing so, Aurora Serverless ignores the following settings:
• When modifying the DB cluster as a whole, Aurora Serverless ignores the following:
• The Apply Immediately setting in the AWS Management Console
• The --apply-immediately|--no-apply-immediately option in the AWS CLI command
modify-db-cluster
• The ApplyImmediately parameter in the RDS API operation ModifyDBCluster
• When modifying parameters, Aurora Serverless ignores the ApplyMethod value in the parameter list
in the AWS CLI commands modify-db-cluster-parameter-group and reset-db-cluster-parameter-group.
• When modifying parameters, Aurora Serverless ignores the ApplyMethod value in the parameter list
in the RDS API operations ModifyDBClusterParameterGroup and ResetDBClusterParameterGroup.
To apply a change to a DB cluster parameter group, Aurora Serverless starts a seamless scale with the
current capacity if the DB cluster is active. It resumes the DB cluster if it's paused.
Important
Aurora performs the seamless scaling operation for a parameter group change with the force-
apply-capacity-change option. If a scaling point can't be found, connections that prevent
Aurora Serverless from finding a scaling point might be dropped.
To view the supported engine mode for cluster-level parameters, run the describe-engine-default-
cluster-parameters command or the RDS API operation DescribeEngineDefaultClusterParameters. For
example, the following Linux command extracts the names of parameters that you can set for Aurora
MySQL Serverless clusters, from an aurora5.6 default DB cluster parameter group.
The following Linux command extracts the names of parameters that you can set for Aurora PostgreSQL
Serverless clusters, from an aurora-postgresql10 default DB cluster parameter group.
The following Linux command extracts the names of parameters that you can set for Serverless clusters
from a DB cluster parameter group that you created.
123
Amazon Aurora User Guide for Aurora
How Aurora Serverless Works
--db-cluster-parameter-group-name my_cluster_param_group_name \
--query 'Parameters[*].{ParameterName:ParameterName,
SupportedEngineModes:SupportedEngineModes}
| [?contains(SupportedEngineModes, `serverless`) == `true`]
| [*].{param:ParameterName}' \
--output text
For more information about parameter groups, see Working with DB Parameter Groups and DB Cluster
Parameter Groups (p. 205).
With an Aurora MySQL Serverless DB cluster, modifications to parameter values only take effect for the
following parameters. You can modify other parameters, but Aurora doesn't use the changed values. For
all other configuration parameters, Aurora MySQL Serverless clusters use default values. These default
values might be different than for other kinds of Aurora clusters. These values might also change as
Aurora scales the Aurora Serverless cluster up or down.
• character_set_server.
• collation_server.
• general_log. This setting was formerly only in the DB instance parameter group.
• innodb_file_format. This setting was formerly only in the DB instance parameter group.
• innodb_file_per_table.
• innodb_large_prefix. This setting was formerly only in the DB instance parameter group.
• innodb_lock_wait_timeout. This setting was formerly only in the DB instance parameter group.
• innodb_monitor_disable. This setting was formerly only in the DB instance parameter group.
• innodb_monitor_enable. This setting was formerly only in the DB instance parameter group.
• innodb_monitor_reset. This setting was formerly only in the DB instance parameter group.
• innodb_monitor_reset_all. This setting was formerly only in the DB instance parameter group.
• innodb_print_all_deadlocks. This setting was formerly only in the DB instance parameter group.
• lc_time_names.
• log_output. This setting was formerly only in the DB instance parameter group. This setting has a
default value of FILE. You can't change this value.
• log_queries_not_using_indexes. This setting was formerly only in the DB instance parameter
group.
• log_warnings. This setting was formerly only in the DB instance parameter group.
• long_query_time. This setting was formerly only in the DB instance parameter group.
• lower_case_table_names.
• net_read_timeout. This setting was formerly only in the DB instance parameter group.
• net_retry_count. This setting was formerly only in the DB instance parameter group.
• net_write_timeout. This setting was formerly only in the DB instance parameter group.
• server_audit_logging.
• server_audit_events.
• server_audit_excl_users.
• server_audit_incl_users.
• slow_query_log. This setting was formerly only in the DB instance parameter group.
• sql_mode. This setting was formerly only in the DB instance parameter group.
• time_zone.
• tx_isolation. This setting was formerly only in the DB instance parameter group.
124
Amazon Aurora User Guide for Aurora
Creating an Aurora Serverless DB Cluster
To apply maintenance, Aurora Serverless must find a scaling point. For more information about scaling
points, see Autoscaling for Aurora Serverless (p. 121).
If there is maintenance required for an Aurora Serverless DB cluster, the DB cluster attempts
to find a scaling point to apply the maintenance for seven days. After each day that no scaling
point can be found, Aurora Serverless creates a cluster event to notify you that it must scale
to apply maintenance. The notification includes the date at which scaling will be applied with
the ForceApplyCapacityChange timeout action to apply the maintenance, regardless of the
ScalingConfiguration settings. If your DB cluster has RollbackCapacityChange set as the
TimeoutAction for its ScalingConfiguration, Aurora Serverless tries to apply maintenance using
the RollbackCapacityChange timeout action prior to the time included in the event. If your DB
cluster has ForceApplyCapacityChange set as the TimeoutAction for its ScalingConfiguration,
then scaling to apply maintenance uses it for all attempts. When ForceApplyCapacityChange
is used, it might interrupt your workload. For more information, see Timeout Action for Capacity
Changes (p. 122).
Note
Maintenance windows don't apply to Aurora Serverless.
This failover mechanism takes longer than for an Aurora Provisioned cluster. The Aurora Serverless
failover time is currently undefined because it depends on demand and capacity availability in other AZs
within the given AWS Region.
Because Aurora separates computation capacity and storage, the storage volume for the cluster is spread
across multiple AZs. Your data remains available even if outages affect the DB instance or the associated
AZ.
• Minimum Aurora capacity unit – Aurora Serverless can reduce capacity down to this capacity unit.
• Maximum Aurora capacity unit – Aurora Serverless can increase capacity up to this capacity unit.
125
Amazon Aurora User Guide for Aurora
Creating an Aurora Serverless DB Cluster
• Timeout action – The action to take when a capacity modification times out because it can't find a
scaling point. Aurora can force the capacity change to set the capacity to the specified value as soon as
possible. Or, it can roll back the capacity change to cancel it. For more information, see Timeout Action
for Capacity Changes (p. 122).
• Pause after inactivity – The amount of time with no database traffic to scale to zero processing
capacity. When database traffic resumes, Aurora automatically resumes processing capacity and scales
to handle the traffic.
You can create an Aurora Serverless DB cluster with the AWS Management Console, the AWS CLI, or the
RDS API.
For general information about creating a DB cluster, see Creating an Amazon Aurora DB Cluster (p. 101).
Note
Currently, Aurora Serverless isn't available in all AWS Regions. For more information on Aurora
Serverless, see Pricing under either MySQL-Compatible Edition or PostgreSQL-Compatible
Edition.
The cluster volume for an Aurora Serverless cluster is always encrypted. You can choose the
encryption key, but not turn off encryption. Therefore, you can't perform operations that aren't
allowed for encrypted snapshots. For example, you can't copy snapshots of Aurora Serverless
clusters to a different AWS Region.
Console
To create a new Aurora Serverless DB cluster with the AWS Management Console, specify Serverless for
Capacity type on the Specify DB details page.
The following image shows the Specify DB details page with Serverless chosen during DB cluster
creation for the Aurora MySQL engine.
You can configure the scaling configuration of the Aurora Serverless DB cluster by adjusting values in the
Capacity settings section on the Configure advanced settings page.
126
Amazon Aurora User Guide for Aurora
Creating an Aurora Serverless DB Cluster
The following image shows the Capacity settings you can adjust for an Aurora MySQL Serverless DB
cluster.
You can also enable the Data API for your Aurora MySQL Serverless DB cluster. For more information, see
Using the Data API for Aurora Serverless (p. 140).
127
Amazon Aurora User Guide for Aurora
Creating an Aurora Serverless DB Cluster
You can configure the scaling configuration of the Aurora Serverless DB cluster by adjusting values in the
Capacity settings section on the Configure advanced settings page.
The following image shows the Capacity settings you can adjust for an Aurora PostgreSQL Serverless DB
cluster.
For more information on creating an Aurora DB cluster using the AWS Management Console, see
Creating an Amazon Aurora DB Cluster (p. 101).
To connect to an Aurora Serverless DB cluster, use the database endpoint. For details, see the
instructions in Connecting to an Amazon Aurora DB Cluster (p. 169).
Note
If you encounter the following error message, your account requires additional permissions:
Unable to create the resource. Verify that you have permission to create
service linked role. Otherwise wait and try again later.
For more information, see Using Service-Linked Roles for Amazon Aurora (p. 1063).
AWS CLI
To create a new Aurora Serverless DB cluster with the AWS CLI, run the create-db-cluster command and
specify serverless for the --engine-mode option.
You can optionally specify the --scaling-configuration option to configure the minimum capacity,
maximum capacity, and automatic pause when there are no connections.
The following command examples create a new Serverless DB cluster by setting the --engine-mode
option to serverless. The examples also specify values for the --scaling-configuration option.
The following command creates a new MySQL 5.6–compatible Serverless DB cluster. Valid capacity
values for Aurora MySQL are 1, 2, 4, 8, 16, 32, 64, 128, and 256.
128
Amazon Aurora User Guide for Aurora
Creating an Aurora Serverless DB Cluster
For Windows:
The following command creates a new PostgreSQL 10.7–compatible Serverless DB cluster. Valid capacity
values for Aurora PostgreSQL are 2, 4, 8, 16, 32, 64, 192, and 384.
For Windows:
RDS API
To create a new Aurora Serverless DB cluster with the RDS API, run the CreateDBCluster operation and
specify serverless for the EngineMode parameter.
You can optionally specify the ScalingConfiguration parameter to configure the minimum capacity,
maximum capacity, and automatic pause when there are no connections. Valid capacity values include
the following:
129
Amazon Aurora User Guide for Aurora
Restoring an Aurora Serverless DB Cluster
When you restore a snapshot to an Aurora Serverless DB cluster, you can set the following specific
values:
• Minimum Aurora capacity unit – Aurora Serverless can reduce capacity down to this capacity unit.
• Maximum Aurora capacity unit – Aurora Serverless can increase capacity up to this capacity unit.
• Timeout action – The action to take when a capacity modification times out because it can't find a
scaling point. Aurora can force the capacity change to set the capacity to the specified value as soon as
possible. Or, it can roll back the capacity change to cancel it. For more information, see Timeout Action
for Capacity Changes (p. 122).
• Pause after inactivity – The amount of time with no database traffic to scale to zero processing
capacity. When database traffic resumes, Aurora automatically resumes processing capacity and scales
to handle the traffic.
For general information about restoring a DB cluster from a snapshot, see Restoring from a DB Cluster
Snapshot (p. 292).
Console
You can restore a DB cluster snapshot to an Aurora DB cluster with 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 upper-right corner of the AWS Management Console, choose the AWS Region that hosts your
source DB cluster.
3. In the navigation pane, choose Snapshots, and choose the DB cluster snapshot that you want to
restore.
4. For Actions, choose Restore Snapshot.
5. On the Restore DB Cluster page, choose Serverless for Capacity type.
130
Amazon Aurora User Guide for Aurora
Restoring an Aurora Serverless DB Cluster
6. In the DB cluster identifier field, type the name for your restored DB cluster, and complete the other
fields.
7. In the Capacity settings section, modify the scaling configuration.
To connect to an Aurora Serverless DB cluster, use the database endpoint. For details, see the
instructions in Connecting to an Amazon Aurora DB Cluster (p. 169).
Note
If you encounter the following error message, your account requires additional permissions:
131
Amazon Aurora User Guide for Aurora
Restoring an Aurora Serverless DB Cluster
Unable to create the resource. Verify that you have permission to create
service linked role. Otherwise wait and try again later.
For more information, see Using Service-Linked Roles for Amazon Aurora (p. 1063).
AWS CLI
To configure an Aurora Serverless DB cluster when you restore from a DB cluster using the AWS CLI, run
the restore-db-cluster-from-snapshot CLI command and specify serverless for the --engine-mode
option.
You can optionally specify the --scaling-configuration option to configure the minimum capacity,
maximum capacity, and automatic pause when there are no connections. Valid capacity values include
the following:
In the following example, you restore from a previously created DB cluster snapshot named
mydbclustersnapshot. You restore to a new DB cluster named mynewdbcluster. To restore the DB
cluster as an Aurora Serverless DB cluster, set the --engine-mode option to serverless. The example
also specifies values for the --scaling-configuration option.
For Windows:
RDS API
To configure an Aurora Serverless DB cluster when you restore from a DB cluster using the RDS API, run
the RestoreDBClusterFromSnapshot operation and specify serverless for the EngineMode parameter.
You can optionally specify the ScalingConfiguration parameter to configure the minimum capacity,
maximum capacity, and automatic pause when there are no connections. Valid capacity values include
the following:
132
Amazon Aurora User Guide for Aurora
Modifying an Aurora Serverless DB Cluster
You can set the minimum and maximum capacity for the DB cluster. Each capacity unit is equivalent
to a specific compute and memory configuration. Aurora Serverless automatically creates scaling rules
for thresholds for CPU utilization, connections, and available memory. You can also set whether Aurora
Serverless pauses the database when there's no activity and then resumes when activity begins again.
• Minimum Aurora capacity unit – Aurora Serverless can reduce capacity down to this capacity unit.
• Maximum Aurora capacity unit – Aurora Serverless can increase capacity up to this capacity unit.
• Timeout action – The action to take when a capacity modification times out because it can't find a
scaling point. Aurora can force the capacity change to set the capacity to the specified value as soon as
possible. Or, it can roll back the capacity change to cancel it. For more information, see Timeout Action
for Capacity Changes (p. 122).
• Pause after inactivity – The amount of time with no database traffic to scale to zero processing
capacity. When database traffic resumes, Aurora automatically resumes processing capacity and scales
to handle the traffic.
Console
You can modify the scaling configuration of an Aurora DB cluster with the AWS Management Console.
133
Amazon Aurora User Guide for Aurora
Setting the Capacity of an Aurora Serverless DB Cluster
6. Choose Continue.
7. Choose Modify cluster.
AWS CLI
To modify the scaling configuration of an Aurora Serverless DB cluster using the AWS CLI, run the
modify-db-cluster AWS CLI command. Specify the --scaling-configuration option to configure
the minimum capacity, maximum capacity, and automatic pause when there are no connections. Valid
capacity values include the following:
In this example, you modify the scaling configuration of an Aurora Serverless DB cluster named sample-
cluster.
For Windows:
RDS API
You can modify the scaling configuration of an Aurora DB cluster with the ModifyDBCluster API
operation. Specify the ScalingConfiguration parameter to configure the minimum capacity,
maximum capacity, and automatic pause when there are no connections. Valid capacity values include
the following:
Aurora Serverless scales seamlessly based on the workload on the DB cluster. In some cases, the capacity
might not scale fast enough to meet a sudden change in workload, such as a large number of new
134
Amazon Aurora User Guide for Aurora
Setting the Capacity of an Aurora Serverless DB Cluster
transactions. In these cases, you can set the capacity explicitly. After you set the capacity explicitly,
Aurora Serverless can automatically scale the DB cluster. It does so based on the cooldown period for
scaling down.
Console
You can set the capacity of an Aurora DB cluster with the AWS Management Console.
6. Enable or disable the option to forcibly scale capacity. If you enable it, specify the amount of time
to find a scaling point. Aurora Serverless attempts to find a scaling point before timing out. If the
timeout is reached, Aurora Serverless performs one of the following actions:
• If checked, Aurora Serverless will force the scaling capacity change to proceed after the timeout.
• If unchecked, Aurora Serverless will not perform the scaling capacity change after the timeout.
Important
When the option is enabled, connections that prevent Aurora Serverless from finding a
scaling point might be dropped. For more information about scaling points and cooldown
periods, see Autoscaling for Aurora Serverless (p. 121).
7. Choose Apply.
135
Amazon Aurora User Guide for Aurora
Viewing Aurora Serverless DB Clusters
AWS CLI
To set the capacity of an Aurora Serverless DB cluster using the AWS CLI, run the modify-current-db-
cluster-capacity AWS CLI command, and specify the --capacity option. Valid capacity values include
the following:
In this example, you set the capacity of an Aurora Serverless DB cluster named sample-cluster to 64.
RDS API
You can set the capacity of an Aurora DB cluster with the ModifyCurrentDBClusterCapacity API operation.
Specify the Capacity parameter. Valid capacity values include the following:
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 Aurora Serverless DB clusters.
3. In the navigation pane, choose Databases.
For each DB cluster, the DB cluster type is shown under Role. The Aurora Serverless DB clusters show
Serverless for the type. You can view an Aurora Serverless DB cluster's current capacity under Size.
136
Amazon Aurora User Guide for Aurora
Viewing Aurora Serverless DB Clusters
On the Connectivity & security tab, note the database endpoint, because it's required to connect to
the DB cluster.
137
Amazon Aurora User Guide for Aurora
Viewing Aurora Serverless DB Clusters
138
Amazon Aurora User Guide for Aurora
Viewing Aurora Serverless DB Clusters
A scaling event is generated when the DB cluster scales up, scales down, pauses, or resumes. Choose
the Logs & events tab to see recent events. The following image shows examples of these events.
You can also monitor your Aurora Serverless DB cluster in CloudWatch. In particular, you can
monitor the capacity allocated to the DB cluster with the ServerlessDatabaseCapacity metric.
You can also monitor all of the standard Aurora CloudWatch metrics, such as CPUUtilization,
DatabaseConnections, Queries, and so on. For details about how to monitor Aurora clusters through
CloudWatch, see Monitoring Log Events in Amazon CloudWatch (p. 688).
You can have Aurora publish some or all database logs to CloudWatch. You select which logs to publish
by enabling the configuration parameters such as general_log and slow_query_log in the DB
cluster parameter group associated with the Serverless cluster. Unlike provisioned clusters, Serverless
clusters don't require you to specify in the DB cluster settings which log types to upload to CloudWatch.
Serverless clusters automatically upload all the available logs. When you disable a log configuration
parameter, publishing of the log to CloudWatch stops. You can also delete the logs in CloudWatch if they
are no longer needed.
139
Amazon Aurora User Guide for Aurora
Using the Data API
To connect to an Aurora Serverless DB cluster, use the database endpoint. Follow the instructions in
Connecting to an Amazon Aurora DB Cluster (p. 169) to connect to your Aurora Serverless DB cluster.
Note
With Aurora Serverless, you can't connect directly to specific DB instances in the DB cluster.
The Data API doesn't require a persistent connection to the DB cluster. Instead, it provides a secure HTTP
endpoint and integration with AWS SDKs. You can use the endpoint to run SQL statements without
managing connections. All calls to the Data API are synchronous. By default, a call times out and is
terminated in 45 seconds if it's not finished processing. You can use the continueAfterTimeout
parameter to continue running the SQL statement after the call times out.
The API uses database credentials stored in AWS Secrets Manager, so you don't need to pass credentials
in the API calls. The API also provides a more secure way to use AWS Lambda. It enables you to access
your DB cluster without your needing to configure a Lambda function to access resources in a virtual
private cloud (VPC). For more information about AWS Secrets Manager, see What Is AWS Secrets
Manager? in the AWS Secrets Manager User Guide.
Note
When you enable the Data API, you can also use the query editor for Aurora Serverless. For more
information, see Using the Query Editor for Aurora Serverless (p. 164).
The following table shows the AWS Regions where the Data API is currently available for Aurora
Serverless. Use the HTTPS protocol to access the Data API in these AWS Regions.
Region Link
140
Amazon Aurora User Guide for Aurora
Using the Data API
You can also create an IAM policy that grants access to the Data API. After you create the policy, add it to
each user that requires access to the Data API.
The following policy provides the minimum required permissions for a user to access the Data API.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SecretsManagerDbCredentialsAccess",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:PutResourcePolicy",
"secretsmanager:PutSecretValue",
"secretsmanager:DeleteSecret",
"secretsmanager:DescribeSecret",
"secretsmanager:TagResource"
],
"Resource": "arn:aws:secretsmanager:*:*:secret:rds-db-credentials/*"
},
{
"Sid": "RDSDataServiceAccess",
"Effect": "Allow",
"Action": [
"secretsmanager:CreateSecret",
"secretsmanager:ListSecrets",
"secretsmanager:GetRandomPassword",
"tag:GetResources",
"rds-data:BatchExecuteStatement",
"rds-data:BeginTransaction",
"rds-data:CommitTransaction",
"rds-data:ExecuteStatement",
"rds-data:RollbackTransaction"
],
"Resource": "*"
}
]
}
For information about creating an IAM policy, see Creating IAM Policies in the IAM User Guide.
For information about adding an IAM policy to a user, see Adding and Removing IAM Identity Permissions
in the IAM User Guide.
Console
You can enable the Data API by using the RDS console when you create or modify an Aurora Serverless
DB cluster. When you create an Aurora Serverless DB cluster, you do so by enabling the Data API in the
RDS console's Connectivity section. When you modify an Aurora Serverless DB cluster, you do so by
enabling the Data API in the RDS console's Network & Security section.
The following screenshot shows the enabled Data API when modifying an Aurora Serverless DB cluster.
141
Amazon Aurora User Guide for Aurora
Using the Data API
For instructions, see Creating an Aurora Serverless DB Cluster (p. 125) and Modifying an Aurora
Serverless DB Cluster (p. 133).
AWS CLI
When you create or modify an Aurora Serverless DB cluster using AWS CLI commands, the Data API is
enabled when you specify -enable-http-endpoint.
You can specify the -enable-http-endpoint using the following AWS CLI commands:
• create-db-cluster
• modify-db-cluster
For Windows:
RDS API
When you create or modify an Aurora Serverless DB cluster using Amazon RDS API operations, you
enable the Data API by setting the EnableHttpEndpoint value to true.
You can set the EnableHttpEndpoint value using the following API operations:
• CreateDBCluster
• ModifyDBCluster
142
Amazon Aurora User Guide for Aurora
Using the Data API
1. Use AWS Secrets Manager to create a secret that contains credentials for the Aurora DB cluster.
For instructions, see Creating a Basic Secret in the AWS Secrets Manager User Guide.
2. Use the AWS Secrets Manager console to view the details for the secret you created, or run the aws
secretsmanager describe-secret AWS CLI command.
Note the name and ARN of the secret. You can use them in calls to the Data API.
You can call the Data API with Amazon VPC endpoints. Using an Amazon VPC endpoint keeps traffic
between applications in your Amazon VPC and the Data API in the AWS network, without using public IP
addresses. Amazon VPC endpoints can help you meet compliance and regulatory requirements related
to limiting public internet connectivity. For example, if you use an Amazon VPC endpoint, you can keep
traffic between an application running on an Amazon EC2 instance and the Data API in the VPCs that
contain them.
After you create the Amazon VPC endpoint, you can start using it without making any code or
configuration changes in your application.
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc/.
2. Choose Endpoints, and then choose Create Endpoint.
3. On the Create Endpoint page, for Service category, choose AWS services. For Service Name,
choose rds-data.
143
Amazon Aurora User Guide for Aurora
Using the Data API
Choose the VPC that contains the application that makes Data API calls.
5. For Subnets, choose the subnet for each Availability Zone (AZ) used by the AWS service that is
running your application.
To create an Amazon VPC endpoint, specify the private IP address range in which the endpoint
will be accessible. To do this, choose the subnet for each Availability Zone. Doing so restricts the
VPC endpoint to the private IP address range specific to each Availability Zone and also creates an
Amazon VPC endpoint in each Availability Zone.
6. For Enable DNS name, select Enable for this endpoint.
Private DNS resolves the standard Data API DNS hostname (https://rds-
data.region.amazonaws.com) to the private IP addresses associated with the DNS hostname
specific to your Amazon VPC endpoint. As a result, you can access the Data API VPC endpoint using
the AWS CLI or AWS SDKs without making any code or configuration changes to update the Data API
endpoint URL.
7. For Security group, choose a security group to associate with the Amazon VPC endpoint.
144
Amazon Aurora User Guide for Aurora
Using the Data API
Choose the security group that allows access to the AWS service that is running your application.
For example, if an Amazon EC2 instance is running your application, choose the security group that
allows access to the Amazon EC2 instance. The security group enables you to control the traffic to
the Amazon VPC endpoint from resources in your VPC.
8. For Policy, choose Full Access to allow anyone inside the Amazon VPC to access the Data API
through this endpoint. Or choose Custom to specify a policy that limits access.
If you choose Custom, enter the policy in the policy creation tool.
9. Choose Create endpoint.
After the endpoint is created, choose the link in the AWS Management Console to view the endpoint
details.
The endpoint Details tab shows the DNS hostnames that were generated while creating the Amazon VPC
endpoint.
You can use the standard endpoint (rds-data.region.amazonaws.com) or one of the VPC-specific
endpoints to call the Data API within the Amazon VPC. The standard Data API endpoint automatically
routes to the Amazon VPC endpoint. This routing occurs because the Private DNS hostname was enabled
when the Amazon VPC endpoint was created.
When you use an Amazon VPC endpoint in a Data API call, all traffic between your application and the
Data API remains in the Amazon VPCs that contain them. You can use an Amazon VPC endpoint for any
type of Data API call. For information about calling the Data API, see Calling the Data API (p. 145).
The Data API provides the following operations to execute SQL statements.
145
Amazon Aurora User Guide for Aurora
Using the Data API
ExecuteStatement
aws rds-data execute- Runs a SQL statement against a database.
statement
BatchExecuteStatement
aws rds-data batch- Runs a batch SQL statement over an array of data
execute-statement for bulk update and insert operations. You can run
a DML statement with array of parameter sets.
A batch SQL statement can provide a significant
performance improvement over individual insert
and update statements.
You can run both operations for executing a SQL statement independently, or you can run them in a
transaction. The Data API provides the following operations to support transactions.
BeginTransaction
aws rds-data begin- Starts a SQL transaction.
transaction
CommitTransaction
aws rds-data commit- Ends a SQL transaction and commits the changes.
transaction
RollbackTransaction
aws rds-data rollback- Performs a rollback of a transaction.
transaction
The operations for executing SQL statements and supporting transactions have the following common
Data API parameters and AWS CLI options. Some operations support other parameters or options.
You can use parameters in Data API calls to ExecuteStatement and BatchExecuteStatement, and
when you run the AWS CLI commands execute-statement and batch-execute-statement. To use
a parameter, you specify a name-value pair in the SqlParameter data type. You specify the value with
the Field data type. The following table maps Java Database Connectivity (JDBC) data types to the data
types you specify in Data API calls.
146
Amazon Aurora User Guide for Aurora
Using the Data API
DECIMAL STRING
CLOB STRING
For some specific types, such as DECIMAL or TIME, a hint might be required to instruct the Data API that
the String value should be passed to the database as a different type. You can do this by including
values in typeHint in the SqlParameter data type. The possible values for typeHint are the
following:
• DECIMAL – The corresponding String parameter value is sent as an object of DECIMAL type to the
database.
• TIMESTAMP – The corresponding String parameter value is sent as an object of TIMESTAMP type to
the database. The accepted format is YYYY-MM-DD HH:MM:SS[.FFF].
• TIME – The corresponding String parameter value is sent as an object of TIME type to the database.
The accepted format is HH:MM:SS[.FFF].
• DATE – The corresponding String parameter value is sent as an object of DATE type to the database.
The accepted format is YYYY-MM-DD.
Note
Currently, the Data API doesn't support arrays of Universal Unique Identifiers (UUIDs).
Examples
• Calling the Data API with the AWS CLI (p. 147)
• Calling the Data API from a Python Application (p. 154)
• Calling the Data API from a Java Application (p. 157)
Note
These examples are not exhaustive.
The following examples use the AWS CLI for the Data API. For more information, see AWS Command Line
Interface Reference for the Data API.
In each example, replace the DB cluster ARN with the ARN for your Aurora Serverless DB cluster. Also,
replace the secret ARN with the ARN of the secret in AWS Secrets Manager that allows access to the DB
cluster.
Note
The AWS CLI can format responses in JSON.
Topics
• Starting a SQL Transaction (p. 148)
• Running a SQL Statement (p. 148)
147
Amazon Aurora User Guide for Aurora
Using the Data API
You can start a SQL transaction using the aws rds-data begin-transaction CLI command. The call
returns a transaction identifier.
Important
A transaction times out if there are no calls that use its transaction ID in three minutes. If a
transaction times out before it's committed, it's rolled back automatically.
DDL statements inside a transaction cause an implicit commit. We recommend that you run each
DDL statement in a separate execute-statement command with the --continue-after-
timeout option.
For Windows:
{
"transactionId": "ABC1234567890xyz"
}
You can run a SQL statement using the aws rds-data execute-statement CLI command.
You can run the SQL statement in a transaction by specifying the transaction identifier with the --
transaction-id option. You can start a transaction using the aws rds-data begin-transaction
CLI command. You can end and commit a transaction using the aws rds-data commit-transaction
CLI command.
148
Amazon Aurora User Guide for Aurora
Using the Data API
Important
If you don't specify the --transaction-id option, changes that result from the call are
committed automatically.
For data definition language (DDL) statements, we recommend continuing to run the statement after
the call times out to avoid errors and the possibility of corrupted data structures.
For example, the following CLI command runs a single SQL statement and omits the metadata in the
results (the default).
For Windows:
{
"numberOfRecordsUpdated": 0,
"records": [
[
149
Amazon Aurora User Guide for Aurora
Using the Data API
{
"longValue": 1
},
{
"stringValue": "ValueOne"
}
],
[
{
"longValue": 2
},
{
"stringValue": "ValueTwo"
}
],
[
{
"longValue": 3
},
{
"stringValue": "ValueThree"
}
]
]
}
The following CLI command runs a single SQL statement in a transaction by specifying the --
transaction-id option.
For Windows:
{
"numberOfRecordsUpdated": 1
}
The following CLI command runs a single SQL statement with parameters.
150
Amazon Aurora User Guide for Aurora
Using the Data API
For Windows:
{
"numberOfRecordsUpdated": 1
}
The following CLI command runs a data definition language (DDL) SQL statement. The DDL statement
renames column job to column role.
Important
For DDL statements, we recommend continuing to run the statement after the call times out.
When a DDL statement terminates before it is finished running, it can result in errors and
possibly corrupted data structures. To continue running a statement after a call times out,
specify the --continue-after-timeout option.
For Windows:
151
Amazon Aurora User Guide for Aurora
Using the Data API
{
"generatedFields": [],
"numberOfRecordsUpdated": 0
}
Note
The generatedFields data isn't supported by Aurora PostgreSQL. To get the values of
generated fields, use the RETURNING clause. For more information, see Returning Data From
Modified Rows in the PostgreSQL documentation.
You can run a batch SQL statement over an array of data by using the aws rds-data batch-
execute-statement CLI command. You can use this command to perform a bulk import or update
operation.
You can run the SQL statement in a transaction by specifying the transaction identifier with the
--transaction-id option. You can start a transaction by using the aws rds-data begin-
transaction CLI command. You can end and commit a transaction by using the aws rds-data
commit-transaction CLI command.
Important
If you don't specify the --transaction-id option, changes that result from the call are
committed automatically.
For example, the following CLI command runs a batch SQL statement over an array of data with a
parameter set.
152
Amazon Aurora User Guide for Aurora
Using the Data API
For Windows:
Note
Don't include line breaks in the --parameter-sets option.
Using the aws rds-data commit-transaction CLI command, you can end a SQL transaction that
you started with aws rds-data begin-transaction and commit the changes.
• --transaction-id (required) – The identifier of a transaction that was started using the begin-
transaction CLI command. Specify the transaction ID of the transaction that you want to end and
commit.
For example, the following CLI command ends a SQL transaction and commits the changes.
For Windows:
{
"transactionStatus": "Transaction Committed"
}
153
Amazon Aurora User Guide for Aurora
Using the Data API
Using the aws rds-data rollback-transaction CLI command, you can roll back a SQL transaction
that you started with aws rds-data begin-transaction. Rolling back a transaction cancels its
changes.
Important
If the transaction ID has expired, the transaction was rolled back automatically. In this case, an
aws rds-data rollback-transaction command that specifies the expired transaction ID
returns an error.
• --transaction-id (required) – The identifier of a transaction that was started using the begin-
transaction CLI command. Specify the transaction ID of the transaction that you want to roll back.
For example, the following AWS CLI command rolls back a SQL transaction.
For Windows:
{
"transactionStatus": "Rollback Complete"
}
The following examples use the AWS SDK for Python (Boto). For more information about Boto, see the
AWS SDK for Python (Boto 3) Documentation.
In each example, replace the DB cluster's Amazon Resource Name (ARN) with the ARN for your Aurora
Serverless DB cluster. Also, replace the secret ARN with the ARN of the secret in AWS Secrets Manager
that allows access to the DB cluster.
Topics
154
Amazon Aurora User Guide for Aurora
Using the Data API
You can run a SELECT statement and fetch the results with a Python application.
import boto3
rdsData = boto3.client('rds-data')
cluster_arn = 'arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster'
secret_arn = 'arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret'
response1 = rdsData.execute_statement(
resourceArn = cluster_arn,
secretArn = secret_arn,
database = 'mydb',
sql = 'select * from employees limit 3')
print (response1['records'])
[
[
{
'longValue': 1
},
{
'stringValue': 'ROSALEZ'
},
{
'stringValue': 'ALEJANDRO'
},
{
'stringValue': '2016-02-15 04:34:33.0'
}
],
[
{
'longValue': 1
},
{
'stringValue': 'DOE'
},
{
'stringValue': 'JANE'
},
{
'stringValue': '2014-05-09 04:34:33.0'
}
],
[
{
'longValue': 1
},
{
'stringValue': 'STILES'
},
{
'stringValue': 'JOHN'
155
Amazon Aurora User Guide for Aurora
Using the Data API
},
{
'stringValue': '2017-09-20 04:34:33.0'
}
]
]
You can run a data manipulation language (DML) statement to insert, update, or delete data in your
database. You can also use parameters in DML statements.
Important
If a call isn't part of a transaction because it doesn't include the transactionID parameter,
changes that result from the call are committed automatically.
The following example runs an insert SQL statement and uses parameters.
import boto3
cluster_arn = 'arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster'
secret_arn = 'arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret'
rdsData = boto3.client('rds-data')
response2 = rdsData.execute_statement(resourceArn=cluster_arn,
secretArn=secret_arn,
database='mydb',
sql='insert into employees(first_name, last_name)
VALUES(:firstname, :lastname)',
parameters = paramSet)
print (response2["numberOfRecordsUpdated"])
You can start a SQL transaction, run one or more SQL statements, and then commit the changes with a
Python application.
Important
A transaction times out if there are no calls that use its transaction ID in three minutes. If a
transaction times out before it's committed, it's rolled back automatically.
If you don't specify a transaction ID, changes that result from the call are committed
automatically.
The following example runs a SQL transaction that inserts a row in a table.
import boto3
rdsData = boto3.client('rds-data')
cluster_arn = 'arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster'
secret_arn = 'arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret'
156
Amazon Aurora User Guide for Aurora
Using the Data API
tr = rdsData.begin_transaction(
resourceArn = cluster_arn,
secretArn = secret_arn,
database = 'mydb')
response3 = rdsData.execute_statement(
resourceArn = cluster_arn,
secretArn = secret_arn,
database = 'mydb',
sql = 'insert into employees(first_name, last_name) values('XIULAN', 'WANG')',
transactionId = tr['transactionId'])
cr = rdsData.commit_transaction(
resourceArn = cluster_arn,
secretArn = secret_arn,
transactionId = tr['transactionId'])
cr['transactionStatus']
'Transaction Committed'
response3['numberOfRecordsUpdated']
1
Note
If you run a data definition language (DDL) statement, we recommend continuing to run the
statement after the call times out. When a DDL statement terminates before it is finished
running, it can result in errors and possibly corrupted data structures. To continue running a
statement after a call times out, set the continueAfterTimeout parameter to true.
The following examples use the AWS SDK for Java. For more information, see the AWS SDK for Java
Developer Guide.
In each example, replace the DB cluster's Amazon Resource Name (ARN) with the ARN for your Aurora
Serverless DB cluster. Also, replace the secret ARN with the ARN of the secret in AWS Secrets Manager
that allows access to the DB cluster.
Topics
• Running a SQL Query (p. 157)
• Running a SQL Transaction (p. 158)
• Running a Batch SQL Operation (p. 159)
You can run a SELECT statement and fetch the results with a Java application.
package com.amazonaws.rdsdata.examples;
import com.amazonaws.services.rdsdata.AWSRDSData;
import com.amazonaws.services.rdsdata.AWSRDSDataClient;
import com.amazonaws.services.rdsdata.model.ExecuteStatementRequest;
import com.amazonaws.services.rdsdata.model.ExecuteStatementResult;
157
Amazon Aurora User Guide for Aurora
Using the Data API
import com.amazonaws.services.rdsdata.model.Field;
import java.util.List;
You can start a SQL transaction, run one or more SQL statements, and then commit the changes with a
Java application.
Important
A transaction times out if there are no calls that use its transaction ID in three minutes. If a
transaction times out before it's committed, it's rolled back automatically.
If you don't specify a transaction ID, changes that result from the call are committed
automatically.
package com.amazonaws.rdsdata.examples;
import com.amazonaws.services.rdsdata.AWSRDSData;
import com.amazonaws.services.rdsdata.AWSRDSDataClient;
import com.amazonaws.services.rdsdata.model.BeginTransactionRequest;
import com.amazonaws.services.rdsdata.model.BeginTransactionResult;
import com.amazonaws.services.rdsdata.model.CommitTransactionRequest;
import com.amazonaws.services.rdsdata.model.ExecuteStatementRequest;
158
Amazon Aurora User Guide for Aurora
Using the Data API
Note
If you run a data definition language (DDL) statement, we recommend continuing to run the
statement after the call times out. When a DDL statement terminates before it is finished
running, it can result in errors and possibly corrupted data structures. To continue running a
statement after a call times out, set the continueAfterTimeout parameter to true.
You can run bulk insert and update operations over an array of data with a Java application. You can run
a DML statement with array of parameter sets.
Important
If you don't specify a transaction ID, changes that result from the call are committed
automatically.
package com.amazonaws.rdsdata.examples;
import com.amazonaws.services.rdsdata.AWSRDSData;
import com.amazonaws.services.rdsdata.AWSRDSDataClient;
import com.amazonaws.services.rdsdata.model.BatchExecuteStatementRequest;
import com.amazonaws.services.rdsdata.model.Field;
import com.amazonaws.services.rdsdata.model.SqlParameter;
import java.util.Arrays;
159
Amazon Aurora User Guide for Aurora
Using the Data API
.withResourceArn(RESOURCE_ARN)
.withSecretArn(SECRET_ARN)
.withSql("INSERT INTO test_table2 VALUES (:string, :number)")
.withParameterSets(Arrays.asList(
Arrays.asList(
new SqlParameter().withName("string").withValue(new
Field().withStringValue("Hello")),
new SqlParameter().withName("number").withValue(new
Field().withLongValue(1L))
),
Arrays.asList(
new SqlParameter().withName("string").withValue(new
Field().withStringValue("World")),
new SqlParameter().withName("number").withValue(new
Field().withLongValue(2L))
)
));
rdsData.batchExecuteStatement(request);
}
}
You can download and use a Java client library for the Data API. The Java client library provides an
alternative way to use the Data API. Using this library, you can map your client-side classes to requests
and responses of the Data API. This mapping support can ease integration with some specific Java types,
such as Date, Time, and BigDecimal.
https://github.com/awslabs/rds-data-api-client-library-java
You can build the library manually from the source files, but the best practice is to consume the library
using Apache Maven dependency management. Add the following dependency to your Maven POM file:
<dependency>
<groupId>software.amazon.rdsdata</groupId>
<artifactId>rds-data-api-client-library-java</artifactId>
<version>1.0.1</version>
</dependency>
160
Amazon Aurora User Guide for Aurora
Using the Data API
String accountId;
double balance;
// getters and setters omitted
}
The client library enables you to pass DTOs as input parameters. The following example shows how
customer DTOs are mapped to input parameters sets.
In some cases, it's easier to work with simple values as input parameters. You can do so with the
following syntax.
The following is another example that works with simple values as input parameters.
The client library provides automatic mapping to DTOs when an execution result is returned. The
following examples show how the execution result is mapped to your DTOs.
Topics
• Transaction <transaction_ID> Is Not Found (p. 162)
161
Amazon Aurora User Guide for Aurora
Logging Data API Calls with AWS CloudTrail
To solve the issue, make sure that your call has a valid transaction ID. Also make sure that each
transaction call runs within three minutes of the last one.
For information about running transactions, see Calling the Data API (p. 145).
To solve this issue, make sure that each row in a result set is 64 KB or less.
To solve this issue, make sure that calls to the Data API return 1 MB of data or less. If you need to return
more than 1 MB, you can use multiple ExecuteStatement calls with the LIMIT clause in your query.
For more information about the LIMIT clause, see SELECT Syntax in the MySQL documentation.
• The Data API isn't enabled for the Aurora Serverless DB cluster. To use the Data API with an Aurora
Serverless DB cluster, the Data API must be enabled for the DB cluster.
• The DB cluster was renamed after the Data API was enabled for it.
If the Data API has not been enabled for the DB cluster, enable it.
If the DB cluster was renamed after the Data API was enabled for the DB cluster, disable the Data API
and then enable it again.
For information about enabling the Data API, see Enabling the Data API (p. 141).
162
Amazon Aurora User Guide for Aurora
Logging Data API Calls with AWS CloudTrail
calls from the Amazon RDS console and from code calls to the Data API operations. If you create a trail,
you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for
Data API. 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 a lot of information. This
information includes the request that was made to Data API, the IP address the request was made from,
who made the request, when it was made, and additional details.
To learn more about CloudTrail, see the AWS CloudTrail User Guide.
For an ongoing record of events in your AWS account, including events for Data API, 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 the AWS CloudTrail User Guide:
All Data API operations are logged by CloudTrail and documented in the Amazon RDS Data
Service API Reference. For example, calls to the BatchExecuteStatement, BeginTransaction,
CommitTransaction, and ExecuteStatement 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 ExecuteStatement
operation.
163
Amazon Aurora User Guide for Aurora
Using the Query Editor
{
"eventVersion": "1.05",
"userIdentity": {
"type": "IAMUser",
"principalId": "AKIAIOSFODNN7EXAMPLE",
"arn": "arn:aws:iam::123456789012:user/johndoe",
"accountId": "123456789012",
"accessKeyId": "AKIAI44QH8DHBEXAMPLE",
"userName": "johndoe"
},
"eventTime": "2019-12-18T00:49:34Z",
"eventSource": "rdsdata.amazonaws.com",
"eventName": "ExecuteStatement",
"awsRegion": "us-east-1",
"sourceIPAddress": "192.0.2.0",
"userAgent": "aws-cli/1.16.102 Python/3.7.2 Windows/10 botocore/1.12.92",
"requestParameters": {
"continueAfterTimeout": false,
"database": "**********",
"includeResultMetadata": false,
"parameters": [],
"resourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:my-database-1",
"schema": "**********",
"secretArn": "arn:aws:secretsmanager:us-east-1:123456789012:secret:dataapisecret-
ABC123",
"sql": "**********"
},
"responseElements": null,
"requestID": "6ba9a36e-b3aa-4ca8-9a2e-15a9eada988e",
"eventID": "a2c7a357-ee8e-4755-a0d0-aed11ed4253a",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012"
}
The query editor requires an Aurora Serverless DB cluster with the Data API enabled. For information
about creating an Aurora Serverless DB cluster with the Data API enabled, see Using the Data API for
Aurora Serverless (p. 140).
You can also create an IAM policy that grants access to the query editor. After you create the policy, add
it to each user that requires access to the query editor.
The following policy provides the minimum required permissions for a user to access the query editor.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "QueryEditor0",
164
Amazon Aurora User Guide for Aurora
Using the Query Editor
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:PutResourcePolicy",
"secretsmanager:PutSecretValue",
"secretsmanager:DeleteSecret",
"secretsmanager:DescribeSecret",
"secretsmanager:TagResource"
],
"Resource": "arn:aws:secretsmanager:*:*:secret:rds-db-credentials/*"
},
{
"Sid": "QueryEditor1",
"Effect": "Allow",
"Action": [
"secretsmanager:GetRandomPassword",
"tag:GetResources",
"secretsmanager:CreateSecret",
"secretsmanager:ListSecrets",
"dbqms:CreateFavoriteQuery",
"dbqms:DescribeFavoriteQueries",
"dbqms:UpdateFavoriteQuery",
"dbqms:DeleteFavoriteQueries",
"dbqms:GetQueryString",
"dbqms:CreateQueryHistory",
"dbqms:UpdateQueryHistory",
"dbqms:DeleteQueryHistory",
"dbqms:DescribeQueryHistory",
"rds-data:BatchExecuteStatement",
"rds-data:BeginTransaction",
"rds-data:CommitTransaction",
"rds-data:ExecuteStatement",
"rds-data:RollbackTransaction"
],
"Resource": "*"
}
]
}
For information about creating an IAM policy, see Creating IAM Policies in the AWS Identity and Access
Management User Guide.
For information about adding an IAM policy to a user, see Adding and Removing IAM Identity Permissions
in the AWS Identity and Access Management User 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 upper-right corner of the AWS Management Console, choose the AWS Region in which you
created the Aurora Serverless DB clusters that you want to query.
3. In the navigation pane, choose Databases.
4. Choose the Aurora Serverless DB cluster that you want to run SQL queries against.
5. For Actions, choose Query. If you haven't connected to the database before, the Connect to
database page opens.
165
Amazon Aurora User Guide for Aurora
Using the Query Editor
a. For Database instance or cluster, choose the Aurora Serverless DB cluster that you want to run
SQL queries on.
b. For Database username, choose the user name of the database user to connect with, or choose
Add new database credentials. If you choose Add new database credentials, enter the user
name for the new database credentials in Enter database username.
c. For Enter database password, enter the password for the database user that you chose.
d. In the last box, enter the name of the database or schema that you want to use for the Aurora
DB cluster.
e. Choose Connect to database.
Note
If your connection is successful, your connection and authentication information are
stored in AWS Secrets Manager. You don't need to enter the connection information
again.
7. In the query editor, enter the SQL query that you want to run on the database.
166
Amazon Aurora User Guide for Aurora
Using the Query Editor
Each SQL statement can commit automatically, or you can run SQL statements in a script as part of
a transaction. To control this behavior, choose the gear icon above the query window.
167
Amazon Aurora User Guide for Aurora
Using the Query Editor
If you choose Auto-commit, every SQL statement commits automatically. If you choose Transaction,
you can run a group of statements in a script, and they don't commit automatically. If Transaction
is set, the statements in the group are committed when choose Run. Also, you can choose to stop a
running script if an error occurs by enabling Stop on error.
Note
In a group of statements, data definition language (DDL) statements can cause previous
data manipulation language (DML) statements to commit. You can also include COMMIT and
ROLLBACK statements in a group of statements in a script.
After you make your choices in the Query Editor Settings window, choose Save.
8. Choose Run or press Ctrl+Enter, and the query editor displays the results of your query.
You can find, edit, and rerun previous queries. To do so, choose the Recent tab or the Saved queries tab,
choose the query text, and then choose Run.
168
Amazon Aurora User Guide for Aurora
Connecting to a DB Cluster
In the connection string, you typically use the host and port information from special endpoints
associated with the DB cluster. With these endpoints, you can use the same connection parameters
regardless of how many DB instances are in the cluster.
For specialized tasks such as troubleshooting, you can use the host and port information from a specific
DB instance in your Aurora DB cluster.
Topics
• Connecting to an Amazon Aurora MySQL DB Cluster (p. 169)
• Connecting to an Amazon Aurora PostgreSQL DB Cluster (p. 172)
• Troubleshooting Aurora Connection Failures (p. 174)
• Managing Connections with Amazon RDS Proxy (Preview) (p. 175)
When you have a connection to your Amazon Aurora DB cluster with MySQL 5.6 compatibility, you can
execute SQL commands that are compatible with MySQL version 5.6. For more information about MySQL
5.6 SQL syntax, see the MySQL 5.6 Reference Manual.
When you have a connection to your Amazon Aurora DB cluster with MySQL 5.7 compatibility, you can
execute SQL commands that are compatible with MySQL version 5.7. For more information about MySQL
5.7 SQL syntax, see the MySQL 5.7 Reference Manual. For information about limitations that apply to
Aurora MySQL 5.7, see Comparison of Aurora MySQL 5.7 and MySQL 5.7 (p. 507).
Note
For a helpful and detailed guide on connecting to an Amazon Aurora MySQL DB cluster, you can
see the Aurora Connection Management handbook.
In the details view for your DB cluster, you can find the cluster endpoint, which you can use in
your MySQL connection string. The endpoint is made up of the domain name and port for your
DB cluster. For example, if an endpoint value is mycluster.cluster-123456789012.us-
east-1.rds.amazonaws.com:3306, then you specify the following values in a MySQL connection
string:
The cluster endpoint connects you to the primary instance for the DB cluster. You can perform both read
and write operations using the cluster endpoint. Your DB cluster can also have up to 15 Aurora Replicas
169
Amazon Aurora User Guide for Aurora
Connecting to Aurora MySQL
that support read-only access to the data in your DB cluster. The primary instance and each Aurora
Replica has a unique endpoint that is independent of the cluster endpoint and allows you to connect to a
specific DB instance in the cluster directly. The cluster endpoint always points to the primary instance. If
the primary instance fails and is replaced, then the cluster endpoint points to the new primary instance.
Note
If the cluster is an Aurora Serverless DB cluster, you can only connect to its database endpoint.
For more information, see Using Amazon Aurora Serverless (p. 117).
To view the cluster endpoint (writer endpoint), choose Databases on the Amazon RDS console and
choose the name of the DB cluster to show the DB cluster details.
• Command line – You can connect to an Amazon Aurora DB cluster by using tools like the MySQL
command line utility. For more information on using the MySQL utility, see mysql - The MySQL
Command Line Tool in the MySQL documentation.
170
Amazon Aurora User Guide for Aurora
Connecting to Aurora MySQL
• GUI – You can use the MySQL Workbench utility to connect by using a UI interface. For more
information, see the Download MySQL Workbench page.
• Applications – You can use the MariaDB Connector/J utility to connect your applications to your
Aurora DB cluster. For more information, see the MariaDB Connector/J download page.
Note
If you use the MariaDB Connector/J utility with an Aurora Serverless cluster, use the prefix
jdbc:mariadb:aurora// in your connection string. The mariadb:aurora parameter
avoids the automatic DNS scan for failover targets. That scanning is not needed with Aurora
Serverless clusters and causes a delay in establishing the connection.
You can use SSL encryption on connections to an Amazon Aurora DB instance. For information, see Using
SSL with a MySQL DB Instance.
Note
Because you can create Amazon Aurora DB cluster only in an Amazon Virtual Private Cloud
(VPC), connections to an Amazon Aurora DB cluster from AWS instances that are not in a
VPC have been required to use the public endpoint address of the Amazon Aurora DB cluster.
However, you can now communicate with an Amazon EC2 instance that is not in a VPC and an
Amazon Aurora DB cluster using ClassicLink. For more information, see A DB Instance in a VPC
Accessed by an EC2 Instance Not in a VPC (p. 1076).
1. Download the public key for the Amazon RDS signing certificate.
For information about downloading certificates, see Using SSL/TLS to Encrypt a Connection to a DB
Cluster (p. 1005).
2. Type the following command at a command prompt to connect to the primary instance of a DB
cluster with SSL using the MySQL utility. For the -h parameter, substitute the endpoint DNS name
for your primary instance. For the --ssl_ca parameter, substitute the SSL certificate file name as
appropriate. Type the master user password when prompted.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
171
Amazon Aurora User Guide for Aurora
Connecting to Aurora PostgreSQL
For general instructions on constructing Amazon RDS MySQL connection strings and finding the public
key for SSL connections, see Connecting to a DB Instance Running the MySQL Database Engine.
When you have a connection to a DB instance in your Amazon Aurora PostgreSQL DB cluster, you can run
any SQL command that is compatible with PostgreSQL version 9.6.3.
In the details view for your Aurora PostgreSQL DB cluster you can find the cluster endpoint. You use this
endpoint in your PostgreSQL connection string. The endpoint is made up of the domain name and port
for your DB cluster. For example, if an endpoint value is mycluster.cluster-123456789012.us-
east-1.rds.amazonaws.com:5432, then you specify the following values in a PostgreSQL connection
string:
The cluster endpoint connects you to the primary instance for the DB cluster. You can perform both read
and write operations using the cluster endpoint. Your DB cluster can also have up to 15 Aurora Replicas
that support read-only access to the data in your DB cluster. Each DB instance in the Aurora cluster
(that is, the primary instance and each Aurora Replica) has a unique endpoint that is independent of
the cluster endpoint. This unique endpoint allows you to connect to a specific DB instance in the cluster
directly. The cluster endpoint always points to the primary instance. If the primary instance fails and is
replaced, the cluster endpoint points to the new primary instance.
To view the cluster endpoint (writer endpoint), choose Databases on the Amazon RDS console and
choose the name of the DB cluster to show the DB cluster details.
172
Amazon Aurora User Guide for Aurora
Connecting to Aurora PostgreSQL
• Command line – You can connect to an Amazon Aurora PostgreSQL DB instance by using tools like
psql, the PostgreSQL interactive terminal. For more information on using the PostgreSQL interactive
terminal, see psql in the PostgreSQL documentation.
• GUI – You can use the pgAdmin utility to connect to a PostgreSQL DB instance by using a UI interface.
For more information, see the Download page from the pgAdmin website.
• Applications – You can use the PostgreSQL JDBC driver to connect your applications to your
PostgreSQL DB instance. For more information, see the Download page from the PostgreSQL JDBC
driver website.
Note
Because you can create an Amazon Aurora PostgreSQL DB cluster only in an Amazon Virtual
Private Cloud (VPC), connections to an Aurora PostgreSQL DB cluster from AWS instances
that are not in a VPC have been required to use the public endpoint address of the Aurora
PostgreSQL DB cluster. However, you can now communicate with an Amazon EC2 instance that
173
Amazon Aurora User Guide for Aurora
Troubleshooting Connections
is not in a VPC and an Aurora PostgreSQL DB cluster using ClassicLink. For more information,
see A DB Instance in a VPC Accessed by an EC2 Instance Not in a VPC (p. 1076).
• The DB cluster was created using a VPC that does not allow connections from your device. To fix this
failure, modify the VPC to allow connections from your device, or create a new VPC for your DB cluster
that allows connections from your device. For an example, see Create a VPC and Subnets (p. 1067).
• The DB cluster was created using the default port, 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.
• If you are using IAM database authentication, you might need to configure IAM database
authentication. For information, see IAM Database Authentication (p. 1035).
Note
For a helpful and detailed guide on connecting to an Amazon Aurora MySQL DB cluster, you can
see the Aurora Connection Management handbook.
174
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
By using Amazon RDS Proxy, you can allow your applications to pool and share database connections to
improve scalability. RDS Proxy makes applications more resilient to database failures by automatically
connecting to a standby DB instance while preserving application connections. RDS Proxy also enables
you to enforce AWS Identity and Access Management (IAM) authentication for databases, and securely
store credentials in AWS Secrets Manager.
Note
RDS Proxy is fully compatible with MySQL and PostgreSQL. You can enable RDS Proxy for most
applications with no code changes.
Using RDS Proxy, you can handle unpredictable surges in database traffic that otherwise could 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 sequences 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 (sheds load). At the same time, it maintains predictable
performance for the load that can be served with 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.
Important
Currently, Amazon RDS Proxy is in preview. Don't use RDS Proxy for production workloads. Also,
we strongly recommend not putting sensitive data in databases that you use with RDS Proxy
preview. You might encounter issues during the preview that cause incorrect results, corrupted
data, or both. Over the duration of the preview, we might introduce breaking changes without
advance notice. These might include upgrades and changes to our API operations.
Topics
• RDS Proxy Concepts and Terminology (p. 175)
• Planning for and Setting Up RDS Proxy (p. 179)
• Connecting to a Database through RDS Proxy (p. 187)
• Managing RDS Proxy (p. 188)
• Monitoring RDS Proxy Using Amazon CloudWatch (p. 196)
• Command-Line Examples for RDS Proxy (p. 199)
• Troubleshooting for RDS Proxy (p. 201)
175
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
You can simplify connection management for your Amazon RDS DB instances and Aurora DB clusters by
using 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 independent of the database servers for the 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.
Topics
• Overview of RDS Proxy Terminology (p. 176)
• Connection Pooling (p. 177)
• RDS Proxy Security (p. 177)
• Failover (p. 178)
• Transactions (p. 179)
Each proxy handles connections to a single RDS DB instance or Aurora DB cluster. The proxy determines
the current writer instance for RDS multi-AZ DB instances and Aurora provisioned clusters.
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. In some cases, RDS Proxy can't be sure that it's safe to run different
transactions from a session using different connections. In these cases, it keeps the session on the same
connection until the session ends. This fallback behavior is called pinning.
A proxy has an 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 example,
you can still connect to the cluster endpoint for read-write connections without connection pooling. You
can still connect to the reader endpoint for load-balanced read-only connections. You can still connect
to the instance endpoints for diagnosis and troubleshooting of specific DB instances within an Aurora
cluster. If you are using other AWS services such as AWS Lambda to connect to RDS databases, you
change their connection settings to use the proxy endpoint. For example, you specify the proxy endpoint
to allow Lambda functions to access your database while taking advantage of RDS Proxy functionality.
Each proxy contains a target group. This target group embodies the RDS DB instance or Aurora DB cluster
that the proxy can connect to. For an Aurora cluster, by default the target group is associated with all
the DB instances in that cluster. That way, the proxy can connect to whichever Aurora DB instance is
promoted to be the writer instance in the cluster. The RDS DB instance associated with a proxy, or the
Aurora DB cluster and its instances, are referred to as the targets of that proxy. For convenience, when
you create a proxy through the AWS Management Console, RDS Proxy also creates the corresponding
target group and registers the associated targets automatically.
176
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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. For a global database, you can create a proxy for the
primary AWS Region, but not for a read-only secondary AWS Region.
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
only supports 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/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 still use native password
authentication. These security features are a preferable alternative to embedding database credentials in
your application code.
RDS Proxy can 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 with the --ssl-mode parameter.
SSL session variables are not set for SSL connections to a RDS Proxy database.
RDS Proxy supports TLS protocol version 1.0, 1.1, and 1.2. However, you don't need to configure RDS
Proxy database for TLS. In particular, don't use the REQUIRE clause on your database user privileges for
SSL. Doing so prevents that user from connecting.
177
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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 could also be part of normal maintenance procedures, such as during a database upgrade.
Failover applies to RDS DB instances in a multi-AZ configuration, and Aurora DB clusters with one or
more reader instances in addition to the writer instance.
Connecting through a proxy makes your application more resilient to database failovers. When the
original DB instance becomes unavailable, RDS Proxy connects to the standby database without dropping
idle application connections. Doing so helps to speed up and simplify the failover process. The result is
faster failover that's less disruptive to your application than a typical reboot or database problem.
Without RDS Proxy, a failover involves a brief outage. During the outage, you can't perform write
operations on that database. Any existing database connections are disrupted and your application must
reopen them. The database becomes available for new connections and write operations when a read-
only DB instance is promoted to take the place of the one that's unavailable.
During DB failovers, RDS Proxy continues to accept connections at the same IP address and automatically
directs connections to the new master. Clients connecting through RDS Proxy are not susceptible to the
following:
178
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
• Waiting for a query response from a former writer that became unavailable without closing
connections.
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 cancelled. 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 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. 194).
In the following sections, you can find how to set up RDS Proxy. You can also find how to set the related
security options that control who can access each proxy and how each proxy connects to DB instances.
Topics
• Limitations for RDS Proxy (p. 180)
• Identifying DB Instances, Clusters, and Applications to Use with RDS Proxy (p. 180)
• Setting Up Network Prerequisites (p. 181)
• Setting Up Database Credentials in AWS Secrets Manager (p. 181)
• Setting Up AWS Identity and Access Management (IAM) Policies (p. 182)
179
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
The following limitations apply to RDS Proxy during the public preview:
• The public preview is available only in these AWS Regions: US East (N. Virginia), US East (Ohio), US
West (Oregon), Asia Pacific (Tokyo), and Europe (Ireland).
• You can have up to 20 proxies for each AWS account ID.
• In an Aurora cluster, all of the connections in the connection pool are handled by the Aurora writer
instance. To perform load balancing for read-intensive workloads, you still use the reader endpoint
directly for the Aurora cluster.
• You can't use RDS Proxy with Aurora Serverless clusters.
• You can't use RDS Proxy with Aurora multi-master clusters.
• Your RDS Proxy must be in the same VPC as the database. The proxy can't be publicly accessible,
although the database can be.
• RDS Proxy is available for the MySQL and PostgreSQL engine families.
• The MySQL engine family includes RDS MySQL 5.6 and 5.7, and Aurora MySQL versions 1 and 2.
• Currently, all proxies listen on port 3306 for MySQL.
• Within the MySQL engine family, currently RDS Proxy supports Aurora provisioned clusters, Aurora
parallel query clusters, and Aurora Global Databases.
• You can't use RDS Proxy with RDS 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.
• Not all logic is implemented to pin sessions to database connections based on SQL statements and
functions. For the most current pinning behavior, see Avoiding Pinning (p. 194).
• The Aurora with PostgreSQL compatibility engine family includes version 10.11 and 11.5.
• 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.
180
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
• Any DB instance or cluster that ever 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. 196).
• 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.
• 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.
In Secrets Manager, you create these secrets with 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.
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. If you choose Credentials for other database, that option prompts
you for the user name and password, but not the other connection details, which you specify in the
settings for the proxy itself. If you choose Other type of secrets, you create the secret with keys named
username and password.
181
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
Because the secrets 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.
If a password associated with a secret is incorrect, you can update the associated secret in Secrets
Manager. For example, you might update the secret if the password for the database account changes.
Until you update the secret, you can't connect through the proxy to that database account. You can still
connect to other accounts where the passwords match the credentials stored in the secrets.
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 instructions about creating secrets in
Secrets Manager, see Creating a Secret in the AWS Secrets Manager User Guide. 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.
• Follow the Create Role process. Include the Add Role to Database step.
• For the new role, perform the Add inline policy step. Paste the following JSON, substituting the
Amazon Resource Name (ARN) for the secret that you created.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"secretsmanager:GetRandomPassword",
"secretsmanager:CreateSecret",
"secretsmanager:ListSecrets"
],
"Resource": "*"
182
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "secretsmanager:*",
"Resource": [
"your_secret_ARN"
]
}
]
}
• Optionally, edit the trust policy for this IAM policy. Paste the following JSON.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "rds.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"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 Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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. For the public preview, some choices are restricted or
required. Consider the following guidance:
Proxy configuration:
• 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 1800 seconds (30 minutes). A client connection is considered
idle when the application doesn't submit a new request within the specified time after the
previous request completed. The underlying database connection stays open and is returned to
the connection pool. Thus, it's available to be reused for new client connections.
Consider lowering the idle client connection timeout if you want the proxy to proactively remove
stale connections. If your workload is spiking, consider raising the idle client connection timeout to
save the cost of establishing connections.
• Database. Choose one RDS DB instance or Aurora DB cluster to access through this proxy. The list
only includes DB instances and clusters with compatible database engines, engine versions, and
other settings. If the list is empty, create a new DB instance or cluster that's compatible with RDS
Proxy. Then try creating the proxy again.
• Connection pool maximum connections. Specify a value between 1 and 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 it
to 100. For details about how RDS Proxy uses this setting, see Controlling Connection Limits and
Timeouts (p. 194).
• Session pinning filters. 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 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. 194).
• Connection borrow timeout. In some cases, you might expect the proxy to sometimes use up all
available connections. In such cases, you can specify how long the proxy waits for a connection to
become available before returning a timeout error. This setting only applies when the proxy has
the maximum number of connections open and all connections are already in use.
Connectivity:
• Secrets Manager ARNs. Choose at least one Secrets Manager secret associated with the RDS DB
instance or Aurora DB cluster that you intend to access with this proxy.
184
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
• IAM role. Choose an IAM role that has permission to access the Secrets Manager secrets 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.
• 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.
Advanced configuration:
• Enable enhanced logging. You can enable this setting to troubleshoot proxy compatibility or
performance issues. When this setting is enabled, RDS Proxy includes detailed information about
SQL statements in its logs. This information helps you to debug issues involving SQL behavior or
the performance and scalability of the proxy connections. The debug information includes the text
of SQL statements that you submit through the proxy. Thus, only enable this setting when needed
for debugging, and only when you have security measures in place to safeguard any sensitive
information that appears in the logs.
5. Select RDS Proxy is now available in Preview to acknowledge the terms and conditions for the
preview.
6. Choose Create Proxy.
AWS CLI
To create a proxy, use the AWS CLI command create-db-proxy. Note the --engine-family value is
case sensitive.
Example
For Windows:
185
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
[--auth ProxyAuthenticationConfig_JSON_string] ^
[--require-tls | --no-require-tls] ^
[--idle-client-timeout value] ^
[--debug-logging | --no-debug-logging] ^
[--tags comma_separated_list]
To create the required information and associations for the proxy, you also use the create-db-proxy-
target-group and register-db-proxy-targets commands:
RDS API
To create an RDS Proxy, you call the Amazon RDS API function CreateDBProxy. You pass a parameter
with the AuthConfig data structure.
You also create the associated target group by calling the function CreateDBProxyTargetGroup. Then
you associate an RDS DB instance or Aurora DB cluster with the target group by calling the function
RegisterDBProxyTargets.
In particular, you need the endpoint for the proxy to use in the connection string for any database
applications that use the 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 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.
186
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
CLI
To view your RDS 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 these commands:
Use the following sequence of commands to see more detail about the things that are associated with
the proxy:
RDS API
To view your proxies using the RDS API, use the DescribeDBProxies operation. It returns values of the
DBProxy data type.
You can use the proxy identifiers from the return value to see details of the connection settings
for the proxy by using the DescribeDBProxyTargetGroups operation. It returns values of the
DBProxyTargetGroup data type.
You can see the RDS instance or Aurora DB cluster associated with the proxy by using the
DescribeDBProxyTargets operation. It returns values of the DBProxyTarget data type.
You connect to an RDS DB instance or Aurora DB cluster through a proxy in generally the same way as
you connect directly to the database. The main difference is that you specify the proxy endpoint instead
of the instance or cluster endpoint.
For an Aurora DB cluster, all proxy connections have read-write capability and use the writer instance. If
you use the reader endpoint for read-only connections, you continue using the reader endpoint the same
way.
For PostgreSQL, if you use JDBC we recommend that you set the connection parameter
assumeMinServerVersion to at least 9.0 to avoid pinning. See also Avoiding Pinning (p. 194).
Topics
• Connecting to a Proxy Using Native Authentication (p. 188)
• Connecting to a Proxy Using IAM Authentication (p. 188)
187
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
• 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:
• 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.
• Supply the same database user name and password as you normally do.
You can grant a specific user access to the proxy by modifying the IAM policy. For example:
"Resource": "arn:aws:rds-db:us-east-2:1234567890:dbuser:db-ABCDEFGHIJKL01234/db_user”
The following explain aspects of RDS Proxy operation and configuration that help your application to
make the most efficient use of database connections and achieve maximum connection reuse. The more
you can take advantage of connection reuse, the more CPU and memory overhead you can save. This in
turn reduces latency for your application and enables the database to devote more of its resources to
processing application requests.
Topics
• Deleting an RDS Proxy (p. 189)
188
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
189
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
If you didn't find the settings you intended to change, continue with the following procedure to
update the target group for the proxy. Each proxy has one associated target group, which is created
automatically along with the proxy.
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:
190
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
The following example shows how to first check the MaxConnectionsPercent 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
}
]
}
{
"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
}
}
191
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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 would have 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"
}
]
}
{
"Targets": []
}
{
"DBProxyTargets": [
{
192
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
"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.
• Create a new Secrets Manager secret, using the procedure described in Setting Up Database
Credentials in AWS Secrets Manager (p. 181).
• 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.
193
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
The proxy setting for maximum connections represents a percentage of the max_connections value. 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 less
than 75% 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. This setting enables you to limit the wait period that is most suitable 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.
194
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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. 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 using the following techniques:
You can work with the initialization query through the AWS CLI and RDS API. Currently, you can't set
this property through the AWS Management Console. For PostgreSQL, the initialization query is not
currently implemented.
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 4 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.
• 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.
195
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
The behavior might be different 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 your that 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.
If you have expert knowledge about your application behavior, you can choose to skip the pinning
behavior for certain application statements. You do so by choosing the Session pinning filters option
when creating the proxy. Currently, you can opt out of session pinning for the following kinds of
application statements:
To see metrics about how often pinning occurs for a proxy, see Monitoring RDS Proxy Using Amazon
CloudWatch (p. 196).
You can monitor RDS Proxy using Amazon CloudWatch. CloudWatch collects and processes raw data
from the proxies into readable, near real-time metrics. To find these metrics in the CloudWatch console,
choose Metrics, then choose RDS, and choose Per-Proxy Metrics.
Note
RDS publishes these metrics for each underlying EC2 instance associated with the proxy. A single
proxy might be served by more than one EC2 instance. Use CloudWatch statistics to aggregate
the values for a proxy across all the associated instances.
Some of these metrics might not be visible until after the first successful connection by a proxy.
All RDS Proxy metrics are in the group proxy, with a dimension of ProxyName.
196
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
197
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
1 minute
DatabaseConnectionsCurrentlySessionPinned The current number of
database connections
currently pinned
due to session state-
altering operations
in client requests.
This is reported every
minute. The most
useful statistic for this
metric is Sum.
1 minute
DatabaseConnectionsCurrentlyInTransaction The current number of
database connections
in transaction. This
is reported every
minute. The most
useful statistic for this
metric is Sum.
198
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
To see how combinations of connection commands and SQL statements interact with RDS Proxy, look at
the following examples.
Examples
This MySQL example demonstrates how open connections continue working during a failover, for
example when you reboot a database or it becomes unavailable due to a problem. This example
uses a proxy named the-proxy and an Aurora DB cluster with DB instances instance-8898 and
instance-9814. When you run the failover-db-cluster command from the Linux command line,
the writer instance that the proxy is connected to changes to a different DB instance. You can see that
the DB instance associated with the proxy changes while the connection remains open.
mysql>
[1]+ Stopped mysql -h the-proxy.proxy-demo.us-east-1.rds.amazonaws.com -
u admin_user -p
$ # Initially, instance-9814 is the writer.
$ aws rds failover-db-cluster --db-cluster-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
199
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
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
export REGION=us-east-1
export CLUSTER_PARAM_GROUP=rds-proxy-mysql-56-max-connections-demo
export CLUSTER_NAME=rds-proxy-mysql-56
200
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
Topics
• Common Issues and Solutions (p. 201)
• CloudWatch Logs (p. 203)
• Verifying Connectivity to a Proxy (p. 203)
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
201
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
ERROR 1040 The number of simultaneous connection requests from the client to the
(HY000): Number proxy exceeded the limit.
simultaneous
connections
exceeded (*limit
value*)
ERROR 1231 The value set for the character_set_client parameter is not valid. For
(42000): Variable example, the value ucs2 is not valid because it can crash the MySQL server.
''character_set_client''
can't be set
to the value of
*value*
ERROR 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 setting The user needs to do either of
TLS connections. “Require Transport Layer the following:
202
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
IAM authentication This error could be due to the To fix this error, do the
failed for user following reasons: following:
username. Check the IAM
token for this user and • The client supplied the 1. Confirm that the provided
try again. incorrect IAM username. IAM user exists.
• The client supplied an 2. Confirm that the IAM
incorrect IAM authorization authorization token belongs
token for the user to the provided IAM user.
• The client is using an IAM 3. Confirm that the IAM policy
policy that does not have the has adequate permissions for
necessary permissions. RDS.
• The client supplied an expired 4. Check the validity of the IAM
IAM authorization token for authorization token used.
the user.
CloudWatch Logs
You can find logs of RDS Proxy activity under CloudWatch in the AWS Management Console. Each proxy
has an entry in the Log groups page.
Important
These logs are intended for human consumption for troubleshooting purposes and not for
programmatic access. The format and content of the logs is subject to change (especially during
preview).
Examine the proxy itself using the describe-db-proxies command. Also examine the associated
target groups and the targets specified in the target groups using the describe-db-proxy-target-
groups and describe-db-proxy-targets commands. Check that the details of the targets match
the RDS DB instance or Aurora DB cluster that you intend to associate with the proxy.
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.
203
Amazon Aurora User Guide for Aurora
Managing Connections with RDS Proxy (Preview)
You can use the following commands to make sure that your EC2 instance has the required properties. In
particular, the VPC for the EC2 instance must be the same as the VPC for the RDS DB instance or Aurora
DB cluster that the proxy connects to.
Make sure that the SecretString field displayed by get-secret-value is encoded as a JSON
string that includes username and password fields. The following example shows the format of the
SecretString field.
{
"ARN": "some_arn",
"Name": "some_name",
"VersionId": "some_version_id",
"SecretString": '{"username":"some_username","password":"some_password"}',
"VersionStages": [ "some_stage" ],
"CreatedDate": some_timestamp
}
Examine the RDS DB instance or Aurora DB cluster that you associated with the proxy. For an Aurora
DB cluster, also examine each of the DB instances in the cluster. Make sure that their properties match
what's expected for the proxy, such as the port being 3306 for MySQL and 5432 for PostgreSQL.
204
Amazon Aurora User Guide for Aurora
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. DB parameter groups apply to DB instances in both Amazon RDS and Aurora. These
configuration settings apply to properties that can vary among the DB instances within an Aurora cluster,
such as the sizes for memory buffers.
A DB cluster parameter group acts as a container for engine configuration values that are applied
to every DB instance in an Aurora DB cluster. For example, the Aurora shared storage model
requires that every DB instance in an Aurora cluster use the same setting for parameters such as
innodb_file_per_table. Thus, parameters that affect the physical storage layout are part of
the cluster parameter group. The DB cluster parameter group also includes default values for all the
instance-level parameters
If you create a DB instance without specifying a DB parameter group, the DB instance uses a default DB
parameter group. Likewise, if you create an Aurora DB cluster without specifying a DB cluster parameter
group, the DB cluster uses a default DB cluster parameter group. Each default 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 or DB cluster 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. Likewise, if you update parameters within a DB cluster
parameter group, the changes apply to all Aurora clusters that are associated with that DB cluster
parameter group.
You can copy an existing DB parameter group with the AWS CLI copy-db-parameter-group command.
You can copy an existing DB cluster parameter group with the AWS CLI copy-db-cluster-parameter-group
command. Copying a parameter group can be convenient when you want to include most of an existing
parameter group's custom parameters and values in a new parameter group.
Here are some important points about working with parameters in a parameter group:
• When you change a dynamic parameter and save the 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 or by explicitly calling the
RebootDbInstance API operation (without failover, if the DB instance is in a Multi-AZ deployment).
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 new DB parameter group is used by the DB instance.
205
Amazon Aurora User Guide for Aurora
Working with Parameter Groups
Note
Reboot isn't required when you change the DB cluster parameter group associated with a DB
cluster.
• You can specify the value for a 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 DB Parameter Values (p. 222).
• 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.
You can change character set or collation values for an existing database using the ALTER DATABASE
command, for example:
• Improperly setting parameters in a 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 parameter group. Try out parameter group
setting changes on a test DB instance before applying those parameter group changes to a production
DB instance.
• For an Aurora global database, you can specify different configuration settings for the individual
Aurora clusters. Make sure that the settings are similar enough to produce consistent behavior if you
promote a secondary cluster to be the primary cluster. For example, use the same settings for time
zones and character sets across all the clusters of an Aurora global database.
• To determine the supported parameters for your DB engine, you can view the parameters in the DB
parameter group and DB cluster parameter group used by the DB cluster. For more information, see
Viewing Parameter Values for a DB Parameter Group (p. 219) and Viewing Parameter Values for a DB
Cluster Parameter Group (p. 220).
Topics
• Amazon Aurora DB Cluster and DB Instance Parameters (p. 207)
• Creating a DB Parameter Group (p. 208)
• Creating a DB Cluster Parameter Group (p. 209)
• Modifying Parameters in a DB Parameter Group (p. 210)
• Modifying Parameters in a DB Cluster Parameter Group (p. 213)
• Copying a DB Parameter Group (p. 215)
• Copying a DB Cluster Parameter Group (p. 216)
• Listing DB Parameter Groups (p. 217)
• Listing DB Cluster Parameter Groups (p. 218)
• Viewing Parameter Values for a DB Parameter Group (p. 219)
• Viewing Parameter Values for a DB Cluster Parameter Group (p. 220)
• Comparing Parameter Groups (p. 222)
• DB Parameter Values (p. 222)
206
Amazon Aurora User Guide for Aurora
DB Cluster and DB Instance Parameters
• Parameters in a DB cluster parameter group apply to every DB instance in a DB cluster. Your data is
stored in the Aurora shared storage subsystem. Because of this, all parameters related to physical
layout of table data must be the same for all DB instances in an Aurora cluster. Likewise, because
Aurora DB instances are connected by replication, all the parameters for replication settings must be
identical throughout an Aurora cluster.
• Parameters in a DB parameter group apply to a single DB instance in an Aurora DB cluster. These
parameters are related to aspects such as memory usage that you can vary across DB instances in the
same Aurora cluster. For example, a cluster often contains DB instances with different AWS instance
classes.
Every Aurora cluster is associated with a DB cluster parameter group. Each DB instance within the cluster
inherits the settings from that DB cluster parameter group, and is associated with a DB parameter group.
Aurora assigns default parameter groups when you create a cluster or a new DB instance, based on the
specified database engine and version. You can change the parameter groups later to ones that you
create, where you can edit the parameter values.
The DB cluster parameter groups also include default values for all the instance-level parameters from
the DB parameter group. These defaults are mainly intended for configuring Aurora Serverless clusters,
which are only associated with DB cluster parameter groups, not DB parameter groups. You can modify
the instance-level parameter settings in the DB cluster parameter group. Then, Aurora applies those
settings to each new DB instance that's added to a Serverless cluster. To learn more about configuration
settings for Aurora Serverless clusters and which settings you can modify, see Aurora Serverless and
Parameter Groups (p. 122).
For non-Serverless clusters, any configuration values that you modify in the DB cluster parameter
group override default values in the DB parameter group. If you edit the corresponding values in the DB
parameter group, those values override the settings from the DB cluster parameter group.
Any DB parameter settings that you modify take precedence over the DB cluster parameter group
values, even if you change the configuration parameters back to their default values. You can see
which parameters are overridden by using the describe-db-parameters AWS CLI command or
the DescribeDBParameters RDS API. The Source field contains the value user if you modified that
parameter. To reset one or more parameters so that the value from the DB cluster parameter group takes
precedence, use the reset-db-parameter-group AWS CLI command or the ResetDBParameterGroup
RDS API operation.
The DB cluster and DB instance parameters available to you in Aurora vary depending on database
engine compatibility.
207
Amazon Aurora User Guide for Aurora
Creating a DB Parameter Group
Console
To create a DB parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. Choose Create parameter group.
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:
208
Amazon Aurora User Guide for Aurora
Creating a DB Cluster Parameter Group
RDS API
To create a DB parameter group, use the RDS API CreateDBParameterGroup operation.
• DBParameterGroupName
• DBParameterGroupFamily
• Description
Console
To create a DB cluster parameter group
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
3. Choose Create parameter group.
AWS CLI
To create a DB cluster parameter group, use the AWS CLI create-db-cluster-parameter-
group command. The following example creates a DB cluster parameter group named
mydbclusterparametergroup for MySQL version 5.6 with a description of "My new cluster parameter
group."
• --db-cluster-parameter-group-name
• --db-parameter-group-family
209
Amazon Aurora User Guide for Aurora
Modifying Parameters in a DB Parameter Group
• --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 cluster parameter group, use the RDS API CreateDBClusterParameterGroup action.
• DBClusterParameterGroupName
• DBParameterGroupFamily
• Description
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.
210
Amazon Aurora User Guide for Aurora
Modifying Parameters in a DB Parameter Group
211
Amazon Aurora User Guide for Aurora
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 parameters:
• --db-parameter-group-name
• --parameters
The following example modifies the max_connections and max_allowed_packet values in the DB
parameter group named mydbparametergroup.
Example
For Linux, macOS, or Unix:
"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 command with the
following required parameters:
• DBParameterGroupName
• Parameters
212
Amazon Aurora User Guide for Aurora
Modifying Parameters in a DB Cluster Parameter Group
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 cluster parameter group associated with a DB instance. For example, if the DB instance is not
using the latest changes to the associated DB cluster parameter group, the RDS console shows the DB
cluster parameter group with a status of pending-reboot. You would need to manually reboot the DB
instance for the latest parameter changes to take effect for that DB instance.
213
Amazon Aurora User Guide for Aurora
Modifying Parameters in a DB Cluster Parameter Group
Console
To modify a DB cluster 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 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 cluster parameter group, use the AWS CLI modify-db-cluster-parameter-group
command with the following required parameters:
• --db-cluster-parameter-group-name
• --parameters
Example
For Linux, macOS, or Unix:
"ParameterName=server_audit_logs_upload,ParameterValue=1,ApplyMethod=immediate"
For Windows:
"ParameterName=server_audit_logs_upload,ParameterValue=1,ApplyMethod=immediate"
DBCLUSTERPARAMETERGROUP mydbclusterparametergroup
RDS API
To modify a DB cluster parameter group, use the RDS API ModifyDBClusterParameterGroup
command with the following required parameters:
• DBClusterParameterGroupName
214
Amazon Aurora User Guide for Aurora
Copying a DB Parameter Group
• Parameters
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.
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 parameters:
• --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
215
Amazon Aurora User Guide for Aurora
Copying a DB Cluster Parameter Group
For Windows:
RDS API
To copy a DB parameter group, use the RDS API CopyDBParameterGroup operation with the following
required parameters:
• SourceDBParameterGroupIdentifier
• TargetDBParameterGroupIdentifier
• TargetDBParameterGroupDescription
After you copy a DB cluster parameter group, wait at least 5 minutes before creating your first DB cluster
that uses that DB cluster parameter group as the default parameter group. Doing this allows Amazon
RDS to fully complete the copy action before the parameter group is used as the default for a new
DB cluster. You can use the Parameter Groups option of the Amazon RDS console or the describe-db-
cluster-parameters command to verify that your DB cluster 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.
Console
To copy a DB cluster 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 cluster parameter group, use the AWS CLI copy-db-cluster-parameter-group
command with the following required parameters:
• --source-db-cluster-parameter-group-identifier
216
Amazon Aurora User Guide for Aurora
Listing DB Parameter Groups
• --target-db-cluster-parameter-group-identifier
• --target-db-cluster-parameter-group-description
The following example creates a new DB cluster parameter group named mygroup2 that is a copy of the
DB cluster parameter group mygroup1.
Example
For Linux, macOS, or Unix:
For Windows:
RDS API
To copy a DB cluster parameter group, use the RDS API CopyDBClusterParameterGroup operation
with the following required parameters:
• SourceDBClusterParameterGroupIdentifier
• TargetDBClusterParameterGroupIdentifier
• TargetDBClusterParameterGroupDescription
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.
217
Amazon Aurora User Guide for Aurora
Listing DB Cluster Parameter Groups
Example
The following example lists all available DB parameter groups for an AWS account.
For Windows:
RDS API
To list all DB parameter groups for an AWS account, use the RDS API DescribeDBParameterGroups
operation.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Parameter groups.
The DB cluster parameter groups appear in the list with DB cluster parameter group for Type.
218
Amazon Aurora User Guide for Aurora
Viewing Parameter Values for a DB Parameter Group
AWS CLI
To list all DB cluster parameter groups for an AWS account, use the AWS CLI describe-db-cluster-
parameter-groups command.
Example
The following example lists all available DB cluster parameter groups for an AWS account.
DBCLUSTERPARAMETERGROUPS arn:aws:rds:us-west-2:1234567890:cluster-
pg:default.aurora5.6 default.aurora5.6 aurora5.6 Default cluster parameter
group for aurora5.6
DBCLUSTERPARAMETERGROUPS arn:aws:rds:us-west-2:1234567890:cluster-
pg:mydbclusterparametergroup mydbclusterparametergroup aurora5.6 My new cluster
parameter group
For Windows:
DBCLUSTERPARAMETERGROUPS arn:aws:rds:us-west-2:1234567890:cluster-
pg:mydbclusterparametergroup mydbclusterparametergroup aurora5.6 My new cluster
parameter group
RDS API
To list all DB cluster parameter groups for an AWS account, use the RDS API
DescribeDBClusterParameterGroups action.
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/.
219
Amazon Aurora User Guide for Aurora
Viewing Parameter Values for
a DB Cluster Parameter Group
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.
RDS API
To view the parameter values for a DB parameter group, use the RDS API DescribeDBParameters
command with the following required parameter.
• DBParameterGroupName
Console
To view the parameter values for a DB cluster 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.
220
Amazon Aurora User Guide for Aurora
Viewing Parameter Values for
a DB Cluster Parameter Group
The DB cluster parameter groups appear in the list with DB cluster parameter group for Type.
3. Choose the name of the DB cluster parameter group to see its list of parameters.
AWS CLI
To view the parameter values for a DB cluster parameter group, use the AWS CLI describe-db-
cluster-parameters command with the following required parameter.
• --db-cluster-parameter-group-name
Example
The following example lists the parameters and parameter values for a DB cluster parameter group
named mydbclusterparametergroup, in JSON format.
{
"Parameters": [
{
"ApplyMethod": "pending-reboot",
"Description": "Controls whether user-defined functions that have only an xxx
symbol for the main function can be loaded",
"DataType": "boolean",
"AllowedValues": "0,1",
"SupportedEngineModes": [
"provisioned"
],
"Source": "engine-default",
"IsModifiable": false,
"ParameterName": "allow-suspicious-udfs",
"ApplyType": "static"
},
{
"ApplyMethod": "pending-reboot",
"Description": "Enables new features in the Aurora engine.",
"DataType": "boolean",
"IsModifiable": true,
"AllowedValues": "0,1",
"SupportedEngineModes": [
"provisioned"
],
"Source": "engine-default",
"ParameterValue": "0",
"ParameterName": "aurora_lab_mode",
"ApplyType": "static"
},
...
The following example lists the parameters and parameter values for a DB cluster parameter group
named mydbclusterparametergroup, in plain text format.
221
Amazon Aurora User Guide for Aurora
Comparing Parameter Groups
PARAMETERS 0,1 pending-reboot static boolean Controls whether user-defined functions that
have only an xxx symbol for the main function can be loaded False allow-suspicious-udfs
engine-default SUPPORTEDENGINEMODES provisioned
PARAMETERS 0,1 pending-reboot static boolean Enables new features in the Aurora engine.
True aurora_lab_mode 0 engine-default SUPPORTEDENGINEMODES provisioned
...
RDS API
To view the parameter values for a DB cluster parameter group, use the RDS API
DescribeDBClusterParameters command with the following required parameter.
• DBClusterParameterGroupName
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.
DB Parameter Values
You can specify the value for a DB parameter as any of the following:
• An integer constant
• A DB parameter formula
• A DB parameter function
• A character string constant
• A log expression (the log function represents log base 2), such as
value={log(DBInstanceClassMemory/8187281418)*1000}
DB Parameter Formulas
A DB parameter formula is an expression that resolves to an integer value or a Boolean value, and is
enclosed in braces: {}. You can specify formulas for either a DB parameter value or as an argument to a
DB parameter function.
222
Amazon Aurora User Guide for Aurora
DB Parameter Values
Syntax
{FormulaVariable}
{FormulaVariable*Integer}
{FormulaVariable*Integer/Integer}
{FormulaVariable/Integer}
AllocatedStorage
Returns the number of bytes of memory allocated to the DB instance class associated with the
current DB instance, less the memory used by the Amazon RDS processes that manage the instance.
EndPointPort
Returns the number of 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.
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
The parameter arguments can be specified as either integers or formulas. Each function must have at
least one argument. Multiple arguments can be specified as a comma-separated list. The list can't have
any empty members, such as argument1,,argument3. Function names are case-insensitive.
223
Amazon Aurora User Guide for Aurora
DB Parameter Values
Note
DB Parameter functions are not currently supported in the AWS CLI.
IF()
Returns an argument.
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.
SUM()
Syntax
SUM(argument1, argument2,...argumentn)
Returns an integer.
You can specify the LEAST() function in an Aurora MySQL table_definition_cache parameter
value to set the number of table definitions that can be stored in the definition cache to the lesser of
DBInstanceClassMemory/393040 or 20,000.
224
Amazon Aurora User Guide for Aurora
DB Parameter Values
LEAST({DBInstanceClassMemory/393040}, 20000)
225
Amazon Aurora User Guide for Aurora
Migrating Data to a DB Cluster
For more information, see Migrating Data to an Amazon Aurora MySQL DB Cluster (p. 514).
For more information, see Migrating Data to Amazon Aurora with PostgreSQL Compatibility (p. 831).
226
Amazon Aurora User Guide for Aurora
Topics
• Stopping and Starting an Amazon Aurora DB Cluster (p. 228)
• Modifying an Amazon Aurora DB Cluster (p. 232)
• Adding Aurora Replicas to a DB Cluster (p. 248)
• Managing Performance and Scaling for Aurora DB Clusters (p. 252)
• Cloning Databases in an Aurora DB Cluster (p. 254)
• Integrating Aurora with Other AWS Services (p. 269)
• Backing Up and Restoring an Amazon Aurora DB Cluster (p. 286)
• Maintaining an Amazon Aurora DB Cluster (p. 328)
• Rebooting a DB Instance in a DB Cluster (p. 336)
• Deleting a DB Instance in an Aurora DB Cluster (p. 338)
• Tagging Amazon RDS Resources (p. 340)
• Working with Amazon Resource Names (ARNs) in Amazon RDS (p. 345)
• Amazon Aurora Updates (p. 352)
227
Amazon Aurora User Guide for Aurora
Stopping and Starting a Cluster
Topics
• Overview of Stopping and Starting an Aurora DB Cluster (p. 228)
• Limitations for Stopping and Starting Aurora DB Clusters (p. 228)
• Stopping an Aurora DB Cluster (p. 229)
• Possible Operations While an Aurora DB Cluster Is Stopped (p. 230)
• Starting an Aurora DB Cluster (p. 230)
While your DB cluster is stopped, you are charged only for cluster storage, manual snapshots, and
automated backup storage within your specified retention window. You aren't charged for any DB
instance hours. Aurora automatically starts your DB cluster after seven days so that it doesn't fall behind
any required maintenance updates.
To minimize charges for a lightly loaded Aurora cluster, you can stop the cluster instead of deleting
all of its Aurora Replicas. For clusters with more than one or two instances, frequently deleting and
recreating the DB instances is only practical using the AWS CLI or Amazon RDS API. Such a sequence of
operations can also be difficult to perform in the right order, for example to delete all Aurora Replicas
before deleting the primary instance to avoid activating the failover mechanism.
Don't use starting and stopping if you need to keep your DB cluster running but it has more capacity
than you need. If your cluster is too costly or not very busy, delete one or more DB instances or change
all your DB instances to a small instance class. You can't stop an individual Aurora DB instance.
• You can't stop and start a cluster that's part of an Aurora global database (p. 41).
• You can't stop and start a cluster that uses the Aurora parallel query (p. 570) feature.
• You can't stop and start an Aurora Serverless cluster (p. 117).
• You can't stop and start an Aurora multi-master cluster (p. 628).
If an existing cluster can't be stopped and started, the Stop action isn't available from the Actions menu
on the Databases page or the details page.
228
Amazon Aurora User Guide for Aurora
Stopping a DB Cluster
The stop operation stops the Aurora Replica instances first, then the primary instance, to avoid activating
the failover mechanism.
You can't stop a DB cluster that acts as the replication target for data from another DB cluster, or acts as
the replication master and transmits data to another cluster.
You can't stop certain special kinds of clusters. Currently, you can't stop a cluster that's part of an Aurora
global database, or a multi-master cluster.
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 a cluster. You can perform the stop
operation from this page, or navigate to the details page for the DB cluster that you want to stop.
If an existing cluster can't be stopped and started, the Stop action isn't available from the Actions
menu on the Databases page or the details page. For the kinds of clusters that you can't start and
stop, see Limitations for Stopping and Starting Aurora DB Clusters (p. 228).
3. For Actions, choose Stop.
AWS CLI
To stop a DB instance by using the AWS CLI, call the stop-db-cluster command with the following
parameters:
Example
RDS API
To stop a DB instance by using the Amazon RDS API, call the StopDBCluster operation with the following
parameter:
229
Amazon Aurora User Guide for Aurora
While a DB Cluster Is Stopped
You can't modify the configuration of an Aurora DB cluster, or any of its DB instances, while the cluster
is stopped. You also can't add or remove DB instances from the cluster, or delete the cluster if it still
has any associated DB instances. You must start the cluster before performing any such administrative
actions.
Aurora applies any scheduled maintenance to your stopped cluster after it's started again. Remember
that after seven days, Aurora automatically starts any stopped clusters so that they don't fall too far
behind in their maintenance status.
Aurora also doesn't perform any automated backups, because the underlying data can't change while the
cluster is stopped. Aurora doesn't extend the backup retention period while the cluster is stopped.
Console
To start an Aurora cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose a cluster. You can perform the start
operation from this page, or navigate to the details page for the DB cluster that you want to start.
3. For Actions, choose Start.
AWS CLI
To start a DB cluster by using the AWS CLI, call the start-db-cluster command with the following
parameters:
• --db-cluster-identifier – the name of the Aurora cluster. This name is either a specific cluster
identifier you chose when creating the cluster, or the DB instance identifier you chose with -cluster
appended to the end.
Example
RDS API
To start an Aurora DB cluster by using the Amazon RDS API, call the StartDBCluster operation with the
following parameter:
230
Amazon Aurora User Guide for Aurora
Starting a DB Cluster
• DBCluster – the name of the Aurora cluster. This name is either a specific cluster identifier you chose
when creating the cluster, or the DB instance identifier you chose with -cluster appended to the
end.
231
Amazon Aurora User Guide for Aurora
Modifying an Aurora DB Cluster
We recommend that you test any changes on a test DB cluster or DB instance before modifying a
production DB cluster or DB instance, so that you fully understand the impact of each change. This is
especially important when upgrading database versions.
Console
To modify a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then select the DB cluster that you want to modify.
3. Choose Modify. The Modify DB cluster page appears.
4. Change any of the settings that you want. For information about each setting, see Settings for
Amazon Aurora (p. 235).
Note
In the AWS Management Console, some instance level changes only apply to the current
DB instance, while others apply to the entire DB cluster. For information about whether a
setting applies to the DB instance or the DB cluster, see the scope for the setting in Settings
for Amazon Aurora (p. 235). To change a setting that modifies the entire DB cluster at
the instance level in the AWS Management Console, follow the instructions in Modify a DB
Instance in a DB Cluster (p. 233).
5. When all the changes are as you want them, choose Continue and check the summary of
modifications.
6. To apply the changes immediately, select Apply immediately.
7. On the confirmation page, review your changes. If they are correct, choose Modify cluster to save
your changes.
Alternatively, choose Back to edit your changes, or choose Cancel to cancel your changes.
AWS CLI
To modify a DB cluster using the AWS CLI, call the modify-db-cluster command. Specify the DB cluster
identifier, and the values for the settings that you want to modify. For information about each setting,
see Settings for Amazon Aurora (p. 235).
232
Amazon Aurora User Guide for Aurora
Modify a DB Instance in a DB Cluster
Note
Some settings only apply to DB instances. To change those settings, follow the instructions in
Modify a DB Instance in a DB Cluster (p. 233).
Example
The following command modifies mydbcluster by setting the backup retention period to 1 week (7
days).
For Windows:
RDS API
To modify a DB cluster using the Amazon RDS API, call the ModifyDBCluster operation. Specify the DB
cluster identifier, and the values for the settings that you want to modify. For information about each
parameter, see Settings for Amazon Aurora (p. 235).
Note
Some settings only apply to DB instances. To change those settings, follow the instructions in
Modify a DB Instance in a DB Cluster (p. 233).
When you modify a DB instance, you can apply the changes immediately. To apply changes immediately,
you select the Apply Immediately option in the AWS Management Console, you use the --apply-
immediately parameter when calling the AWS CLI, or you set the ApplyImmediately parameter to
true when using the Amazon RDS API.
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 apply immediately can cause
unexpected downtime for the DB instance. There is no downtime for the other DB instances in
the DB cluster.
Console
To modify a DB instance in a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
233
Amazon Aurora User Guide for Aurora
Modify a DB Instance in a DB Cluster
2. In the navigation pane, choose Databases, and then select the DB instance that you want to modify.
3. For Actions, 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
Amazon Aurora (p. 235).
Note
Some settings apply to the entire DB cluster and must be changed at the cluster level. To
change those settings, follow the instructions in Modifying the DB Cluster by Using the
Console, CLI, and API (p. 232).
In the AWS Management Console, some instance level changes only apply to the current
DB instance, while others apply to the entire DB cluster. For information about whether a
setting applies to the DB instance or the DB cluster, see the scope for the setting in Settings
for Amazon Aurora (p. 235).
5. When all the changes are as you want them, choose Continue and check the summary of
modifications.
6. To apply the changes immediately, select Apply immediately.
7. 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 modify a DB instance in a DB cluster by using the AWS CLI, call the modify-db-instance command.
Specify the DB instance identifier, and the values for the settings that you want to modify. For
information about each parameter, see Settings for Amazon Aurora (p. 235).
Note
Some settings apply to the entire DB cluster. To change those settings, follow the instructions in
Modifying the DB Cluster by Using the Console, CLI, and API (p. 232).
Example
The following code modifies mydbinstance by setting the DB instance class to db.r4.xlarge. The
changes are applied during the next maintenance window by using --no-apply-immediately. Use --
apply-immediately to apply the changes immediately.
For Windows:
RDS API
To modify a MySQL instance by using the Amazon RDS API, call the ModifyDBInstance operation. Specify
the DB instance identifier, and the values for the settings that you want to modify. For information about
each parameter, see Settings for Amazon Aurora (p. 235).
234
Amazon Aurora User Guide for Aurora
Available Settings
Note
Some settings apply to the entire DB cluster. To change those settings, follow the instructions in
Modifying the DB Cluster by Using the Console, CLI, and API (p. 232).
Auto minor version Using the AWS The entire DB cluster An outage doesn't occur
upgrade Management Console, during this change.
Modify a DB Instance in
Whether you want the a DB Cluster (p. 233).
DB instance to receive
preferred minor engine Using the AWS CLI, run
version upgrades modify-db-instance
automatically when and set the --auto-
they become available. minor-version-
Upgrades are installed upgrade|--no-auto-
only during your minor-version-
scheduled maintenance upgrade option.
window.
Using the RDS API, call
The Auto minor version ModifyDBInstance
upgrade setting only and set the
applies to Aurora AutoMinorVersionUpgrade
PostgreSQL DB clusters. parameter.
Backup retention Using the AWS The entire DB cluster An outage doesn't occur
period Management Console, during this change.
Modifying the DB
The number of days Cluster by Using the
that automatic backups Console, CLI, and
are retained. The API (p. 232).
minimum value is 1.
Using the AWS CLI, run
modify-db-cluster
235
Amazon Aurora User Guide for Aurora
Available Settings
Certificate Authority Using the AWS Only the specified DB An outage occurs
Management Console, instance during this change. The
The certificate that you Modify a DB Instance in DB instance is rebooted.
want to use. a DB Cluster (p. 233).
Copy tags to snapshots Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
Select to specify that Modifying the DB
tags defined for this DB Cluster by Using the
cluster are copied to Console, CLI, and
DB snapshots created API (p. 232).
from this DB cluster. For
more information, see Using the AWS CLI, run
Tagging Amazon RDS modify-db-cluster
Resources (p. 340). and set the --copy-
tags-to-snapshot or
--no-copy-tags-to-
snapshot option.
236
Amazon Aurora User Guide for Aurora
Available Settings
Data API Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
You can access Aurora Modifying the DB
Serverless with Cluster by Using the
web services–based Console, CLI, and
applications, including API (p. 232).
AWS Lambda and AWS
AppSync. This setting Using the AWS CLI, run
only applies to an modify-db-cluster
Aurora Serverless DB and set the --enable-
cluster. http-endpoint
option.
For more information,
see Using the Data Using the RDS API, call
API for Aurora ModifyDBCluster
Serverless (p. 140). and set the
EnableHttpEndpoint
parameter.
Database Using the AWS The entire DB cluster An outage doesn't occur
authentication Management Console, during this change.
Modifying the DB
The database Cluster by Using the
authentication option Console, CLI, and
you want to use. API (p. 232).
237
Amazon Aurora User Guide for Aurora
Available Settings
Database port Using the AWS The entire DB cluster An outage occurs
Management Console, during this change. All
The port that you want Modifying the DB of the DB instances
to use to access the DB Cluster by Using the in the DB cluster are
cluster. Console, CLI, and rebooted immediately.
API (p. 232).
DB cluster identifier Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
The DB cluster Modifying the DB
identifier. This value is Cluster by Using the
stored as a lowercase Console, CLI, and
string. API (p. 232).
DB cluster parameter Using the AWS The entire DB cluster An outage doesn't occur
group Management Console, during this change.
Modifying the DB When you change
The DB cluster Cluster by Using the the parameter group,
parameter group that Console, CLI, and changes to some
you want associated API (p. 232). parameters are applied
with the DB cluster. to the DB instances
Using the AWS CLI, run in the DB cluster
For more information, modify-db-cluster immediately without
see Working with DB and set the --db- a reboot. Changes to
Parameter Groups and cluster-parameter- other parameters are
DB Cluster Parameter group-name option. applied only after the
Groups (p. 205). DB instances in the DB
Using the RDS API, call cluster are rebooted.
ModifyDBCluster
and set the
DBClusterParameterGroupName
parameter.
238
Amazon Aurora User Guide for Aurora
Available Settings
DB engine version Using the AWS The entire DB cluster An outage occurs
Management Console, during this change.
The version of the Modifying the DB
DB engine that you Cluster by Using the
want to use. Before Console, CLI, and
you upgrade your API (p. 232).
production DB cluster,
we recommend that Using the AWS CLI, run
you test the upgrade modify-db-cluster
process on a test DB and set the --engine-
cluster to verify its version option.
duration and to validate
your applications. Using the RDS API, call
ModifyDBCluster
Currently, you can and set the
only use this setting EngineVersion
to upgrade the minor parameter.
engine version of an
Aurora PostgreSQL DB
cluster.
DB instance class Using the AWS Only the specified DB An outage occurs
Management Console, instance during this change.
The DB instance class Modify a DB Instance in
that you want to use. a DB Cluster (p. 233).
DB instance identifier Using the AWS Only the specified DB An outage occurs
Management Console, instance during this change. The
The DB instance Modify a DB Instance in DB instance is rebooted.
identifier. This value is a DB Cluster (p. 233).
stored as a lowercase
string. Using the AWS CLI,
run modify-db-
instance and set the
--new-db-instance-
identifier option.
239
Amazon Aurora User Guide for Aurora
Available Settings
DB parameter group Using the AWS Only the specified DB An outage doesn't occur
Management Console, instance during this change.
The DB parameter Modify a DB Instance in When you change
group that you want a DB Cluster (p. 233). the parameter group,
associated with the DB changes to some
instance. Using the AWS CLI, run parameters are applied
modify-db-instance to the DB instance
For more information, and set the --db- immediately without
see Working with DB parameter-group- a reboot. Changes to
Parameter Groups and name option. other parameters are
DB Cluster Parameter applied only after the
Groups (p. 205). Using the RDS API, call DB instance is rebooted.
ModifyDBInstance
and set the
DBParameterGroupName
parameter.
Deletion protection Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
Enable deletion Modifying the DB
protection to prevent Cluster by Using the
your DB cluster from Console, CLI, and
being deleted. For API (p. 232).
more information,
see Deleting a DB Using the AWS CLI,
Instance in an Aurora run modify-db-
DB Cluster (p. 338). cluster and set
the --deletion-
protection|--
no-deletion-
protection option.
240
Amazon Aurora User Guide for Aurora
Available Settings
Enhanced monitoring Using the AWS Only the specified DB An outage doesn't occur
Management Console, instance during this change.
Enable enhanced Modify a DB Instance in
monitoring to enable a DB Cluster (p. 233).
gathering metrics
in real time for the Using the AWS CLI,
operating system that run modify-db-
your DB instance runs instance and set
on. the --monitoring-
role-arn and
For more information, --monitoring-
see Enhanced interval options.
Monitoring (p. 390).
Using the RDS API, call
ModifyDBInstance
and set the
MonitoringRoleArn
and
MonitoringInterval
parameters.
Log exports Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
Select the log types Modifying the DB
to publish to Amazon Cluster by Using the
CloudWatch Logs. Console, CLI, and
API (p. 232).
For more information,
see MySQL Database Using the AWS CLI,
Log Files (p. 493). run modify-db-
cluster and set the
--cloudwatch-
logs-export-
configuration
option.
241
Amazon Aurora User Guide for Aurora
Available Settings
Maintenance window To change the The entire DB cluster or If there are one or
maintenance window a single DB instance more pending actions
The time range for the DB cluster using that cause an outage,
during which system the AWS Management and the maintenance
maintenance occurs. Console, Modifying the window is changed
System maintenance DB Cluster by Using to include the current
includes upgrades, the Console, CLI, and time, then those
if applicable. The API (p. 232). pending actions are
maintenance window is applied immediately,
a start time in UniversalTo change the and an outage occurs.
Coordinated Time maintenance window
(UTC), and a duration in for a DB instance using
hours. the AWS Management
Console, Modify a
If you set the window to DB Instance in a DB
the current time, there Cluster (p. 233).
must be at least 30
minutes between the To change the
current time and end of maintenance window
the window to ensure for the DB cluster
any pending changes using the AWS CLI,
are applied. run modify-db-
cluster and set
You can set the the --preferred-
maintenance window maintenance-window
independently for the option.
DB cluster and for each
DB instance in the DB To change the
cluster. When the scope maintenance window
of a modification is for a DB instance
the entire DB cluster, using the AWS CLI,
the modification is run modify-db-
performed during the instance and set
DB cluster maintenance the --preferred-
window. When the maintenance-window
scope of a modification option.
is the a DB instance,
the modification is To change the
performed during maintenance window
maintenance window of for the DB cluster
that DB instance. using the RDS API, call
ModifyDBCluster
For more information, and set the
see The Amazon PreferredMaintenanceWindow
RDS Maintenance parameter.
Window (p. 331).
To change the
maintenance window
for a DB instance using
the RDS API, call
ModifyDBInstance
and set the
PreferredMaintenanceWindow
parameter.
242
Amazon Aurora User Guide for Aurora
Available Settings
New master password Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
The password for Modifying the DB
your master user. Cluster by Using the
The password must Console, CLI, and
contain from 8 to API (p. 232).
41 alphanumeric
characters. Using the AWS CLI, run
modify-db-cluster
and set the --master-
user-password
option.
Performance Insights Using the AWS Only the specified DB An outage doesn't occur
Management Console, instance during this change.
Whether to enable Modify a DB Instance in
Performance Insights, a DB Cluster (p. 233).
a tool that monitors
your DB instance load Using the AWS CLI, run
so that you can analyze modify-db-instance
and troubleshoot your and set the --enable-
database performance. performance-
insights|--
For more information, no-enable-
see Using Amazon performance-
RDS Performance insights option.
Insights (p. 398).
Using the RDS API, call
ModifyDBInstance
and set the
EnablePerformanceInsights
parameter.
243
Amazon Aurora User Guide for Aurora
Available Settings
Performance Insights Using the AWS Only the specified DB An outage doesn't occur
AWS KMS key Management Console, instance during this change.
identifier Modify a DB Instance in
a DB Cluster (p. 233).
The AWS KMS key
identifier for encryption Using the AWS CLI,
of Performance Insights run modify-db-
data. The KMS key ID is instance and set the
the Amazon Resource --performance-
Name (ARN), KMS key insights-kms-key-
identifier, or the KMS id option.
key alias for the KMS
encryption key. Using the RDS API, call
ModifyDBInstance
For more information, and set the
see Enabling PerformanceInsightsKMSKeyId
Performance parameter.
Insights (p. 399).
Performance Insights Using the AWS Only the specified DB An outage doesn't occur
retention period Management Console, instance during this change.
Modify a DB Instance in
The amount of time, a DB Cluster (p. 233).
in days, to retain
Performance Insights Using the AWS CLI,
data. Valid values are 7 run modify-db-
or 731 (2 years). instance and set the
--performance-
For more information, insights-
see Enabling retention-period
Performance option.
Insights (p. 399).
Using the RDS API, call
ModifyDBInstance
and set the
PerformanceInsightsRetentionPeriod
parameter.
Promotion tier Using the AWS Only the specified DB An outage doesn't occur
Management Console, instance during this change.
A value that specifies Modify a DB Instance in
the order in which a DB Cluster (p. 233).
an Aurora Replica
is promoted to the Using the AWS CLI,
primary instance in a run modify-db-
cluster that uses single- instance and set the
master replication, after --promotion-tier
a failure of the existing option.
primary instance.
Using the RDS API, call
For more information, ModifyDBInstance
see Fault Tolerance and set the
for an Aurora DB PromotionTier
Cluster (p. 287). parameter.
244
Amazon Aurora User Guide for Aurora
Available Settings
Public accessibility Using the AWS Only the specified DB An outage doesn't occur
Management Console, instance during this change.
Whether to give the Modify a DB Instance in
DB instance a public a DB Cluster (p. 233).
IP address, meaning
that it is accessible Using the AWS CLI,
outside the VPC. To be run modify-db-
publicly accessible, the instance and set
DB instance also has to the --publicly-
be in a public subnet accessible|--
in the VPC. When the no-publicly-
DB instance is not accessible option.
publicly accessible, it
is accessible only from Using the RDS API, call
inside the VPC. ModifyDBInstance
and set the
For more information, PubliclyAccessible
see Hiding a DB parameter.
Instance in a VPC from
the Internet (p. 1079).
Scaling configuration Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
The scaling properties Modifying the DB
of the DB cluster. You Cluster by Using the
can only modify scaling Console, CLI, and
properties for DB API (p. 232).
clusters in serverless
DB engine mode. This Using the AWS CLI,
setting is available only run modify-db-
for Aurora MySQL. cluster and set
the --scaling-
For information about configuration
Aurora Serverless, see option.
Using Amazon Aurora
Serverless (p. 117). Using the RDS API, call
ModifyDBCluster
and set the
ScalingConfiguration
parameter.
245
Amazon Aurora User Guide for Aurora
Non-Applicable Settings
Security group Using the AWS The entire DB cluster An outage doesn't occur
Management Console, during this change.
The security group you Modifying the DB
want associated with Cluster by Using the
the DB cluster. Console, CLI, and
API (p. 232).
For more information,
see Controlling Using the AWS CLI, run
Access with Security modify-db-cluster
Groups (p. 1060). and set the --vpc-
security-group-ids
option.
Target Backtrack Using the AWS The entire DB cluster An outage doesn't occur
window Management Console, during this change.
Modifying the DB
The amount of time Cluster by Using the
you want to be able Console, CLI, and
to backtrack your DB API (p. 232).
cluster, in seconds.
This setting is available Using the AWS CLI,
only for Aurora MySQL run modify-db-
and only if the DB cluster and set the
cluster was created with --backtrack-window
Backtrack enabled. option.
--allocated-storage AllocatedStorage
--allow-major-version-upgrade|--no- AllowMajorVersionUpgrade
allow-major-version-upgrade
246
Amazon Aurora User Guide for Aurora
Non-Applicable Settings
--copy-tags-to-snapshot|--no-copy- CopyTagsToSnapshot
tags-to-snapshot
--domain Domain
--db-security-groups DBSecurityGroups
--db-subnet-group-name DBSubnetGroupName
--domain-iam-role-name DomainIAMRoleName
--multi-az|--no-multi-az MultiAZ
--iops Iops
--license-model LicenseModel
--option-group-name OptionGroupName
--preferred-backup-window PreferredBackupWindow
--processor-features ProcessorFeatures
--storage-type StorageType
--tde-credential-arn TdeCredentialArn
--tde-credential-password TdeCredentialPassword
--use-default-processor-features|--no- UseDefaultProcessorFeatures
use-default-processor-features
Note
Although the preferred backup window can be set for Aurora, the setting is ignored. Aurora
backups are continuous and incremental.
247
Amazon Aurora User Guide for Aurora
Adding Aurora Replicas
We recommend that you distribute the primary instance and Aurora Replicas in your DB cluster over
multiple Availability Zones to improve the availability of your DB cluster. For more information, see
Region Availability (p. 5).
You can add Aurora Replicas to a DB cluster using the AWS Management Console, the AWS CLI, or the
RDS API.
To remove an Aurora Replica from a DB cluster, delete the Aurora Replica DB instance by following the
instructions in Deleting a DB Instance in an Aurora DB Cluster (p. 338).
For more information about Aurora Replicas, see Aurora Replicas (p. 60).
Note
Amazon Aurora also supports replication with an external database, or an RDS DB instance.
When using Amazon Aurora, your RDS DB instance must be in the same AWS Region. For more
information, see Replication with Amazon Aurora (p. 60).
Console
To add an Aurora Replica to a DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then select the DB cluster where you want to add the
new DB instance.
3. For Actions, choose Add reader.
Publicly accessible Select Yes to give the Aurora Replica a public IP address;
otherwise, select No. For more information about hiding
Aurora Replicas from public access, see Hiding a DB
Instance in a VPC from the Internet (p. 1079).
248
Amazon Aurora User Guide for Aurora
Adding Aurora Replicas
Aurora replica source Select the identifier of the primary instance to create an
Aurora Replica for.
DB instance identifier Type a name for the instance that is unique for your
account in the AWS Region you selected. You might
choose to add some intelligence to the name such as
including the AWS Region and DB engine you selected, for
example aurora-read-instance1.
Database port The port for an Aurora Replica is the same as the port for
the DB cluster.
249
Amazon Aurora User Guide for Aurora
Adding Aurora Replicas
Auto minor version upgrade Select Enable auto minor version upgrade if you want
to enable your Aurora DB cluster to receive minor DB
Engine version upgrades automatically when they become
available.
AWS CLI
To create an Aurora Replica in your DB cluster, run the create-db-instance AWS CLI command. Include
the name of the DB cluster as the --db-cluster-identifier option. You can optionally specify an
Availability Zone for the Aurora Replica using the --availability-zone parameter, as shown in the
following examples.
For example, the following command creates a new MySQL 5.7–compatible Aurora Replica named
sample-instance-us-west-2a.
For Windows:
The following command creates a new MySQL 5.6–compatible Aurora Replica named sample-
instance-us-west-2a.
For Windows:
250
Amazon Aurora User Guide for Aurora
Adding Aurora Replicas
The following command creates a new PostgreSQL-compatible Aurora Replica named sample-
instance-us-west-2a.
For Windows:
RDS API
To create an Aurora Replica in your DB cluster, call the CreateDBInstance operation. Include the name of
the DB cluster as the DBClusterIdentifier parameter. You can optionally specify an Availability Zone
for the Aurora Replica using the AvailabilityZone parameter.
251
Amazon Aurora User Guide for Aurora
Managing Performance and Scaling
Topics
• Storage Scaling (p. 252)
• Instance Scaling (p. 252)
• Read Scaling (p. 252)
• Managing Connections (p. 253)
• Managing Query Execution Plans (p. 253)
Storage Scaling
Aurora storage automatically scales with the data in your cluster volume. As your data grows, your
cluster volume storage grows in 10 gibibyte (GiB) increments up to 64 TiB.
The size of your cluster volume is checked on an hourly basis to determine your storage costs. For pricing
information, see the Aurora pricing page.
When Aurora data is removed, such as by dropping a table or partition, the overall allocated space
remains the same. The free space is reused automatically when data volume increases in the future.
Note
Storage costs are based on the storage "high water mark," the maximum amount that was
allocated for the Aurora cluster at any point in time. Thus, you can manage costs by avoiding
extract, transform, load (ETL) practices that create large volumes of temporary information.
Similarly, you can manage costs by avoiding ETL practices that load large volumes of new data
before removing unneeded older data.
If removing data from an Aurora cluster results in a substantial amount of allocated but unused space,
resetting the high water mark requires doing a logical data dump and restore to a new cluster, using
a tool such as mysqldump. Creating and restoring a snapshot does not reduce the allocated storage
because the physical layout of the underlying storage remains the same in the restored snapshot.
Instance Scaling
You can scale your Aurora DB cluster as needed by modifying the DB instance class for each DB instance
in the DB cluster. Aurora supports several DB instance classes optimized for Aurora, depending on
database engine compatibility.
Amazon Aurora MySQL See Scaling Aurora MySQL DB Instances (p. 550)
Amazon Aurora PostgreSQL See Scaling Aurora PostgreSQL DB Instances (p. 854)
Read Scaling
You can achieve read scaling for your Aurora DB cluster by creating up to 15 Aurora Replicas in a DB
cluster that uses single-master replication. Each Aurora Replica returns the same data from the cluster
252
Amazon Aurora User Guide for Aurora
Managing Connections
volume with minimal replica lag—usually considerably less than 100 milliseconds after the primary
instance has written an update. As your read traffic increases, you can create additional Aurora Replicas
and connect to them directly to distribute the read load for your DB cluster. Aurora Replicas don't have
to be of the same DB instance class as the primary instance.
For information about adding Aurora Replicas to a DB cluster, see Adding Aurora Replicas to a DB
Cluster (p. 248).
Managing Connections
The maximum number of connections allowed to an Aurora DB instance is determined by the
max_connections parameter in the instance-level parameter group for the DB instance. The default
value of that parameter varies depends on the DB instance class used for the DB instance and database
engine compatibility.
253
Amazon Aurora User Guide for Aurora
Cloning Databases in an Aurora DB Cluster
Database cloning uses a copy-on-write protocol, in which data is copied at the time that data changes,
either on the source databases or the clone databases. You can make multiple clones from the same
DB cluster. You can also create additional clones from other clones. For more information on how the
copy-on-write protocol works in the context of Aurora storage, see Copy-on-Write Protocol for Database
Cloning (p. 254).
You can use database cloning in a variety of use cases, especially where you don't want to have an impact
on your production environment. Some examples are the following:
• Experiment with and assess the impact of changes, such as schema changes or parameter group
changes.
• Perform workload-intensive operations, such as exporting data or running analytical queries.
• Create a copy of a production DB cluster in a nonproduction environment for development or testing.
Topics
• Limitations (p. 254)
• Copy-on-Write Protocol for Database Cloning (p. 254)
• Deleting Source Databases (p. 256)
• Cloning an Aurora Cluster Through the AWS Management Console (p. 256)
• Cloning an Aurora Cluster Through the AWS CLI (p. 257)
• Cross-Account Cloning (p. 258)
Limitations
There are some limitations involved with database cloning, described following:
• You cannot create clone databases across AWS regions. The clone databases must be created in the
same region as the source databases.
• Currently, you are limited to 15 clones based on a copy, including clones based on other clones. After
that, only copies can be created. However, each copy can also have up to 15 clones.
• Currently, you cannot clone from a cluster without the parallel query feature, to a cluster where
parallel query is enabled. To bring data into a cluster that uses parallel query, create a snapshot of the
original cluster and restore it to a cluster where the parallel query option is enabled.
• You can provide a different virtual private cloud (VPC) for your clone. However, the subnets in those
VPCs must map to the same set of Availability Zones.
254
Amazon Aurora User Guide for Aurora
Copy-on-Write Protocol for Database Cloning
255
Amazon Aurora User Guide for Aurora
Deleting Source Databases
As shown in the second scenario, after database cloning there is no additional storage required at the
point of clone creation. However, as changes occur in the source database and clone database, only the
changed pages are created, as shown in the third and fourth scenarios. As more changes occur over time
in both the source database and clone database, you need incrementally more storage to capture and
store the changes.
These instructions apply for DB clusters owned by the same AWS account that is creating the clone. If the
DB cluster is owned by a different AWS account, see Cross-Account Cloning (p. 258) instead.
256
Amazon Aurora User Guide for Aurora
Cloning an Aurora Cluster Through the AWS CLI
To create a clone of a DB cluster owned by your AWS account 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. Choose the DB cluster that you want to create a clone of.
3. For Actions, choose Create clone.
4. On the Create clone page, type a name for the primary instance of the clone DB cluster as the DB
instance identifier.
If you want to, set any other settings for the clone DB cluster. For information about the different DB
cluster settings, see New Console (p. 102).
5. Choose Create clone to launch the clone DB cluster.
• Call the restore-db-cluster-to-point-in-time AWS CLI command and supply the following values:
The following example creates a clone of the DB cluster named sample-source-cluster. The
name of the clone DB cluster is sample-cluster-clone.
For Windows:
Note
The restore-db-cluster-to-point-in-time AWS CLI command only restores the DB cluster, not the
DB instances for that DB cluster. You must invoke the create-db-instance command to create
DB instances for the restored DB cluster, specifying the identifier of the restored DB cluster
in --db-cluster-identifier. You can create DB instances only after the restore-db-
cluster-to-point-in-time command has completed and the DB cluster is available.
257
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
Cross-Account Cloning
With Amazon Aurora, you can share an Aurora DB cluster with another AWS account or AWS
organization. By sharing this way, you can clone the DB cluster and access the clone from the other
account or organization.
For example, if you use separate accounts for production and testing, you can create a clone of
production data in your test account. You can use this clone to experiment with different parameters
and run expensive online analytical processing (OLAP) queries, all without having an impact on the
production environment. You can give outside companies access to your database, for example for
an external vendor to train a machine learning model. Cross-account cloning is much faster in such
situations than creating and restoring a database snapshot.
To authorize sharing, you use AWS Resource Access Manager (AWS RAM). For more information about
controlling access through AWS RAM, see the AWS RAM User Guide.
Creating a cross-account clone requires actions from the AWS account that owns the original cluster, and
the AWS account that creates the clone. First, the owner modifies the cluster to allow one or more other
accounts to clone it. If any of the accounts are in a different AWS organization, AWS generates a sharing
invitation and the other account must accept the invitation before proceeding. Then each authorized
account can clone the cluster. Throughout this process, the cluster is identified by its unique Amazon
Resource Name (ARN).
You're only charged for additional storage space if you make data changes. If the source cluster is
deleted, storage costs are distributed equally among remaining cloned clusters.
Topics
• Limitations of Cross-Account Cloning (p. 258)
• Allowing Other AWS Accounts to Clone Your Cluster (p. 259)
• Cloning a Cluster Owned by Another AWS Account (p. 261)
258
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
For the procedures to share resources owned by you in the AWS RAM console, see Sharing Resources
Owned by You in the AWS RAM User Guide.
Topics
• Granting Permission to Other AWS Accounts to Clone Your Cluster (p. 259)
• Checking If a Cluster You Own Is Shared with Other AWS Accounts (p. 261)
Console
To grant permission to clone your cluster 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 DB cluster that you want to share to see its Details page, and choose the Connectivity &
security tab.
4. In the Share DB cluster with other AWS accounts section, enter the numeric account ID for the AWS
account that you want to allow to clone this cluster. For account IDs in the same organization, you
can begin typing in the box and then choose from the menu.
Important
In some cases, you might want an account that is not in the same AWS organization as
your account to clone a cluster. In these cases, for security reasons the AWS Management
Console doesn't report who owns that account ID or whether the account exists.
Be careful entering account numbers that are not in the same AWS organization as your
AWS account. Immediately verify that you shared with the intended account.
5. On the confirmation page, verify that the account ID that you specified is correct. Enter share in the
confirmation box to confirm.
On the Details page, an entry appears showing the specified AWS account ID under Accounts that
this DB cluster is shared with. The Status column initially shows a status of Pending.
6. Contact the owner of the other AWS account, or sign in to that account if you own both of them.
Instruct the owner of the other account to accept the sharing invitation and clone the DB cluster, as
described following.
AWS CLI
1. Gather the information for the required parameters. You need the ARN for your cluster and the
numeric ID for the other AWS account.
259
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
For Windows:
To include multiple account IDs for the --principals parameter, separate IDs from each other
with spaces. To specify whether the permitted account IDs can be outside your AWS organization,
include the --allow-external-principals or --no-allow-external-principals
parameter for create-resource-share.
RAM API
1. Gather the information for the required parameters. You need the ARN for your cluster and the
numeric ID for the other AWS account.
2. Call the RAM API operation CreateResourceShare, and specify the following values:
• Specify the account IDs of one or more AWS accounts as the principals parameter.
• Specify the ARNs of one or more Aurora DB clusters as the resourceArns parameter.
• Specify whether the permitted account IDs can be outside your AWS organization or not by
including a Boolean value for the allowExternalPrincipals parameter.
If the encrypted cluster that you intend to share uses the default RDS key, you must recreate it using a
customer master key (CMK) and share the new cluster instead. You do so by creating a manual snapshot
of your DB cluster and restoring it to a new cluster. Use the following steps.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Snapshots from the navigation pane.
3. Choose your snapshot.
4. For Actions, choose Copy Snapshot, and then choose Enable encryption.
5. For Master key, choose the new encryption key that you want to use.
6. Restore the copied snapshot. To do so, follow the procedure in Restoring from a DB Cluster
Snapshot (p. 292). The new DB instance uses your new encryption key.
260
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
7. (Optional) Delete the old DB cluster if you no longer need it. To do so, follow the procedure in
Deleting a DB Cluster Snapshot (p. 327). Before you do, confirm that your new cluster has all
necessary data and that your application can access it successfully.
For the procedures to share resources using the AWS RAM console, see Sharing Resources Owned by You
in the AWS RAM User Guide.
AWS CLI
To find out if a cluster you own is shared with other AWS accounts using the AWS CLI
• Call the RAM CLI command list-principals, using your account ID as the resource owner and
the ARN of your cluster as the resource ARN. You can see all shares with the following command.
The results indicate which AWS accounts are allowed to clone the cluster.
RAM API
To find out if a cluster you own is shared with other AWS accounts using the RAM API
• Call the RAM API operation ListPrincipals. Use your account ID as the resource owner and the ARN of
your cluster as the resource ARN.
You can also check whether a cluster that you own is a clone of a cluster owned by a different AWS
account.
For the procedures to work with resources owned by others in the AWS RAM console, see Accessing
Resources Shared With You in the AWS RAM User Guide.
Topics
• Viewing Invitations to Clone Clusters Owned by Other AWS Accounts (p. 261)
• Accepting Invitations to Share Clusters Owned by Other AWS Accounts (p. 262)
• Cloning an Aurora Cluster Owned by Another AWS Account (p. 263)
• Checking If a DB Cluster is a Cross-Account Clone (p. 266)
261
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
For the procedures to work with invitations in the AWS RAM console, see Accessing Resources Shared
With You in the AWS RAM User Guide.
AWS CLI
To see invitations to clone clusters owned by other AWS accounts using the AWS CLI
The results from the preceding command show all invitations to clone clusters, including any that
you already accepted or rejected.
2. (Optional) Filter the list so you see only the invitations that require action from you. To do so, add
the parameter --query 'resourceShareInvitations[?status==`PENDING`]'.
RAM API
To see invitations to clone clusters owned by other AWS accounts using the RAM API
1. Call the RAM API operation GetResourceShareInvitations. This operation returns all such
invitations, including any that you already accepted or rejected.
2. (Optional) Find only the invitations that require action from you by checking the
resourceShareAssociations return field for a status value of PENDING.
For the procedures to work with invitations in the AWS RAM console, see Accessing Resources Shared
With You in the AWS RAM User Guide.
Console
To accept an invitation to share a cluster from another AWS account using the AWS CLI
1. Find the invitation ARN by running the RAM CLI command get-resource-share-invitations,
as shown preceding.
2. Accept the invitation by calling the RAM CLI command accept-resource-share-invitation, as
shown following.
For Windows:
262
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
To accept invitations to share somebody's cluster using the RAM and RDS APIs
1. Find the invitation ARN by calling the RAM API operation GetResourceShareInvitations, as
shown preceding.
2. Pass that ARN as the resourceShareInvitationArn parameter to the RDS API operation
AcceptResourceShareInvitation.
Console
To clone an Aurora cluster owned by another AWS account 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.
At the top of the database list, you should see one or more items with a Role value of Shared from
account #account_id. For security reasons, you can only see limited information about the
original clusters. The properties that you can see are the ones such as database engine and version
that must be the same in your cloned cluster.
3. Choose the cluster that you intend to clone.
4. For Actions, choose Create clone.
5. Follow the procedure in Cloning an Aurora Cluster Through the AWS Management Console (p. 256)
to finish setting up the cloned cluster.
6. As needed, enable encryption for the cloned cluster. If the cluster that you are cloning is encrypted,
you must enable encryption for the cloned cluster. The AWS account that shared the cluster with
you must also share the KMS key that was used to encrypt the cluster. You can use the same key to
encrypt the clone, or your own customer master key (CMK). You can't create a cross-account clone
for a cluster that is encrypted with the default RDS key.
The account owning the encryption key must grant permission to use the key to the destination
account by using a key policy. This process is similar to how encrypted snapshots are shared, by
using a key policy that grants permission to the destination account to use the key.
AWS CLI
To clone an Aurora cluster owned by another AWS account using the AWS CLI
1. Accept the invitation from the AWS account that owns the DB cluster, as shown preceding.
2. Clone the cluster by specifying the full ARN of the source cluster in the source-db-cluster-
identifier parameter of the RDS CLI command restore-db-cluster-to-point-in-time, as
shown following.
263
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
If the ARN passed as the source-db-cluster-identifier hasn't been shared, the same error is
returned as if the specified cluster doesn't exist.
For Windows:
3. If the cluster that you are cloning is encrypted, encrypt your cloned cluster by including a kms-key-
id parameter. This kms-key-id value can be the same one used to encrypt the original DB cluster,
or your own customer master key (CMK). Your account must have permission to use that encryption
key.
For Windows:
The account owning the encryption key must grant permission to use the key to the destination
account by using a key policy. This process is similar to how encrypted snapshots are shared, by
using a key policy that grants permission to the destination account to use the key. An example of a
key policy follows.
{
"Id": "key-policy-1",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow use of the key",
264
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
"Effect": "Allow",
"Principal": {"AWS": [
"arn:aws:iam::account_id:user/KeyUser",
"arn:aws:iam::account_id: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::account_id:user/KeyUser",
"arn:aws:iam::account_id:root"
]},
"Action": [
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant"
],
"Resource": "*",
"Condition": {"Bool": {"kms:GrantIsForAWSResource": true}}
}
]
}
RDS API
To clone an Aurora cluster owned by another AWS account using the RDS API
1. Accept the invitation from the AWS account that owns the DB cluster, as shown preceding.
2. Clone the cluster by specifying the full ARN of the source cluster in the
SourceDBClusterIdentifier parameter of the RDS API operation
RestoreDBClusterToPointInTime.
If the ARN passed as the SourceDBClusterIdentifier hasn't been shared, then the same error is
returned as if the specified cluster doesn't exist.
3. If the cluster that you are cloning is encrypted, include a KmsKeyId parameter to encrypt your
cloned cluster. This kms-key-id value can be the same one used to encrypt the original DB cluster,
or your own customer master key (CMK). Your account must have permission to use that encryption
key.
When cloning a volume, the destination account must have permission to use the encryption key
used to encrypt the source cluster. Aurora encrypts the new cloned cluster with the encryption key
specified in KmsKeyId.
The account owning the encryption key must grant permission to use the key to the destination
account by using a key policy. This process is similar to how encrypted snapshots are shared, by
using a key policy that grants permission to the destination account to use the key. An example of a
key policy follows.
265
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
"Id": "key-policy-1",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow use of the key",
"Effect": "Allow",
"Principal": {"AWS": [
"arn:aws:iam::account_id:user/KeyUser",
"arn:aws:iam::account_id: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::account_id:user/KeyUser",
"arn:aws:iam::account_id:root"
]},
"Action": [
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant"
],
"Resource": "*",
"Condition": {"Bool": {"kms:GrantIsForAWSResource": true}}
}
]
}
AWS CLI
The following example shows how actual or potential cross-account clone DB clusters appear
in describe-db-clusters output. For existing clusters owned by your AWS account, the
CrossAccountClone field indicates whether the cluster is a clone of a DB cluster that is owned by
another AWS account.
In some cases, an entry might have a different AWS account number than yours in the
DBClusterArn field. In this case, that entry represents a cluster that is owned by a different AWS
account and that you can clone. Such entries have few fields other than DBClusterArn. When
creating the cloned cluster, specify the same StorageEncrypted, Engine, and EngineVersion
values as in the original cluster.
266
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
RDS API
For existing clusters owned by your AWS account, the CrossAccountClone field indicates whether
the cluster is a clone of a DB cluster owned by another AWS account. Entries with a different AWS
account number in the DBClusterArn field represent clusters that you can clone and that are
owned by other AWS accounts. These entries have few fields other than DBClusterArn. When
creating the cloned cluster, specify the same StorageEncrypted, Engine, and EngineVersion
values as in the original cluster.
The following example shows a return value that demonstrates both actual and potential cloned
clusters.
{
"DBClusters": [
{
"EarliestRestorableTime": "2019-05-01T21:17:54.106Z",
"Engine": "aurora",
"EngineVersion": "5.6.10a",
"CrossAccountClone": false,
...
},
{
"EarliestRestorableTime": "2019-04-09T16:01:07.398Z",
"Engine": "aurora",
"EngineVersion": "5.6.10a",
"CrossAccountClone": true,
...
},
267
Amazon Aurora User Guide for Aurora
Cross-Account Cloning
{
"StorageEncrypted": false,
"DBClusterArn": "arn:aws:rds:us-east-1:12345678:cluster:cluster-abcdefgh",
"Engine": "aurora",
"EngineVersion": "5.6.10a"
}
]
}
268
Amazon Aurora User Guide for Aurora
Integrating with AWS Services
Topics
• Integrating AWS Services with Amazon Aurora MySQL (p. 269)
• Integrating AWS Services with Amazon Aurora PostgreSQL (p. 269)
• Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270)
• Using Machine Learning (ML) Capabilities with Amazon Aurora (p. 285)
• Synchronously or asynchronously invoke an AWS Lambda function using the native functions
lambda_sync or lambda_async. Or, asynchronously invoke an AWS Lambda function using the
mysql.lambda_async procedure.
• Load data from text or XML files stored in an Amazon S3 bucket into your DB cluster using the LOAD
DATA FROM S3 or LOAD XML FROM S3 command.
• Save data to text files stored in an Amazon S3 bucket from your DB cluster using the SELECT INTO
OUTFILE S3 command.
• Automatically add or remove Aurora Replicas with Application Auto Scaling. For more information, see
Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270).
For more information about integrating Aurora MySQL with other AWS services, see Integrating Amazon
Aurora MySQL with Other AWS Services (p. 653).
• Quickly collect, view, and assess performance on your relational database workloads with Performance
Insights.
• Automatically add or remove Aurora Replicas with Aurora Auto Scaling. For more information, see
Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270).
For more information about integrating Aurora PostgreSQL with other AWS services, see Integrating
Amazon Aurora PostgreSQL with Other AWS Services (p. 864).
269
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
You define and apply a scaling policy to an Aurora DB cluster. The scaling policy defines the minimum
and maximum number of Aurora Replicas that Aurora Auto Scaling can manage. Based on the policy,
Aurora Auto Scaling adjusts the number of Aurora Replicas up or down in response to actual workloads,
determined by using Amazon CloudWatch metrics and target values.
You can use the AWS Management Console to apply a scaling policy based on a predefined metric.
Alternatively, you can use either the AWS CLI or Aurora Auto Scaling API to apply a scaling policy based
on a predefined or custom metric.
Topics
• Before You Begin (p. 270)
• Aurora Auto Scaling Policies (p. 271)
• Adding a Scaling Policy (p. 272)
• Editing a Scaling Policy (p. 281)
• Deleting a Scaling Policy (p. 283)
• Related Topics (p. 284)
Aurora Auto Scaling only scales a DB cluster if all Aurora Replicas in a DB cluster are in the available
state. If any of the Aurora Replicas are in a state other than available, Aurora Auto Scaling waits until the
whole DB cluster becomes available for scaling.
When Aurora Auto Scaling adds a new Aurora Replica, the new Aurora Replica is the same DB instance
class as the one used by the primary instance. For more information about DB instance classes, see
DB Instance Classes (p. 33). Also, the promotion tier for new Aurora Replicas is set to the last priority,
which is 15 by default. This means that during a failover, a replica with a better priority, such as one
created manually, would be promoted first. For more information, see Fault Tolerance for an Aurora DB
Cluster (p. 287).
To benefit from Aurora Auto Scaling, your applications must support connections to new Aurora Replicas.
To do so, we recommend using the Aurora reader endpoint. For Aurora MySQL you can use a driver such
as the MariaDB Connector/J utility. For more information, see Connecting to an Amazon Aurora DB
Cluster (p. 169).
270
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
• A service-linked role
• A target metric
• Minimum and maximum capacity
• A cooldown period
Target Metric
In this type of policy, a predefined or custom metric and a target value for the metric is specified in
a target-tracking scaling policy configuration. Aurora Auto Scaling creates and manages CloudWatch
alarms that trigger the scaling policy and calculates the scaling adjustment based on the metric and
target value. The scaling policy adds or removes Aurora Replicas as required to keep the metric at, or
close to, the specified target value. In addition to keeping the metric close to the target value, a target-
tracking scaling policy also adjusts to fluctuations in the metric due to a changing workload. Such a
policy also minimizes rapid fluctuations in the number of available Aurora Replicas for your DB cluster.
For example, take a scaling policy that uses the predefined average CPU utilization metric. Such a policy
can keep CPU utilization at, or close to, a specified percentage of utilization, such as 40 percent.
Note
For each Aurora DB cluster, you can create only one Auto Scaling policy for each target metric.
You can also specify the minimum number of Aurora Replicas to be managed by Application Auto
Scaling. This value must be set to 0–15, and must be equal to or less than the value specified for the
maximum number of Aurora Replicas.
Note
The minimum and maximum capacity are set for an Aurora DB cluster. The specified values
apply to all of the policies associated with that Aurora DB cluster.
Cooldown Period
You can tune the responsiveness of a target-tracking scaling policy by adding cooldown periods that
affect scaling your Aurora DB cluster in and out. A cooldown period blocks subsequent scale-in or scale-
out requests until the period expires. These blocks slow the deletions of Aurora Replicas in your Aurora
DB cluster for scale-in requests, and the creation of Aurora Replicas for scale-out requests.
• A scale-in activity reduces the number of Aurora Replicas in your Aurora DB cluster. A scale-in
cooldown period specifies the amount of time, in seconds, after a scale-in activity completes before
another scale-in activity can start.
271
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
• A scale-out activity increases the number of Aurora Replicas in your Aurora DB cluster. A scale-out
cooldown period specifies the amount of time, in seconds, after a scale-out activity completes before
another scale-out activity can start.
When a scale-in or a scale-out cooldown period is not specified, the default for each is 300 seconds.
Topics
• Adding a Scaling Policy Using the AWS Management Console (p. 272)
• Adding a Scaling Policy Using the AWS CLI or the Application Auto Scaling API (p. 275)
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 Aurora DB cluster that you want to add a policy for.
4. Choose the Logs & events tab.
5. In the Auto scaling policies section, choose Add.
• Average CPU utilization of Aurora Replicas to create a policy based on the average CPU
utilization.
• Average connections of Aurora Replicas to create a policy based on the average number of
connections to Aurora Replicas.
8. For the target value, type one of the following:
• If you chose Average CPU utilization of Aurora Replicas in the previous step, type the percentage
of CPU utilization that you want to maintain on Aurora Replicas.
• If you chose Average connections of Aurora Replicas in the previous step, type the number of
connections that you want to maintain.
272
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
Aurora Replicas are added or removed to keep the metric close to the specified value.
9. (Optional) Open Additional Configuration to create a scale-in or scale-out cooldown period.
10. For Minimum capacity, type the minimum number of Aurora Replicas that the Aurora Auto Scaling
policy is required to maintain.
11. For Maximum capacity, type the maximum number of Aurora Replicas the Aurora Auto Scaling
policy is required to maintain.
12. Choose Add policy.
The following dialog box creates an Auto Scaling policy based an average CPU utilization of 40 percent.
The policy specifies a minimum of 5 Aurora Replicas and a maximum of 15 Aurora Replicas.
273
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
The following dialog box creates an auto scaling policy based an average number of connections of 100.
The policy specifies a minimum of two Aurora Replicas and a maximum of eight Aurora Replicas.
274
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
Adding a Scaling Policy Using the AWS CLI or the Application Auto Scaling API
You can apply a scaling policy based on either a predefined or custom metric. To do so, you can use the
AWS CLI or the Application Auto Scaling API. The first step is to register your Aurora DB cluster with
Application Auto Scaling.
Before you can use Aurora Auto Scaling with an Aurora DB cluster, you register your Aurora DB
cluster with Application Auto Scaling. You do so to define the scaling dimension and limits to be
applied to that cluster. Application Auto Scaling dynamically scales the Aurora DB cluster along the
275
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
To register your Aurora DB cluster, you can use either the AWS CLI or the Application Auto Scaling API.
AWS CLI
To register your Aurora DB cluster, use the register-scalable-target AWS CLI command with the
following parameters:
Example
In the following example, you register an Aurora DB cluster named myscalablecluster. The
registration indicates that the DB cluster should be dynamically scaled to have from one to eight Aurora
Replicas.
For Windows:
RDS API
To register your Aurora DB cluster with Application Auto Scaling, use the RegisterScalableTarget
Application Auto Scaling API operation with the following parameters:
276
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
Example
In the following example, you register an Aurora DB cluster named myscalablecluster with the
Application Auto Scaling API. This registration indicates that the DB cluster should be dynamically scaled
to have from one to eight Aurora Replicas.
POST / HTTP/1.1
Host: autoscaling.us-east-2.amazonaws.com
Accept-Encoding: identity
Content-Length: 219
X-Amz-Target: AnyScaleFrontendService.RegisterScalableTarget
X-Amz-Date: 20160506T182145Z
User-Agent: aws-cli/1.10.23 Python/2.7.11 Darwin/15.4.0 botocore/1.4.8
Content-Type: application/x-amz-json-1.1
Authorization: AUTHPARAMS
{
"ServiceNamespace": "rds",
"ResourceId": "cluster:myscalablecluster",
"ScalableDimension": "rds:cluster:ReadReplicaCount",
"MinCapacity": 1,
"MaxCapacity": 8
}
A target-tracking scaling policy configuration is represented by a JSON block that the metrics and target
values are defined in. You can save a scaling policy configuration as a JSON block in a text file. You use
that text file when invoking the AWS CLI or the Application Auto Scaling API. For more information about
policy configuration syntax, see TargetTrackingScalingPolicyConfiguration in the Application
Auto Scaling API Reference.
The following options are available for defining a target-tracking scaling policy configuration.
Topics
• Using a Predefined Metric (p. 277)
• Using a Custom Metric (p. 278)
• Using Cooldown Periods (p. 278)
• Disabling Scale-in Activity (p. 279)
By using predefined metrics, you can quickly define a target-tracking scaling policy for an Aurora DB
cluster that works well with both target tracking and dynamic scaling in Aurora Auto Scaling.
Currently, Aurora supports the following predefined metrics in Aurora Auto Scaling:
277
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
For more information about the CPUUtilization and DatabaseConnections metrics, see Amazon
Aurora Metrics (p. 377).
To use a predefined metric in your scaling policy, you create a target tracking configuration for
your scaling policy. This configuration must include a PredefinedMetricSpecification for the
predefined metric and a TargetValue for the target value of that metric.
Example
The following example describes a typical policy configuration for target-tracking scaling for an Aurora
DB cluster. In this configuration, the RDSReaderAverageCPUUtilization predefined metric is used to
adjust the Aurora DB cluster based on an average CPU utilization of 40 percent across all Aurora Replicas.
{
"TargetValue": 40.0,
"PredefinedMetricSpecification":
{
"PredefinedMetricType": "RDSReaderAverageCPUUtilization"
}
}
Not all Aurora metrics work for target tracking. The metric must be a valid utilization metric and describe
how busy an instance is. The value of the metric must increase or decrease in proportion to the number
of Aurora Replicas in the Aurora DB cluster. This proportional increase or decrease is necessary to use the
metric data to proportionally scale out or in the number of Aurora Replicas.
Example
The following example describes a target-tracking configuration for a scaling policy. In this configuration,
a custom metric adjusts an Aurora DB cluster based on an average CPU utilization of 50 percent across all
Aurora Replicas in an Aurora DB cluster named my-db-cluster.
{
"TargetValue": 50,
"CustomizedMetricSpecification":
{
"MetricName": "CPUUtilization",
"Namespace": "AWS/RDS",
"Dimensions": [
{"Name": "DBClusterIdentifier","Value": "my-db-cluster"},
{"Name": "Role","Value": "READER"}
],
"Statistic": "Average",
"Unit": "Percent"
}
}
278
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
cooldown period for scaling in your Aurora DB cluster. For more information about ScaleInCooldown
and ScaleOutCooldown, see TargetTrackingScalingPolicyConfiguration in the Application
Auto Scaling API Reference.
Example
The following example describes a target-tracking configuration for a scaling policy. In this configuration,
the RDSReaderAverageCPUUtilization predefined metric is used to adjust an Aurora DB cluster
based on an average CPU utilization of 40 percent across all Aurora Replicas in that Aurora DB cluster.
The configuration provides a scale-in cooldown period of 10 minutes and a scale-out cooldown period of
5 minutes.
{
"TargetValue": 40.0,
"PredefinedMetricSpecification":
{
"PredefinedMetricType": "RDSReaderAverageCPUUtilization"
},
"ScaleInCooldown": 600,
"ScaleOutCooldown": 300
}
You can specify a Boolean value for DisableScaleIn to enable or disable scale in
activity for your Aurora DB cluster. For more information about DisableScaleIn, see
TargetTrackingScalingPolicyConfiguration in the Application Auto Scaling API Reference.
Example
The following example describes a target-tracking configuration for a scaling policy. In this configuration,
the RDSReaderAverageCPUUtilization predefined metric adjusts an Aurora DB cluster based
on an average CPU utilization of 40 percent across all Aurora Replicas in that Aurora DB cluster. The
configuration disables scale-in activity for the scaling policy.
{
"TargetValue": 40.0,
"PredefinedMetricSpecification":
{
"PredefinedMetricType": "RDSReaderAverageCPUUtilization"
},
"DisableScaleIn": true
}
AWS CLI
To apply a scaling policy to your Aurora DB cluster, use the put-scaling-policy AWS CLI command
with the following parameters:
279
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
• --resource-id – The resource identifier for the Aurora DB cluster. For this parameter, the resource
type is cluster and the unique identifier is the name of the Aurora DB cluster, for example
cluster:myscalablecluster.
• --service-namespace – Set this value to rds.
• --scalable-dimension – Set this value to rds:cluster:ReadReplicaCount.
• --target-tracking-scaling-policy-configuration – The target-tracking scaling policy
configuration to use for the Aurora DB cluster.
Example
In the following example, you apply a target-tracking scaling policy named myscalablepolicy to an
Aurora DB cluster named myscalablecluster with Application Auto Scaling. To do so, you use a policy
configuration saved in a file named config.json.
For Windows:
RDS API
To apply a scaling policy to your Aurora DB cluster with the Application Auto Scaling API, use the
PutScalingPolicy Application Auto Scaling API operation with the following parameters:
Example
In the following example, you apply a target-tracking scaling policy named myscalablepolicy to
an Aurora DB cluster named myscalablecluster with Application Auto Scaling. You use a policy
configuration based on the RDSReaderAverageCPUUtilization predefined metric.
280
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
POST / HTTP/1.1
Host: autoscaling.us-east-2.amazonaws.com
Accept-Encoding: identity
Content-Length: 219
X-Amz-Target: AnyScaleFrontendService.PutScalingPolicy
X-Amz-Date: 20160506T182145Z
User-Agent: aws-cli/1.10.23 Python/2.7.11 Darwin/15.4.0 botocore/1.4.8
Content-Type: application/x-amz-json-1.1
Authorization: AUTHPARAMS
{
"PolicyName": "myscalablepolicy",
"ServiceNamespace": "rds",
"ResourceId": "cluster:myscalablecluster",
"ScalableDimension": "rds:cluster:ReadReplicaCount",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"TargetValue": 40.0,
"PredefinedMetricSpecification":
{
"PredefinedMetricType": "RDSReaderAverageCPUUtilization"
}
}
}
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 Aurora DB cluster whose auto scaling policy you want to edit.
4. Choose the Logs & events tab.
5. In the Auto scaling policies section, choose the auto scaling policy, and then choose Edit.
6. Make changes to the policy.
7. Choose Save.
281
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
Editing a Scaling Policy Using the AWS CLI or the Application Auto Scaling API
You can use the AWS CLI or the Application Auto Scaling API to edit a scaling policy in the same way that
you apply a scaling policy:
282
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
• When using the AWS CLI, specify the name of the policy you want to edit in the --policy-name
parameter. Specify new values for the parameters you want to change.
• When using the Application Auto Scaling API, specify the name of the policy you want to edit in the
PolicyName parameter. Specify new values for the parameters you want to change.
For more information, see Applying a Scaling Policy to an Aurora DB Cluster (p. 279).
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 Aurora DB cluster whose auto scaling policy you want to delete.
4. Choose the Logs & events tab.
5. In the Auto scaling policies section, choose the auto scaling policy, and then choose Delete.
Deleting a Scaling Policy Using the AWS CLI or the Application Auto Scaling API
You can use the AWS CLI or the Application Auto Scaling API to delete a scaling policy from an Aurora DB
cluster.
AWS CLI
To delete a scaling policy from your Aurora DB cluster, use the delete-scaling-policy AWS CLI
command with the following parameters:
Example
In the following example, you delete a target-tracking scaling policy named myscalablepolicy from
an Aurora DB cluster named myscalablecluster.
283
Amazon Aurora User Guide for Aurora
Using Auto Scaling with Aurora Replicas
--policy-name myscalablepolicy \
--resource-id cluster:myscalablecluster \
--service-namespace rds \
--scalable-dimension rds:cluster:ReadReplicaCount \
For Windows:
RDS API
To delete a scaling policy from your Aurora DB cluster, use the DeleteScalingPolicy the Application
Auto Scaling API operation with the following parameters:
Example
In the following example, you delete a target-tracking scaling policy named myscalablepolicy from
an Aurora DB cluster named myscalablecluster with the Application Auto Scaling API.
POST / HTTP/1.1
Host: autoscaling.us-east-2.amazonaws.com
Accept-Encoding: identity
Content-Length: 219
X-Amz-Target: AnyScaleFrontendService.DeleteScalingPolicy
X-Amz-Date: 20160506T182145Z
User-Agent: aws-cli/1.10.23 Python/2.7.11 Darwin/15.4.0 botocore/1.4.8
Content-Type: application/x-amz-json-1.1
Authorization: AUTHPARAMS
{
"PolicyName": "myscalablepolicy",
"ServiceNamespace": "rds",
"ResourceId": "cluster:myscalablecluster",
"ScalableDimension": "rds:cluster:ReadReplicaCount"
}
Related Topics
• Integrating Aurora with Other AWS Services (p. 269)
• Managing an Amazon Aurora DB Cluster (p. 227)
284
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora
This feature is suitable for many kinds of quick predictions. Examples include low-latency, real-time
use cases such as fraud detection, ad targeting, and product recommendations. The queries pass
customer profile, shopping history, and product catalog data to an Amazon SageMaker model. Then your
application gets product recommendations returned as query results.
To use this feature, it helps for your organization to already have the appropriate ML models, notebooks,
and so on available in the Amazon machine learning services. You can divide the database knowledge
and ML knowledge among the members of your team. The database developers can focus on the SQL
and database side of your application. The Aurora Machine Learning feature enables the application to
use ML processing through the familiar database interface of stored function calls.
Topics
285
Amazon Aurora User Guide for Aurora
Backing Up and Restoring an Aurora DB Cluster
Topics
• Overview of Backing Up and Restoring an Aurora DB Cluster (p. 287)
• Understanding Aurora Backup Storage Usage (p. 289)
• Creating a DB Cluster Snapshot (p. 290)
• Restoring from a DB Cluster Snapshot (p. 292)
• Copying a Snapshot (p. 295)
• Sharing a DB Cluster Snapshot (p. 305)
• Exporting DB Snapshot Data to Amazon S3 (p. 311)
• Restoring a DB Cluster to a Specified Time (p. 325)
• Deleting a Snapshot (p. 327)
286
Amazon Aurora User Guide for Aurora
Overview of Backing Up and Restoring
If the primary instance in a DB cluster using single-master replication fails, Aurora automatically fails
over to a new primary instance in one of two ways:
If the DB cluster has one or more Aurora Replicas, then an Aurora Replica is promoted to the primary
instance during a failure event. A failure event results in a brief interruption, during which read and write
operations fail with an exception. However, service is typically restored in less than 120 seconds, and
often less than 60 seconds. To increase the availability of your DB cluster, we recommend that you create
at least one or more Aurora Replicas in two or more different Availability Zones.
You can customize the order in which your Aurora Replicas are promoted to the primary instance after a
failure by assigning each replica a priority. Priorities range from 0 for the first priority to 15 for the last
priority. If the primary instance fails, Amazon RDS promotes the Aurora Replica with the better priority
to the new primary instance. You can modify the priority of an Aurora Replica at any time. Modifying the
priority doesn't trigger a failover.
More than one Aurora Replica can share the same priority, resulting in promotion tiers. If two or more
Aurora Replicas share the same priority, then Amazon RDS promotes the replica that is largest in size. If
two or more Aurora Replicas share the same priority and size, then Amazon RDS promotes an arbitrary
replica in the same promotion tier.
If the DB cluster doesn't contain any Aurora Replicas, then the primary instance is recreated during a
failure event. A failure event results in an interruption during which read and write operations fail with
an exception. Service is restored when the new primary instance is created, which typically takes less
than 10 minutes. Promoting an Aurora Replica to the primary instance is much faster than creating a
new primary instance.
Note
Amazon Aurora also supports replication with an external MySQL database, or an RDS MySQL
DB instance. For more information, see Replication Between Aurora and MySQL or Between
Aurora and Another Aurora DB Cluster (p. 611).
Backups
Aurora backs up your cluster volume automatically and retains restore data for the length of the backup
retention period. Aurora backups are continuous and incremental so you can quickly restore to any point
within the backup retention period. No performance impact or interruption of database service occurs
as backup data is being written. You can specify a backup retention period, from 1 to 35 days, when you
create or modify a DB cluster.
If you want to retain a backup beyond the backup retention period, you can also take a snapshot of
the data in your cluster volume. Because Aurora retains incremental restore data for the entire backup
287
Amazon Aurora User Guide for Aurora
Overview of Backing Up and Restoring
retention period, you only need to create a snapshot for data that you want to retain beyond the backup
retention period. You can create a new DB cluster from the snapshot.
Note
• For Amazon Aurora DB clusters, the default backup retention period is one day regardless of
how the DB cluster is created.
• You cannot disable automated backups on Aurora. The backup retention period for Aurora is
managed by the DB cluster.
Your costs for backup storage depend upon the amount of Aurora backup and snapshot data you keep
and how long you keep it. For information about the storage associated with Aurora backups and
snapshots, see Understanding Aurora Backup Storage Usage (p. 289). For pricing information about
Aurora backup storage, see Amazon RDS for Aurora Pricing. After the Aurora cluster associated with a
snapshot is deleted, storing that snapshot incurs the standard backup storage charges for Aurora.
Restoring Data
You can recover your data by creating a new Aurora DB cluster from the backup data that Aurora retains,
or from a DB cluster snapshot that you have saved. You can quickly restore a new copy of a DB cluster
created from backup data to any point in time during your backup retention period. The continuous and
incremental nature of Aurora backups during the backup retention period means you don't need to take
frequent snapshots of your data to improve restore times.
To determine the latest or earliest restorable time for a DB instance, look for the Latest Restorable
Time or Earliest Restorable Time values on the RDS console. For information about viewing these
values, see Viewing an Amazon Aurora DB Cluster (p. 366). The latest restorable time for a DB cluster is
the most recent point at which you can restore your DB cluster, typically within 5 minutes of the current
time. The earliest restorable time specifies how far back within the backup retention period that you can
restore your cluster volume.
You can determine when the restore of a DB cluster is complete by checking the Latest Restorable
Time and Earliest Restorable Time values. The Latest Restorable Time and Earliest
Restorable Time values return NULL until the restore operation is complete. You can't request a
backup or restore operation if Latest Restorable Time or Earliest Restorable Time returns
NULL.
For information about restoring a DB cluster to a specified time, see Restoring a DB Cluster to a Specified
Time (p. 325).
Backtrack
Aurora MySQL now supports "rewinding" a DB cluster to a specific time, without restoring data from a
backup. For more information, see Backtracking an Aurora DB Cluster (p. 552).
288
Amazon Aurora User Guide for Aurora
Backup Storage
To control your costs, you can monitor the amount of storage consumed by continuous backups and
manual snapshots that persist beyond the retention period. Then you can reduce the backup retention
interval and remove manual snapshots when they are no longer needed.
You can monitor your Aurora clusters and build reports using CloudWatch metrics through the
CloudWatch console. For more information about how to use CloudWatch metrics, see Overview of
Monitoring Amazon RDS (p. 354) and the table of metrics in Amazon RDS Metrics (p. 358).
The backtrack setting for an Aurora DB cluster doesn't affect the volume of backup data for that
cluster. Amazon bills the storage for backtrack data separately. You can also find the backtrack pricing
information on the Amazon Aurora Pricing web page.
If you share a snapshot with another user, you are still the owner of that snapshot. The storage costs
apply to the snapshot owner. If you delete a shared snapshot that you own, nobody can access it. To keep
access to a shared snapshot owned by someone else, you can copy that snapshot. Doing so makes you
the owner of the new snapshot. Any storage costs for the copied snapshot apply to your account.
289
Amazon Aurora User Guide for Aurora
Creating a DB Cluster Snapshot
You can create a DB cluster snapshot using the AWS Management Console, the AWS CLI, or the RDS API.
Console
To create a DB cluster 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 a writer instance for the DB cluster.
4. Choose Actions, and then choose Take snapshot.
AWS CLI
When you create a DB cluster snapshot using the AWS CLI, you need to identify which DB cluster you
are going to back up, and then give your DB cluster snapshot a name so you can restore from it later.
290
Amazon Aurora User Guide for Aurora
Creating a DB Cluster Snapshot
You can do this by using the AWS CLI create-db-cluster-snapshot command with the following
parameters:
• --db-cluster-identifier
• --db-cluster-snapshot-identifier
In this example, you create a DB cluster snapshot named mydbclustersnapshot for a DB cluster called
mydbcluster.
Example
For Windows:
RDS API
When you create a DB cluster snapshot using the Amazon RDS API, you need to identify which DB cluster
you are going to back up, and then give your DB cluster snapshot a name so you can restore from it
later. You can do this by using the Amazon RDS API CreateDBClusterSnapshot command with the
following parameters:
• DBClusterIdentifier
• DBClusterSnapshotIdentifier
You can also use the wait db-cluster-snapshot-available CLI command to poll the API every 30
seconds until the snapshot is available.
291
Amazon Aurora User Guide for Aurora
Restoring from a DB Cluster Snapshot
• If you're using the Amazon RDS console, you can specify a custom security group to associate
with the cluster 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 cluster by including the --vpc-security-group-ids option in the restore-db-
cluster-from-snapshot command.
• If you're using the Amazon RDS API, you can include the
VpcSecurityGroupIds.VpcSecurityGroupId.N parameter in the
RestoreDBClusterFromSnapshot action.
As soon as the restore is complete and your new DB cluster 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 cluster with the RDS console, the AWS CLI modify-db-cluster command, or the
ModifyDBCluster Amazon RDS API operation. For more information, see Modifying an Amazon Aurora
DB Cluster (p. 232).
With Aurora MySQL, you can also restore a DB cluster snapshot to an Aurora Serverless DB cluster. For
more information, see Restoring an Aurora Serverless DB Cluster (p. 130).
With Aurora MySQL, you can restore a DB cluster snapshot from a cluster without parallel query to a
cluster with parallel query. Because parallel query is typically used with very large tables, the snapshot
mechanism is the fastest way to ingest large volumes of data to an Aurora MySQL parallel query-enabled
cluster. For more information, see Working with Parallel Query for Amazon Aurora MySQL (p. 570).
292
Amazon Aurora User Guide for Aurora
Restoring from a DB Cluster Snapshot
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the DB cluster snapshot that you want to restore from.
4. For Actions, choose Restore Snapshot.
5. On the Restore DB Instance page, for DB Instance Identifier, enter the name for your restored DB
cluster.
6. Choose Restore DB Instance.
AWS CLI
To restore a DB cluster from a DB cluster snapshot, use the AWS CLI command restore-db-cluster-from-
snapshot.
In this example, you restore from a previously created DB cluster snapshot named mydbclustersnapshot.
You restore to a new DB cluster named mynewdbcluster.
Example
For Windows:
After the DB cluster has been restored, you must add the DB cluster to the security group used by the DB
cluster used to create the DB cluster snapshot if you want the same functionality as that of the previous
DB cluster.
Important
If you use the console to restore a DB cluster, then Amazon RDS automatically creates the
primary instance (writer) for your DB cluster. If you use the AWS CLI to restore a DB cluster,
you must explicitly create the primary instance for your DB cluster. The primary instance is the
first instance that is created in a DB cluster. Call the create-db-instance AWS CLI command to
create the primary instance for your DB cluster. Include the name of the DB cluster as the --db-
cluster-identifier option value.
RDS API
To restore a DB cluster from a DB cluster snapshot, call the RDS API operation
RestoreDBClusterFromSnapshot with the following parameters:
• DBClusterIdentifier
• SnapshotIdentifier
293
Amazon Aurora User Guide for Aurora
Restoring from a DB Cluster Snapshot
Important
If you use the console to restore a DB cluster, then Amazon RDS automatically creates the
primary instance (writer) for your DB cluster. If you use the RDS API to restore a DB cluster,
you must explicitly create the primary instance for your DB cluster. The primary instance is
the first instance that is created in a DB cluster. Call the RDS API operation CreateDBInstance
to create the primary instance for your DB cluster. Include the name of the DB cluster as the
DBClusterIdentifier parameter value.
294
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Copying a Snapshot
With Amazon RDS, you can copy automated or manual DB cluster 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.
You can't copy a DB cluster snapshot across Regions and accounts in a single step. Perform one step for
each of these copy actions. As an alternative to copying, you can also share manual snapshots with other
AWS accounts. For more information, see Sharing a DB Cluster Snapshot (p. 305).
Note
Amazon bills you based upon the amount of Aurora backup and snapshot data you keep and
the period of time that you keep it. For information about the storage associated with Aurora
backups and snapshots, see Understanding Aurora Backup Storage Usage (p. 289). For pricing
information about Aurora storage, see Amazon RDS for Aurora Pricing.
Limitations
The following are some limitations when you copy snapshots:
• You can't copy a snapshot to or from the following AWS Regions: China (Beijing) or China (Ningxia).
• You can copy a snapshot between AWS GovCloud (US-East) and AWS GovCloud (US-West), but you
can't copy a snapshot between these AWS GovCloud (US) Regions and other AWS Regions.
• If you delete a source snapshot before the target snapshot becomes available, the snapshot copy may
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 Regions involved and the amount of data to be copied, a cross-Region snapshot
copy can take hours to complete. If there is a large number of cross-Region snapshot copy requests
from a given source AWS Region, 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
copy starts.
Snapshot Retention
Amazon RDS deletes automated snapshots at the end of their retention period, when you disable
automated snapshots for a DB cluster, or when you delete a DB cluster. 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 only copy a shared DB cluster snapshot, whether encrypted or not, in the same AWS Region. For
more information, see Sharing an Encrypted Snapshot (p. 305).
295
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Handling Encryption
You can copy a snapshot that has been encrypted using an AWS KMS encryption key. If you copy
an encrypted snapshot, the copy of the snapshot must also be encrypted. If you copy an encrypted
snapshot within the same AWS Region, you can encrypt the copy with the same KMS encryption key
as the original snapshot, or you can specify a different KMS encryption key. If you copy an encrypted
snapshot across Regions, you can't use the same KMS encryption key for the copy as used for the source
snapshot, because KMS keys are Region-specific. Instead, you must specify a KMS key valid in the
destination AWS Region.
The source snapshot remains encrypted throughout the copy process. For more information, see
Limitations of Amazon Aurora Encrypted DB Clusters (p. 1005).
Note
For Amazon Aurora DB cluster snapshots, you can't encrypt an unencrypted DB cluster snapshot
when you copy the snapshot.
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 AWS Region. In these 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 copy starts.
Cross-Region snapshot copy isn't supported in the following opt-in AWS Regions:
Note
Aurora doesn't support incremental snapshot copying. Aurora DB cluster snapshot copies are
always full copies.
1. In the destination AWS Region, create a DB cluster parameter group with the same settings as the
original DB cluster. 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 cluster and add the
new or existing parameter group from the previous step.
296
Amazon Aurora User Guide for Aurora
Copying a Snapshot
For each AWS account, you can copy up to five DB cluster snapshots at a time from one AWS Region to
another. Copying both encrypted and unencrypted DB cluster snapshots is supported. If you copy a DB
cluster snapshot to another AWS Region, you create a manual DB cluster snapshot that is retained in
that AWS Region. Copying a DB cluster 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 cluster snapshot copy has been created in the new AWS Region, the DB cluster snapshot
copy behaves the same as all other DB cluster snapshots in that AWS Region.
Console
This procedure works for copying encrypted or unencrypted DB cluster snapshots, in the same AWS
Region or across Regions.
To cancel a copy operation once it is in progress, delete the target DB cluster snapshot while that DB
cluster snapshot is in copying status.
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 check box for the DB cluster snapshot you want to copy.
4. For Actions, choose Copy Snapshot. The Make Copy of DB Snapshot page appears.
297
Amazon Aurora User Guide for Aurora
Copying a Snapshot
5. (Optional) To copy the DB cluster snapshot to a different AWS Region, choose that AWS Region for
Destination Region.
6. Type the name of the DB cluster snapshot copy in New DB Snapshot Identifier.
7. To copy tags and values from the snapshot to the copy of the snapshot, choose Copy Tags.
8. Choose Copy Snapshot.
To cancel a copy operation once it is in progress, delete the target DB cluster snapshot identified by --
target-db-cluster-snapshot-identifier or TargetDBClusterSnapshotIdentifier while
that DB cluster snapshot is in copying status.
298
Amazon Aurora User Guide for Aurora
Copying a Snapshot
AWS CLI
To copy a DB cluster snapshot, use the AWS CLI copy-db-cluster-snapshot command. If you
are copying the snapshot to another AWS Region, run the command in the AWS Region to which the
snapshot will be copied.
Example
For Windows:
RDS API
To copy a DB cluster snapshot, use the Amazon RDS API CopyDBClusterSnapshot operation. If you
are copying the snapshot to another AWS Region, perform the action in the AWS Region to which the
snapshot will be copied.
299
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Example
https://rds.us-west-1.amazonaws.com/
?Action=CopyDBClusterSnapshot
&CopyTags=true
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SourceDBSnapshotIdentifier=arn%3Aaws%3Ards%3Aus-east-1%3A123456789012%3Acluster-
snapshot%3Aaurora-cluster1-snapshot-20130805
&TargetDBSnapshotIdentifier=myclustersnapshotcopy
&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
To cancel a copy operation once it is in progress, delete the target DB cluster snapshot identified by --
target-db-cluster-snapshot-identifier or TargetDBClusterSnapshotIdentifier while
that DB cluster snapshot is in copying status.
AWS CLI
To copy a DB cluster snapshot, use the AWS CLI copy-db-cluster-snapshot command. If you
are copying the snapshot to another AWS Region, run the command in the AWS Region to which the
snapshot will be copied.
• --source-region – If you are copying the snapshot to another AWS Region, specify the AWS Region
that the encrypted DB cluster snapshot will be copied from.
If you are copying the snapshot to another AWS Region and you don't specify source-region, you
must specify the pre-signed-url option instead. The pre-signed-url value must be a URL that
contains a Signature Version 4 signed request for the CopyDBClusterSnapshot action to be called
in the source AWS Region where the DB cluster snapshot is copied from. To learn more about the pre-
signed-url, see copy-db-cluster-snapshot.
• --source-db-cluster-snapshot-identifier – The identifier for the encrypted DB cluster
snapshot to be copied. If you are copying the snapshot to another AWS Region, this identifier must be
in the ARN format for the source AWS Region. If that is the case, the AWS Region specified in source-
db-cluster-snapshot-identifier must match the AWS Region specified for --source-region.
• --target-db-cluster-snapshot-identifier – The identifier for the new copy of the encrypted
DB cluster snapshot.
• --kms-key-id – The KMS key identifier for the key to use to encrypt the copy of the DB cluster
snapshot.
You can optionally use this option if the DB cluster snapshot is encrypted, you are copying the
snapshot in the same AWS Region, and you want to specify a new KMS encryption key to use to
encrypt the copy. Otherwise, the copy of the DB cluster snapshot is encrypted with the same KMS key
as the source DB cluster snapshot.
You must use this option if the DB cluster snapshot is encrypted and you are copying the snapshot to
another AWS Region. In that case, you must specify a KMS key for the destination AWS Region.
300
Amazon Aurora User Guide for Aurora
Copying a Snapshot
The following code example copies the encrypted DB cluster snapshot from the us-west-2 Region to the
us-east-1 Region. The command is called in the us-east-1 Region.
Example
For Linux, macOS, or Unix:
For Windows:
RDS API
To copy a DB cluster snapshot, use the Amazon RDS API CopyDBClusterSnapshot operation. If you
are copying the snapshot to another AWS Region, perform the action in the AWS Region to which the
snapshot will be copied.
You can optionally use this parameter if the DB cluster snapshot is encrypted, you are copying the
snapshot in the same AWS Region, and you want to specify a new KMS encryption key to use to
encrypt the copy. Otherwise, the copy of the DB cluster snapshot is encrypted with the same KMS key
as the source DB cluster snapshot.
You must use this parameter if the DB cluster snapshot is encrypted and you are copying the snapshot
to another AWS Region. In that case, you must specify a KMS key for the destination AWS Region.
• PreSignedUrl – If you are copying the snapshot to another AWS Region, you must specify the
PreSignedUrl parameter. The PreSignedUrl value must be a URL that contains a Signature
Version 4 signed request for the CopyDBClusterSnapshot action to be called in the source AWS
Region where the DB cluster snapshot is copied from. To learn more about using a presigned URL, see
CopyDBClusterSnapshot.
To automatically rather than manually generate a presigned URL, use the AWS CLI copy-db-
cluster-snapshot command with the --source-region option instead.
The following code example copies the encrypted DB cluster snapshot from the us-west-2 Region to the
us-east-1 Region. The action is called in the us-east-1 Region.
301
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Example
https://rds.us-east-1.amazonaws.com/
?Action=CopyDBClusterSnapshot
&KmsKeyId=my-us-east-1-key
&PreSignedUrl=https%253A%252F%252Frds.us-west-2.amazonaws.com%252F
%253FAction%253DCopyDBClusterSnapshot
%2526DestinationRegion%253Dus-east-1
%2526KmsKeyId%253Dmy-us-east-1-key
%2526SourceDBClusterSnapshotIdentifier%253Darn%25253Aaws%25253Ards%25253Aus-
west-2%25253A123456789012%25253Acluster-snapshot%25253Aaurora-cluster1-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
&SourceDBClusterSnapshotIdentifier=arn%3Aaws%3Ards%3Aus-
west-2%3A123456789012%3Acluster-snapshot%3Aaurora-cluster1-snapshot-20161115
&TargetDBClusterSnapshotIdentifier=myclustersnapshotcopy
&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
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=da4f2da66739d2e722c85fcfd225dc27bba7e2b8dbea8d8612434378e52adccf
To list all of the AWS accounts permitted to restore a DB cluster snapshot, use the
DescribeDBSnapshotAttributes or DescribeDBClusterSnapshotAttributes API operation.
302
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Use the following procedure to copy an unencrypted DB cluster snapshot to another account in the same
AWS Region.
Running the following example using the account 987654321 permits two AWS account identifiers,
123451234512 and 123456789012, to restore the DB cluster snapshot named manual-
snapshot1.
https://rds.us-west-2.amazonaws.com/
?Action=ModifyDBClusterSnapshotAttribute
&AttributeName=restore
&DBClusterSnapshotIdentifier=manual-snapshot1
&SignatureMethod=HmacSHA256&SignatureVersion=4
&ValuesToAdd.member.1=123451234512
&ValuesToAdd.member.2=123456789012
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
&X-Amz-Date=20150922T220515Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=ef38f1ce3dab4e1dbf113d8d2a265c67d17ece1999ffd36be85714ed36dddbb3
Running the following example using the account 123451234512 copies the DB cluster snapshot
aurora-cluster1-snapshot-20130805 from account 987654321 and creates a DB cluster
snapshot named dbclustersnapshot1.
https://rds.us-west-2.amazonaws.com/
?Action=CopyDBClusterSnapshot
&CopyTags=true
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SourceDBClusterSnapshotIdentifier=arn:aws:rds:us-west-2:987654321:cluster-
snapshot:aurora-cluster1-snapshot-20130805
&TargetDBClusterSnapshotIdentifier=dbclustersnapshot1
&Version=2013-09-09
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/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
Use the following procedure to copy an encrypted DB cluster snapshot to another account in the same
AWS Region.
303
Amazon Aurora User Guide for Aurora
Copying a Snapshot
Running the following example using the account 987654321 permits two AWS account identifiers,
123451234512 and 123456789012, to restore the DB cluster snapshot named manual-
snapshot1.
https://rds.us-west-2.amazonaws.com/
?Action=ModifyDBClusterSnapshotAttribute
&AttributeName=restore
&DBClusterSnapshotIdentifier=manual-snapshot1
&SignatureMethod=HmacSHA256&SignatureVersion=4
&ValuesToAdd.member.1=123451234512
&ValuesToAdd.member.2=123456789012
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
&X-Amz-Date=20150922T220515Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=ef38f1ce3dab4e1dbf113d8d2a265c67d17ece1999ffd36be85714ed36dddbb3
2. In the source account for the DB cluster snapshot, update the key policy for the KMS key, first adding
the ARN of the target account as a Principal, and then allow the kms:CreateGrant action. For
more information, see Allowing Access to an AWS KMS Encryption Key (p. 306).
3. In the target account, choose or create an IAM user and attach an IAM policy to that user that allows
it to copy an encrypted DB cluster snapshot using your KMS key. For more information, see Creating
an IAM Policy to Enable Copying of the Encrypted Snapshot (p. 307).
4. In the target account, call CopyDBClusterSnapshot and use the
SourceDBClusterSnapshotIdentifier parameter to specify the ARN of the DB cluster
snapshot to be copied, which must include the ID for the source account.
Running the following example using the account 123451234512 copies the DB cluster snapshot
aurora-cluster1-snapshot-20130805 from account 987654321 and creates a DB cluster
snapshot named dbclustersnapshot1.
https://rds.us-west-2.amazonaws.com/
?Action=CopyDBClusterSnapshot
&CopyTags=true
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SourceDBClusterSnapshotIdentifier=arn:aws:rds:us-west-2:987654321:cluster-
snapshot:aurora-cluster1-snapshot-20130805
&TargetDBClusterSnapshotIdentifier=dbclustersnapshot1
&Version=2013-09-09
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/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
304
Amazon Aurora User Guide for Aurora
Sharing a Snapshot
• Sharing a manual DB cluster snapshot, whether encrypted or unencrypted, enables authorized AWS
accounts to copy the snapshot.
• Sharing a manual DB cluster snapshot, whether encrypted or unencrypted, enables authorized AWS
accounts to directly restore a DB cluster from the snapshot instead of taking a copy of it and restoring
from that.
Note
To share an automated DB cluster snapshot, create a manual DB cluster snapshot by copying the
automated snapshot, and then share that copy.
For more information on copying a snapshot, see Copying a Snapshot (p. 295). For more information on
restoring a DB instance from a DB cluster snapshot, see Restoring from a DB Cluster Snapshot (p. 292).
For more information on restoring a DB cluster from a DB cluster snapshot, see Overview of Backing Up
and Restoring an Aurora DB Cluster (p. 287).
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.
The following limitations apply when sharing manual snapshots with other AWS accounts:
• When you restore a DB cluster 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.
1. Share the AWS Key Management Service (AWS KMS) encryption key 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 encryption keys with another AWS account by adding the other account to
the KMS key policy. For details on updating a key policy, see Key Policies in the AWS KMS Developer
Guide. For an example of creating a key policy, see Allowing Access to an AWS KMS Encryption
Key (p. 306) 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.
305
Amazon Aurora User Guide for Aurora
Sharing a Snapshot
After you have given an AWS account access to your KMS encryption key, 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 cluster snapshot using your KMS key. The account must be
an IAM user and cannot be a root AWS account identity due to KMS security restrictions.
In the following key policy example, user 111122223333 is the owner of the KMS encryption key, and
user 444455556666 is the account that the key is being shared with. This updated key policy gives the
AWS account access to the KMS key by including the ARN for the root AWS account identity for user
444455556666 as a Principal for the policy, and by allowing the kms:CreateGrant action.
{
"Id": "key-policy-1",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow use of the key",
"Effect": "Allow",
"Principal": {"AWS": [
"arn:aws:iam::111122223333:user/KeyUser",
"arn:aws:iam::444455556666:root"
]},
"Action": [
"kms:CreateGrant",
"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}}
}
]
}
306
Amazon Aurora User Guide for Aurora
Sharing a Snapshot
Once the external AWS account has access to your KMS key, the owner of that AWS account can create
a policy that allows an IAM user created for that account to copy an encrypted snapshot encrypted with
that KMS key.
The following example shows a policy that can be attached to an IAM user for AWS account
444455556666 that enables the IAM user to copy a shared snapshot from AWS account 111122223333
that has been encrypted with the KMS key c989c1dd-a3f2-4a5d-8d96-e793d082ab26 in the us-
west-2 region.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUseOfTheKey",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey",
"kms:CreateGrant",
"kms:RetireGrant"
],
"Resource": ["arn:aws:kms:us-west-2:111122223333:key/c989c1dd-a3f2-4a5d-8d96-
e793d082ab26"]
},
{
"Sid": "AllowAttachmentOfPersistentResources",
"Effect": "Allow",
"Action": [
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant"
],
"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 cluster 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 cluster snapshot with up to 20 AWS
accounts. You can also use the console to stop sharing a manual snapshot with one or more accounts.
307
Amazon Aurora User Guide for Aurora
Sharing a 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 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 cluster
from your manual DB cluster snapshot, or choose Private to permit only AWS accounts that you
specify to restore a DB cluster from your manual DB cluster snapshot.
Warning
If you set DB snapshot visibility to Public, all AWS accounts can restore a DB cluster from
your manual DB cluster snapshot and have access to your data. Do not share any manual
DB cluster snapshots that contain private information as Public.
• If the source is encrypted, DB snapshot visibility is set as Private because encrypted snapshots
can't be shared as public.
6. For AWS Account ID, type the AWS account identifier for an account that you want to permit to
restore a DB cluster 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.
308
Amazon Aurora User Guide for Aurora
Sharing a 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 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.
AWS CLI
The following example permits two AWS account identifiers, 123451234512 and 123456789012, to
restore the DB cluster snapshot named manual-cluster-snapshot1, and removes the all attribute
value to mark the snapshot as private.
309
Amazon Aurora User Guide for Aurora
Sharing a Snapshot
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.
RDS API
You can also share a manual DB cluster snapshot with other AWS accounts by using the Amazon RDS
API. To do so, call the ModifyDBClusterSnapshotAttribute 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.
To list all of the AWS accounts permitted to restore a snapshot, use the
DescribeDBClusterSnapshotAttributes API operation.
310
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
When you export a DB snapshot, Amazon Aurora 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 manual snapshots and automated system snapshots. By default, all data in the snapshot
is exported. However, you can choose to export specific sets of databases, schemas, or tables.
Note
You can copy a snapshot from an AWS Region where S3 export isn't supported to one where it is
supported, then export the copy. The S3 bucket must be in the same AWS Region as the copy.
The following lists show the engine versions that are supported for exporting snapshot data to Amazon
S3.
Aurora MySQL
• Versions 1.19.2, 1.19.3, 1.19.4, and 1.19.5 compatible with MySQL 5.6
• Versions 2.04.4, 2.04.5, and 2.04.6 compatible with MySQL 5.7
For more information about Aurora MySQL engine versions, see Database Engine Updates for Amazon
Aurora MySQL (p. 733).
Aurora PostgreSQL
For more information about Aurora PostgreSQL engine versions, see Engine Versions for Amazon Aurora
PostgreSQL (p. 961).
Topics
• Overview of Exporting Snapshot Data (p. 312)
• Setting Up Access to an Amazon S3 Bucket (p. 312)
• Exporting a Snapshot to an Amazon S3 Bucket (p. 314)
• Monitoring Snapshot Exports (p. 316)
• Canceling a Snapshot Export Task (p. 317)
• Data Conversion When Exporting to an Amazon S3 Bucket (p. 318)
311
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
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
to Export to (p. 312).
b. Create an AWS Key Management Service (AWS KMS) key for the server-side encryption.
The KMS key is used by the snapshot export task to set up KMS server-side encryption
when writing the export data to S3. For more information, see Encrypting Amazon Aurora
Resources (p. 1003).
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. 312).
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. 314).
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.
Topics
• Identifying the Amazon S3 Bucket to Export to (p. 312)
• Providing Access to an Amazon S3 Bucket Using an IAM Role (p. 312)
For more information about working with Amazon S3 buckets, see How Do I View the Properties for an
S3 Bucket?, How Do I Enable Default Encryption for an Amazon S3 Bucket?, and How Do I Create an S3
Bucket? in the Amazon Simple Storage Service Console User Guide.
312
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
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.
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 Aurora
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/*
For more information on creating an IAM policy for Amazon Aurora, see Creating and Using an IAM
Policy for IAM Database Access (p. 1037). 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.
313
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
]
}'
2. Create an IAM role. You do this so that Aurora 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.
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.
Console
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.
314
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
To assign the exported data to a folder path in the S3 bucket, enter the optional path for S3 prefix.
9. For IAM role, choose a role that grants you write access to your chosen S3 bucket. If you created a
role by following the steps in Providing Access to an Amazon S3 Bucket Using an IAM Role (p. 312),
choose that role.
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:
315
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
"Status": "STARTING",
"IamRoleArn": "iam_role",
"ExportTime": "2019-08-12T01:23:53.109Z",
"S3Bucket": "my_export_bucket",
"PercentProgress": 0,
"KmsKeyId": "master_key",
"ExportTaskIdentifier": "my_snapshot_export",
"TotalExtractedDataInGB": 0,
"TaskStartTime": "2019-11-13T19:46:00.173Z",
"SourceArn": "arn:aws:rds:AWS_Region:123456789012:snapshot:snapshot_name"
}
To provide a folder path in the S3 bucket for the snapshot export, include the --s3-prefix option in
the start-export-task command.
RDS API
To export a DB snapshot to Amazon S3 using the Amazon RDS API, use the StartExportTask operation
with the following required parameters:
• ExportTaskIdentifier
• SourceArn
• S3BucketName
• IamRoleArn
• KmsKeyId
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. To monitor 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",
316
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
"S3Bucket": "awsexamplebucket",
"PercentProgress": 0,
"KmsKeyId": "arn:aws:kms:AWS_Region:123456789012:key/K7MDENG/
bPxRfiCYEXAMPLEKEY",
"ExportTaskIdentifier": "anewtest",
"IamRoleArn": "arn:aws:iam::123456789012:role/export-to-s3",
"TotalExtractedDataInGB": 0,
"TaskStartTime": "2019-10-25T19:10:58.885Z",
"SourceArn": "arn:aws:rds:AWS_Region:123456789012:snapshot:parameter-groups-
test"
},
{
"Status": "COMPLETE",
"TaskEndTime": "2019-10-31T21:37:28.312Z",
"WarningMessage": "{\"skippedTables\":[],\"skippedObjectives\":[],\"general\":
[{\"reason\":\"FAILED_TO_EXTRACT_TABLES_LIST_FOR_DATABASE\"}]}",
"S3Prefix": "",
"ExportTime": "2019-10-31T06:44:53.452Z",
"S3Bucket": "awsexamplebucket1",
"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": "awsexamplebucket2",
"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.
317
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
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
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.
• BOOLEAN
• INT32
• INT64
• INT96
318
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
• FLOAT
• DOUBLE
• BYTE_ARRAY – A variable-length byte array, also known as binary
• FIXED_LEN_BYTE_ARRAY – A fixed-length byte array used when the values have a constant size
The Parquet data types are few to reduce the complexity of reading and writing the format. Parquet
provides logical types for extending primitive types. A logical type is implemented as an annotation with
the data in a LogicalType metadata field. The logical type annotation explains how to interpret the
primitive type.
When the STRING logical type annotates a BYTE_ARRAY type, it indicates that the byte array should be
interpreted as a UTF-8 encoded character string. After an export task completes, Amazon Aurora 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.
Note
• 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.
• If the database, schema, or table name contains spaces, partial export isn't supported.
However, you can export the entire DB snapshot.
Topics
• MySQL Data Type Mapping to Parquet (p. 319)
• PostgreSQL Data Type Mapping to Parquet (p. 322)
Source Data Type Parquet Primitive Type Logical Type Conversion Notes
Annotation
BIGINT INT64
BIT BYTE_ARRAY
319
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
Source Data Type Parquet Primitive Type Logical Type Conversion Notes
Annotation
DOUBLE DOUBLE
FLOAT DOUBLE
INT INT32
MEDIUMINT INT32
SMALLINT INT32
TINYINT INT32
320
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
Source Data Type Parquet Primitive Type Logical Type Conversion Notes
Annotation
BINARY BYTE_ARRAY
BLOB BYTE_ARRAY
CHAR BYTE_ARRAY
LINESTRING BYTE_ARRAY
LONGBLOB BYTE_ARRAY
MEDIUMBLOB BYTE_ARRAY
MULTILINESTRING BYTE_ARRAY
TINYBLOB BYTE_ARRAY
VARBINARY BYTE_ARRAY
YEAR INT32
GEOMETRY BYTE_ARRAY
GEOMETRYCOLLECTION BYTE_ARRAY
321
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
Source Data Type Parquet Primitive Type Logical Type Conversion Notes
Annotation
MULTIPOINT BYTE_ARRAY
MULTIPOLYGON BYTE_ARRAY
POINT BYTE_ARRAY
POLYGON BYTE_ARRAY
PostgreSQL Data Type Parquet Primitive Type Logical Type Mapping Notes
Annotation
BIGINT INT64
BIGSERIAL INT64
This conversion is to
avoid complications due
to data precision and
data values that are not
a number (NaN).
INTEGER INT32
REAL FLOAT
SERIAL INT32
322
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
PostgreSQL Data Type Parquet Primitive Type Logical Type Mapping Notes
Annotation
This conversion is to
avoid complications due
to data precision, data
values that are not a
number (NaN), and time
data values.
BYTEA BINARY
323
Amazon Aurora User Guide for Aurora
Exporting Snapshot Data to Amazon S3
PostgreSQL Data Type Parquet Primitive Type Logical Type Mapping Notes
Annotation
BOOLEAN BOOLEAN
324
Amazon Aurora User Guide for Aurora
Point-in-Time Recovery
You can restore a DB cluster to a point in time using the AWS Management Console, the AWS CLI, or the
RDS API.
Console
To restore a DB cluster 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 Databases.
3. Choose the DB cluster that you want to restore.
4. For Actions, choose Restore to point in time.
If you chose Custom, enter the date and time that you want to restore the cluster 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.
6. For DB instance identifier, enter the name of the restored DB instance, and then complete the other
options.
7. Choose Launch DB Instance.
AWS CLI
To restore a DB cluster to a specified time, use the AWS CLI command restore-db-cluster-to-
point-in-time to create a new DB cluster.
Example
For Windows:
325
Amazon Aurora User Guide for Aurora
Point-in-Time Recovery
RDS API
To restore a DB cluster to a specified time, call the Amazon RDS API
RestoreDBClusterToPointInTime operation with the following parameters:
• SourceDBClusterIdentifier
• DBClusterIdentifier
• RestoreToTime
326
Amazon Aurora User Guide for Aurora
Deleting a Snapshot
Deleting a Snapshot
You can delete DB cluster snapshots managed by Amazon RDS when you no longer need them.
To delete a shared or public snapshot, you must sign in to the AWS account that owns the snapshot.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Snapshots.
3. Choose the DB cluster snapshot that you want to delete.
4. For Actions, choose Delete Snapshot.
5. Choose Delete on the confirmation page.
AWS CLI
You can delete a DB cluster snapshot by using the AWS CLI command delete-db-cluster-snapshot.
Example
For Windows:
RDS API
You can delete a DB cluster snapshot by using the Amazon RDS API operation DeleteDBClusterSnapshot.
327
Amazon Aurora User Guide for Aurora
Maintaining an Aurora DB Cluster
Some maintenance items require that Amazon RDS take your DB cluster 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.
You can view whether a maintenance update is available for your DB cluster 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 cluster on the Amazon RDS console, as shown following.
If no maintenance update is available for a DB cluster, the column value is none for it.
If a maintenance update is available for a DB cluster, the following column values are possible:
• required – The maintenance action will be applied to the resource and can't be deferred.
• 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.
• Schedule the maintenance items to start during your next maintenance window.
• Take no action.
328
Amazon Aurora User Guide for Aurora
Maintaining an Aurora DB Cluster
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 cluster 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
execution 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. 331).
For information about updates to Amazon Aurora engines and instructions for upgrading and patching
them, see Database Engine Updates for Amazon Aurora MySQL (p. 733) and Database Engine Updates
for Amazon Aurora PostgreSQL (p. 960).
329
Amazon Aurora User Guide for Aurora
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 cluster 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 cluster, 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.
330
Amazon Aurora User Guide for Aurora
The Maintenance Window
Example
For Windows:
You can also return a list of resources for a DB cluster 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-
cluster1 and sample-cluster2 DB clusters.
Example
For Windows:
RDS API
To apply an update to a DB cluster, 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.
331
Amazon Aurora User Guide for Aurora
The Maintenance Window
given week, it is initiated during the 30-minute maintenance window you identify. Most maintenance
events also complete during the 30-minute maintenance window, although larger maintenance events
may take more than 30 minutes to complete.
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 cluster, 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 cluster 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.
332
Amazon Aurora User Guide for Aurora
Adjusting the Maintenance Window for a DB Cluster
Console
To adjust the preferred DB cluster 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.
3. Choose the DB cluster for which you want to change the maintenance window.
4. For Actions, choose Modify cluster.
5. In the Maintenance section, update the maintenance window.
6. Choose Continue.
Alternatively, choose Back to edit your changes, or choose Cancel to cancel your changes.
AWS CLI
To adjust the preferred DB cluster maintenance window, use the AWS CLI modify-db-cluster
command with the following parameters:
• --db-cluster-identifier
• --preferred-maintenance-window
Example
The following code example sets the maintenance window to Tuesdays from 4:00–4:30 AM UTC.
For Windows:
333
Amazon Aurora User Guide for Aurora
Choosing the Frequency of Aurora
MySQL Maintenance Updates
RDS API
To adjust the preferred DB cluster maintenance window, use the Amazon RDS ModifyDBCluster API
operation with the following parameters:
• DBClusterIdentifier = my-cluster
• PreferredMaintenanceWindow = Tue:04:00-Tue:04:30
Example
The following code example sets the maintenance window to Tuesdays from 4:00–4:30 AM UTC.
https://rds.us-west-2.amazonaws.com/
?Action=ModifyDBCluster
&DBClusterIdentifier=my-cluster
&PreferredMaintenanceWindow=Tue:04:00-Tue:04:30
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140725/us-east-1/rds/aws4_request
&X-Amz-Date=20161017T161457Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=d6d1c65c2e94f5800ab411a3f7336625820b103713b6c063430900514e21d784
You might choose to upgrade an Aurora MySQL cluster rarely if some or all of the following conditions
apply:
• Your testing cycle for your application takes a long time for each update to the Aurora MySQL
database engine.
• You have many DB clusters or many applications all running on the same Aurora MySQL version. You
prefer to upgrade all of your DB clusters and associated applications at the same time.
• You use both Aurora MySQL Amazon RDS MySQL, and you prefer to keep the Aurora MySQL clusters
and RDS MySQL DB instances compatible with the same level of MySQL.
• Your Aurora MySQL application is in production or is otherwise business-critical. You can't afford
downtime for upgrades outside of rare occurrences for critical patches.
• Your Aurora MySQL application isn't limited by performance issues or feature gaps that are addressed
in subsequent Aurora MySQL versions.
If the preceding factors apply to your situation, you can limit the number of forced upgrades for an
Aurora MySQL DB cluster. You do so by choosing a specific Aurora MySQL version known as the "Long-
334
Amazon Aurora User Guide for Aurora
Choosing the Frequency of Aurora
MySQL Maintenance Updates
Term Support" (LTS) version when you create or upgrade that DB cluster. Doing so minimizes the number
of upgrade cycles, testing cycles, and upgrade-related outages for that DB cluster.
You might choose to upgrade an Aurora MySQL cluster frequently if some or all of the following
conditions apply:
If the preceding factors apply to your situation, you can enable Aurora to apply important upgrades
more frequently by upgrading an Aurora MySQL DB cluster to a more recent Aurora MySQL version than
the LTS version. Doing so makes the latest performance enhancements, bug fixes, and features available
to you more quickly.
335
Amazon Aurora User Guide for Aurora
Rebooting a DB Instance
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.
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.
Important
When you reboot the primary instance of an Amazon Aurora DB cluster, RDS also automatically
restarts all of the Aurora Replicas in that DB cluster. When you reboot the primary instance of an
Aurora DB cluster, no failover occurs. When you reboot an Aurora Replica, no failover occurs. To
fail over an Aurora DB cluster, call the AWS CLI command failover-db-cluster, or the API
operation FailoverDBCluster.
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.
AWS CLI
To reboot a DB instance by using the AWS CLI, call the reboot-db-instance command.
For Windows:
336
Amazon Aurora User Guide for Aurora
Rebooting a DB Instance
--db-instance-identifier mydbinstance
RDS API
To reboot a DB instance by using the Amazon RDS API, call the RebootDBInstance action.
337
Amazon Aurora User Guide for Aurora
Deleting a DB Instance
For Aurora MySQL, you can't delete a DB instance in a DB cluster if both of the following conditions are
true:
To delete a DB instance in this case, first promote the DB cluster so that it's no longer a read replica.
After the promotion completes, you can delete the final DB instance in the DB cluster. For more
information, see Replicating Amazon Aurora MySQL DB Clusters Across AWS Regions (p. 601).
Deletion Protection
You can enable deletion protection so that users can't delete a DB cluster. Deletion protection is enabled
by default when you create a production DB cluster using the AWS Management Console. However,
deletion protection is disabled by default if you create a cluster using the AWS CLI or API. Enabling or
disabling deletion protection doesn't cause an outage. For more information about turning deletion
protection on and off, see Modifying the DB Cluster by Using the Console, CLI, and API (p. 232).
Aurora enforces deletion protection for a DB cluster whether you perform the operation from the
console, the CLI, or the API. If you try to delete a DB cluster that has deletion protection enabled,
you can't do so. To be certain that you can delete the cluster, modify the cluster and disable deletion
protection.
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. Enter delete me in the box.
5. Choose Delete.
338
Amazon Aurora User Guide for Aurora
Using the Console, CLI, and API
AWS CLI
To delete a DB instance by using the AWS CLI, call the delete-db-instance command and specify the --
db-instance-identifier option.
Example
For Windows:
RDS API
To delete a DB instance by using the Amazon RDS API, call the DeleteDBInstance operation and
specify the DBInstanceIdentifier parameter.
339
Amazon Aurora User Guide for Aurora
Tagging RDS 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
For information on managing access to tagged resources with IAM policies, see Identity and Access
Management in Amazon Aurora (p. 1019).
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.
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
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.
340
Amazon Aurora User Guide for Aurora
Overview
• 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.
Note
You can add a tag to a snapshot, however, your bill will not reflect this grouping.
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. 345).
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.
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.
341
Amazon Aurora User Guide for Aurora
Overview
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.
5. Choose the tag you want to delete.
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.
342
Amazon Aurora User Guide for Aurora
Overview
• 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. 345).
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. 345).
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.
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.
343
Amazon Aurora User Guide for Aurora
Overview
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.
344
Amazon Aurora User Guide for Aurora
Working with ARNs
arn:aws:rds:<region>:<account number>:<resourcetype>:<name>
345
Amazon Aurora User Guide for Aurora
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>
346
Amazon Aurora User Guide for Aurora
Constructing an ARN
arn:aws:rds:us-east-2:123456789012:db:my-mysql-instance-1
DB cluster arn:aws:rds:<region>:<account>:cluster:<name>
For example:
arn:aws:rds:us-east-2:123456789012:cluster:my-aurora-
cluster-1
For example:
arn:aws:rds:us-east-2:123456789012:es:my-subscription
For example:
arn:aws:rds:us-east-2:123456789012:pg:my-param-enable-logs
For example:
arn:aws:rds:us-east-2:123456789012:cluster-pg:my-cluster-
param-timezone
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
347
Amazon Aurora User Guide for Aurora
Getting an Existing ARN
For example:
arn:aws:rds:us-east-2:123456789012:cluster-snapshot:rds:my-
aurora-cluster-2019-07-22-16-16
For example:
arn:aws:rds:us-east-2:123456789012:snapshot:my-mysql-db-
snap
For example:
arn:aws:rds:us-east-2:123456789012:cluster-snapshot:my-
aurora-cluster-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.
348
Amazon Aurora User Guide for Aurora
Getting an Existing ARN
349
Amazon Aurora User Guide for Aurora
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
describe-db-parameter-groups DBParameterGroupArn
describe-db-cluster-parameter- DBClusterParameterGroupArn
groups
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-db-clusters DBClusterArn
describe-db-cluster-snapshots DBClusterSnapshotArn
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"
350
Amazon Aurora User Guide for Aurora
Getting an Existing ARN
}
]
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
DescribeDBParameterGroups DBParameterGroupArn
DescribeDBClusterParameterGroups DBClusterParameterGroupArn
DescribeDBInstances DBInstanceArn
DescribeDBSecurityGroups DBSecurityGroupArn
DescribeDBSnapshots DBSnapshotArn
DescribeEvents SourceArn
DescribeReservedDBInstances ReservedDBInstanceArn
DescribeDBSubnetGroups DBSubnetGroupArn
DescribeDBClusters DBClusterArn
DescribeDBClusterSnapshots DBClusterSnapshotArn
351
Amazon Aurora User Guide for Aurora
Aurora Updates
Following, you can find information on general updates to Amazon Aurora. Some of the updates applied
to Amazon Aurora are specific to a database engine supported by Aurora. For more information about
database engine updates for Aurora, see the following table.
Amazon Aurora MySQL See Database Engine Updates for Amazon Aurora MySQL (p. 733)
Amazon Aurora PostgreSQL See Database Engine Updates for Amazon Aurora PostgreSQL
(p. 960)
An Aurora DB instance provides two version numbers, the Aurora version number and the Aurora
database engine version number. Aurora version numbers use the following format.
To get the Aurora version number from an Aurora DB instance using a particular database engine, use
one of the following queries.
SHOW @@aurora_version;
352
Amazon Aurora User Guide for Aurora
Topics
• Overview of Monitoring Amazon RDS (p. 354)
• Viewing an Amazon Aurora DB Cluster (p. 366)
• DB Cluster Status (p. 372)
• DB Instance Status (p. 374)
• Monitoring Amazon Aurora DB Cluster Metrics (p. 377)
• Enhanced Monitoring (p. 390)
• Using Amazon RDS Performance Insights (p. 398)
• Using Amazon Aurora Recommendations (p. 442)
• Using Database Activity Streams with Aurora PostgreSQL (p. 447)
• Using Amazon RDS Event Notification (p. 465)
• Viewing Amazon RDS Events (p. 483)
• Getting CloudWatch Events and Amazon EventBridge Events for Amazon Aurora (p. 485)
• Amazon Aurora Database Log Files (p. 489)
• Logging Amazon RDS API Calls with AWS CloudTrail (p. 501)
353
Amazon Aurora User Guide for Aurora
Overview of Monitoring
The next step is to establish a baseline for normal Amazon RDS performance in your environment, by
measuring performance at various times and under different load conditions. As you monitor Amazon
RDS, you should consider storing historical monitoring data. This stored data will give you a baseline to
compare against with current performance data, identify normal performance patterns and performance
anomalies, and devise methods to address issues.
For example, with Amazon RDS, you can monitor network throughput, I/O for read, write, and/or
metadata operations, client connections, and burst credit balances for your DB instances. When
performance falls outside your established baseline, you might need to change the instance class of your
DB instance or the number of DB instances and read replicas that are available for clients in order to
optimize your database availability for your workload.
In general, 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.
• 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 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 and DB Cluster
Parameter Groups (p. 205).
• 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.
354
Amazon Aurora User Guide for Aurora
Monitoring Tools
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, while some of the tools require manual intervention. We recommend
that you automate monitoring tasks as much as possible.
• Amazon RDS Events – Subscribe to Amazon RDS events to be notified when changes occur with a
DB instance, DB cluster, DB cluster snapshot, DB parameter group, or DB security group. For more
information, see Using Amazon RDS Event Notification (p. 465).
• Database log files – 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 Amazon Aurora Database Log Files (p. 489).
• Amazon RDS Enhanced Monitoring — Look at metrics in real time for the operating system. For more
information, see Enhanced Monitoring (p. 390).
In addition, Amazon RDS integrates with Amazon CloudWatch for additional monitoring capabilities:
• Amazon CloudWatch Metrics – Amazon RDS automatically sends metrics to CloudWatch every minute
for each active database. You are not charged additionally for Amazon RDS metrics in CloudWatch. For
more information, see the section called “Viewing DB Instance Metrics” (p. 363).
• Amazon CloudWatch Alarms – You can watch a single Amazon RDS metric over a specific time period,
and perform one or more actions based on the value of the metric relative to a threshold you set. For
more information, see Monitoring with Amazon CloudWatch (p. 356).
• 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.
• 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 utilizing
• The amount of memory and CPU being utilized for a DB instance
• The amount of network traffic to and from a DB instance
• From the AWS 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
• Aurora DB Instance Accessibility
355
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
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
Data points with a period of 60 seconds (1 minute) are available for 15 days, so that you can access
historical information and gain a better perspective on how your web application or service is
performing. For more information about CloudWatch metrics retention, see Metrics Retention in the
Amazon CloudWatch User Guide.
Note
If you are using Amazon RDS Performance Insights, additional metrics are available. For more
information, see Performance Insights Metrics Published to Amazon CloudWatch (p. 431).
Metrics are grouped first by the service namespace, and then by the various dimension combinations
within each namespace.
356
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
357
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
Metric Description
BinLogDiskUsage The amount of disk space occupied by binary logs on the master.
Applies to MySQL read replicas.
Units: Bytes
BurstBalance The percent of General Purpose SSD (gp2) burst-bucket I/O credits
available.
Units: Percent
Units: Percent
CPUCreditUsage (T2 instances) The number of CPU credits spent by the instance for
CPU utilization. One CPU credit equals one vCPU running at 100
percent utilization for one minute or an equivalent combination
of vCPUs, utilization, and time. For example, you might have one
vCPU running at 50 percent utilization for two minutes or two vCPUs
running at 25 percent utilization for two minutes.
CPUCreditBalance (T2 instances) The number of earned CPU credits that an instance
has accrued since it was launched or started. For T2 Standard, the
CPUCreditBalance also includes the number of launch credits that
have been accrued.
Credits are accrued in the credit balance after they are earned, and
removed from the credit balance when they are spent. The credit
balance has a maximum limit, determined by the instance size. After
the limit is reached, any new credits that are earned are discarded. For
T2 Standard, launch credits don't count towards the limit.
358
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
Metric Description
Units: Credits (vCPU-minutes)
Units: Count
Units: Count
The number of failed SQL Server Agent jobs during the last minute.
FailedSQLServerAgentJobsCount
Unit: Count/Minute
For Aurora, this metric reports the value of the MemAvailable field
of /proc/meminfo.
Units: Bytes
Units: Bytes
Units: Count
Units: Bytes/Second
Units: Bytes/Second
OldestReplicationSlotLag The lagging size of the replica lagging the most in terms of WAL data
received. Applies to PostgreSQL.
Units: Megabytes
ReadIOPS The average number of disk read I/O operations per second.
Units: Count/Second
359
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
Metric Description
ReadLatency The average amount of time taken per disk I/O operation.
Units: Seconds
ReadThroughput The average number of bytes read from disk per second.
Units: Bytes/Second
ReplicaLag The amount of time a read replica DB instance lags behind the source
DB instance. Applies to MySQL, MariaDB, Oracle, PostgreSQL, and
SQL Server read replicas.
Units: Seconds
ReplicationSlotDiskUsage The disk space used by replication slot files. Applies to PostgreSQL.
Units: Megabytes
SwapUsage The amount of swap space used on the DB instance. This metric is not
available for SQL Server.
Units: Bytes
Units: Megabytes
Units: Bytes/Second
WriteIOPS The average number of disk write I/O operations per second.
Units: Count/Second
WriteLatency The average amount of time taken per disk I/O operation.
Units: Seconds
Units: Bytes/Second
Dimension Description
DBInstanceIdentifier This dimension filters the data you request for a specific database
instance.
DBClusterIdentifier This dimension filters the data you request for a specific Amazon
Aurora DB cluster.
DBClusterIdentifier, This dimension filters the data you request for a specific Aurora DB
Role cluster, aggregating the metric by instance role (WRITER/READER).
360
Amazon Aurora User Guide for Aurora
Monitoring with CloudWatch
Dimension Description
For example, you can aggregate metrics for all READER instances
that belong to a cluster.
DatabaseClass This dimension filters the data you request for all instances in a
database class. For example, you can aggregate metrics for all
instances that belong to the database class db.m1.small
EngineName This dimension filters the data you request for the identified engine
name only. For example, you can aggregate metrics for all instances
that have the engine name mysql.
SourceRegion This dimension filters the data you request for the specified region
only. For example, you can aggregate metrics for all instances in the
region us-east-1.
Alarms invoke actions for sustained state changes only. CloudWatch alarms will not invoke actions simply
because they are in a particular state, the state must have changed and been maintained for a specified
number of periods. The following procedures show how to create alarms for Amazon RDS.
Note
For Aurora, use WRITER or READER role metrics to set up alarms instead of relying on metrics for
specific DB instances. Aurora DB instance roles can change roles over time. You can find these
role-based metrics in the CloudWatch console.
Aurora Auto Scaling automatically sets alarms based on READER role metrics. For more
information about Aurora Auto Scaling, see Using Amazon Aurora Auto Scaling with Aurora
Replicas (p. 270).
1. Sign in to the AWS Management Console and open the CloudWatch console at https://
console.aws.amazon.com/cloudwatch/.
2. Choose Alarms and then choose Create Alarm. This launches the Create Alarm Wizard.
3. Choose RDS Metrics and scroll through the Amazon RDS metrics to locate the metric you want to
place an alarm on. To display just the Amazon RDS metrics in this dialog box, search for the identifier
of your resource. Choose the metric to create an alarm on and then choose Next.
4. Enter Name, Description, and Whenever values for the metric.
5. If you want CloudWatch to send you an email when the alarm state is reached, for Whenever this
alarm:, choose State is ALARM. For Send notification to:, choose an existing SNS topic. If you
choose Create topic, you can set the name and email addresses for a new email subscription list.
This list is saved and appears in the field for future alarms.
Note
If you use Create topic to create a new Amazon SNS topic, the email addresses must be
verified before they receive notifications. Emails are only sent when the alarm enters an
alarm state. If this alarm state change happens before the email addresses are verified, they
don't receive a notification.
6. At this point, the Alarm Preview area gives you a chance to preview the alarm you’re about to
create. Choose Create Alarm.
361
Amazon Aurora User Guide for Aurora
Publishing to CloudWatch Logs
• Call put-metric-alarm. For more information, see AWS CLI Command Reference.
• Call PutMetricAlarm. For more information, see Amazon CloudWatch API Reference
• the section called “Publishing Aurora MySQL Logs to CloudWatch Logs” (p. 685)
• the section called “Publishing Aurora PostgreSQL Logs to CloudWatch Logs” (p. 899)
Note
Before you enable log data publishing, you must have a service-linked role in AWS Identity and
Access Management (IAM). For more information about service-linked roles, see Using Service-
Linked Roles for Amazon Aurora (p. 1063).
362
Amazon Aurora User Guide for Aurora
Publishing to CloudWatch Logs
After you have enabled publishing, Amazon RDS continuously streams all of the DB instance log records
to a log group. For example, you have a log group /aws/rds/instance/log type for each type of log
that you publish. This log group is in the same AWS Region as the database instance that generates the
log.
After you have published log records, you can use CloudWatch Logs to search and filter the records. For
more information about searching and filtering logs, see Searching and Filtering Log Data.
This section provides details on how you can view metrics for your DB instance using the RDS console
and CloudWatch. For information on monitoring metrics for the operating system of your DB instance in
real time using CloudWatch Logs, see Enhanced Monitoring (p. 390).
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 you need information about to show its details.
4. Choose the Monitoring tab.
5. For Monitoring, choose the option for how you want to view your metrics from these:
• CloudWatch – Shows a summary of DB instance metrics available from Amazon CloudWatch. Each
metric includes a graph showing the metric monitored over a specific time span.
• Enhanced monitoring – Shows a summary of OS metrics available for a DB instance with
Enhanced Monitoring enabled. Each metric includes a graph showing the metric monitored over a
specific time span.
• OS Process list – Shows details for each process running in the selected instance.
363
Amazon Aurora User Guide for Aurora
Publishing to CloudWatch Logs
Tip
You can choose the time range of the metrics represented by the graphs with the time
range list.
You can choose any graph to bring up a more detailed view. You can also apply metric-
specific filters to the data.
Amazon RDS integrates with CloudWatch metrics to provide a variety of DB instance metrics. You can
view CloudWatch metrics using the RDS console, AWS CLI, or API.
For a complete list of Amazon RDS metrics, go to Amazon RDS Dimensions and Metrics in the Amazon
CloudWatch User Guide.
364
Amazon Aurora User Guide for Aurora
Publishing to CloudWatch Logs
The StartTime and EndTime values supplied in this example are for illustrative purposes. You must
substitute appropriate start and end time values for your DB instance.
• Statistics.member.1 = Average
• Namespace = AWS/RDS
• StartTime = 2009-10-16T00:00:00
• EndTime = 2009-10-16T00:02:00
• Period = 60
• MeasureName = FreeStorageSpace
365
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
• You can view DB clusters and DB instances in the Amazon RDS console by choosing Databases from
the navigation pane.
• You can get DB cluster and DB instance information using the AWS Command Line Interface (AWS CLI).
• You can get DB cluster and DB instance information using the Amazon RDS API.
Console
In the Amazon RDS, you can see details about a DB cluster by choosing Databases from the console's
navigation pane. You can also see details about DB instances that are members of an Amazon Aurora DB
cluster on the Databases page.
The Databases list shows all of the DB clusters for your AWS account. When you choose a DB cluster, you
see both information about the DB cluster and also a list of the DB instances that are members of that
DB cluster. You can choose the identifier for a DB instance in the list to go directly to the details page for
that DB instance in the RDS console.
To view the details page for a DB cluster, choose Databases in the navigation pane, and then choose the
name of the DB cluster.
You can modify your DB cluster by choosing Databases from the console's navigation pane to go to the
Databases list. To modify a DB cluster, select the DB cluster from the Databases list and choose Modify.
To modify a DB instance that is a member of a DB cluster, choose Databases from the console's
navigation pane to go to the Databases list.
For example, the following image shows the details page for the DB cluster named aurora-test. The
DB cluster has four DB instances shown in the DB identifier list. The writer DB instance, dbinstance4, is
the primary DB instance for the DB cluster.
366
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
If you click the link for the dbinstance4 DB instance identifier, the Amazon RDS console shows the
details page for the dbinstance4 DB instance, as shown in the following image.
367
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
AWS CLI
To view DB cluster information by using the AWS CLI, use the describe-db-clusters command. For
example, the following AWS CLI command lists the DB cluster information for all of the DB clusters in
the us-east-1 region for the configured AWS account.
The command returns the following output if your AWS CLI is configured for JSON output.
{
"DBClusters": [
{
"Status": "available",
"Engine": "aurora",
"Endpoint": "sample-cluster1.cluster-123456789012.us-east-1.rds.amazonaws.com"
"AllocatedStorage": 1,
"DBClusterIdentifier": "sample-cluster1",
"MasterUsername": "mymasteruser",
"EarliestRestorableTime": "2016-03-30T03:35:42.563Z",
368
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
"DBClusterMembers": [
{
"IsClusterWriter": false,
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "sample-replica"
},
{
"IsClusterWriter": true,
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "sample-primary"
}
],
"Port": 3306,
"PreferredBackupWindow": "03:34-04:04",
"VpcSecurityGroups": [
{
"Status": "active",
"VpcSecurityGroupId": "sg-ddb65fec"
}
],
"DBSubnetGroup": "default",
"StorageEncrypted": false,
"DatabaseName": "sample",
"EngineVersion": "5.6.10a",
"DBClusterParameterGroup": "default.aurora5.6",
"BackupRetentionPeriod": 1,
"AvailabilityZones": [
"us-east-1b",
"us-east-1c",
"us-east-1d"
],
"LatestRestorableTime": "2016-03-31T20:06:08.903Z",
"PreferredMaintenanceWindow": "wed:08:15-wed:08:45"
},
{
"Status": "available",
"Engine": "aurora",
"Endpoint": "aurora-sample.cluster-123456789012.us-east-1.rds.amazonaws.com",
"AllocatedStorage": 1,
"DBClusterIdentifier": "aurora-sample-cluster",
"MasterUsername": "mymasteruser",
"EarliestRestorableTime": "2016-03-30T10:21:34.826Z",
"DBClusterMembers": [
{
"IsClusterWriter": false,
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "aurora-replica-sample"
},
{
"IsClusterWriter": true,
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "aurora-sample"
}
],
"Port": 3306,
"PreferredBackupWindow": "10:20-10:50",
"VpcSecurityGroups": [
{
"Status": "active",
"VpcSecurityGroupId": "sg-55da224b"
}
],
"DBSubnetGroup": "default",
"StorageEncrypted": false,
"DatabaseName": "sample",
"EngineVersion": "5.6.10a",
369
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
"DBClusterParameterGroup": "default.aurora5.6",
"BackupRetentionPeriod": 1,
"AvailabilityZones": [
"us-east-1b",
"us-east-1c",
"us-east-1d"
],
"LatestRestorableTime": "2016-03-31T20:00:11.491Z",
"PreferredMaintenanceWindow": "sun:03:53-sun:04:23"
}
]
}
RDS API
To view DB cluster information using the Amazon RDS API, use the DescribeDBClusters operation. For
example, the following Amazon RDS API command lists the DB cluster information for all of the DB
clusters in the us-east-1 region.
https://rds.us-east-1.amazonaws.com/
?Action=DescribeDBClusters
&MaxRecords=100
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140722/us-east-1/rds/aws4_request
&X-Amz-Date=20140722T200807Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=2d4f2b9e8abc31122b5546f94c0499bba47de813cb875f9b9c78e8e19c9afe1b
<DescribeDBClustersResponse xmlns="http://rds.amazonaws.com/doc/2014-10-31/">
<DescribeDBClustersResult>
<DBClusters>
<DBCluster>
<Engine>aurora5.6</Engine>
<Status>available</Status>
<BackupRetentionPeriod>0</BackupRetentionPeriod>
<DBSubnetGroup>my-subgroup</DBSubnetGroup>
<EngineVersion>5.6.10a</EngineVersion>
<Endpoint>sample-cluster2.cluster-cbfvmgb0y5fy.us-east-1.rds.amazonaws.com</
Endpoint>
<DBClusterIdentifier>sample-cluster2</DBClusterIdentifier>
<PreferredBackupWindow>04:45-05:15</PreferredBackupWindow>
<PreferredMaintenanceWindow>sat:05:56-sat:06:26</PreferredMaintenanceWindow>
<DBClusterMembers/>
<AllocatedStorage>15</AllocatedStorage>
<MasterUsername>awsuser</MasterUsername>
</DBCluster>
<DBCluster>
<Engine>aurora5.6</Engine>
<Status>available</Status>
<BackupRetentionPeriod>0</BackupRetentionPeriod>
<DBSubnetGroup>my-subgroup</DBSubnetGroup>
<EngineVersion>5.6.10a</EngineVersion>
<Endpoint>sample-cluster3.cluster-cefgqfx9y5fy.us-east-1.rds.amazonaws.com</
Endpoint>
<DBClusterIdentifier>sample-cluster3</DBClusterIdentifier>
<PreferredBackupWindow>07:06-07:36</PreferredBackupWindow>
370
Amazon Aurora User Guide for Aurora
Viewing a DB Cluster
<PreferredMaintenanceWindow>tue:10:18-tue:10:48</PreferredMaintenanceWindow>
<DBClusterMembers>
<DBClusterMember>
<IsClusterWriter>true</IsClusterWriter>
<DBInstanceIdentifier>sample-cluster3-master</DBInstanceIdentifier>
</DBClusterMember>
<DBClusterMember>
<IsClusterWriter>false</IsClusterWriter>
<DBInstanceIdentifier>sample-cluster3-read1</DBInstanceIdentifier>
</DBClusterMember>
</DBClusterMembers>
<AllocatedStorage>15</AllocatedStorage>
<MasterUsername>awsuser</MasterUsername>
</DBCluster>
</DBClusters>
</DescribeDBClustersResult>
<ResponseMetadata>
<RequestId>d682b02c-1383-11b4-a6bb-172dfac7f170</RequestId>
</ResponseMetadata>
</DescribeDBClustersResponse>
371
Amazon Aurora User Guide for Aurora
DB Cluster Status
DB Cluster Status
The status of a DB cluster indicates the health of the DB cluster. You can view the status of a DB cluster
by using the Amazon RDS console, the AWS CLI command describe-db-clusters, or the API operation
DescribeDBClusters.
Note
Aurora 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 cluster. Maintenance status is independent of DB cluster status.
For more information on maintenance status, see Applying Updates for a DB Cluster (p. 330).
Find the possible status values for DB clusters in the following table.
DB Cluster Status Description
inaccessible-encryption- The AWS KMS key used to encrypt or decrypt the DB cluster can't
credentials be accessed.
resetting-master-credentials The master credentials for the DB cluster are being reset because of
a customer request to reset them.
372
Amazon Aurora User Guide for Aurora
DB Cluster Status
DB Cluster Status Description
373
Amazon Aurora User Guide for Aurora
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 Cluster (p. 330).
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 key used to encrypt or decrypt the DB instance can't
encryption-credentials billed be accessed.
374
Amazon Aurora User Guide for Aurora
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.
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.
375
Amazon Aurora User Guide for Aurora
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.
376
Amazon Aurora User Guide for Aurora
Monitoring Aurora DB Cluster Metrics
377
Amazon Aurora User Guide for Aurora
Aurora Metrics
Units: Bytes
Units: Bytes
Units: Milliseconds
378
Amazon Aurora User Guide for Aurora
Aurora Metrics
379
Amazon Aurora User Guide for Aurora
Aurora Metrics
380
Amazon Aurora User Guide for Aurora
Aurora Metrics
381
Amazon Aurora User Guide for Aurora
Aurora Metrics
382
Amazon Aurora User Guide for Aurora
Aurora Metrics
383
Amazon Aurora User Guide for Aurora
Aurora Metrics
384
Amazon Aurora User Guide for Aurora
Aurora Metrics
385
Amazon Aurora User Guide for Aurora
Viewing Metrics in the Amazon RDS 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 Instances.
3. Choose the name of the DB instance you want to monitor to see its details.
4. In the Cloudwatch section, choose one of the following options from Monitoring for how you want to
view your metrics:
• Cloudwatch – Shows a summary of CloudWatch metrics. Each metric includes a graph showing the
metric monitored over a specific time span. For more information, see Monitoring with Amazon
CloudWatch (p. 356).
• Enhanced monitoring – Shows a summary of OS metrics available to an Aurora DB instance with
Enhanced Monitoring enabled. Each metric includes a graph showing the metric monitored over a
specific time span. For more information, see Enhanced Monitoring (p. 390).
• OS process list – Shows the processes running on the DB instance or DB cluster and their related
metrics including CPU percentage, memory usage, and so on.
5. The following image shows the metrics view with Enhanced monitoring selected.
386
Amazon Aurora User Guide for Aurora
Aurora Metrics Available in the Amazon RDS Console
The following Aurora metrics are not available in the Amazon RDS console:
• AuroraBinlogReplicaLag
• DeleteLatency
• DeleteThroughput
• EngineUptime
• InsertLatency
387
Amazon Aurora User Guide for Aurora
Aurora Metrics Available in the Amazon RDS Console
• InsertThroughput
• NetworkThroughput
• Queries
• UpdateLatency
• UpdateThroughput
In addition, some Aurora metrics are either shown only for specific instance classes, or only for DB
instances, or with different names and different units of measurement:
• The CPUCreditBalance and CPUCreditUsage metrics are displayed only for db.t2.small and
db.t2.medium instances
• The following metrics that are displayed with different names, as listed:
DDLThroughput DDL
• The following metrics apply to an entire Aurora DB cluster, but are displayed only when viewing DB
instances for an Aurora DB cluster in the Amazon RDS console:
• VolumeBytesUsed
• VolumeReadIOPs
• VolumeWriteIOPs
• The following metrics are displayed in megabytes, instead of bytes, in the Amazon RDS console:
• FreeableMemory
• FreeLocalStorage
• NetworkReceiveThroughput
• NetworkTransmitThroughput
Category Metrics
SQL ActiveTransactions
BlockedTransactions
BufferCacheHitRatio
388
Amazon Aurora User Guide for Aurora
Aurora Metrics Available in the Amazon RDS Console
Category Metrics
CommitLatency
CommitThroughput
DatabaseConnections
DDLLatency
DDLThroughput
Deadlocks
DMLLatency
DMLThroughput
LoginFailures
ResultSetCacheHitRatio
SelectLatency
SelectThroughput
System AuroraReplicaLag
AuroraReplicaLagMaximum
AuroraReplicaLagMinimum
CPUCreditBalance
CPUCreditUsage
CPUUtilization
FreeableMemory
FreeLocalStorage
NetworkReceiveThroughput
Deployment AuroraReplicaLag
BufferCacheHitRatio
ResultSetCacheHitRatio
SelectThroughput
Note
The Failed SQL Statements metric, displayed under the SQL category of the Latest Metrics view
in the Amazon RDS console, does not apply to Amazon Aurora.
389
Amazon Aurora User Guide for Aurora
Enhanced Monitoring
Enhanced Monitoring
Amazon RDS provides metrics in real time for the operating system (OS) that your DB instance runs on.
You can view the metrics for your DB instance using the console, or consume the Enhanced Monitoring
JSON output from Amazon CloudWatch Logs in a monitoring system of your choice.
By default, Enhanced Monitoring metrics are stored in the CloudWatch Logs for 30 days. 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.
• You are only charged for Enhanced Monitoring that exceeds the free tier provided by Amazon
CloudWatch Logs.
The first time that you enable Enhanced Monitoring in the console, you can select the Default option for
the Monitoring Role property to have RDS create the required IAM role. RDS then automatically creates
a role named rds-monitoring-role for you, and uses it for the specified DB instance or read replica.
You can also create the required role before you enable Enhanced Monitoring, and then specify your
new role's name when you enable Enhanced Monitoring. You must create this required role if you enable
Enhanced Monitoring using the AWS CLI or the RDS API.
390
Amazon Aurora User Guide for Aurora
Setting Up for and Enabling Enhanced Monitoring
To create the appropriate IAM role to permit Amazon RDS to communicate with the Amazon CloudWatch
Logs service on your behalf, take the following steps.
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.
Console
You can enable Enhanced Monitoring when you create a DB cluster or read replica, or when you modify
a DB cluster. 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.
You can enable Enhanced Monitoring in the RDS console when you do one of the following actions:
• Create a DB cluster – 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.
To enable Enhanced Monitoring by using the RDS console, scroll to the Monitoring section and do the
following:
391
Amazon Aurora User Guide for Aurora
Setting Up for and Enabling Enhanced Monitoring
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 Before You Begin (p. 390).
• create-db-instance
• create-db-instance-read-replica
• modify-db-instance
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:
392
Amazon Aurora User Guide for Aurora
Viewing Enhanced Monitoring
RDS API
To enable Enhanced Monitoring using the RDS API, in the following operations, set the
MonitoringInterval parameter to a value other than 0 and set the MonitoringRoleArn parameter
to the role you created in Before You Begin (p. 390).
• CreateDBInstance
• CreateDBInstanceReadReplica
• ModifyDBInstance
The MonitoringInterval parameter specifies the interval, in seconds, between points when Enhanced
Monitoring metrics are collected. Valid values for the parameter are 0, 1, 5, 10, 15, 30, and 60.
To disable Enhanced Monitoring using the RDS API, set the MonitoringInterval parameter to 0 in the
these operations.
If you want to see details for the processes running on your DB instance, choose OS process list for
Monitoring.
393
Amazon Aurora User Guide for Aurora
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 aurora for Amazon Aurora DB clusters. 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. 395).
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.
394
Amazon Aurora User Guide for Aurora
Viewing Enhanced Monitoring by Using CloudWatch Logs
Available OS Metrics
The following tables list the OS metrics available using Amazon CloudWatch Logs.
uptime The amount of time that the DB instance has been active.
total The total percentage of the CPU in use. This value includes
the nice value.
395
Amazon Aurora User Guide for Aurora
Viewing Enhanced Monitoring by Using CloudWatch Logs
wait The percentage of CPU unused while waiting for I/O access.
fileSys maxFiles The maximum number of files that can be created for the
file system.
total The total number of disk space available for the file system,
in kilobytes.
used The amount of disk space used by files in the file system, in
kilobytes.
loadAverageMinute
fifteen The number of processes requesting CPU time over the last
15 minutes.
five The number of processes requesting CPU time over the last 5
minutes.
one The number of processes requesting CPU time over the last
minute.
buffers The amount of memory used for buffering I/O requests prior
to writing to the storage device, in kilobytes.
hugePagesFree The number of free huge pages. Huge pages are a feature of
the Linux kernel.
hugePagesSurp The number of available surplus huge pages over the total.
hugePagesTotal The total size of huge pages for the system, in kilobytes.
396
Amazon Aurora User Guide for Aurora
Viewing Enhanced Monitoring by Using CloudWatch Logs
writeback The amount of dirty pages in RAM that are still being written
to the backing storage, in kilobytes.
network interface The identifier for the network interface being used for the
DB instance.
parentID The process identifier for the parent process of the process.
zombie The number of child tasks that are inactive with an active
parent task.
397
Amazon Aurora User Guide for Aurora
Performance Insights
• Amazon Aurora with MySQL compatibility version 2.04.2 and higher 2.x versions (compatible with
MySQL 5.7)
• Amazon Aurora with MySQL compatibility version 1.17.3 and higher 1.x versions (compatible with
MySQL 5.6)
• Amazon Aurora with PostgreSQL compatibility
• Amazon RDS for MariaDB version 10.4.8 and higher 10.4 versions, version 10.3.13 and higher 10.3
versions, and version 10.2.21 and higher 10.2 versions
• Amazon RDS for MySQL version 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
• Amazon RDS for Microsoft SQL Server (all versions except SQL Server 2008)
• Amazon RDS for PostgreSQL version 10 and 11
• Amazon RDS for Oracle (all versions)
Note
Amazon RDS Performance Insights is not supported for MariaDB version 10.0 or 10.1, or for
MySQL version 5.5. Amazon RDS Performance Insights is not supported for MariaDB version
10.3.13 DB instances in the Europe (Frankfurt) and Europe (Stockholm) AWS Regions.
For Amazon RDS for MariaDB and MySQL, Performance Insights is not supported on the
following DB instance classes: db.t2.micro, db.t2.small, db.t3.micro, and db.t3.small.
On Aurora MySQL, Performance Insights is not supported on db.t2 or db.t3 DB instance classes.
Performance Insights is not supported for Aurora MySQL DB clusters enabled for parallel query.
Performance Insights expands on existing Amazon RDS monitoring features to illustrate your database's
performance and help you analyze any issues that affect it. With the Performance Insights dashboard,
you can visualize the database load and filter the load by waits, SQL statements, hosts, or users.
Performance Insights is on by default in the console create wizard for all DB engines that work with
Amazon RDS. If you have more than one database on a DB instance, performance data for all of the
databases is aggregated for the DB instance.
The central metric for Performance Insights is DB Load, which represents the average number of
active sessions for the DB engine. The DB Load metric is collected every second. An active session
is a connection that has submitted work to the DB engine and is waiting for a response from it. For
example, if you submit a SQL query to the DB engine, the database session is active while the DB engine
is processing that query.
By combining DB Load with wait event data, you can get a complete picture of the state for an active
session. A wait event is a condition that causes the execution of a SQL statement to wait for a specific
event to happen before it can continue. For example, SQL statement execution might wait until a locked
resource is unlocked. Wait events vary by DB engine:
• For a list of the most commonly used wait events for Aurora MySQL, see Aurora MySQL
Events (p. 724).
• For information about all MySQL wait events, see Wait Event Summary Tables in the MySQL
documentation.
• For a list of the most commonly used wait events for Aurora PostgreSQL, see Amazon Aurora
PostgreSQL Events (p. 959).
398
Amazon Aurora User Guide for Aurora
Enabling Performance Insights
• For information about all PostgreSQL wait events, see PostgreSQL Wait Events in the PostgreSQL
documentation.
Session information is collected, aggregated, and displayed in the dashboard as the Average Active
Sessions chart. The Average Active Sessions chart displays the Max CPU value as a line, so you can see if
active sessions are exceeding it or not. The Max CPU value is determined by the number of vCPU (virtual
CPU) cores for your DB instance.
If the load in the Average Active Sessions chart is often above the Max CPU 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 CPU line.
Topics
• Enabling Performance Insights (p. 399)
• Access Control for Performance Insights (p. 403)
• Using the Performance Insights Dashboard (p. 404)
• Additional User Interface Features (p. 417)
• Performance Insights API (p. 418)
• Performance Insights Metrics Published to Amazon CloudWatch (p. 431)
• Performance Insights Counters (p. 432)
• Logging Performance Insights Calls by Using AWS CloudTrail (p. 439)
If you use Performance Insights together with Aurora Global Database, you must enable Performance
Insights individually for the DB instances in each AWS Region. For details, see Performance Insights for
Aurora Global Database (p. 58).
Console
You can use the console to enable Performance Insights when you create a new DB instance. You can also
modify a DB instance to enable Performance Insights.
Topics
• Enabling Performance Insights with the Console When Creating a DB Instance (p. 399)
• Enabling Performance Insights with the Console When Modifying a DB Instance (p. 400)
When you create a new DB instance, Performance Insights is enabled when you choose Enable
Performance Insights in the Performance Insights section.
To create a DB instance, follow the instructions for your DB engine in Creating an Amazon Aurora DB
Cluster (p. 101).
399
Amazon Aurora User Guide for Aurora
Enabling Performance Insights
You have the following options when you choose Enable Performance Insights:
• 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) key. Performance Insights
encrypts all potentially sensitive data using your AWS KMS key. Data is encrypted in flight and at rest.
For more information, see Encrypting Amazon Aurora Resources (p. 1003).
You can modify a DB instance to enable 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 the DB instance that you want to modify, and choose Modify.
4. In the Performance Insights section, choose Enable Performance Insights.
You have the following options when you choose Enable Performance Insights:
• 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) key. Performance Insights
encrypts all potentially sensitive data using your AWS KMS key. Data is encrypted in flight and at
rest. For more information, see Encrypting Amazon Aurora Resources (p. 1003).
5. Choose Continue.
6. For Scheduling of Modifications, choose one of the following:
• Apply during the next scheduled maintenance window – Wait to apply the Performance
Insights modification until the next maintenance window.
400
Amazon Aurora User Guide for Aurora
Enabling Performance Insights
AWS CLI
When you create a new DB instance using the create-db-instance AWS CLI command, Performance
Insights is enabled when you specify --enable-performance-insights.
You can also specify the --enable-performance-insights value 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 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.
401
Amazon Aurora User Guide for Aurora
Enabling Performance Insights
--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,
Performance Insights is enabled when you set EnablePerformanceInsights to True.
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 1
performance-schema-consumer-events- ON
waits-current
performance-schema-instrument wait/%=ON
performance-schema-consumer-global- ON
instrumentation
performance-schema-consumer-thread- ON
instrumentation
Performance Schema is enabled automatically 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 the Performance Schema
parameters to be set automatically, then reset the value for the performance_schema parameter. You
402
Amazon Aurora User Guide for Aurora
Access Control for Performance Insights
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.
When you change the value of the performance_schema parameter, a DB instance reboot is required.
If you're creating a new DB instance with Performance Insights enabled, the performance_schema
parameter is set to 1 (enabled) by default.
Without the Performance Schema enabled, Performance Insights displays database load broken down by
the list state of the MySQL process. With Performance Schema enabled, Performance Insights displays
database load broken down by detailed wait events.
For more information, see Using the Performance Insights Dashboard (p. 404).
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.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "pi:*",
"Resource": "arn:aws:pi:*:*:metrics/rds/*"
}
]
}
403
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Note
Currently, when you enter this policy, the Visual editor tab displays a warning that the pi
resource is not recognized. You can ignore this warning.
7. Provide a name for the policy and optionally a description, and then choose Create policy.
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.
Topics
• Opening the Performance Insights Dashboard (p. 405)
• Performance Insights Dashboard Components (p. 407)
404
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
• Analyzing Database Load Using the Performance Insights Dashboard (p. 411)
• Analyzing Statistics for Running Queries (p. 412)
• Viewing More SQL Text in the Performance Insights Dashboard (p. 415)
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.
405
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
By default, the Performance Insights dashboard shows data for the last 60 minutes. You can modify it to
display data for the last 5 minutes, 60 minutes, 5 hours, 24 hours, or 1 week. You can also show all of the
data available.
The Performance Insight dashboard automatically refreshes with new data. The refresh rate depends on
the amount of data displayed:
406
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
1. Counter Metrics chart – Shows data for specific performance counter metrics.
2. Average Active Sessions chart – Shows how the database load compares to DB instance capacity as
represented by the Max CPU line.
3. Top load items table – Shows the top items contributing to database load.
407
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
To see details for any item for the selected time period in the legend, hover over that item on the
Average Active Sessions chart.
The percentage of the database load associated with each top load item is illustrated in the DB Load by
Waits column. This column reflects the load for that item by whatever grouping is currently selected in
the Average Active Sessions chart. Take the case where the Average Active Sessions chart is grouping
by hosts and you are looking at SQL queries in the top load items table. In this case, the DB Load by
Waits bar reflects the load that query represents on the related host. Here it's colored-coded to map to
the representation of that host in the Average Active Sessions chart.
For another example, suppose that the Average Active Sessions chart is grouping by wait states and you
are looking at SQL queries in the top load items table. In this case, the DB Load by Waits bar is sized,
408
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
segmented, and color-coded to show how much of a given wait state that query is contributing to. It also
shows what wait states are affecting that query.
In the Top Load Items table, you can view the following types of identifiers (IDs) that are associated with
SQL statements:
For Aurora MySQL and Aurora PostgreSQL DB instances, you can use a digest ID to find a specific SQL
digest.
• 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.
In the Top Load Items table, you can open a top statement to view its IDs. The following screenshot
shows an open top statement.
409
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
You can control the IDs that the Top Load Items table shows by choosing the Preferences icon.
When you choose the Preferences icon, the Preferences window opens.
410
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Enable the IDs that you want to have visible in the Top Load Items table, and choose Save.
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, IO:XactSync waits are a frequent issue. CPU wait is less, but it
still contributes to load.
The first four roll-up queries in the SQL tab of the top load items table correlate strongly to the first
state. Thus, those are the ones to drill into and examine the child queries of. You do so to determine how
they are contributing to the performance issue.
The last three roll-up queries are the major contributors to CPU. These are the queries to investigate if
CPU load is an issue.
411
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Topics
• SQL Digest Statistics for Aurora PostgreSQL (p. 412)
• Analyzing Aurora Metrics for SQL Statements That Are Running (p. 414)
The following SQL Digest statistics are available for Aurora PostgreSQL DB instances.
Metric Unit
412
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Metric Unit
The following metrics provide per call statistics for a SQL statement.
Metric Unit
For more information about these metrics, see pg_stat_statements in the PostgreSQL documentation.
413
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Choose which statistics to display by choosing the gear icon in the upper-right corner of the chart.
414
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
The limit for SQL text depends on the DB engine. The following limits apply:
For Aurora PostgreSQL DB instances, you can control the limit of the SQL text size by setting the
track_activity_query_size DB instance parameter, up to 102,400 bytes. You can use the AWS
Management Console to download SQL text up to the limit you set with this parameter. For more
information, see Setting the SQL Text Limit for Aurora PostgreSQL DB Instances (p. 417).
415
Amazon Aurora User Guide for Aurora
Using the Performance Insights Dashboard
Important
Currently, you can only view and download more SQL text with the AWS Management Console.
The AWS Performance Insights CLI and API can return a maximum of 500 bytes of text.
SQL statements with text larger than 500 bytes look similar to the following image.
The Performance Insights dashboard can display up to 4,096 bytes for each SQL statement.
5. (Optional) Choose Copy snippet to copy the displayed SQL statement, or choose Download full SQL
to download the SQL statement to view the SQL text up to the DB engine limit.
416
Amazon Aurora User Guide for Aurora
Additional User Interface Features
Note
To copy or download the SQL statement, disable pop-up blockers.
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 10,240 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 Aurora PostgreSQL DB instance.
If the Aurora 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. 210).
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 region, and the Top N table is recalculated.
In the upper-right corner of the load chart, you can find the Pause and Zoom out tools.
417
Amazon Aurora User Guide for Aurora
Performance Insights API
When you choose Pause, the load chart stops autorefreshing. When you choose Pause again, the chart
resumes autorefreshing.
When you choose Zoom out, the load chart zooms out to the next largest time interval.
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. The API can be used 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 Performance Insights (p. 399).
DescribeDimensionKeys
aws pi describe- Retrieves the top N dimension keys for a metric
dimension-keys for a specific time period.
GetResourceMetrics
aws pi get-resource- Retrieves Performance Insights metrics for a set of
metrics data sources, over a time period. You can provide
specific dimension groups and dimensions, and
provide aggregation and filtering criteria for each
group.
For more information about the Performance Insights API, see the Amazon RDS Performance Insights
API Reference.
418
Amazon Aurora User Guide for Aurora
Performance Insights API
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.
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 Performance Insights
Counters (p. 432).
• Average – The average value for the metric over a period of time. Append .avg to the metric name.
419
Amazon Aurora User Guide for Aurora
Performance Insights API
• 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
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. 420)
• Retrieving the DB Load Average for Top Wait Events (p. 423)
• Retrieving the DB Load Average for Top SQL (p. 425)
• Retrieving the DB Load Average Filtered by SQL (p. 428)
420
Amazon Aurora User Guide for Aurora
Performance Insights API
The following example shows how to gather the same data that the AWS Management Console uses to
generate the two counter metric charts.
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"
}
]
421
Amazon Aurora User Guide for Aurora
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 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
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
},
422
Amazon Aurora User Guide for Aurora
Performance Insights API
{
"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
"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 }
}
]
423
Amazon Aurora User Guide for Aurora
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 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
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",
424
Amazon Aurora User Guide for Aurora
Performance Insights API
"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.
• 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. 423). However, the query.json file has the following contents.
[
{
"Metric": "db.load.avg",
"GroupBy": { "Group": "db.sql_tokenized", "Limit": 10 }
}
]
425
Amazon Aurora User Guide for Aurora
Performance Insights API
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.
{
"AlignedStartTime": 1540771200.0,
"AlignedEndTime": 1540857600.0,
"Identifier": "db-XXX",
426
Amazon Aurora User Guide for Aurora
Performance Insights API
] //End of MetricList
} //End of response
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 key. 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.
[
{
"Metric": "db.load.avg",
"GroupBy": {
"Group": "db.sql_tokenized",
"Dimensions":["db.sql_tokenized.statement"],
"Limit": 10
}
}
]
427
Amazon Aurora User Guide for Aurora
Performance Insights API
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. 425). 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
For Windows:
aws pi get-resource-metrics ^
--service-type RDS ^
--identifier db-ID ^
428
Amazon Aurora User Guide for Aurora
Performance Insights API
--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
},
{
"Timestamp": 1556222400.0,
"Value": 0.05163360560093349
}
]
429
Amazon Aurora User Guide for Aurora
Performance Insights API
},
{
"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
430
Amazon Aurora User Guide for Aurora
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
},
{
"Timestamp": "2018-07-19T21:34:00Z",
"Unit": "None",
"Average": 1.7
},
{
"Timestamp": "2018-07-19T21:35:00Z",
431
Amazon Aurora User Guide for Aurora
Performance Insights Counters
"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.
Topics
• Performance Insights Operating System Counters (p. 432)
• Performance Insights Counters for Aurora MySQL (p. 434)
• Performance Insights Counters for Aurora PostgreSQL (p. 437)
432
Amazon Aurora User Guide for Aurora
Performance Insights Counters
433
Amazon Aurora User Guide for Aurora
Performance Insights Counters
in swap os.swap.in
rx network os.network.rx
tx network os.network.tx
Topics
• Native Counters for Aurora MySQL (p. 435)
• Non-Native Counters for Aurora MySQL (p. 436)
434
Amazon Aurora User Guide for Aurora
Performance Insights Counters
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
435
Amazon Aurora User Guide for Aurora
Performance Insights Counters
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)
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
The hit ratio for the MySQL Qcache_hits /
result set cache (query (QCache_hits +
cache). Com_select) * 100
innodb_rows_changed
SQL db.SQL.innodb_rows_changed
The total InnoDB row db.SQL.Innodb_rows_inserted
operations. +
db.SQL.Innodb_rows_deleted
436
Amazon Aurora User Guide for Aurora
Performance Insights Counters
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 SELECT COUNT AS
deadlocks that timed out. innodb_lock_timeouts
FROM
INFORMATION_SCHEMA.INNODB_METRIC
WHERE
NAME='lock_timeouts'
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'
Topics
• Native Counters for Aurora PostgreSQL (p. 437)
• Non-Native Counters for Aurora PostgreSQL (p. 438)
437
Amazon Aurora User Guide for Aurora
Performance Insights Counters
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)
438
Amazon Aurora User Guide for Aurora
Logging Performance Insights
Calls by Using AWS CloudTrail
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.
read_latency IO db.IO.read_latency
The time spent reading blk_read_time /
data file blocks by blks_read
backends in this instance.
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.
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:
439
Amazon Aurora User Guide for Aurora
Logging Performance Insights
Calls by Using AWS CloudTrail
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": {
"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"
440
Amazon Aurora User Guide for Aurora
Logging Performance Insights
Calls by Using AWS CloudTrail
441
Amazon Aurora User Guide for Aurora
Using Amazon Aurora 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 and DB
parameters diverge too much recommend setting custom memory Cluster Parameter
from the default parameters to their default values in Groups (p. 205)
values. the DB parameter group used by the
DB instance.
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. 493)
output to TABLE. parameter to FILE. To avoid reaching
the storage limit, we recommend
setting the logging output parameter
to FILE.
DB cluster Your DB cluster only For improved performance and High Availability for
with one DB contains one DB availability, we recommend adding Aurora (p. 40)
instance instance. another DB instance with the same
DB instance class in a different
Availability Zone.
442
Amazon Aurora User Guide for Aurora
Responding to Recommendations
Amazon Aurora generates recommendations for a resource when the resource is created or modified.
Amazon Aurora also periodically scans your resources and generates 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.
443
Amazon Aurora User Guide for Aurora
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.
444
Amazon Aurora User Guide for Aurora
Responding to Recommendations
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.
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
445
Amazon Aurora User Guide for Aurora
Responding to Recommendations
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 cluster, see Modifying an Amazon Aurora DB
Cluster (p. 232).
Note
When you choose Apply now, a brief DB instance outage might result.
446
Amazon Aurora User Guide for Aurora
Using Database Activity Streams
Beyond external security threats, managed databases need to provide protection against insider risks
from database administrators (DBAs). Database Activity Streams protect your databases from internal
threats by controlling DBA access to the Database Activity Streams. Thus, the collection, transmission,
storage, and subsequent processing of the stream of database activity is beyond the access of the DBAs
that manage the database.
A stream of database activity is pushed from Aurora PostgreSQL to an Amazon Kinesis data stream
that is created on behalf of your database. From Kinesis, the activity stream can then be consumed by
Amazon CloudWatch or by applications for compliance management. These compliance applications
include Imperva's SecureSphere Database Audit and Protection, McAfee's Data Center Security Suite, or
IBM's Infosphere Guardium. These applications can use the activity stream information to generate alerts
and provide auditing of all activity on your Amazon Aurora databases.
• Currently, these streams are supported only with Aurora with PostgreSQL compatibility version 2.3 and
higher. Version 2.3 is compatible with PostgreSQL version 10.7.
• Database Activity Streams only support db.r4 and db.r5 instance classes. The t3.medium instance
classes aren't supported. For more information, see Aurora PostgreSQL in Hardware Specifications for
All Available DB Instance Classes for Aurora (p. 34).
• They're not supported in the following AWS Regions:
• China (Beijing) Region, cn-north-1
• China (Ningxia) Region, cn-northwest-1
• Asia Pacific (Hong Kong) Region, ap-east-1
• AWS GovCloud (US-East), us-gov-east-1
• AWS GovCloud (US-West), us-gov-west-1
• They require use of AWS Key Management Service (AWS KMS) because the activity streams are always
encrypted.
Topics
• Starting an Activity Stream (p. 447)
• Getting the Status of an Activity Stream (p. 449)
• Stopping an Activity Stream (p. 450)
• Monitoring Database Activity Streams (p. 450)
• Managing Access to Database Activity Streams (p. 462)
447
Amazon Aurora User Guide for Aurora
Starting an Activity Stream
When you start an activity stream, each database activity event, such as a change or access, generates an
activity stream event. Access events are generated from SQL commands such as CONNECT and SELECT.
Change events are generated from SQL commands such as CREATE and INSERT. To make each activity
stream event durable, you encrypt and store it. You can choose to have the database session handle
database activity events either synchronously or asynchronously:
• Synchronous mode – In synchronous mode, when a database session generates an activity stream
event, the session blocks until the event is made durable. If the event can't be made durable for some
reason, the database session returns to normal activities. However, an RDS event is sent indicating that
activity stream records might be lost for some time. A second RDS event is sent after the system is
back to a healthy state.
The synchronous mode favors the accuracy of the activity stream over database performance.
• Asynchronous mode – In asynchronous mode, when a database session generates an activity stream
event, the session returns to normal activities immediately. In the background, the activity stream
event is made a durable record. If an error occurs in the background task, an RDS event is sent. This
event indicates the beginning and end of any time windows where activity stream event records might
have been lost.
Asynchronous mode favors database performance over the accuracy of the activity stream.
Console
To start an activity stream
• For Master key, choose a key from the list of AWS KMS keys.
The master key is used to encrypt the key that in turn encrypts the database activity logged. You
must choose a master key other than the default key. For more information about encryption keys
and AWS KMS, see What is AWS Key Management Service? in the AWS Key Management Service
Developer Guide.
• For Database activity stream mode, choose Asynchronous or Synchronous.
• Choose Apply immediately.
If you choose Schedule for the next maintenance window, the database doesn't restart right
away. Instead, it remains in the PENDING REBOOT state. In this case, the database activity stream
will not start until either the next maintenance window or a manual restart.
The cluster's DB instance status shows that the database activity stream is being configured.
AWS CLI
To start Database Activity Streams for a DB cluster, configure the DB cluster using the start-activity-
stream AWS CLI command. Identify the AWS Region for the DB cluster with the --region parameter.
The --apply-immediately parameter is optional.
448
Amazon Aurora User Guide for Aurora
Getting Activity Stream Status
For Windows:
Console
To get the status of a DB cluster's activity stream
AWS CLI
You can get a DB cluster's activity stream configuration as the response to a describe-db-clusters
CLI request. In the following example, see the values for ActivityStreamKinesisStreamName,
ActivityStreamStatus, ActivityStreamKmsKeyId, and ActivityStreamMode.
The response includes the following items for a database activity stream:
{
"DBClusters": [
{
"DBClusterIdentifier": "my-cluster",
. . .
"ActivityStreamKinesisStreamName": "aws-rds-das-cluster-A6TSYXITZCZXJHIRVFUBZ5LTWY",
"ActivityStreamStatus": "starting",
"ActivityStreamKmsKeyId": "12345678-abcd-efgh-ijkl-bd041f170262",
"ActivityStreamMode": "sync",
"DbClusterResourceId": "cluster-ABCD123456"
. . .
}
]
}
449
Amazon Aurora User Guide for Aurora
Stopping an Activity Stream
Console
To turn off an activity stream
If you choose Schedule for the next maintenance window, the database doesn't restart right
away. Instead, it remains in the PENDING REBOOT state. In this case, the data activity stream is
not disabled until either the next maintenance window or a manual restart.
b. Choose Continue.
AWS CLI
To stop Database Activity Streams for a DB cluster, configure the DB cluster using the AWS CLI command
stop-activity-stream. Identify the AWS Region for the DB cluster using the --region parameter. The --
apply-immediately parameter is optional.
For Windows:
The following categories of activity are monitored and put in the activity stream audit log:
• SQL commands – All SQL commands are audited, and also prepared statements, PostgreSQL
functions, and functions in Procedural Language for SQL (PL/SQL).
450
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
• Other database information – Activity monitored includes the full SQL statement, parameters, bind
variables, the row count of affected rows from DML commands, accessed objects, and the unique
database name.
• Connection information – Activity monitored includes session and network information, the server
process ID, and exit codes.
If an activity stream has a failure while monitoring a DB instance, you are notified by using RDS events. If
a failure occurs, you can decide to shut down the DB instance or let it continue.
Topics
• Accessing an Activity Stream from Kinesis (p. 451)
• Audit Log Contents and Examples (p. 451)
• Processing an Activity Stream using the AWS SDK (p. 456)
An activity stream's name includes the prefix aws-rds-das- followed by the DB cluster's resource
ID. The following is an example.
aws-rds-das-cluster-NHVOV4PCLWHGF52NP
To use the Amazon RDS console to find your DB cluster's resource ID, choose your DB cluster from
the list of databases, and then choose the Configuration tab.
To use the AWS CLI to find the full Kinesis stream name for an activity stream, use a describe-
db-clusters CLI request and note the value of DBActivityStreamKinesisStreamName in the
response.
3. Choose Monitoring to begin observing the database activity.
For more information about using Amazon Kinesis, see What Is Amazon Kinesis Data Streams?.
Topics
• Audit Log Examples (p. 452)
• Activity Event Record (p. 453)
• databaseActivityEventList JSON Array (p. 454)
451
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
Following is an activity event record of a login with the use of a CONNECT SQL statement (command) by a
psql client (clientApplication).
{
"type":"DatabaseActivityMonitoringRecord",
"clusterId":"cluster-4HNY5V4RRNPKKYB7ICFKE5JBQQ",
"instanceId":"db-FZJTMYKCXQBUUZ6VLU7NW3ITCM",
"databaseActivityEventList":[
{
"logTime": "2019-05-23 01:31:28.610198+00",
"statementId": 1,
"substatementId": 1,
"objectType": null,
"command": "CONNECT",
"objectName": null,
"databaseName": "postgres",
"dbUserName": "rdsadmin",
"remoteHost": "172.31.3.195",
"remotePort": "49804",
"sessionId": "5ce5f7f0.474b",
"rowCount": null,
"commandText": null,
"paramList": [],
"pid": 18251,
"clientApplication": "psql",
"exitCode": null,
"class": "MISC",
"serverVersion": "2.3.1",
"serverType": "PostgreSQL",
"serviceName": "Amazon Aurora PostgreSQL-Compatible edition",
"serverHost": "172.31.3.192",
"netProtocol": "TCP",
"dbProtocol": "Postgres 3.0",
"type": "record"
}
]
}
{
"type":"DatabaseActivityMonitoringRecord",
"clusterId":"cluster-4HNY5V4RRNPKKYB7ICFKE5JBQQ",
"instanceId":"db-FZJTMYKCXQBUUZ6VLU7NW3ITCM",
"databaseActivityEventList":[
{
"logTime": "2019-05-24 00:36:54.494235+00",
"statementId": 2,
"substatementId": 1,
"objectType": null,
"command": "CREATE TABLE",
"objectName": null,
"databaseName": "postgres",
"dbUserName": "rdsadmin",
452
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
"remoteHost": "172.31.3.195",
"remotePort": "34534",
"sessionId": "5ce73c6f.7e64",
"rowCount": null,
"commandText": "create table my_table (id serial primary key, name varchar(32));",
"paramList": [],
"pid": 32356,
"clientApplication": "psql",
"exitCode": null,
"class": "DDL",
"serverVersion": "2.3.1",
"serverType": "PostgreSQL",
"serviceName": "Amazon Aurora PostgreSQL-Compatible edition",
"serverHost": "172.31.3.192",
"netProtocol": "TCP",
"dbProtocol": "Postgres 3.0",
"type": "record"
}
]
}
{
"type":"DatabaseActivityMonitoringRecord",
"clusterId":"cluster-4HNY5V4RRNPKKYB7ICFKE5JBQQ",
"instanceId":"db-FZJTMYKCXQBUUZ6VLU7NW3ITCM",
"databaseActivityEventList":[
{
"logTime": "2019-05-24 00:39:49.940668+00",
"statementId": 6,
"substatementId": 1,
"objectType": "TABLE",
"command": "SELECT",
"objectName": "public.my_table",
"databaseName": "postgres",
"dbUserName": "rdsadmin",
"remoteHost": "172.31.3.195",
"remotePort": "34534",
"sessionId": "5ce73c6f.7e64",
"rowCount": 10,
"commandText": "select * from my_table;",
"paramList": [],
"pid": 32356,
"clientApplication": "psql",
"exitCode": null,
"class": "READ",
"serverVersion": "2.3.1",
"serverType": "PostgreSQL",
"serviceName": "Amazon Aurora PostgreSQL-Compatible edition",
"serverHost": "172.31.3.192",
"netProtocol": "TCP",
"dbProtocol": "Postgres 3.0",
"type": "record"
}
]
}
453
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
string
databaseActivityEventList A JSON object encrypted as a base64 byte array. Take the
following steps to decrypt this content:
1. Decrypt the value in the key JSON field using the database
activity stream's master key.
2. Decrypt the databaseActivityEventList object using the
decrypted key from step 1.
class string The class of activity event. Valid values are the following:
• ALL
• CONNECT – A connect or disconnect event.
• DDL – A DDL statement that is not included in the list of
statements for the ROLE class.
• FUNCTION – A function call or a DO block.
• MISC – A miscellaneous command such as DISCARD, FETCH,
CHECKPOINT, or VACUUM.
• NONE
• READ – A SELECT or COPY statement when the source is a
relation or a query.
• ROLE – A statement related to roles and privileges including
GRANT, REVOKE, and CREATE/ALTER/DROP ROLE.
• WRITE – An INSERT, UPDATE, DELETE, TRUNCATE, or COPY
statement when the destination is a relation.
command string The name of the SQL command without any command details.
commandText string The actual SQL statement passed in by the user. This field is
used for all types of records except for connect or disconnect
records, in which case the value is null.
Sensitive Data
454
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
dbUserName string The database user with which the client authenticated.
exitCode int A value used for a session exit record. On a clean exit, this
contains the exit code. An exit code can't always be obtained
in some failure scenarios. Examples are if PostgreSQL does an
exit() or if an operator performs a command such as kill
-9.
objectName string The name of the database object if the SQL statement is
operating on one. This field is used only where the SQL
statement operates on a database object. If the SQL statement is
not operating on an object, this value is null.
objectType string The database object type such as table, index, view, and so on.
This field is used only where the SQL statement operates on a
database object. If the SQL statement is not operating on an
object, this value is null. Valid values include the following:
• COMPOSITE TYPE
• FOREIGN TABLE
• FUNCTION
• INDEX
• MATERIALIZED VIEW
• SEQUENCE
• TABLE
• TOAST TABLE
• VIEW
• UNKNOWN
pid int The process ID of the backend process that is allocated for
serving the client connection.
455
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
rowCount int The number of table rows affected or retrieved by the SQL
statement. This field is used only for SQL statements that are
data manipulation language (DML) statements. If the SQL
statement is not a DML statement, this value is null.
serviceName string The name of the service, for example Amazon Aurora
PostgreSQL-Compatible edition.
statementId int An ID for the client's SQL statement. The counter is at the
session level and increments with each SQL statement entered
by the client.
substatementId int An ID for a SQL substatement. This value counts the contained
substatements for each SQL statement identified by the
statementId field.
type string The event type. Valid values are record or heartbeat.
Java
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.GZIPInputStream;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.encryptionsdk.AwsCrypto;
import com.amazonaws.encryptionsdk.CryptoInputStream;
import com.amazonaws.encryptionsdk.jce.JceMasterKey;
import com.amazonaws.services.kinesis.clientlibrary.exceptions.InvalidStateException;
import com.amazonaws.services.kinesis.clientlibrary.exceptions.ShutdownException;
456
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
import com.amazonaws.services.kinesis.clientlibrary.exceptions.ThrottlingException;
import com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor;
import
com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer;
import
com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory;
import
com.amazonaws.services.kinesis.clientlibrary.lib.worker.InitialPositionInStream;
import
com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibConfiguration;
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShutdownReason;
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker;
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.Builder;
import com.amazonaws.services.kinesis.model.Record;
import com.amazonaws.services.kms.AWSKMS;
import com.amazonaws.services.kms.AWSKMSClientBuilder;
import com.amazonaws.services.kms.model.DecryptRequest;
import com.amazonaws.services.kms.model.DecryptResult;
import com.amazonaws.util.Base64;
import com.amazonaws.util.IOUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
class Activity {
String type;
String version;
String databaseActivityEvents;
String key;
}
class ActivityEvent {
@SerializedName("class") String _class;
String clientApplication;
String command;
String commandText;
String databaseName;
String dbProtocol;
String dbUserName;
String exitCode;
String logTime;
String netProtocol;
String objectName;
String objectType;
457
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
List<String> paramList;
String pid;
String remoteHost;
String remotePort;
String rowCount;
String serverHost;
String serverType;
String serverVersion;
String serviceName;
String sessionId;
String statementId;
String substatementId;
String type;
}
class ActivityRecords {
String type;
String clusterId;
String instanceId;
List<ActivityEvent> databaseActivityEventList;
}
@Override
public void initialize(String shardId) {
}
@Override
public void processRecords(final List<Record> records, final
IRecordProcessorCheckpointer checkpointer) {
for (final Record record : records) {
processSingleBlob(record.getData());
}
458
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
@Override
public void shutdown(IRecordProcessorCheckpointer checkpointer, ShutdownReason
reason) {
if (reason == ShutdownReason.TERMINATE) {
checkpoint(checkpointer);
}
}
// Base64.Decode
final byte[] decoded = Base64.decode(activity.databaseActivityEvents);
final byte[] decodedDataKey = Base64.decode(activity.key);
// Decrypt
final DecryptRequest decryptRequest = new DecryptRequest()
.withCiphertextBlob(ByteBuffer.wrap(decodedDataKey)).withEncryptionContext(context);
final DecryptResult decryptResult = KMS.decrypt(decryptRequest);
final byte[] decrypted = decrypt(decoded,
getByteArray(decryptResult.getPlaintext()));
// GZip Decompress
final byte[] decompressed = decompress(decrypted);
// JSON $ActivityRecords
final ActivityRecords activityRecords = GSON.fromJson(new
String(decompressed, StandardCharsets.UTF_8), ActivityRecords.class);
459
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
kinesisClientLibConfiguration.withInitialPositionInStream(InitialPositionInStream.LATEST);
kinesisClientLibConfiguration.withRegionName(REGION_NAME);
final Worker worker = new Builder()
.recordProcessorFactory(new RecordProcessorFactory())
.config(kinesisClientLibConfiguration)
.build();
try {
worker.run();
} catch (Throwable t) {
System.err.println("Caught throwable while processing data.");
t.printStackTrace();
System.exit(1);
}
System.exit(0);
}
460
Amazon Aurora User Guide for Aurora
Monitoring Activity Streams
Python
import base64
import json
import zlib
import aws_encryption_sdk
from aws_encryption_sdk.internal.crypto import WrappingKey
from aws_encryption_sdk.key_providers.raw import RawMasterKeyProvider
from aws_encryption_sdk.identifiers import WrappingAlgorithm, EncryptionKeyType
import boto3
class MyRawMasterKeyProvider(RawMasterKeyProvider):
provider_id = "BC"
materials_manager=aws_encryption_sdk.DefaultCryptoMaterialsManager(master_key_provider=my_key_prov
return decrypted_plaintext
def main():
session = boto3.session.Session()
kms = session.client('kms', region_name=REGION_NAME)
kinesis = session.client('kinesis', region_name=REGION_NAME)
response = kinesis.describe_stream(StreamName=STREAM_NAME)
shard_iters = []
461
Amazon Aurora User Guide for Aurora
Managing Access to Activity Streams
if __name__ == '__main__':
main()
You set access to Database Activity Streams using IAM policies. For more information about Aurora
authentication, see Identity and Access Management in Amazon Aurora (p. 1019). For more information
about creating IAM policies, see Creating and Using an IAM Policy for IAM Database Access (p. 1037).
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"ConfigureActivityStreams",
"Effect":"Allow",
"Action": [
"rds:StartActivityStream",
"rds:StopActivityStream"
],
"Resource":"*",
}
]
}
462
Amazon Aurora User Guide for Aurora
Managing Access to Activity Streams
The following IAM policy example allows a user or role to start activity streams.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowStartActivityStreams",
"Effect":"Allow",
"Action":"rds:StartActivityStream",
"Resource":"*"
}
]
}
The following IAM policy example allows a user or role to stop activity streams.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowStopActivityStreams",
"Effect":"Allow",
"Action":"rds:StopActivityStream",
"Resource":"*"
}
]
}
The following IAM policy example denies a user or role from starting activity streams.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyStartActivityStreams",
"Effect":"Deny",
"Action":"rds:StartActivityStream",
"Resource":"*"
}
]
}
The following IAM policy example denies a user or role from stopping activity streams.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyStopActivityStreams",
"Effect":"Deny",
"Action":"rds:StopActivityStream",
"Resource":"*"
463
Amazon Aurora User Guide for Aurora
Managing Access to Activity Streams
}
]
}
464
Amazon Aurora User Guide for Aurora
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
cluster, DB cluster 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.
For Amazon Aurora, events occur at both the DB cluster and the DB instance level, so you can receive
events if you subscribe to an Aurora DB cluster or an Aurora DB instance.
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
Amazon RDS event notifications using SMS text messages are currently available for topic
Amazon Resource Names (ARNs) and Amazon RDS resources in the US-East (Northern Virginia)
Region. For more information on using text messages with SNS, see Sending and Receiving SMS
Notifications Using Amazon SNS 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.
465
Amazon Aurora User Guide for Aurora
Amazon RDS Event Categories and Event Messages
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.
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.
The following table shows the event category and a list of events when a DB instance is the source type.
backtrack RDS-EVENT-0132 The actual Backtrack window is the same as the target
Backtrack window.
466
Amazon Aurora User Guide for Aurora
Amazon RDS Event Categories and Event Messages
configuration RDS-EVENT-0018 The current storage settings for this DB instance are
change being changed.
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.
467
Amazon Aurora User Guide for Aurora
Amazon RDS Event Categories and Event Messages
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. 363).
468
Amazon Aurora User Guide for Aurora
Amazon RDS Event Categories and Event Messages
low storage RDS-EVENT-0007 The allocated storage for the DB instance has been
exhausted. To resolve this issue, you should 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. 363).
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.
469
Amazon Aurora User Guide for Aurora
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.
The following table shows the event category and a list of events when a DB parameter group is the
source type.
470
Amazon Aurora User Guide for Aurora
Amazon RDS Event Categories and Event Messages
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 an Aurora DB cluster is the
source type.
failover RDS-EVENT-0072 A failover for the DB cluster has begun within the
same Availability Zone.
471
Amazon Aurora User Guide for Aurora
Subscribing to Amazon RDS Event Notification
notification RDS-EVENT-0149 Seamless scaling completed with the force option for
the Aurora Serverless DB cluster. Connections might
have been interrupted as required.
The following table shows the event category and a list of events when an Aurora DB cluster snapshot is
the source type.
472
Amazon Aurora User Guide for Aurora
Subscribing to Amazon RDS Event Notification
using the CLI or API, you must create an Amazon Simple Notification Service topic and subscribe to
that topic with the Amazon SNS console or Amazon SNS API. You will also need to retain the Amazon
Resource Name (ARN) of the topic because it is used when submitting CLI commands or API operations.
For information on creating an SNS topic and subscribing to it, see Getting Started with Amazon SNS in
the Amazon Simple Notification Service Developer Guide.
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
To subscribe to RDS event notification
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:
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
473
Amazon Aurora User Guide for Aurora
Subscribing to Amazon RDS Event Notification
• --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
474
Amazon Aurora User Guide for Aurora
Listing Your 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.
Example
https://rds.us-east-1.amazonaws.com/
?Action=DescribeEventSubscriptions
475
Amazon Aurora User Guide for Aurora
Listing Your Amazon RDS Event Notification Subscriptions
&MaxRecords=100
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140428/us-east-1/rds/aws4_request
&X-Amz-Date=20140428T161907Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=4208679fe967783a1a149c826199080a066085d5a88227a80c6c0cadb3e8c0d4
https://rds.us-east-1.amazonaws.com/
?Action=DescribeEventSubscriptions
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&SubscriptionName=myfirsteventsubscription
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140428/us-east-1/rds/aws4_request
&X-Amz-Date=20140428T161907Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=4208679fe967783a1a149c826199080a066085d5a88227a80c6c0cadb3e8c0d4
476
Amazon Aurora User Guide for Aurora
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:
• SubscriptionName
477
Amazon Aurora User Guide for Aurora
Modifying an Amazon RDS Event Notification Subscription
478
Amazon Aurora User Guide for Aurora
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. 477).
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
479
Amazon Aurora User Guide for Aurora
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. 477).
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
480
Amazon Aurora User Guide for Aurora
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. 477).
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.
481
Amazon Aurora User Guide for Aurora
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
482
Amazon Aurora User Guide for Aurora
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 Aurora (p. 485)
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
DB instance event type and containing the characters 1318.
AWS CLI
To view all Amazon RDS instance events for the past 7 days
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
To view all Amazon RDS instance events for the past 14 days
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.
483
Amazon Aurora User Guide for Aurora
API
https://rds.us-west-2.amazonaws.com/
?Action=DescribeEvents
&Duration=20160
&MaxRecords=100
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140421/us-west-2/rds/aws4_request
&X-Amz-Date=20140421T194733Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=8e313cabcdbd9766c56a2886b5b298fd944e0b7cfa248953c82705fdd0374f27
484
Amazon Aurora User Guide for Aurora
CloudWatch Events and EventBridge
Events for Amazon Aurora
You can set a variety of targets—such as an AWS Lambda function or an Amazon SNS topic—which
receive events in JSON format. For more information, see the Amazon CloudWatch Events User Guide
and the Amazon EventBridge User Guide.
For example, you can configure Amazon Aurora to send events to CloudWatch Events or Amazon
EventBridge whenever a DB instance is created or deleted.
Topics
• Sending Amazon RDS Events to CloudWatch Events (p. 485)
• DB Cluster Events (p. 486)
• DB Instance Events (p. 486)
• DB Parameter Group Events (p. 487)
• DB Security Group Events (p. 487)
• DB Cluster Snapshot Events (p. 488)
• DB Snapshot Events (p. 488)
Use the following steps to create a CloudWatch Events rule that triggers on an event emitted by an AWS
service.
485
Amazon Aurora User Guide for Aurora
DB Cluster Events
DB Cluster Events
The following is an example of a DB cluster event.
{
"version": "0",
"id": "844e2571-85d4-695f-b930-0153b71dcb42",
"detail-type": "RDS DB Cluster Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-10-06T12:26:13Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:cluster:my-db-cluster"
],
"detail": {
"EventCategories": [
"notification"
],
"SourceType": "CLUSTER",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:my-db-cluster",
"Date": "2018-10-06T12:26:13.882Z",
"SourceIdentifier": "rds:my-db-cluster",
"Message": "Database cluster has been patched"
}
}
DB Instance Events
The following is an example of a DB instance event.
{
"version": "0",
"id": "68f6e973-1a0c-d37b-f2f2-94a7f62ffd4e",
"detail-type": "RDS DB Instance Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-09-27T22:36:43Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:db:my-db-instance"
],
"detail": {
"EventCategories": [
"failover"
],
"SourceType": "DB_INSTANCE",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:db:my-db-instance",
"Date": "2018-09-27T22:36:43.292Z",
"SourceIdentifier": "rds:my-db-instance",
"Message": "A Multi-AZ failover has completed."
}
}
486
Amazon Aurora User Guide for Aurora
DB Parameter Group Events
{
"version": "0",
"id": "844e2571-85d4-695f-b930-0153b71dcb42",
"detail-type": "RDS DB Parameter Group Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-10-06T12:26:13Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:pg:my-db-param-group"
],
"detail": {
"EventCategories": [
"configuration change"
],
"SourceType": "DB_PARAM",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:pg:my-db-param-group",
"Date": "2018-10-06T12:26:13.882Z",
"SourceIdentifier": "rds:my-db-param-group",
"Message": "Updated parameter time_zone to UTC with apply method immediate"
}
}
{
"version": "0",
"id": "844e2571-85d4-695f-b930-0153b71dcb42",
"detail-type": "RDS DB Security Group Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-10-06T12:26:13Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:secgrp:my-security-group"
],
"detail": {
"EventCategories": [
"configuration change"
],
"SourceType": "SECURITY_GROUP",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:secgrp:my-security-group",
"Date": "2018-10-06T12:26:13.882Z",
"SourceIdentifier": "rds:my-security-group",
"Message": "Applied change to security group"
}
}
487
Amazon Aurora User Guide for Aurora
DB Cluster Snapshot Events
{
"version": "0",
"id": "844e2571-85d4-695f-b930-0153b71dcb42",
"detail-type": "RDS DB Cluster Snapshot Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-10-06T12:26:13Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:cluster-snapshot:rds:my-db-cluster-snapshot"
],
"detail": {
"EventCategories": [
"backup"
],
"SourceType": "CLUSTER_SNAPSHOT",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:rds:my-db-cluster-
snapshot",
"Date": "2018-10-06T12:26:13.882Z",
"SourceIdentifier": "rds:my-db-cluster-snapshot",
"Message": "Creating manual cluster snapshot"
}
}
DB Snapshot Events
The following is an example of a DB snapshot event.
{
"version": "0",
"id": "844e2571-85d4-695f-b930-0153b71dcb42",
"detail-type": "RDS DB Snapshot Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-10-06T12:26:13Z",
"region": "us-east-1",
"resources": [
"arn:aws:rds:us-east-1:123456789012:snapshot:rds:my-db-snapshot"
],
"detail": {
"EventCategories": [
"deletion"
],
"SourceType": "SNAPSHOT",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:snapshot:rds:my-db-snapshot",
"Date": "2018-10-06T12:26:13.882Z",
"SourceIdentifier": "rds:my-db-snapshot",
"Message": "Deleted manual snapshot"
}
}
488
Amazon Aurora User Guide for Aurora
Database Log Files
Note
In some cases, logs contain hidden data. Therefore, the AWS Management Console might show
content in a log file, but the log file might be empty when you download it.
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.
489
Amazon Aurora User Guide for Aurora
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.
490
Amazon Aurora User Guide for Aurora
Watching a Database Log File
Console
To watch a database log file
• the section called “Publishing Aurora MySQL Logs to CloudWatch Logs” (p. 685)
• the section called “Publishing Aurora PostgreSQL Logs to CloudWatch Logs” (p. 899)
• 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.
The following example downloads the log file named log/ERROR.6 for the DB instance named sample-sql
in the us-west-2 region.
491
Amazon Aurora User Guide for Aurora
Reading Log File Contents Using REST
host: rds.us-west-2.amazonaws.com
X-Amz-Security-Token: AQoDYXdzEIH//////////
wEa0AIXLhngC5zp9CyB1R6abwKrXHVR5efnAVN3XvR7IwqKYalFSn6UyJuEFTft9nObglx4QJ+GXV9cpACkETq=
X-Amz-Date: 20140903T233749Z
X-Amz-Algorithm: AWS4-HMAC-SHA256
X-Amz-Credential: AKIADQKE4SARGYLE/20140903/us-west-2/rds/aws4_request
X-Amz-SignedHeaders: host
X-Amz-Content-SHA256: e3b0c44298fc1c229afbf4c8996fb92427ae41e4649b934de495991b7852b855
X-Amz-Expires: 86400
X-Amz-Signature: 353a4f14b3f250142d9afc34f9f9948154d46ce7d4ec091d0cdabbcf8b40c558
If you specify a nonexistent DB instance, the response consists of the following error:
492
Amazon Aurora User Guide for Aurora
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 Amazon
Aurora Database Log Files (p. 489).
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:
493
Amazon Aurora User Guide for Aurora
MySQL 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. 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. 465).
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 72 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:
494
Amazon Aurora User Guide for Aurora
MySQL Database Log Files
size exceeds the threshold after removing old log files, then the largest log files are deleted until the log
file size no longer exceeds the threshold.
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
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 and DB Cluster Parameter Groups (p. 205). 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.
495
Amazon Aurora User Guide for Aurora
MySQL Database Log Files
3. Choose the parameter group used by the DB instance 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 and DB
Cluster Parameter Groups (p. 205).
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 the default.mysql5.6, default.mysql5.7, or default.mysql8.0 DB
parameter group affects all MySQL version DB instances that use that parameter group. If
you want to specify different binary logging formats for different MySQL 5.6, 5.7, or 8.0 DB
instances in an AWS Region, you need to create your own DB parameter group. This parameter
group identifies the different logging format and assigns that DB parameter group to the
intended DB instances.
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 \
496
Amazon Aurora User Guide for Aurora
MySQL Database Log Files
--raw \
--result-file=/tmp/ \
binlog.00098
For Windows:
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;
497
Amazon Aurora User Guide for Aurora
PostgreSQL Database Log Files
To set logging parameters for a DB instance, set the parameters in a DB parameter group and associate
that parameter group with the DB instance. For more information, see Working with DB Parameter
Groups and DB Cluster Parameter Groups (p. 205).
Topics
• Setting the Log Retention Period (p. 498)
• Setting Log File Rotation (p. 498)
• Using Query Logging (p. 499)
Amazon Aurora compresses older PostgreSQL logs when storage for the DB instance reaches a threshold.
Aurora compresses the files using the gzip compression utility; for information on gzip, see the gzip
website. When storage for the DB instance is low and all available logs are compressed, you get a
warning like the following.
Warning: local storage for PostgreSQL log files is critically low for
this Aurora PostgreSQL instance, and could lead to a database outage.
Note
If storage gets too low, Aurora might delete compressed PostgreSQL logs before the retention
period expires. If logs are deleted early, you get a message like the following.
The oldest PostgreSQL log files were deleted due to local storage constraints.
To retain older logs, publish them to Amazon CloudWatch Logs. For more information, see Publishing
Aurora PostgreSQL Logs to Amazon CloudWatch Logs (p. 899). After you set up CloudWatch
publishing, Aurora doesn't delete a log until it's published to CloudWatch Logs.
To control log file rotation based on time, set the log_rotation_age parameter to anywhere from
1 minute to 1,440 minutes (24 hours). The log_rotation_age default is 60 minutes. If you set the
log_rotation_age parameter to less than 60 minutes, also set the log_filename parameter to the
minute format: postgresql.log.%Y-%m-%d-%H%M.
To control log file rotation based on file size, set the log_rotation_size parameter to anywhere from
50,000 to 1,000,000 KB. The default is 100,000 KB. We recommend that you also set the log_filename
498
Amazon Aurora User Guide for Aurora
PostgreSQL Database Log Files
parameter to the minute format. Doing this makes sure that you can create a new log file in less than an
hour if the log_rotation_age parameter is 60 minutes or greater.
The log_statement parameter controls which SQL statements are logged. We recommend that you
set this parameter to all to log all statements when you debug issues in your DB instance. The default
value is none. To log all data definition language (DDL) statements (CREATE, ALTER, DROP, and so on),
set this value to ddl. To log all DDL and data modification language (DML) statements (INSERT, UPDATE,
DELETE, and so on), set this value to mod.
1. Set the log_statement parameter to all. The following example shows the information that is
written to the postgres.log file.
Additional information is written to the postgres.log file when you run a query. The following example
shows the type of information written to the file after a query.
2. Set the log_min_duration_statement parameter. The following example shows the information
that is written to the postgres.log file when the parameter is set to 1.
Additional information is written to the postgres.log file when you run a query that exceeds the
duration parameter setting. The following example shows the type of information written to the file
after a query.
499
Amazon Aurora User Guide for Aurora
PostgreSQL Database Log Files
500
Amazon Aurora User Guide for Aurora
Logging Amazon RDS API Calls with AWS CloudTrail
To learn more about CloudTrail, see the AWS CloudTrail User Guide.
For an ongoing record of events in your AWS account, including events for Amazon RDS, 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 regions. The trail logs events from all 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:
All Amazon RDS actions are logged by CloudTrail and are documented in the Amazon RDS API Reference.
For example, calls to the CreateDBInstance, ModifyDBInstance, and CreateDBParameterGroup
actions 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.
501
Amazon Aurora User Guide for Aurora
Understanding Amazon RDS Log File Entries
parameters, and so on. CloudTrail log files are not an ordered stack trace of the public API calls, so they
do not appear in any specific order.
The following example shows a CloudTrail log entry that demonstrates the CreateDBInstance action.
{
"eventVersion": "1.04",
"userIdentity": {
"type": "IAMUser",
"principalId": "AKIAIOSFODNN7EXAMPLE",
"arn": "arn:aws:iam::123456789012:user/johndoe",
"accountId": "123456789012",
"accessKeyId": "AKIAI44QH8DHBEXAMPLE",
"userName": "johndoe"
},
"eventTime": "2018-07-30T22:14:06Z",
"eventSource": "rds.amazonaws.com",
"eventName": "CreateDBInstance",
"awsRegion": "us-east-1",
"sourceIPAddress": "192.0.2.0",
"userAgent": "aws-cli/1.15.42 Python/3.6.1 Darwin/17.7.0 botocore/1.10.42",
"requestParameters": {
"enableCloudwatchLogsExports": [
"audit",
"error",
"general",
"slowquery"
],
"dBInstanceIdentifier": "test-instance",
"engine": "mysql",
"masterUsername": "myawsuser",
"allocatedStorage": 20,
"dBInstanceClass": "db.m1.small",
"masterUserPassword": "****"
},
"responseElements": {
"dBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance",
"storageEncrypted": false,
"preferredBackupWindow": "10:27-10:57",
"preferredMaintenanceWindow": "sat:05:47-sat:06:17",
"backupRetentionPeriod": 1,
"allocatedStorage": 20,
"storageType": "standard",
"engineVersion": "5.6.39",
"dbInstancePort": 0,
"optionGroupMemberships": [
{
"status": "in-sync",
"optionGroupName": "default:mysql-5-6"
}
],
"dBParameterGroups": [
{
"dBParameterGroupName": "default.mysql5.6",
"parameterApplyStatus": "in-sync"
}
],
"monitoringInterval": 0,
"dBInstanceClass": "db.m1.small",
"readReplicaDBInstanceIdentifiers": [],
"dBSubnetGroup": {
"dBSubnetGroupName": "default",
"dBSubnetGroupDescription": "default",
"subnets": [
502
Amazon Aurora User Guide for Aurora
Understanding Amazon RDS Log File Entries
{
"subnetAvailabilityZone": {"name": "us-east-1b"},
"subnetIdentifier": "subnet-cbfff283",
"subnetStatus": "Active"
},
{
"subnetAvailabilityZone": {"name": "us-east-1e"},
"subnetIdentifier": "subnet-d7c825e8",
"subnetStatus": "Active"
},
{
"subnetAvailabilityZone": {"name": "us-east-1f"},
"subnetIdentifier": "subnet-6746046b",
"subnetStatus": "Active"
},
{
"subnetAvailabilityZone": {"name": "us-east-1c"},
"subnetIdentifier": "subnet-bac383e0",
"subnetStatus": "Active"
},
{
"subnetAvailabilityZone": {"name": "us-east-1d"},
"subnetIdentifier": "subnet-42599426",
"subnetStatus": "Active"
},
{
"subnetAvailabilityZone": {"name": "us-east-1a"},
"subnetIdentifier": "subnet-da327bf6",
"subnetStatus": "Active"
}
],
"vpcId": "vpc-136a4c6a",
"subnetGroupStatus": "Complete"
},
"masterUsername": "myawsuser",
"multiAZ": false,
"autoMinorVersionUpgrade": true,
"engine": "mysql",
"cACertificateIdentifier": "rds-ca-2015",
"dbiResourceId": "db-ETDZIIXHEWY5N7GXVC4SH7H5IA",
"dBSecurityGroups": [],
"pendingModifiedValues": {
"masterUserPassword": "****",
"pendingCloudwatchLogsExports": {
"logTypesToEnable": [
"audit",
"error",
"general",
"slowquery"
]
}
},
"dBInstanceStatus": "creating",
"publiclyAccessible": true,
"domainMemberships": [],
"copyTagsToSnapshot": false,
"dBInstanceIdentifier": "test-instance",
"licenseModel": "general-public-license",
"iAMDatabaseAuthenticationEnabled": false,
"performanceInsightsEnabled": false,
"vpcSecurityGroups": [
{
"status": "active",
"vpcSecurityGroupId": "sg-f839b688"
}
]
503
Amazon Aurora User Guide for Aurora
Understanding Amazon RDS Log File Entries
},
"requestID": "daf2e3f5-96a3-4df7-a026-863f96db793e",
"eventID": "797163d3-5726-441d-80a7-6eeb7464acd4",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012"
}
504
Amazon Aurora User Guide for Aurora
Overview of Aurora MySQL
Topics
• Overview of Amazon Aurora MySQL (p. 505)
• Security with Amazon Aurora MySQL (p. 508)
• Updating Applications to Connect to Aurora MySQL DB Clusters Using New SSL/TLS
Certificates (p. 510)
• Migrating Data to an Amazon Aurora MySQL DB Cluster (p. 514)
• Managing Amazon Aurora MySQL (p. 550)
• Working with Parallel Query for Amazon Aurora MySQL (p. 570)
• Using Advanced Auditing with an Amazon Aurora MySQL DB Cluster (p. 595)
• Single-Master Replication with Amazon Aurora MySQL (p. 598)
• Working with Aurora Multi-Master Clusters (p. 628)
• Integrating Amazon Aurora MySQL with Other AWS Services (p. 653)
• Amazon Aurora MySQL Lab Mode (p. 700)
• Best Practices with Amazon Aurora MySQL (p. 701)
• Amazon Aurora MySQL Reference (p. 711)
• Database Engine Updates for Amazon Aurora MySQL (p. 733)
Topics
• Amazon Aurora MySQL Performance Enhancements (p. 505)
• Amazon Aurora MySQL and Spatial Data (p. 506)
• Comparison of Aurora MySQL 5.6 and Aurora MySQL 5.7 (p. 507)
• Comparison of Aurora MySQL 5.7 and MySQL 5.7 (p. 507)
Fast Insert
Fast insert accelerates parallel inserts sorted by primary key and applies specifically to LOAD DATA and
INSERT INTO ... SELECT ... statements. Fast insert caches the position of a cursor in an index
traversal while executing the statement. This avoids unnecessarily traversing the index again.
505
Amazon Aurora User Guide for Aurora
Aurora MySQL and Spatial Data
You can monitor the following metrics to determine the effectiveness of fast insert for your DB cluster:
You can retrieve the current value of the fast insert metrics using the following command:
+---------------------------------+-----------+
| Variable_name | Value |
+---------------------------------+-----------+
| Aurora_fast_insert_cache_hits | 3598300 |
| Aurora_fast_insert_cache_misses | 436401336 |
+---------------------------------+-----------+
• Aurora MySQL 1.x supports the same spatial data types and spatial relation functions as MySQL 5.6.
• Aurora MySQL 2.x supports the same spatial data types and spatial relation functions as MySQL 5.7.
• Aurora MySQL 1.x and 2.x both support spatial indexing on InnoDB tables. Spatial indexing improves
query performance on large datasets for queries on spatial data. In MySQL, spatial indexing for InnoDB
tables isn't available in MySQL 5.6, but is available in MySQL 5.7. Both Aurora MySQL 1.x and 2.x use a
different spatial indexing strategy than MySQL for high performance with spatial queries. The Aurora
spatial index implementation uses a space-filling curve on a B-tree, which is intended to provide higher
performance for spatial range scans than an R-tree.
The following data definition language (DDL) statements are supported for creating indexes on columns
that use spatial data types.
CREATE TABLE
You can use the SPATIAL INDEX keywords in a CREATE TABLE statement to add a spatial index to a
column in a new table. Following is an example.
ALTER TABLE
You can use the SPATIAL INDEX keywords in an ALTER TABLE statement to add a spatial index to a
column in an existing table. Following is an example.
506
Amazon Aurora User Guide for Aurora
Comparison of Aurora MySQL 5.6 and Aurora MySQL 5.7
CREATE INDEX
You can use the SPATIAL keyword in a CREATE INDEX statement to add a spatial index to a column in
an existing table. Following is an example.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. You can asynchronously invoke
AWS Lambda functions from Aurora MySQL 5.7. For more information, see Invoking a Lambda
Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Currently, Aurora MySQL 5.7 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
The performance schema isn't available for early release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 or
higher for performance schema support.
For more information about these features, see the MySQL 5.7 documentation.
507
Amazon Aurora User Guide for Aurora
Security with Aurora MySQL
• To control who can perform Amazon RDS management actions on Aurora MySQL DB clusters and DB
instances, you use AWS Identity and Access Management (IAM). When you connect to AWS using IAM
credentials, your AWS account must have IAM policies that grant the permissions required to perform
Amazon RDS management operations. For more information, see Identity and Access Management in
Amazon Aurora (p. 1019).
If you are using IAM to access the Amazon RDS console, you must first sign on to the AWS
Management Console with your IAM user credentials. Then go to the Amazon RDS console at https://
console.aws.amazon.com/rds/.
• Aurora MySQL DB clusters must be created in an Amazon Virtual Private Cloud (VPC). To control
which devices and Amazon EC2 instances can open connections to the endpoint and port of the DB
instance for Aurora MySQL DB clusters in a VPC, you use a VPC security group. These endpoint and
port connections can be made using Secure Sockets Layer (SSL). In addition, firewall rules at your
company can control whether devices running at your company can open connections to a DB instance.
For more information on VPCs, see Amazon Virtual Private Cloud VPCs and Amazon Aurora (p. 1067).
The supported VPC tenancy depends on the instance class used by your Aurora MySQL DB clusters.
With default VPC tenancy, the VPC runs on shared hardware. With dedicated VPC tenancy, the VPC
runs on a dedicated hardware instance. Aurora MySQL supports the following VPC tenancy based on
the instance class:
• The db.r3 instance classes support both default and dedicated VPC tenancy.
• The db.r4 instance classes support default and dedicated VPC tenancy only.
• The db.t2 instance classes support default VPC tenancy only.
For more information about instance classes, see DB Instance Classes (p. 33). For more information
about default and dedicated VPC tenancy, see Dedicated Instances in the Amazon Elastic Compute
Cloud User Guide.
• To authenticate login and permissions for an Amazon Aurora MySQL DB cluster, you can take either of
the following approaches, or a combination of them:
• You can take the same approach as with a standalone instance of MySQL.
Commands such as CREATE USER, RENAME USER, GRANT, REVOKE, and SET PASSWORD work just
as they do in on-premises databases, as does directly modifying database schema tables. For more
information, see Access Control and Account Management in the MySQL documentation.
• You can also use IAM database authentication.
With IAM database authentication, you authenticate to your DB cluster by using an IAM user or IAM
role and an authentication token. An authentication token is a unique value that is generated using
the Signature Version 4 signing process. By using IAM database authentication, you can use the same
credentials to control access to your AWS resources and your databases. For more information, see
IAM Database Authentication (p. 1035).
• ALTER
• ALTER ROUTINE
• CREATE
508
Amazon Aurora User Guide for Aurora
Using SSL with Aurora MySQL DB Clusters
• CREATE ROUTINE
• CREATE TEMPORARY TABLES
• CREATE USER
• CREATE VIEW
• DELETE
• DROP
• EVENT
• EXECUTE
• GRANT OPTION
• INDEX
• INSERT
• LOAD FROM S3
• LOCK TABLES
• PROCESS
• REFERENCES
• RELOAD
• REPLICATION CLIENT
• REPLICATION SLAVE
• SELECT
• SHOW DATABASES
• SHOW VIEW
• TRIGGER
• UPDATE
To provide management services for each DB cluster, the rdsadmin user is created when the DB cluster
is created. Attempting to drop, rename, change the password, or change privileges for the rdsadmin
account results in an error.
For management of the Aurora MySQL DB cluster, the standard kill and kill_query commands have
been restricted. Instead, use the Amazon RDS commands rds_kill and rds_kill_query to terminate
user sessions or queries on Aurora MySQL DB instances.
Note
Encryption of a database instance and snapshots is not supported for the China (Ningxia) region.
Amazon RDS creates an SSL certificate and installs the certificate on the DB instance when Amazon
RDS provisions the instance. These certificates are signed by a certificate authority. The SSL certificate
includes the DB instance endpoint as the Common Name (CN) for the SSL certificate to guard against
spoofing attacks. As a result, you can only use the DB cluster endpoint to connect to a DB cluster using
SSL if your client supports Subject Alternative Names (SAN). Otherwise, you must use the instance
endpoint of a writer instance.
For information about downloading certificates, see Using SSL/TLS to Encrypt a Connection to a DB
Cluster (p. 1005).
Aurora MySQL 5.6 supports Transport Layer Security (TLS) version 1.0. Aurora MySQL 5.7 supports TLS
version 1.0, 1.1, and 1.2.
509
Amazon Aurora User Guide for Aurora
Updating Applications for New SSL/TLS Certificates
We recommend the MariaDB Connector/J client as a client that supports SAN with SSL. For more
information, see the MariaDB Connector/J download page.
To encrypt connections using the default mysql client, launch the mysql client using the --ssl-ca
parameter to reference the public key, for example:
mysql -h myinstance.c9akciq32.rds-us-east-1.amazonaws.com
--ssl-ca=[full path]rds-combined-ca-bundle.pem --ssl-mode=VERIFY_IDENTITY
mysql -h myinstance.c9akciq32.rds-us-east-1.amazonaws.com
--ssl-ca=[full path]rds-combined-ca-bundle.pem --ssl-verify-server-cert
You can require SSL connections for specific users accounts. For example, you can use one of the
following statements, depending on your MySQL version, to require SSL connections on the user account
encrypted_user.
When you use an RDS proxy, you connect to the proxy endpoint instead of the usual cluster endpoint.
You can make SSL required or optional for connections to the proxy, in the same way as for connections
directly to the Aurora DB cluster. For information about using the RDS Proxy, see Managing Connections
with Amazon RDS Proxy (Preview) (p. 175).
Note
For more information on SSL connections with MySQL, see the MySQL documentation.
This topic can help you to determine whether any client applications use SSL/TLS to connect to your DB
clusters. If they do, you can further check whether those applications require certificate verification to
connect.
510
Amazon Aurora User Guide for Aurora
Determining Whether any Applications are Connecting
to Your Aurora MySQL DB Cluster Using SSL
Note
Some applications are configured to connect to Aurora MySQL DB clusters only if they can
successfully verify the certificate on the server.
For such applications, you must update your client application trust stores to include the new CA
certificates.
After you update your CA certificates in the client application trust stores, you can rotate the certificates
on your DB clusters. We strongly recommend testing these procedures in a development or staging
environment before implementing them in your production environments.
For more information about certificate rotation, see Rotating Your SSL/TLS Certificate (p. 1007). For
more information about downloading certificates, see Using SSL/TLS to Encrypt a Connection to a DB
Cluster (p. 1005). For information about using SSL/TLS with Aurora MySQL DB clusters, see Using SSL
with Aurora MySQL DB Clusters (p. 509).
Topics
• Determining Whether any Applications are Connecting to Your Aurora MySQL DB Cluster Using
SSL (p. 511)
• Determining Whether a Client Requires Certificate Verification to Connect (p. 512)
• Updating Your Application Trust Store (p. 512)
• Example Java Code for Establishing SSL Connections (p. 514)
In this sample output, you can see both your own session (admin) and an application logged in as
webapp1 are using SSL.
+----+-----------------+------------------+-----------------+
| id | user | host | connection_type |
+----+-----------------+------------------+-----------------+
| 8 | admin | 10.0.4.249:42590 | SSL/TLS |
| 4 | event_scheduler | localhost | NULL |
| 10 | webapp1 | 159.28.1.1:42189 | SSL/TLS |
+----+-----------------+------------------+-----------------+
3 rows in set (0.00 sec)
If you are using Aurora MySQL version 1 (compatible with MySQL 5.6), then you can't determine from
the server side whether applications are connecting with or without SSL. For those versions, you can
511
Amazon Aurora User Guide for Aurora
Determining Whether a Client Requires
Certificate Verification to Connect
determine whether SSL is used by examining the application's connection method. You can find more
information on examining the client connection configuration in the following section.
JDBC
The following example with MySQL Connector/J 8.0 shows one way to check an application's JDBC
connection properties to determine whether successful connections require a valid certificate. For more
information on all of the JDBC connection options for MySQL, see Configuration Properties in the MySQL
documentation.
When using the MySQL Connector/J 8.0, an SSL connection requires verification against the server CA
certificate if your connection properties have sslMode set to VERIFY_CA or VERIFY_IDENTITY, as in
the following example.
MySQL
The following examples with the MySQL Client show two ways to check a script's MySQL connection to
determine whether successful connections require a valid certificate. For more information on all of the
connection options with the MySQL Client, see Client-Side Configuration for Encrypted Connections in
the MySQL documentation.
When using the MySQL 5.7 or MySQL 8.0 Client, an SSL connection requires verification against the
server CA certificate if for the --ssl-mode option you specify VERIFY_CA or VERIFY_IDENTITY, as in
the following example.
When using the MySQL 5.6 Client, an SSL connection requires verification against the server CA
certificate if you specify the --ssl-verify-server-cert option, as in the following example.
512
Amazon Aurora User Guide for Aurora
Updating Your Application Trust Store
Note
When you update the trust store, you can retain older certificates in addition to adding the new
certificates.
1. Download the 2019 root certificate that works for all AWS Regions and put the file in the trust store
directory.
For information about downloading the root certificate, see Using SSL/TLS to Encrypt a Connection
to a DB Cluster (p. 1005).
2. Convert the certificate to .der format using the following command.
Replace the file name with the one that you downloaded.
3. Import the certificate into the key store using the following command.
Enter the metastore password when you are prompted for it.
rds-root,date, trustedCertEntry,
Certificate fingerprint (SHA1):
D4:0D:DB:29:E3:75:0D:FF:A6:71:C3:14:0B:BF:5F:47:8D:1C:80:96
# This fingerprint should match the output from the below command
openssl x509 -fingerprint -in rds-ca-2019-root.pem -noout
If you are using the mysql JDBC driver in an application, set the following properties in the application.
System.setProperty("javax.net.ssl.trustStore", certs);
System.setProperty("javax.net.ssl.trustStorePassword", "password");
513
Amazon Aurora User Guide for Aurora
Example Java Code for Establishing SSL Connections
java -Djavax.net.ssl.trustStore=/path_to_truststore/MyTruststore.jks -
Djavax.net.ssl.trustStorePassword=my_truststore_password com.companyName.MyApplication
System.setProperty("javax.net.ssl.trustStore", KEY_STORE_FILE_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", KEY_STORE_PASS);
return;
}
}
Important
After you have determined that your database connections use SSL/TLS and have updated your
application trust store, you can update your database to use the rds-ca-2019 certificates. For
instructions, see step 3 in Updating Your CA Certificate by Modifying Your DB Instance (p. 1008).
514
Amazon Aurora User Guide for Aurora
Migrating Data to Aurora MySQL
There are two different types of migration: physical and logical. Physical migration means that physical
copies of database files are used to migrate the database. Logical migration means that the migration is
accomplished by applying logical database changes, such as inserts, updates, and deletes.
• Physical migration is faster than logical migration, especially for large databases.
• Database performance does not suffer when a backup is taken for physical migration.
• Physical migration can migrate everything in the source database, including complex database
components.
The following are examples of file names that are not allowed:
"innodb_data_file_path=ibdata1:50M; ibdata2:50M:autoextend" and
"innodb_data_file_path=ibdata01:50M:autoextend".
• The innodb_log_files_in_group parameter must be set to its default value (2).
• You can migrate subsets of the database, such as specific tables or parts of a table.
• The data can be migrated regardless of the physical storage structure.
The following table describes your options and the type of migration for each option.
An Amazon RDS MySQL DB Physical You can migrate from an RDS MySQL DB
instance instance by first creating an Aurora MySQL
Read Replica of a MySQL DB instance.
When the replica lag between the MySQL
DB instance and the Aurora MySQL Read
Replica is 0, you can direct your client
applications to read from the Aurora
Read Replica and then stop replication
to make the Aurora MySQL Read Replica
a standalone Aurora MySQL DB cluster
for reading and writing. For details, see
Migrating Data from a MySQL DB Instance
to an Amazon Aurora MySQL DB Cluster by
Using an Aurora Read Replica (p. 541).
515
Amazon Aurora User Guide for Aurora
Migrating Data to Aurora MySQL
A MySQL database external Logical You can create a dump of your data
to Amazon RDS using the mysqldump utility, and then
import that data into an existing Amazon
Aurora MySQL DB cluster. For details, see
Migrating from MySQL to Amazon Aurora
by Using mysqldump (p. 534).
A MySQL database external Physical You can copy the backup files from your
to Amazon RDS database to an Amazon Simple Storage
Service (Amazon S3) bucket, and then
restore an Amazon Aurora MySQL DB
cluster from those files. This option can
be considerably faster than migrating
data using mysqldump. For details, see
Migrating Data from MySQL by Using an
Amazon S3 Bucket (p. 517).
A MySQL database external Logical You can save data from your database
to Amazon RDS as text files and copy those files to an
Amazon S3 bucket. You can then load that
data into an existing Aurora MySQL DB
cluster using the LOAD DATA FROM S3
MySQL command. For more information,
see Loading Data into an Amazon Aurora
MySQL DB Cluster from Text Files in an
Amazon S3 Bucket (p. 665).
A database that is not Logical You can use AWS Database Migration
MySQL-compatible Service (AWS DMS) to migrate data from
a database that is not MySQL-compatible.
For more information on AWS DMS, see
What Is AWS Database Migration Service?
Note
• If you are migrating a MySQL database external to Amazon RDS, the migration options
described in the table are supported only if your database supports the InnoDB or MyISAM
tablespaces.
• If the MySQL database you are migrating to Aurora MySQL uses memcached, remove
memcached before migrating it.
516
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
• You can create a dump of your data using the mysqldump utility, and then import that data into
an existing Amazon Aurora MySQL DB cluster. For more information, see Migrating from MySQL to
Amazon Aurora by Using mysqldump (p. 534).
• You can copy the full and incremental backup files from your database to an Amazon S3 bucket, and
then restore an Amazon Aurora MySQL DB cluster from those files. This option can be considerably
faster than migrating data using mysqldump. For more information, see Migrating Data from MySQL
by Using an Amazon S3 Bucket (p. 517).
This option can be considerably faster than migrating data using mysqldump, because using mysqldump
replays all of the commands to recreate the schema and data from your source database in your new
Aurora MySQL DB cluster. By copying your source MySQL data files, Aurora MySQL can immediately use
those files as the data for an Aurora MySQL DB cluster.
Note
The Amazon S3 bucket and the Amazon Aurora MySQL DB cluster must be in the same AWS
Region.
Aurora MySQL doesn't restore everything from your database. You should save the database schema and
values for the following items from your source MySQL database and add them to your restored Aurora
MySQL DB cluster after it has been created:
• User accounts
• Functions
• Stored procedures
• Time zone information. Time zone information is loaded from the local operating system of your
Amazon Aurora MySQL DB cluster. For more information, see Local Time Zone for Amazon Aurora DB
Clusters (p. 9).
You can't restore from an encrypted source database, but you can encrypt the data being migrated. You
can also leave the data unencrypted during the migration process.
You can't migrate from a source database that has tables defined outside of the default MySQL data
directory.
Also, decide whether you want to minimize downtime by using binary log replication during the
migration process. If you use binary log replication, the external MySQL database remains open to
transactions while the data is being migrated to the Aurora MySQL DB cluster. After the Aurora MySQL
DB cluster has been created, you use binary log replication to synchronize the Aurora MySQL DB cluster
with the transactions that happened after the backup. When the Aurora MySQL DB cluster is caught up
with the MySQL database, you finish the migration by completely switching to the Aurora MySQL DB
cluster for new transactions.
Topics
517
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Amazon Aurora can restore a DB cluster from files that were created using Percona XtraBackup. You can
install Percona XtraBackup from Download Percona XtraBackup.
Note
For MySQL 5.7 migration, you must use Percona XtraBackup 2.4. For earlier MySQL versions, use
Percona XtraBackup 2.3 or 2.4.
Required Permissions
To migrate your MySQL data to an Amazon Aurora MySQL DB cluster, several permissions are required:
• The user that is requesting that Aurora create a new cluster from an Amazon S3 bucket must have
permission to list the buckets for your AWS account. You grant the user this permission using an AWS
Identity and Access Management (IAM) policy.
• Aurora requires permission to act on your behalf to access the Amazon S3 bucket where you store the
files used to create your Amazon Aurora MySQL DB cluster. You grant Aurora the required permissions
using an IAM service role.
• The user making the request must also have permission to list the IAM roles for your AWS account.
• If the user making the request is to create the IAM service role or request that Aurora create the IAM
service role (by using the console), then the user must have permission to create an IAM role for your
AWS account.
• If you plan to encrypt the data during the migration process, update the IAM policy of the user who
will perform the migration to grant RDS access to the KMS keys used for encrypting the backups. For
instructions, see Creating an IAM Policy to Access AWS KMS Resources (p. 659).
For example, the following IAM policy grants a user the minimum required permissions to use the
console to list IAM roles, create an IAM role, list the Amazon S3 buckets for your account, and list the
KMS keys.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:ListRoles",
"iam:CreateRole",
"iam:CreatePolicy",
518
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
"iam:AttachRolePolicy",
"s3:ListBucket",
"kms:ListKeys"
],
"Resource": "*"
}
]
}
Additionally, for a user to associate an IAM role with an Amazon S3 bucket, the IAM user must have the
iam:PassRole permission for that IAM role. This permission allows an administrator to restrict which
IAM roles a user can associate with Amazon S3 buckets.
For example, the following IAM policy allows a user to associate the role named S3Access with an
Amazon S3 bucket.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowS3AccessRole",
"Effect":"Allow",
"Action":"iam:PassRole",
"Resource":"arn:aws:iam::123456789012:role/S3Access"
}
]
}
For more information on IAM user permissions, see Managing Access Using Policies (p. 1021).
You can have the AWS Management Console create a role for you by choosing the Create a New Role
option (shown later in this topic). If you select this option and specify a name for the new role, then
Aurora creates the IAM service role required for Aurora to access your Amazon S3 bucket with the name
that you supply.
As an alternative, you can manually create the role using the following procedure.
1. Complete the steps in Creating an IAM Policy to Access Amazon S3 Resources (p. 655).
2. Complete the steps in Creating an IAM Role to Allow Amazon Aurora to Access AWS
Services (p. 660).
3. Complete the steps in Associating an IAM Role with an Amazon Aurora MySQL DB Cluster (p. 660).
To create a full backup of your MySQL database files that can be restored from Amazon S3 to create an
Amazon Aurora MySQL DB cluster, use the Percona XtraBackup utility (xtrabackup) to back up your
database.
519
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
For example, the following command creates a backup of a MySQL database and stores the files in the /
on-premises/s3-restore/backup folder.
If you want to compress your backup into a single file (which can be split, if needed), you can use the --
stream option to save your backup in one of the following formats:
• Gzip (.gz)
• tar (.tar)
• Percona xbstream (.xbstream)
The following command creates a backup of your MySQL database split into multiple Gzip files.
The following command creates a backup of your MySQL database split into multiple tar files.
The following command creates a backup of your MySQL database split into multiple xbstream files.
Once you have backed up your MySQL database using the Percona XtraBackup utility, you can copy your
backup directories and files to an Amazon S3 bucket.
For information on creating and uploading a file to an Amazon S3 bucket, see Getting Started with
Amazon Simple Storage Service in the Amazon S3 Getting Started Guide.
Amazon Aurora MySQL supports both full and incremental backups created using Percona XtraBackup.
If you already use Percona XtraBackup to perform full and incremental backups of your MySQL database
files, you don't need to create a full backup and upload the backup files to Amazon S3. Instead, you can
save a significant amount of time by copying your existing backup directories and files for your full and
incremental backups to an Amazon S3 bucket. For more information about creating incremental backups
using Percona XtraBackup, see Incremental Backup.
When copying your existing full and incremental backup files to an Amazon S3 bucket, you must
recursively copy the contents of the base directory. Those contents include the full backup and also all
incremental backup directories and files. This copy must preserve the directory structure in the Amazon
S3 bucket. Aurora iterates through all files and directories. Aurora uses the xtrabackup-checkpoints
file included with each incremental backup to identify the base directory and to order incremental
backups by log sequence number (LSN) range.
For information on creating and uploading a file to an Amazon S3 bucket, see Getting Started with
Amazon Simple Storage Service in the Amazon S3 Getting Started Guide.
520
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Backup Considerations
When you upload a file to an Amazon S3 bucket, you can use server-side encryption to encrypt the data.
You can then restore an Amazon Aurora MySQL DB cluster from those encrypted files. Amazon Aurora
MySQL can restore a DB cluster with files encrypted using the following types of server-side encryption:
• Server-side encryption with Amazon S3–managed keys (SSE-S3) – Each object is encrypted with a
unique key employing strong multifactor encryption.
• Server-side encryption with AWS KMS–managed keys (SSE-KMS) – Similar to SSE-S3, but you have the
option to create and manage encryption keys yourself, and also other differences.
For information about using server-side encryption when uploading files to an Amazon S3 bucket, see
Protecting Data Using Server-Side Encryption in the Amazon S3 Developer Guide.
Amazon S3 limits the size of a file uploaded to an Amazon S3 bucket to 5 terabytes (TB). If the backup
data for your database exceeds 5 TB, use the split command to split the backup files into multiple files
that are each less than 5 TB.
Aurora limits the number of source files uploaded to an Amazon S3 bucket to 1 million files. In some
cases, backup data for your database, including all full and incremental backups, can come to a large
number of files. In these cases, use a tarball (.tar.gz) file to store full and incremental backup files in the
Amazon S3 bucket.
Aurora consumes your backup files based on the file name. Be sure to name your backup files with the
appropriate file extension based on the file format—for example, .xbstream for files stored using the
Percona xbstream format.
Aurora consumes your backup files in alphabetical order and also in natural number order. Always use
the split option when you issue the xtrabackup command to ensure that your backup files are
written and named in the proper order.
Aurora doesn't support partial backups created using Percona XtraBackup. You can't use the following
options to create a partial backup when you back up the source files for your database: --tables, --
tables-exclude, --tables-file, --databases, --databases-exclude, or --databases-file.
For more information about backing up your database with Percona XtraBackup, see Percona XtraBackup
- Documentation and The xtrabackup Binary on the Percona website.
Aurora supports incremental backups created using Percona XtraBackup. For more information about
creating incremental backups using Percona XtraBackup, see Incremental 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 top right corner of the Amazon RDS console, choose the AWS Region in which to create your
DB cluster. Choose the same AWS Region as the Amazon S3 bucket that contains your database
backup.
3. In the navigation pane, choose Databases, and then choose Restore from S3.
4. On the Select engine page, choose Amazon Aurora, choose the MySQL-compatible edition, and
then choose Next.
521
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Source engine version Choose the MySQL version of your source database.
S3 folder path prefix (optional) Specify a file path prefix for the files stored in your
Amazon S3 bucket. The S3 Bucket Prefix is optional. If
you don't specify a prefix, then Aurora MySQL creates
the DB cluster using all of the files and folders in the root
folder of the Amazon S3 bucket. If you specify a prefix,
then Aurora MySQL creates the DB cluster using the files
and folders in the Amazon S3 bucket where the full path
for the file begins with the specified prefix.
522
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Create a new role Choose Yes to create a new IAM role, or No to select an
existing IAM role, to authorize Aurora to access Amazon
S3 on your behalf. For more information, see Required
Permissions (p. 518).
IAM role name This option is available only if Create a new role is set to
Yes.
IAM role This option is available only if Create a new role is set to
No.
Allow access to KMS key This option is available only if Create a new role is set to
Yes.
6. Choose Next.
523
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
524
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
DB engine version Applies only to the provisioned capacity type. Choose the
version number of your DB engine.
DB instance class Select a DB instance class that defines the processing and
memory requirements for each instance in the DB cluster.
For more information about DB instance classes, see DB
Instance Classes (p. 33).
DB instance identifier Type a name for the primary instance in your DB cluster.
This identifier is used in the endpoint address for the
primary instance of your DB cluster.
8. Choose Next.
9. On the Configure advanced settings page, you can customize additional settings for your Aurora
MySQL DB cluster. The following table shows the advanced settings for a DB cluster.
Virtual Private Cloud (VPC) Select the VPC to host the DB cluster. Select Create a
New VPC to have Aurora create a VPC for you. For more
information, see DB Cluster Prerequisites (p. 101) earlier
in this topic.
Subnet group Select the DB subnet group to use for the DB cluster. For
more information, see DB Cluster Prerequisites (p. 101)
earlier in this topic.
525
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
VPC security groups Select Create new VPC security group to have Aurora
create a VPC security group for you. Or, select Select
existing VPC security groups and specify one or
more VPC security groups to secure network access to
the DB cluster. For more information, see DB Cluster
Prerequisites (p. 101) earlier in this topic.
DB Cluster Identifier Type a name for your DB cluster that is unique for your
account in the AWS Region you selected. This identifier is
used in the cluster endpoint address for your DB cluster.
For information on the cluster endpoint, see Amazon
Aurora Connection Management (p. 12).
Database port Specify the port for applications and utilities to use to
access the database. Aurora MySQL DB clusters default to
the default MySQL port, 3306, and Aurora PostgreSQL DB
clusters default to the default PostgreSQL port, 5432. The
firewalls at some companies block connections to these
default ports. If your company firewall blocks the default
port, choose another port for the new DB cluster.
526
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
DB cluster parameter group Select a DB cluster parameter group. Aurora has a default
DB cluster parameter group you can use, or you can
create your own DB cluster parameter group. For more
information about DB cluster parameter groups, see
Working with DB Parameter Groups and DB Cluster
Parameter Groups (p. 205).
Backup retention period Select the length of time, from 1 to 35 days, that Aurora
retains backup copies of the database. Backup copies can
be used for point-in-time restores (PITR) of your database
down to the second.
527
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Log exports Choose the logs that you want to start publishing to
Amazon CloudWatch Logs. For more about publishing to
CloudWatch Logs, see Publishing Amazon Aurora MySQL
Logs to Amazon CloudWatch Logs (p. 685).
Auto minor version upgrade This setting doesn't apply to Aurora MySQL DB clusters.
Maintenance window Select Select window and specify the weekly time range
during which system maintenance can occur. Or, select No
preference for Aurora to assign a period randomly.
10. Choose Create database to launch your Aurora DB instance, and then choose Close to close the
wizard.
On the Amazon 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 created and ready for use. When the state changes to
available, you can connect to the primary instance for your DB cluster. Depending on the DB instance
class and store allocated, it can take several minutes for the new instance to be available.
To view the newly created cluster, choose the Databases view in the Amazon RDS console and choose
the DB cluster. For more information, see Viewing an Amazon Aurora DB Cluster (p. 366).
528
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Note the port and the writer endpoint of the DB cluster. Use the writer endpoint and port of the DB
cluster in your JDBC and ODBC connection strings for any application that performs write or read
operations.
Synchronizing the Amazon Aurora MySQL DB Cluster with the MySQL Database
Using Replication
To achieve little or no downtime during the migration, you can replicate transactions that were
committed on your MySQL database to your Aurora MySQL DB cluster. Replication enables the DB cluster
to catch up with the transactions on the MySQL database that happened during the migration. When
the DB cluster is completely caught up, you can stop the replication and finish the migration to Aurora
MySQL.
Topics
• Configuring Your External MySQL Database and Your Aurora MySQL DB Cluster for Encrypted
Replication (p. 530)
529
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
• Synchronizing the Amazon Aurora MySQL DB Cluster with the External MySQL Database (p. 531)
Configuring Your External MySQL Database and Your Aurora MySQL DB Cluster for Encrypted
Replication
• Secure Sockets Layer (SSL) must be enabled on the external MySQL master database.
• A client key and client certificate must be prepared for the Aurora MySQL DB cluster.
During encrypted replication, the Aurora MySQL DB cluster acts a client to the MySQL database server.
The certificates and keys for the Aurora MySQL client are in files in .pem format.
To configure your external MySQL database and your Aurora MySQL DB cluster for encrypted
replication
• If you don't have SSL enabled on the external MySQL master database and don't have a client
key and client certificate prepared, enable SSL on the MySQL database server and generate the
required client key and client certificate.
• If SSL is enabled on the external master, supply a client key and certificate for the Aurora MySQL
DB cluster. If you don't have these, generate a new key and certificate for the Aurora MySQL DB
cluster. To sign the client certificate, you must have the certificate authority key that you used to
configure SSL on the external MySQL master database.
For more information, see Creating SSL Certificates and Keys Using openssl in the MySQL
documentation.
You need the certificate authority certificate, the client key, and the client certificate.
2. Connect to the Aurora MySQL DB cluster as the master user using SSL.
For information about connecting to an Aurora MySQL DB cluster with SSL, see Using SSL with
Aurora MySQL DB Clusters (p. 509).
3. Run the mysql.rds_import_binlog_ssl_material stored procedure to import the SSL
information into the Aurora MySQL DB cluster.
For the ssl_material_value parameter, insert the information from the .pem format files for the
Aurora MySQL DB cluster in the correct JSON payload.
The following example imports SSL information into an Aurora MySQL DB cluster. In .pem format
files, the body code typically is longer than the body code shown in the example.
call mysql.rds_import_binlog_ssl_material(
'{"ssl_ca":"-----BEGIN CERTIFICATE-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb
530
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END CERTIFICATE-----\n","ssl_cert":"-----BEGIN CERTIFICATE-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END CERTIFICATE-----\n","ssl_key":"-----BEGIN RSA PRIVATE KEY-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END RSA PRIVATE KEY-----\n"}');
For more information, see mysql_rds_import_binlog_ssl_material Using SSL with Aurora MySQL DB
Clusters (p. 509).
Note
After running the procedure, the secrets are stored in files. To erase the files later, you can
run the mysql_rds_remove_binlog_ssl_material stored procedure.
Synchronizing the Amazon Aurora MySQL DB Cluster with the External MySQL Database
You can synchronize your Amazon Aurora MySQL DB cluster with the MySQL database using replication.
To synchronize your Aurora MySQL DB cluster with the MySQL database using replication
1. Ensure that the /etc/my.cnf file for the external MySQL database has the relevant entries.
If encrypted replication is not required, ensure that the external MySQL database is started with
binary logs (binlogs) enabled and SSL disabled. The following are the relevant entries in the /etc/
my.cnf file for unencrypted data.
log-bin=mysql-bin
server-id=2133421
innodb_flush_log_at_trx_commit=1
sync_binlog=1
If encrypted replication is required, ensure that the external MySQL database is started with SSL and
binlogs enabled. The entries in the /etc/my.cnf file include the .pem file locations for the MySQL
database server.
log-bin=mysql-bin
server-id=2133421
innodb_flush_log_at_trx_commit=1
sync_binlog=1
# Setup SSL.
ssl-ca=/home/sslcerts/ca.pem
ssl-cert=/home/sslcerts/server-cert.pem
ssl-key=/home/sslcerts/server-key.pem
You can verify that SSL is enabled with the following command.
531
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
+~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~--+
| Variable_name | Value |
+~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~--+
| have_ssl | YES |
+~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~--+
1 row in set (0.00 sec)
a. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
b. In the navigation pane, choose Events.
c. In the Events list, note the position in the Recovered from Binary log filename event.
The user requires the REPLICATION CLIENT and REPLICATION SLAVE privileges. Grant these
privileges to the user.
If you need to use encrypted replication, require SSL connections for the replication user. For
example, you can use the following statement to require SSL connections on the user account
<user_name>.
532
Amazon Aurora User Guide for Aurora
Migrating from an External
MySQL Database to Aurora MySQL
Note
If REQUIRE SSL is not included, the replication connection might silently fall back to an
unencrypted connection.
4. In the Amazon RDS console, add the IP address of the server that hosts the external MySQL
database to the VPC security group for the Aurora MySQL DB cluster. For more information on
modifying a VPC security group, see Security Groups for Your VPC in the Amazon Virtual Private
Cloud User Guide.
You might also need to configure your local network to permit connections from the IP address of
your Aurora MySQL DB cluster, so that it can communicate with your external MySQL database. To
find the IP address of the Aurora MySQL DB cluster, use the host command.
host RDS_MySQL_DB_<host_name>
The host name is the DNS name from the Aurora MySQL DB cluster endpoint.
5. Enable binary log replication by running the mysql.rds_set_external_master stored
procedure. This stored procedure has the following syntax.
CALL mysql.rds_set_external_master (
host_name
, host_port
, replication_user_name
, replication_user_password
, mysql_binary_log_file_name
, mysql_binary_log_file_location
, ssl_encryption
);
If the data in the Aurora MySQL DB cluster is not encrypted, the ssl_encryption parameter must
be set to 0. If the data is encrypted, the ssl_encryption parameter must be set to 1.
The following example runs the procedure for an Aurora MySQL DB cluster that has encrypted data.
CALL mysql.rds_set_external_master(
'Externaldb.some.com',
3306,
'repl_user'@'mydomain.com',
'password',
'mysql-bin.000010',
120,
1);
This stored procedure sets the parameters that the Aurora MySQL DB cluster uses for connecting to
the external MySQL database and reading its binary log. If the data is encrypted, it also downloads
the SSL certificate authority certificate, client certificate, and client key to the local disk.
6. Start binary log replication by running the mysql.rds_start_replication stored procedure.
533
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
CALL mysql.rds_start_replication;
7. Monitor how far the Aurora MySQL DB cluster is behind the MySQL replication master database. To
do so, connect to the Aurora MySQL DB cluster and run the following command.
In the command output, the Seconds Behind Master field shows how far the Aurora MySQL DB
cluster is behind the MySQL master. When this value is 0 (zero), the Aurora MySQL DB cluster has
caught up to the master, and you can move on to the next step to stop replication.
8. Connect to the MySQL replication master database and stop replication. To do so, run the following
command.
CALL mysql.rds_stop_replication;
For a discussion of how to do so with MySQL databases that are very large, see Importing Data to an
Amazon RDS MySQL or MariaDB DB Instance with Reduced Downtime. For MySQL databases that have
smaller amounts of data, see Importing Data from a MySQL or MariaDB DB to an Amazon RDS MySQL or
MariaDB DB Instance.
Topics
• Migrating an RDS MySQL Snapshot to Aurora (p. 535)
• Migrating Data from a MySQL DB Instance to an Amazon Aurora MySQL DB Cluster by Using an
Aurora Read Replica (p. 541)
Note
Because Amazon Aurora MySQL is compatible with MySQL, you can migrate data from your
MySQL database by setting up replication between your MySQL database and an Amazon
Aurora MySQL DB cluster. If you want to use replication to migrate data from your MySQL
database, we recommend that your MySQL database run MySQL version 5.5 or later. For more
information, see Replication with Amazon Aurora (p. 60).
534
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
You can migrate either a manual or automated DB snapshot. After the DB cluster is created, you can then
create optional Aurora Replicas.
When the MySQL DB instance and the Aurora DB cluster are running the same version of MySQL, you
can restore the MySQL snapshot directly to the Aurora DB cluster. For example, you can restore a MySQL
version 5.6 snapshot directly to Aurora MySQL version 5.6, but you can't restore a MySQL version 5.6
snapshot directly to Aurora MySQL version 5.7.
If you want to migrate a MySQL version 5.6 snapshot to Aurora MySQL version 5.7, you can perform the
migration in one of the following ways:
• Migrate the MySQL version 5.6 snapshot to Aurora MySQL version 5.6, take a snapshot of the Aurora
MySQL version 5.6 DB cluster, and then restore the Aurora MySQL version 5.6 snapshot to Aurora
MySQL version 5.7.
• Upgrade the MySQL version 5.6 snapshot to MySQL version 5.7, take a snapshot of the MySQL version
5.7 DB instance, and then restore the MySQL version 5.7 snapshot to Aurora MySQL version 5.7.
Note
You can also migrate a MySQL DB instance to an Aurora MySQL DB cluster by creating an Aurora
Read Replica of your source MySQL DB instance. For more information, see Migrating Data
from a MySQL DB Instance to an Amazon Aurora MySQL DB Cluster by Using an Aurora Read
Replica (p. 541).
• You can't migrate a MySQL version 5.7 snapshot to Aurora MySQL version 5.6.
• You can't migrate a DB snapshot created with MySQL 5.6.40 or 5.7.22 to Aurora MySQL.
1. Determine the amount of space to provision for your Aurora MySQL DB cluster. For more information,
see How Much Space Do I Need? (p. 535)
2. Use the console to create the snapshot in the AWS Region where the Amazon RDS MySQL instance is
located. For information about creating a DB snapshot, see Creating a DB Snapshot.
3. If the DB snapshot is not in the same AWS Region as your DB cluster, use the Amazon RDS console to
copy the DB snapshot to that AWS Region. For information about copying a DB snapshot, see Copying
a DB Snapshot.
4. Use the console to migrate the DB snapshot and create an Aurora MySQL DB cluster with the same
databases as the original MySQL DB instance.
Warning
Amazon RDS limits each AWS account to one snapshot copy into each AWS Region at a time.
535
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
Tables that are not MyISAM tables and are not compressed can be up to 16 TB in size. If you have
MyISAM tables, then Aurora must use additional space in the volume to convert the tables to be
compatible with Aurora MySQL. If you have compressed tables, then Aurora must use additional space
in the volume to expand these tables before storing them on the Aurora cluster volume. Because of this
additional space requirement, you should ensure that none of the MyISAM and compressed tables being
migrated from your MySQL DB instance exceeds 8 TB in size.
Reducing the Amount of Space Required to Migrate Data into Amazon Aurora
MySQL
You might want to modify your database schema prior to migrating it into Amazon Aurora. Such
modification can be helpful in the following cases:
You can make the following changes to improve the process of migrating a database into Amazon
Aurora.
Important
Be sure to perform these updates on a new DB instance restored from a snapshot of a
production database, rather than on a production instance. You can then migrate the data
from the snapshot of your new DB instance into your Aurora DB cluster to avoid any service
interruptions on your production database.
MyISAM tables Aurora MySQL supports InnoDB tables only. If you have MyISAM
tables in your database, then those tables must be converted before
being migrated into Aurora MySQL. The conversion process requires
additional space for the MyISAM to InnoDB conversion during the
migration procedure.
Compressed tables Aurora MySQL doesn't support compressed tables (that is, tables
created with ROW_FORMAT=COMPRESSED).
You can use the following SQL script on your existing MySQL DB instance to list the tables in your
database that are MyISAM tables or compressed tables.
536
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
The script produces output similar to the output in the following example. The example shows two
tables that must be converted from MyISAM to InnoDB. The output also includes the approximate size of
each table in megabytes (MB).
+---------------------------------+------------------+
| ==> MyISAM or Compressed Tables | Approx size (MB) |
+---------------------------------+------------------+
| test.name_table | 2102.25 |
| test.my_table | 65.25 |
+---------------------------------+------------------+
537
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
Console
You can migrate a DB snapshot of an Amazon RDS MySQL DB instance to create an Aurora MySQL DB
cluster. The new Aurora MySQL DB cluster is populated with the data from the original Amazon RDS
MySQL DB instance. The DB snapshot must have been made from an Amazon RDS DB instance running
MySQL version 5.6 or 5.7. For information about creating a DB snapshot, see Creating a DB Snapshot.
If the DB snapshot is not in the AWS Region where you want to locate your data, use the Amazon RDS
console to copy the DB snapshot to that AWS Region. For information about copying a DB snapshot, see
Copying a DB Snapshot.
When you migrate the DB snapshot by using the AWS Management Console, the console takes the
actions necessary to create both the DB cluster and the primary instance.
You can also choose for your new Aurora MySQL DB cluster to be encrypted at rest using an AWS Key
Management Service (AWS KMS) encryption key.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Either start the migration from the MySQL DB instance or from the snapshot:
1. In the navigation pane, choose Databases, and then select the MySQL DB instance.
2. For Actions, choose Migrate latest snapshot.
1. Choose Snapshots.
2. On the Snapshots page, choose the snapshot that you want to migrate into an Aurora MySQL DB
cluster.
3. Choose Snapshot Actions, and then choose Migrate Snapshot.
538
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
Otherwise, you can choose to have Aurora create a VPC for you by selecting Create a new VPC.
• Subnet group: If you have an existing subnet group, then you can use that subnet group with
your Aurora MySQL DB cluster by selecting your subnet group identifier, for example gs-subnet-
group1.
Otherwise, you can choose to have Aurora create a subnet group for you by selecting Create a
new subnet group.
• Public accessibility: Select No to specify that instances in your DB cluster can only be accessed
by resources inside of your VPC. Select Yes to specify that instances in your DB cluster can be
accessed by resources on the public network. The default is Yes.
Note
Your production DB cluster might not need to be in a public subnet, because only your
application servers require access to your DB cluster. If your DB cluster doesn't need to be
in a public subnet, set Publicly Accessible to No.
• Availability Zone: Select the Availability Zone to host the primary instance for your Aurora MySQL
DB cluster. To have Aurora select an Availability Zone for you, select No Preference.
• Database Port: Type the default port to be used when connecting to instances in the Aurora
MySQL DB cluster. The default is 3306.
Note
You might be behind a corporate firewall that doesn't allow access to default ports such
as the MySQL default port, 3306. In this case, provide a port value that your corporate
firewall allows. Remember that port value later when you connect to the Aurora MySQL
DB cluster.
• Encryption: Choose Enable Encryption for your new Aurora MySQL DB cluster to be encrypted
at rest. If you choose Enable Encryption, you must choose an AWS KMS encryption key as the
Master Key value.
If your DB snapshot isn't encrypted, specify an encryption key to have your DB cluster encrypted
at rest.
If your DB snapshot is encrypted, specify an encryption key to have your DB cluster encrypted
at rest using the specified encryption key. You can specify the encryption key used by the DB
snapshot or a different key. You can't create an unencrypted DB cluster from an encrypted DB
snapshot.
• Auto Minor Version Upgrade: This setting doesn't apply to Aurora MySQL DB clusters.
For more information about engine updates for Aurora MySQL, see Database Engine Updates for
Amazon Aurora MySQL (p. 733).
4. Choose Migrate to migrate your DB snapshot.
5. Choose Instances, and then choose the arrow icon to show the DB cluster details and monitor the
progress of the migration. On the details page, you can find the cluster endpoint used to connect to
the primary instance of the DB cluster. For more information on connecting to an Aurora MySQL DB
cluster, see Connecting to an Amazon Aurora DB Cluster (p. 169).
539
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
AWS CLI
You can migrate a DB snapshot of an Amazon RDS MySQL DB instance to create an Aurora DB cluster.
The new DB cluster is then populated with the data from the DB snapshot. The DB snapshot must come
from an Amazon RDS DB instance running MySQL version 5.6 or 5.7. For more information, see Creating
a DB Snapshot.
If the DB snapshot is not in the AWS Region where you want to locate your data, copy the DB snapshot
to that AWS Region. For more information, see Copying a DB Snapshot.
You can create an Aurora DB cluster from a DB snapshot of an Amazon RDS MySQL DB instance by using
the restore-db-cluster-from-snapshot command with the following parameters:
• --db-cluster-identifier
The AWS Key Management Service (AWS KMS) encryption key to optionally encrypt the DB cluster
with, depending on whether your DB snapshot is encrypted.
• If your DB snapshot isn't encrypted, specify an encryption key to have your DB cluster encrypted at
rest. Otherwise, your DB cluster isn't encrypted.
• If your DB snapshot is encrypted, specify an encryption key to have your DB cluster encrypted at
rest using the specified encryption key. Otherwise, your DB cluster is encrypted at rest using the
encryption key for the DB snapshot.
Note
You can't create an unencrypted DB cluster from an encrypted DB snapshot.
• --snapshot-identifier
The Amazon Resource Name (ARN) of the DB snapshot to migrate. For more information about
Amazon RDS ARNs, see Amazon Relational Database Service (Amazon RDS).
When you migrate the DB snapshot by using the RestoreDBClusterFromSnapshot command, the
command creates both the DB cluster and the primary instance.
In this example, you create a MySQL 5.7–compatible DB cluster named mydbcluster from a DB
snapshot with an ARN set to mydbsnapshotARN.
For Windows:
In this example, you create a MySQL 5.6–compatible DB cluster named mydbcluster from a DB
snapshot with an ARN set to mydbsnapshotARN.
540
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
For Windows:
We recommend using this functionality to migrate from a MySQL DB instance to an Aurora MySQL DB
cluster by creating an Aurora Read Replica of your source MySQL DB instance. When the replica lag
between the MySQL DB instance and the Aurora Read Replica is 0, you can direct your client applications
to the Aurora Read Replica and then stop replication to make the Aurora Read Replica a standalone
Aurora MySQL DB cluster. Be prepared for migration to take a while, roughly several hours per tebibyte
(TiB) of data.
For a list of regions where Aurora is available, see Amazon Aurora in the AWS General Reference.
When you create an Aurora Read Replica of a MySQL DB instance, Amazon RDS creates a DB snapshot of
your source MySQL DB instance (private to Amazon RDS, and incurring no charges). Amazon RDS then
migrates the data from the DB snapshot to the Aurora Read Replica. After the data from the DB snapshot
has been migrated to the new Aurora MySQL DB cluster, Amazon RDS starts replication between your
MySQL DB instance and the Aurora MySQL DB cluster. If your MySQL DB instance contains tables that
use storage engines other than InnoDB, or that use compressed row format, you can speed up the
process of creating an Aurora Read Replica by altering those tables to use the InnoDB storage engine and
dynamic row format before you create your Aurora Read Replica. For more information about the process
of copying a MySQL DB snapshot to an Aurora MySQL DB cluster, see Migrating Data from a MySQL DB
Instance to an Amazon Aurora MySQL DB Cluster by Using a DB Snapshot (p. 534).
You can only have one Aurora Read Replica for a MySQL DB instance.
Note
Replication issues can arise due to feature differences between Amazon Aurora MySQL and
the MySQL database engine version of your RDS MySQL DB instance that is the replication
master. If you encounter an error, you can find help in the Amazon RDS Community Forum or by
contacting AWS Support.
For more information on MySQL read replicas, see Working with Read Replicas of MariaDB, MySQL, and
PostgreSQL DB Instances.
541
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
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 MySQL DB instance that you want to use as the source for your Aurora Read Replica.
4. For Actions, choose Create Aurora read replica.
5. Choose the DB cluster specifications you want to use for the Aurora Read Replica, as described in the
following table.
Option Description
DB instance identifier Type a name for the primary instance in your Aurora Read
Replica DB cluster. This identifier is used in the endpoint
address for the primary instance of the new DB cluster.
Virtual Private Cloud (VPC) Select the VPC to host the DB cluster. Select Create
new VPC to have Aurora create a VPC for you. For more
information, see DB Cluster Prerequisites (p. 101).
Subnet group Select the DB subnet group to use for the DB cluster.
Select Create new DB subnet group to have Aurora create
a DB subnet group for you. For more information, see DB
Cluster Prerequisites (p. 101).
542
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
Option Description
can be a mix of both public and private DB instances.
For more information about hiding instances from
public access, see Hiding a DB Instance in a VPC from the
Internet (p. 1079).
VPC security groups Select Create new VPC security group to have Aurora
create a VPC security group for you. Select Select existing
VPC security groups to specify one or more VPC security
groups to secure network access to the DB cluster. For
more information, see DB Cluster Prerequisites (p. 101).
Database port Specify the port for applications and utilities to use
to access the database. Aurora MySQL DB clusters
default to the default MySQL port, 3306. Firewalls at
some companies block connections to this port. If your
company firewall blocks the default port, choose another
port for the new DB cluster.
DB cluster parameter group Select a DB cluster parameter group for the Aurora
MySQL DB cluster. Aurora has a default DB cluster
parameter group you can use, or you can create your
own DB cluster parameter group. For more information
about DB cluster parameter groups, see Working
with DB Parameter Groups and DB Cluster Parameter
Groups (p. 205).
543
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
Option Description
Backup retention period Select the length of time, from 1 to 35 days, that Aurora
retains backup copies of the database. Backup copies can
be used for point-in-time restores (PITR) of your database
down to the second.
Auto minor version upgrade This setting doesn't apply to Aurora MySQL DB clusters.
Maintenance window Select Select window and specify the weekly time range
during which system maintenance can occur. Or, select No
preference for Aurora to assign a period randomly.
AWS CLI
To create an Aurora Read Replica from a source MySQL DB instance, use the create-db-cluster and
create-db-instance AWS CLI commands to create a new Aurora MySQL DB cluster. When you call
the create-db-cluster command, include the --replication-source-identifier parameter
to identify the Amazon Resource Name (ARN) for the source MySQL DB instance. For more information
about Amazon RDS ARNs, see Amazon Relational Database Service (Amazon RDS).
Don't specify the master username, master password, or database name as the Aurora Read Replica uses
the same master username, master password, and database name as the source MySQL DB instance.
544
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
--replication-source-identifier arn:aws:rds:us-west-2:123456789012:db:master-mysql-
instance
For Windows:
If you use the console to create an Aurora Read Replica, then Aurora automatically creates the primary
instance for your DB cluster Aurora Read Replica. If you use the AWS CLI to create an Aurora Read
Replica, you must explicitly create the primary instance for your DB cluster. The primary instance is the
first instance that is created in a DB cluster.
You can create a primary instance for your DB cluster by using the create-db-instance AWS CLI
command with the following parameters.
• --db-cluster-identifier
The name of the DB instance class to use for your primary instance.
• --db-instance-identifier
In this example, you create a primary instance named myreadreplicainstance for the DB cluster
named myreadreplicacluster, using the DB instance class specified in myinstanceclass.
Example
For Windows:
RDS API
To create an Aurora Read Replica from a source MySQL DB instance, use the CreateDBCluster and
CreateDBInstance Amazon RDS API commands to create a new Aurora DB cluster and primary
instance. Do not specify the master username, master password, or database name as the Aurora Read
Replica uses the same master username, master password, and database name as the source MySQL DB
instance.
545
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
You can create a new Aurora DB cluster for an Aurora Read Replica from a source MySQL DB instance by
using the CreateDBCluster Amazon RDS API command with the following parameters:
• DBClusterIdentifier
The AWS Key Management Service (AWS KMS) encryption key to optionally encrypt the DB cluster
with, depending on whether your MySQL DB instance is encrypted.
• If your MySQL DB instance isn't encrypted, specify an encryption key to have your DB cluster
encrypted at rest. Otherwise, your DB cluster is encrypted at rest using the default encryption key
for your account.
• If your MySQL DB instance is encrypted, specify an encryption key to have your DB cluster encrypted
at rest using the specified encryption key. Otherwise, your DB cluster is encrypted at rest using the
encryption key for the MySQL DB instance.
Note
You can't create an unencrypted DB cluster from an encrypted MySQL DB instance.
• ReplicationSourceIdentifier
The Amazon Resource Name (ARN) for the source MySQL DB instance. For more information about
Amazon RDS ARNs, see Amazon Relational Database Service (Amazon RDS).
• VpcSecurityGroupIds
The list of EC2 VPC security groups to associate with this DB cluster.
In this example, you create a DB cluster named myreadreplicacluster from a source MySQL
DB instance with an ARN set to mysqlmasterARN, associated with a DB subnet group named
mysubnetgroup and a VPC security group named mysecuritygroup.
Example
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBCluster
&DBClusterIdentifier=myreadreplicacluster
&DBSubnetGroupName=mysubnetgroup
&Engine=aurora
&ReplicationSourceIdentifier=mysqlmasterARN
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&VpcSecurityGroupIds=mysecuritygroup
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150927/us-east-1/rds/aws4_request
&X-Amz-Date=20150927T164851Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=6a8f4bd6a98f649c75ea04a6b3929ecc75ac09739588391cd7250f5280e716db
If you use the console to create an Aurora Read Replica, then Aurora automatically creates the primary
instance for your DB cluster Aurora Read Replica. If you use the AWS CLI to create an Aurora Read
Replica, you must explicitly create the primary instance for your DB cluster. The primary instance is the
first instance that is created in a DB cluster.
546
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
You can create a primary instance for your DB cluster by using the CreateDBInstance Amazon RDS API
command with the following parameters:
• DBClusterIdentifier
The name of the DB instance class to use for your primary instance.
• DBInstanceIdentifier
In this example, you create a primary instance named myreadreplicainstance for the DB cluster
named myreadreplicacluster, using the DB instance class specified in myinstanceclass.
Example
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBInstance
&DBClusterIdentifier=myreadreplicacluster
&DBInstanceClass=myinstanceclass
&DBInstanceIdentifier=myreadreplicainstance
&Engine=aurora
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-09-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140424/us-east-1/rds/aws4_request
&X-Amz-Date=20140424T194844Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=bee4aabc750bf7dad0cd9e22b952bd6089d91e2a16592c2293e532eeaab8bc77
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 cluster for the Aurora Read Replica to display its details. The master MySQL DB
instance information is in the Replication source field.
547
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
AWS CLI
To view the MySQL to Aurora MySQL replication relationships for your Aurora MySQL DB clusters by
using the AWS CLI, use the describe-db-clusters and describe-db-instances commands.
To determine which MySQL DB instance is the master, use the describe-db-clusters and specify
the cluster identifier of the Aurora Read Replica for the --db-cluster-identifier option. Refer to
the ReplicationSourceIdentifier element in the output for the ARN of the DB instance that is the
replication master.
To determine which DB cluster is the Aurora Read Replica, use the describe-db-instances and
specify the instance identifier of the MySQL DB instance for the --db-instance-identifier option.
Refer to the ReadReplicaDBClusterIdentifiers element in the output for the DB cluster identifier
of the Aurora Read Replica.
Example
For Linux, macOS, or Unix:
548
Amazon Aurora User Guide for Aurora
Migrating from a MySQL DB Instance to Aurora MySQL
For Windows:
Before you promote your Aurora Read Replica, stop any transactions from being written to the source
MySQL DB instance, and then wait for the replica lag on the Aurora Read Replica to reach 0. You can view
the replica lag for an Aurora Read Replica by calling the SHOW SLAVE STATUS command on your Aurora
Read Replica and reading the Seconds behind master value.
You can start writing to the Aurora Read Replica after write transactions to the master have stopped and
replica lag is 0. If you write to the Aurora Read Replica before this and you modify tables that are also
being modified on the MySQL master, you risk breaking replication to Aurora. If this happens, you must
delete and recreate your Aurora Read Replica.
After you promote, confirm that the promotion has completed by choosing Instances in the navigation
pane and confirming that there is a Promoted Read Replica cluster to stand-alone database cluster
event for the Aurora Read Replica. After promotion is complete, the master MySQL DB Instance and the
Aurora Read Replica are unlinked, and you can safely delete the DB instance if you want to.
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 cluster for the Aurora Read Replica.
4. For Actions, choose Promote.
5. Choose Promote Read Replica.
AWS CLI
549
Amazon Aurora User Guide for Aurora
Managing Aurora MySQL
Example
For Windows:
Topics
• Managing Performance and Scaling for Amazon Aurora MySQL (p. 550)
• Backtracking an Aurora DB Cluster (p. 552)
• Testing Amazon Aurora Using Fault Injection Queries (p. 565)
• Altering Tables in Amazon Aurora Using Fast DDL (p. 568)
• Displaying Volume Status for an Aurora DB Cluster (p. 569)
You can scale your Aurora MySQL DB cluster by modifying the DB instance class for each DB instance
in the DB cluster. Aurora MySQL supports several DB instance classes optimized for Aurora. For the
specifications of the DB instance classes supported by Aurora MySQL, see DB Instance Classes (p. 33).
The following table lists the resulting default value of max_connections for each DB instance class
available to Aurora MySQL. You can increase the maximum number of connections to your Aurora
MySQL DB instance by scaling the instance up to a DB instance class with more memory, or by setting a
larger value for the max_connections parameter, up to 16,000.
db.t2.small 45
550
Amazon Aurora User Guide for Aurora
Managing Performance and
Scaling for Amazon Aurora MySQL
db.t2.medium 90
db.t3.small 45
db.t3.medium 90
db.r3.large 1000
db.r3.xlarge 2000
db.r3.2xlarge 3000
db.r3.4xlarge 4000
db.r3.8xlarge 5000
db.r4.large 1000
db.r4.xlarge 2000
db.r4.2xlarge 3000
db.r4.4xlarge 4000
db.r4.8xlarge 5000
db.r4.16xlarge 6000
db.r5.large 1000
db.r5.xlarge 2000
db.r5.2xlarge 3000
db.r5.4xlarge 4000
db.r5.8xlarge 5000
db.r5.12xlarge 6000
db.r5.16xlarge 6000
db.r5.24xlarge 7000
If you create a new parameter group to customize your own default for the connection limit, you'll see
that the default connection limit is derived using a formula based on the DBInstanceClassMemory
value. As shown in the preceding table, the formula produces connection limits that increase by 1000
as the memory doubles between progressively larger R3, R4, and R5 instances, and by 45 for different
memory sizes of T2 and T3 instances.
The DBInstanceClassMemory value represents the memory capacity available for the DB instance.
Aurora reserves some memory in each instance for the Aurora management components. This
adjustment to the DBInstanceClassMemory results in a lower max_connections value than if the
formula used the full memory for the associated DB instance class.
The much lower connectivity limits for T2 and T3 instances are because with Aurora, those instance
classes are intended only for development and test scenarios, not for production workloads.
551
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
The default connection limits are tuned for systems that use the default values for other major memory
consumers, such as the buffer pool and query cache. If you change those other settings for your cluster,
consider adjusting the connection limit to account for the increase or decrease in available memory on
the DB instances.
Overview of Backtracking
Backtracking "rewinds" the DB cluster to the time you specify. Backtracking is not a replacement for
backing up your DB cluster so that you can restore it to a point in time. However, backtracking provides
the following advantages over traditional backup and restore:
• You can easily undo mistakes. If you mistakenly perform a destructive action, such as a DELETE
without a WHERE clause, you can backtrack the DB cluster to a time before the destructive action with
minimal interruption of service.
• You can backtrack a DB cluster quickly. Restoring a DB cluster to a point in time launches a new DB
cluster and restores it from backup data or a DB cluster snapshot, which can take hours. Backtracking a
DB cluster doesn't require a new DB cluster and rewinds the DB cluster in minutes.
• You can explore earlier data changes. You can repeatedly backtrack a DB cluster back and forth in
time to help determine when a particular data change occurred. For example, you can backtrack a DB
cluster three hours and then backtrack forward in time one hour. In this case, the backtrack time is two
hours before the original time.
Note
For information about restoring a DB cluster to a point in time, see Overview of Backing Up and
Restoring an Aurora DB Cluster (p. 287).
Backtrack Window
With backtracking, there is a target backtrack window and an actual backtrack window:
• The target backtrack window is the amount of time you want to be able to backtrack your DB cluster.
When you enable backtracking, you specify a target backtrack window. For example, you might specify
a target backtrack window of 24 hours if you want to be able to backtrack the DB cluster one day.
• The actual backtrack window is the actual amount of time you can backtrack your DB cluster, which can
be smaller than the target backtrack window. The actual backtrack window is based on your workload
and the storage available for storing information about database changes, called change records.
As you make updates to your Aurora DB cluster with backtracking enabled, you generate change records.
Aurora retains change records for the target backtrack window, and you pay an hourly rate for storing
them. Both the target backtrack window and the workload on your DB cluster determine the number of
change records you store. The workload is the number of changes you make to your DB cluster in a given
amount of time. If your workload is heavy, you store more change records in your backtrack window than
you do if your workload is light.
You can think of your target backtrack window as the goal for the maximum amount of time you want to
be able to backtrack your DB cluster. In most cases, you can backtrack the maximum amount of time that
you specified. However, in some cases, the DB cluster can't store enough change records to backtrack the
maximum amount of time, and your actual backtrack window is smaller than your target. Typically, the
actual backtrack window is smaller than the target when you have extremely heavy workload on your DB
cluster. When your actual backtrack window is smaller than your target, we send you a notification.
552
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
When backtracking is enabled for a DB cluster, and you delete a table stored in the DB cluster, Aurora
keeps that table in the backtrack change records. It does this so that you can revert back to a time before
you deleted the table. If you don't have enough space in your backtrack window to store the table, the
table might be removed from the backtrack change records eventually.
Backtrack Time
Aurora always backtracks to a time that is consistent for the DB cluster. Doing so eliminates the
possibility of uncommitted transactions when the backtrack is complete. When you specify a time for
a backtrack, Aurora automatically chooses the nearest possible consistent time. This approach means
that the completed backtrack might not exactly match the time you specify, but you can determine the
exact time for a backtrack by using the describe-db-cluster-backtracks AWS CLI command. For more
information, see Retrieving Existing Backtracks (p. 564).
Backtrack Limitations
The following limitations apply to backtracking:
• Backtracking is only available on DB clusters that were created with the Backtrack feature enabled.
You can enable the Backtrack feature when you create a new DB cluster or restore a snapshot of a DB
cluster. For DB clusters that were created with the Backtrack feature enabled, you can create a clone
DB cluster with the Backtrack feature enabled. Currently, backtracking is not possible on DB clusters
that were created with the Backtrack feature disabled.
• The limit for a backtrack window is 72 hours.
• Backtracking affects the entire DB cluster. For example, you can't selectively backtrack a single table or
a single data update.
• Backtracking is not supported with binary log (binlog) replication. Cross-region replication must be
disabled before you can configure or use backtracking.
• You can't backtrack a database clone to a time before that database clone was created. However,
you can use the original database to backtrack to a time before the clone was created. For more
information about database cloning, see Cloning Databases in an Aurora DB Cluster (p. 254).
• Backtracking causes a brief DB instance disruption. You must stop or pause your applications before
starting a backtrack operation to ensure that there are no new read or write requests. During the
backtrack operation, Aurora pauses the database, closes any open connections, and drops any
uncommitted reads and writes. It then waits for the backtrack operation to complete.
• Backtracking isn't supported for the following AWS Regions:
• Africa (Cape Town)
• China (Ningxia)
• Asia Pacific (Hong Kong)
• Europe (Stockholm)
• Middle East (Bahrain)
• South America (São Paulo)
• You can't restore a cross-Region snapshot of a backtrack-enabled cluster in an AWS Region that
doesn't support backtracking.
• You can't use Backtrack with Aurora multi-master clusters.
Backtracking is available for Aurora MySQL 1.*, which is compatible with MySQL 5.6. It's also available for
Aurora MySQL 2.06 and higher, which is compatible with MySQL 5.7. Because of the Aurora MySQL 2.*
version requirement, if you created the Aurora MySQL 1.* cluster with the Backtrack setting enabled, you
can only upgrade to a Backtrack-compatible version of Aurora MySQL 2.*. This requirement affects the
following types of upgrade paths:
553
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
• You can only restore a snapshot of the Aurora MySQL 1.* DB cluster to a Backtrack-compatible version
of Aurora MySQL 2.*.
• You can only perform point-in-time recovery on the Aurora MySQL 1.* DB cluster to restore it to a
Backtrack-compatible version of Aurora MySQL 2.*.
These upgrade requirements still apply even if you turn off Backtrack for the Aurora MySQL 1.* cluster.
Configuring Backtracking
To use the Backtrack feature, you must enable backtracking and specify a target backtrack window.
Otherwise, backtracking is disabled.
For the target backtrack window, specify the amount of time that you want to be able to rewind your
database using Backtrack. Aurora tries to retain enough change records to support that window of time.
Console
You can use the console to configure backtracking when you create a new DB cluster. You can also
modify a DB cluster to enable backtracking.
Topics
• Configuring Backtracking with the Console When Creating a DB Cluster (p. 554)
• Configuring Backtrack with the Console When Modifying a DB Cluster (p. 555)
When you create a new Aurora MySQL DB cluster, backtracking is configured when you choose Enable
Backtrack and specify a Target Backtrack window value that is greater than zero in the Backtrack
section.
To create a DB cluster, follow the instructions in Creating an Amazon Aurora DB Cluster (p. 101). The
following image shows the Backtrack section.
When you create a new DB cluster, Aurora has no data for the DB cluster's workload. So it can't estimate
a cost specifically for the new DB cluster. Instead, the console presents a typical user cost for the
554
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
specified target backtrack window based on a typical workload. The typical cost is meant to provide a
general reference for the cost of the Backtrack feature.
Important
Your actual cost might not match the typical cost, because your actual cost is based on your DB
cluster's workload.
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 the cluster that you want to modify, and choose Modify.
4. If backtracking is disabled in the Backtrack section, choose Enable Backtrack.
Note
Currently, you can enable backtracking only for a DB cluster that was created with the
Backtrack feature enabled. The Backtrack section doesn't appear for a DB cluster that was
created with the Backtrack feature disabled.
5. For Target Backtrack window, modify the amount of time that you want to be able to backtrack.
The limit is 72 hours.
The console shows the estimated cost for the amount of time you specified based on the DB cluster's
past workload:
• If backtracking was disabled on the DB cluster, the cost estimate is based on the
VolumeWriteIOPS metric for the DB cluster in Amazon CloudWatch.
• If backtracking was enabled previously on the DB cluster, the cost estimate is based on the
BacktrackChangeRecordsCreationRate metric for the DB cluster in Amazon CloudWatch.
6. Choose Continue.
7. For Scheduling of Modifications, choose one of the following:
• Apply during the next scheduled maintenance window – Wait to apply the Target Backtrack
window modification until the next maintenance window.
555
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
• Apply immediately – Apply the Target Backtrack window modification as soon as possible.
8. Choose Modify cluster.
AWS CLI
When you create a new Aurora MySQL DB cluster using the create-db-cluster AWS CLI command,
backtracking is configured when you specify a --backtrack-window value that is greater than zero.
The --backtrack-window value specifies the target backtrack window. For more information, see
Creating an Amazon Aurora DB Cluster (p. 101).
You can also specify the --backtrack-window value using the following AWS CLI commands:
• modify-db-cluster
• restore-db-cluster-from-s3
• restore-db-cluster-from-snapshot
• restore-db-cluster-to-point-in-time
The following procedure describes how to modify the target backtrack window for a DB cluster using the
AWS CLI.
To modify the target backtrack window for a DB cluster using the AWS CLI
• Call the modify-db-cluster AWS CLI command and supply the following values:
The following example sets the target backtrack window for sample-cluster to one day (86,400
seconds).
For Windows:
Note
Currently, you can enable backtracking only for a DB cluster that was created with the Backtrack
feature enabled.
556
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
RDS API
When you create a new Aurora MySQL DB cluster using the CreateDBCluster Amazon RDS API operation,
backtracking is configured when you specify a BacktrackWindow value that is greater than zero.
The BacktrackWindow value specifies the target backtrack window for the DB cluster specified
in the DBClusterIdentifier value. For more information, see Creating an Amazon Aurora DB
Cluster (p. 101).
You can also specify the BacktrackWindow value using the following API operations:
• ModifyDBCluster
• RestoreDBClusterFromS3
• RestoreDBClusterFromSnapshot
• RestoreDBClusterToPointInTime
Note
Currently, you can enable backtracking only for a DB cluster that was created with the Backtrack
feature enabled.
Performing a Backtrack
You can backtrack a DB cluster to a specified backtrack time stamp. If the backtrack time stamp isn't
earlier than the earliest possible backtrack time, and isn't in the future, the DB cluster is backtracked to
that time stamp.
Otherwise, an error typically occurs. Also, if you try to backtrack a DB cluster for which binary logging
is enabled, an error typically occurs unless you've chosen to force the backtrack to occur. Forcing a
backtrack to occur can interfere with other operations that use binary logging.
Important
Backtracking doesn't generate binlog entries for the changes that it makes. If you have binary
logging enabled for the DB cluster, backtracking might not be compatible with your binlog
implementation.
Note
For database clones, you can't backtrack the DB cluster earlier than the date and time when the
clone was created. For more information about database cloning, see Cloning Databases in an
Aurora DB Cluster (p. 254).
Console
The following procedure describes how to perform a backtrack operation for a DB cluster 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 Instances.
3. Choose the primary instance for the DB cluster that you want to backtrack.
4. For Actions, choose Backtrack DB cluster.
5. On the Backtrack DB cluster page, enter the backtrack time stamp to backtrack the DB cluster to.
557
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
AWS CLI
The following procedure describes how to backtrack a DB cluster using the AWS CLI.
• Call the backtrack-db-cluster AWS CLI command and supply the following values:
The following example backtracks the DB cluster sample-cluster to March 19, 2018, at 10 a.m.
For Windows:
558
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
RDS API
To backtrack a DB cluster using the Amazon RDS API, use the BacktrackDBCluster action. This action
backtracks the DB cluster specified in the DBClusterIdentifier value to the specified time.
Monitoring Backtracking
You can view backtracking information and monitor backtracking metrics for a DB cluster.
Console
To view backtracking information and monitor backtracking metrics 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 the DB cluster name to open information about it.
• Target window – The current amount of time specified for the target backtrack window. The
target is the maximum amount of time that you can backtrack if there is sufficient storage.
• Actual window – The actual amount of time you can backtrack, which can be smaller than the
target backtrack window. The actual backtrack window is based on your workload and the storage
available for retaining backtrack change records.
• Earliest backtrack time – The earliest possible backtrack time for the DB cluster. You can't
backtrack the DB cluster to a time before the displayed time.
4. Do the following to view backtracking metrics for the DB cluster:
559
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
• Backtrack Change Records Creation Rate (Count) – This metric shows the number of
backtrack change records created over five minutes for your DB cluster. You can use this
metric to estimate the backtrack cost for your target backtrack window.
• [Billed] Backtrack Change Records Stored (Count) – This metric shows the actual number of
backtrack change records used by your DB cluster.
• Backtrack Window Actual (Minutes) – This metric shows whether there is a difference
between the target backtrack window and the actual backtrack window. For example, if your
target backtrack window is 2 hours (120 minutes), and this metric shows that the actual
backtrack window is 100 minutes, then the actual backtrack window is smaller than the
target.
• Backtrack Window Alert (Count) – This metric shows how often the actual backtrack window
is smaller than the target backtrack window for a given period of time.
Note
The following metrics might lag behind the current time:
560
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
AWS CLI
The following procedure describes how to view backtrack information for a DB cluster using the AWS CLI.
• Call the describe-db-clusters AWS CLI command and supply the following values:
For Windows:
RDS API
To view backtrack information for a DB cluster using the Amazon RDS API, use the DescribeDBClusters
operation. This action returns backtrack information for the DB cluster specified in the
DBClusterIdentifier value.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Event subscriptions.
3. Choose Create event subscription.
4. In the Name box, type a name for the event subscription, and ensure that Yes is selected for
Enabled.
5. In the Target section, choose New email topic.
6. For Topic name, type a name for the topic, and for With these recipients, enter the email addresses
or phone numbers to receive the notifications.
561
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
562
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
563
Amazon Aurora User Guide for Aurora
Backtracking a DB Cluster
AWS CLI
The following procedure describes how to retrieve existing backtracks for a DB cluster using the AWS CLI.
• Call the describe-db-cluster-backtracks AWS CLI command and supply the following values:
For Windows:
RDS API
To retrieve information about the backtracks for a DB cluster using the Amazon RDS API, use the
DescribeDBClusterBacktracks operation. This action returns information about backtracks for the DB
cluster specified in the DBClusterIdentifier value.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
564
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora Using Fault Injection Queries
2. Choose Databases.
3. Choose the cluster you want to modify, and choose Modify.
4. In the Backtrack section, choose Disable Backtrack.
5. Choose Continue.
6. For Scheduling of Modifications, choose one of the following:
• Apply during the next scheduled maintenance window – Wait to apply the modification until the
next maintenance window.
• Apply immediately – Apply the modification as soon as possible.
7. Choose Modify Cluster.
AWS CLI
You can disable the Backtrack feature for a DB cluster using the AWS CLI by setting the target backtrack
window to 0 (zero).
To modify the target backtrack window for a DB cluster using the AWS CLI
• Call the modify-db-cluster AWS CLI command and supply the following values:
The following example disables the Backtrack feature for the sample-cluster by setting --
backtrack-window to 0.
For Windows:
RDS API
To disable the Backtrack feature for a DB cluster using the Amazon RDS API, use the ModifyDBCluster
operation. Set the BacktrackWindow value to 0 (zero), and specify the DB cluster in the
DBClusterIdentifier value.
565
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora Using Fault Injection Queries
When a fault injection query specifies a crash, it forces a crash of the Aurora DB instance. The other fault
injection queries result in simulations of failure events, but don't cause the event to occur. When you
submit a fault injection query, you also specify an amount of time for the failure event simulation to
occur for.
You can submit a fault injection query to one of your Aurora Replica instances by connecting
to the endpoint for the Aurora Replica. For more information, see Amazon Aurora Connection
Management (p. 12).
For this fault injection query, a failover will not occur. If you want to test a failover, then you can choose
the Failover instance action for your DB cluster in the RDS console, or use the failover-db-cluster AWS
CLI command or the FailoverDBCluster RDS API operation.
Syntax
Options
This fault injection query takes one of the following crash types:
• INSTANCE—A crash of the MySQL-compatible database for the Amazon Aurora instance is simulated.
• DISPATCHER—A crash of the dispatcher on the master instance for the Aurora DB cluster is simulated.
The dispatcher writes updates to the cluster volume for an Amazon Aurora DB cluster.
• NODE—A crash of both the MySQL-compatible database and the dispatcher for the Amazon Aurora
instance is simulated. For this fault injection simulation, the cache is also deleted.
An Aurora Replica failure will block all requests to an Aurora Replica or all Aurora Replicas in the DB
cluster for a specified time interval. When the time interval completes, the affected Aurora Replicas will
be automatically synced up with master instance.
Syntax
566
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora Using Fault Injection Queries
Options
This fault injection query takes the following parameters:
• percentage_of_failure—The percentage of requests to block during the failure event. This value
can be a double between 0 and 100. If you specify 0, then no requests are blocked. If you specify 100,
then all requests are blocked.
• Failure type—The type of failure to simulate. Specify TO ALL to simulate failures for all Aurora
Replicas in the DB cluster. Specify TO and the name of the Aurora Replica to simulate a failure of a
single Aurora Replica. The default failure type is TO ALL.
• quantity—The amount of time for which to simulate the Aurora Replica failure. The interval is an
amount followed by a time unit. The simulation will occur for that amount of the specified unit. For
example, 20 MINUTE will result in the simulation running for 20 minutes.
Note
Take care when specifying the time interval for your Aurora Replica failure event. If you
specify too long of a time interval, and your master instance writes a large amount of data
during the failure event, then your Aurora DB cluster might assume that your Aurora Replica
has crashed and replace it.
During a disk failure simulation, the Aurora DB cluster randomly marks disk segments as faulting.
Requests to those segments will be blocked for the duration of the simulation.
Syntax
Options
This fault injection query takes the following parameters:
• percentage_of_failure — The percentage of the disk to mark as faulting during the failure event.
This value can be a double between 0 and 100. If you specify 0, then none of the disk is marked as
faulting. If you specify 100, then the entire disk is marked as faulting.
• DISK index — A specific logical block of data to simulate the failure event for. If you exceed the
range of available logical blocks of data, you will receive an error that tells you the maximum index
value that you can specify. For more information, see Displaying Volume Status for an Aurora DB
Cluster (p. 569).
• NODE index — A specific storage node to simulate the failure event for. If you exceed the range of
available storage nodes, you will receive an error that tells you the maximum index value that you can
specify. For more information, see Displaying Volume Status for an Aurora DB Cluster (p. 569).
• quantity — The amount of time for which to simulate the disk failure. The interval is an amount
followed by a time unit. The simulation will occur for that amount of the specified unit. For example,
20 MINUTE will result in the simulation running for 20 minutes.
567
Amazon Aurora User Guide for Aurora
Altering Tables in Amazon Aurora Using Fast DDL
During a disk congestion simulation, the Aurora DB cluster randomly marks disk segments as congested.
Requests to those segments will be delayed between the specified minimum and maximum delay time
for the duration of the simulation.
Syntax
Options
This fault injection query takes the following parameters:
For example, suppose that you use an ALTER TABLE operation to add a column to a table. Depending
on the algorithm specified for the operation, this operation can involve the following:
In Amazon Aurora, you can use fast DDL to execute an ALTER TABLE operation in place, nearly
instantaneously. The operation completes without requiring the table to be copied and without having
a material impact on other DML statements. Because the operation doesn't consume temporary storage
for a table copy, it makes DDL statements practical even for large tables on small instance classes.
568
Amazon Aurora User Guide for Aurora
Displaying Volume Status for an Aurora DB Cluster
Important
Currently, Aurora lab mode must be enabled to use fast DDL for Aurora MySQL. We don't
recommended using fast DDL for production DB clusters. For information about enabling Aurora
lab mode, see Amazon Aurora MySQL Lab Mode (p. 700).
Note
Fast DDL is available for Aurora version 1.12 and later. For more information about Aurora
versions, see Database Engine Updates for Amazon Aurora MySQL (p. 733)
Limitations
Currently, fast DDL has the following limitations:
• Fast DDL only supports adding nullable columns, without default values, to the end of an existing
table.
• Fast DDL does not support partitioned tables.
• Fast DDL does not support InnoDB tables that use the REDUNDANT row format.
• If the maximum possible record size for the DDL operation is too large, fast DDL is not used. A record
size is too large if it is greater than half the page size. The maximum size of a record is computed by
adding the maximum sizes of all columns. For variable sized columns, according to InnoDB standards,
extern bytes are not included for computation.
Note
The maximum record size check was added in Aurora 1.15.
Syntax
ALTER TABLE tbl_name ADD COLUMN col_name column_definition
Options
This statement takes the following options:
The data in each protection group is replicated across six physical storage devices, called storage nodes.
These storage nodes are allocated across three Availability Zones (AZs) in the region where the DB cluster
resides. In turn, each storage node contains one or more logical blocks of data for the DB cluster volume.
For more information about protection groups and storage nodes, see Introducing the Aurora Storage
Engine on the AWS Database Blog.
You can simulate the failure of an entire storage node, or a single logical block of data within a storage
node. To do so, you use the ALTER SYSTEM SIMULATE DISK FAILURE fault injection statement. For
569
Amazon Aurora User Guide for Aurora
Parallel Query for Aurora MySQL
the statement, you specify the index value of a specific logical block of data or storage node. However,
if you specify an index value greater than the number of logical blocks of data or storage nodes used
by the DB cluster volume, the statement returns an error. For more information about fault injection
queries, see Testing Amazon Aurora Using Fault Injection Queries (p. 565).
You can avoid that error by using the SHOW VOLUME STATUS statement. The statement returns two
server status variables, Disks and Nodes. These variables represent the total number of logical blocks of
data and storage nodes, respectively, for the DB cluster volume.
Note
The SHOW VOLUME STATUS statement is available for Aurora version 1.12 and later. For
more information about Aurora versions, see Database Engine Updates for Amazon Aurora
MySQL (p. 733).
Syntax
SHOW VOLUME STATUS
Example
The following example illustrates a typical SHOW VOLUME STATUS result.
Topics
• Overview of Parallel Query for Aurora MySQL (p. 571)
• Administering a Parallel Query Cluster (p. 573)
• Upgrade Considerations for Parallel Query (p. 573)
• Creating a DB Cluster that Works with Parallel Query (p. 573)
• Enabling and Disabling Parallel Query (p. 577)
• Performance Tuning for Parallel Query (p. 579)
• Creating Schema Objects to Take Advantage of Parallel Query (p. 579)
• Verifying Which Statements Use Parallel Query (p. 579)
• Monitoring Parallel Query (p. 582)
• How Parallel Query Works with SQL Constructs (p. 584)
570
Amazon Aurora User Guide for Aurora
Overview of Parallel Query
When the parallel query feature is enabled, the Aurora MySQL engine automatically determines when
queries can benefit, without requiring SQL changes such as hints or table attributes. In the following
sections, you can find an explanation of when parallel query is applied to a query. You can also find how
to make sure that parallel query is applied where it provides the most benefit.
Note
The parallel query optimization provides the most benefit for long-running queries that
take minutes or hours to complete. Aurora MySQL generally doesn't perform parallel query
optimization for inexpensive queries or if another optimization technique makes more sense,
such as query caching, buffer pool caching, or index lookups. See Verifying Which Statements
Use Parallel Query (p. 579) if you find parallel query isn't being used when you expect it.
Topics
• Benefits (p. 571)
• Architecture (p. 571)
• Limitations (p. 572)
Benefits
With parallel query, you can run data-intensive analytic queries on Aurora MySQL tables, in many cases
with an order-of-magnitude performance improvement over the traditional division of labor for query
processing.
• Improved I/O performance, due to parallelizing physical read requests across multiple storage nodes.
• Reduced network traffic. Aurora doesn't transmit entire data pages from storage nodes to the head
node and then filter out unnecessary rows and columns afterward. Instead, Aurora transmits compact
tuples containing only the column values needed for the result set.
• Reduced CPU usage on the head node, due to pushing down function execution, row filtering, and
column projection for the WHERE clause.
• Reduced memory pressure on the buffer pool. The pages processed by the parallel query aren't added
to the buffer pool, which reduces the chance of a data-intensive scan evicting frequently used data
from the buffer pool.
• Potentially reduced data duplication in your extract, transform, load (ETL) pipeline, by making it
practical to perform long-running analytic queries on existing data.
Architecture
The parallel query feature uses the major architectural principles of Aurora MySQL: decoupling
the database engine from the storage subsystem, and reducing network traffic by streamlining
communication protocols. Aurora MySQL uses these techniques to speed up write-intensive operations
such as redo log processing. Parallel query applies the same principles to read operations.
571
Amazon Aurora User Guide for Aurora
Overview of Parallel Query
Note
The architecture of Aurora MySQL parallel query differs from that of similarly named
features in other database systems. Aurora MySQL parallel query doesn't involve symmetric
multiprocessing (SMP) and so doesn't depend on the CPU capacity of the database server. The
parallel execution happens in the storage layer, independent of the Aurora MySQL server that
serves as the query coordinator.
By default, without parallel query, the processing for an Aurora query involves transmitting raw data to
a single node within the Aurora cluster (the head node) and performing all further processing in a single
thread on that single node. With parallel query, much of this I/O-intensive and CPU-intensive work is
delegated to nodes in the storage layer. Only the compact rows of the result set are transmitted back
to the head node, with rows already filtered, and column values already extracted and transformed.
The performance benefit comes from the reduction in network traffic, reduction in CPU usage on the
head node, and parallelizing the I/O across the storage nodes. The amount of parallel I/O, filtering, and
projection is independent of the number of DB instances in the Aurora cluster that runs the query.
Limitations
The following limitations apply to the parallel query feature:
• Currently, Aurora MySQL versions that are compatible with MySQL 5.6 support parallel query. (Note
that the PostgreSQL database engine has an unrelated feature that is also called "parallel query".)
• Currently, you can only use parallel query with the following instance classes:
• All instance classes in the db.r3 series.
• All instance classes in the db.r4 series.
• All instance classes that Aurora MySQL supports in the db.r5 series.
Note
You can't create db.t2 or db.t3 instances for parallel query.
• The parallel query option is available in the following regions:
• US East (N. Virginia)
• US East (Ohio)
• US West (Oregon)
• Europe (Ireland)
• Asia Pacific (Tokyo)
• Using parallel query requires creating a new cluster, or restoring from an existing Aurora MySQL
cluster snapshot, as described following.
• The Performance Insights feature is currently not available for clusters that are enabled for parallel
query.
• The backtrack feature is currently not available for clusters that are enabled for parallel query.
• You can't stop and start DB clusters that are enabled for parallel query.
• Currently, partitioned tables aren't supported for parallel query. You can use partitioned tables in
parallel query clusters. Queries against those tables use the non-parallel query execution path.
Note
A join, union, or other multipart query can partially use parallel query, even if some query
blocks refer to partitioned tables. The query blocks that refer only to nonpartitioned tables
can use the parallel query optimization.
• To work with parallel query, currently a table must use the COMPACT row format, which requires the
Antelope file format of the InnoDB storage engine.
• TEXT, BLOB, and GEOMETRY data types aren't supported with parallel query. A query that refers to any
columns of these types can't use parallel query.
• Variable-length columns (VARCHAR and CHAR data types) are compatible with parallel query up to a
maximum declared length of 768 bytes. A query that refers to any columns of the types declared with
572
Amazon Aurora User Guide for Aurora
Administration
a longer maximum length can't use parallel query. For columns that use multibyte character sets, the
byte limit takes into account the maximum number of bytes in the character set. For example, for the
character set utf8mb4 (which has a maximum character length of 4 bytes), a VARCHAR(192) column
is compatible with parallel query but a VARCHAR(193) column isn't.
The JSON data type is a BLOB-like type that is only available in Aurora is compatible with MySQL 5.7.
parallel query is only available in the Aurora compatible with MySQL 5.6. Thus, this type currently can't
be present in a table in a cluster that includes the parallel query feature.
• Currently, parallel query isn't used for tables that contain a full-text search index, regardless of
whether the query refers to such indexed columns or uses the MATCH() operator.
• Currently, parallel query isn't used for any query block that includes a LIMIT clause. Parallel query
might still be used for earlier query phases with GROUP by, ORDER BY, or joins.
• Currently, correlated subqueries can't use the parallel query optimization.
• Parallel query works with SELECT statements that do no writes or locking, and only under the
REPEATABLE READ isolation level. For example, parallel query doesn't work with SELECT FOR
UPDATE or with the WHERE clauses of UPDATE or DELETE statements.
• Parallel query is only available for tables for which no fast data definition language (DDL) operations
are pending.
• The parallel query feature works with most, but not all, operators and functions in the WHERE
clause. For examples that illustrate compatible operations, see How Parallel Query Works with SQL
Constructs (p. 584).
• Each Aurora DB instance can run only a certain number of parallel query sessions at one time. If a
query has multiple parts that use parallel query, such as subqueries, joins, or UNION operators, those
phases run in sequence. The statement only counts as a single parallel query session at any one time.
You can monitor the number of active sessions using the parallel query status variables (p. 582).
You can check the limit on concurrent sessions for a given DB instance by querying the status variable
Aurora_pq_max_concurrent_requests.
• Currently, parallel query doesn't support AWS Identity and Access Management (IAM) database
authentication.
You might need to create new versions of some large tables where parallel query is useful, for example
to make the table nonpartitioned or to remove full-text search indexes. For details, see Creating Schema
Objects to Take Advantage of Parallel Query (p. 579).
After setup is complete, ongoing administration involves monitoring performance and removing
obstacles to parallel query usage. For those instructions, see Performance Tuning for Parallel
Query (p. 579).
573
Amazon Aurora User Guide for Aurora
Creating a Parallel Query Cluster
you do with other Aurora MySQL clusters. You can create a new cluster to work with parallel query. You
can also create a DB cluster to work with parallel query by restoring from a snapshot of a MySQL 5.6-
compatible database. If you aren't familiar with the process for creating a new Aurora MySQL cluster, you
can find background information and prerequisites in Creating an Amazon Aurora DB Cluster (p. 101).
• When you choose an Aurora MySQL engine version, make sure to choose the latest engine that is
compatible with MySQL 5.6. Currently, Aurora MySQL versions that are compatible with MySQL 5.6
support parallel query.
• When you create or restore the DB cluster, make sure to choose the parallelquery engine mode.
Whether you create a new cluster or restore from a snapshot, you use the same techniques to add new
DB instances that you do with other Aurora MySQL clusters.
1. Follow the general AWS Management Console procedure in Creating an Amazon Aurora DB
Cluster (p. 101).
2. On the Select engine screen, choose the MySQL 5.6-compatible edition of Aurora.
3. On the Specify DB details screen, for Capacity type, choose Provisioned with Aurora parallel
query enabled as in the screenshot following.
To restore a snapshot to a parallel query cluster with the AWS Management Console
574
Amazon Aurora User Guide for Aurora
Creating a Parallel Query Cluster
2. Follow the general AWS Management Console procedure in Restoring from a DB Cluster
Snapshot (p. 292).
3. For DB Engine Mode, choose parallelquery, as shown in the screenshot following.
1. Check which combinations of Aurora MySQL version, AWS instance class, AWS Region, Availability
Zone, and so on, are available for parallel query clusters. To do so, use the aws rds describe-
orderable-db-instance-options command, which produces output in JSON format. The
following code example shows how to check which combinations are available for parallel query
clusters in a specified AWS Region.
575
Amazon Aurora User Guide for Aurora
Creating a Parallel Query Cluster
{Engine:Engine,EngineVersion:EngineVersion,SupportedEngineModes:SupportedEngineModes,D
--region us-east-1
[
{
"DBInstanceClass": "db.r3.2xlarge",
"EngineVersion": "5.6.10a",
"Engine": "aurora",
"SupportedEngineModes": [
"parallelquery"
]
},
{
"DBInstanceClass": "db.r3.4xlarge",
"EngineVersion": "5.6.10a",
...
2. Follow the general AWS CLI procedure in Creating an Amazon Aurora DB Cluster (p. 101).
3. Specify the following set of options:
4. Verify that a cluster you created or restored has the parallel query feature available. Check that the
aurora_pq_supported configuration setting is true.
1. Check which combinations of Aurora MySQL version, AWS instance class, AWS Region, Availability
Zone, and so on, are available for parallel query clusters. To do so, use the aws rds describe-
orderable-db-instance-options command, which produces output in JSON format. The
following code example shows how.
576
Amazon Aurora User Guide for Aurora
Enabling and Disabling Parallel Query
5. Verify that a cluster you created or restored has the parallel query feature available. Check that the
aurora_pq_supported configuration setting is true.
To toggle the aurora_pq parameter at the session level, for example through the mysql command
line or within a JDBC or ODBC application, use the standard methods to change a client configuration
577
Amazon Aurora User Guide for Aurora
Enabling and Disabling Parallel Query
setting. For example, the command on the standard MySQL client is set session aurora_pq =
{'ON'/'OFF'}. You can also add the session-level parameter to the JDBC configuration or within your
application code to enable or disable parallel query dynamically.
Currently, when you change the global setting for the aurora_pq parameter, you must do so for the
whole cluster, not for individual DB instances. To toggle the aurora_pq parameter at the cluster level,
use the techniques for working with parameter groups, as described in Working with DB Parameter
Groups and DB Cluster Parameter Groups (p. 205). Follow these steps:
You can modify the parallel query parameter by using the ModifyDBClusterParameterGroup API
operation or the AWS Management Console.
Note
When parallel query is enabled, Aurora MySQL determines whether to use it at runtime for each
query. In the case of joins, unions, subqueries, and so on, Aurora MySQL determines whether to
use parallel query at runtime for each query block. For details, see Verifying Which Statements
Use Parallel Query (p. 579) and How Parallel Query Works with SQL Constructs (p. 584).
To enable or disable parallel query for an Aurora MySQL cluster with the AWS Management
Console
1. Create a custom parameter group, as described in Working with DB Parameter Groups and DB
Cluster Parameter Groups (p. 205).
2. Update aurora_pq to 0 (disabled) or 1 (enabled), as shown in the following screenshot. On clusters
where the parallel query feature is available, aurora_pq is enabled by default.
3. Attach the custom cluster parameter group to the Aurora DB cluster where you intend to use the
parallel query feature.
578
Amazon Aurora User Guide for Aurora
Performance Tuning
You can also enable or disable parallel query at the session level, for example through the mysql
command line or within a JDBC or ODBC application. To do so, use the standard methods to change a
client configuration setting. For example, the command on the standard MySQL client is set session
aurora_pq = {'ON'/'OFF'}.
You can also add the session-level parameter to the JDBC configuration or within your application code
to enable or disable parallel query dynamically.
Parallel query currently requires tables to be nonpartitioned. Thus, check your CREATE TABLE
statements and SHOW CREATE TABLE output and remove any PARTITION BY clauses. For existing
partitioned tables, first copy the data into nonpartitioned tables with the same column definitions and
indexes. Then rename old and new tables so that the nonpartitioned table is used by existing queries and
ETL workflows.
Before changing your schema to enable parallel query to work with more tables, conduct tests to
confirm if parallel query results in a net increase in performance for those tables. Also, make sure that
the schema requirements for parallel query are otherwise compatible with your goals.
579
Amazon Aurora User Guide for Aurora
Verifying Parallel Query Usage
If you run experiments in a development or test environment, you might find that parallel query is
not used because your tables are too small in number of rows or overall data volume. The data for the
table might also be entirely in the buffer pool, especially for tables you created recently to perform
experiments.
As you monitor or tune cluster performance, you need to decide whether parallel query is being used
in the appropriate contexts. You might adjust the database schema, settings, SQL queries, or even the
cluster topology and application connection settings to take advantage of this feature.
To check if a query is using parallel query, check the query execution plan (also known as the "explain
plan") by running the EXPLAIN statement. For examples of how SQL statements, clauses, and expressions
affect EXPLAIN output for parallel query, see How Parallel Query Works with SQL Constructs (p. 584).
The following example demonstrates the difference between a traditional execution plan and a parallel
query plan. This query is Query 3 from the TPC-H benchmark. Many of the sample queries throughout
this section use the tables from the TPC-H dataset.
SELECT l_orderkey,
sum(l_extendedprice * (1 - l_discount)) AS revenue,
o_orderdate,
o_shippriority
FROM customer,
orders,
lineitem
WHERE c_mktsegment = 'AUTOMOBILE'
AND c_custkey = o_custkey
AND l_orderkey = o_orderkey
AND o_orderdate < date '1995-03-13'
AND l_shipdate > date '1995-03-13'
GROUP BY l_orderkey,
o_orderdate,
o_shippriority
ORDER BY revenue DESC,
o_orderdate LIMIT 10;
With parallel query disabled, the query might have an execution plan like the following, which uses hash
join but not parallel query.
+----+-------------+----------+...+-----------
+-----------------------------------------------------------------+
| id | select_type | table |...| rows | Extra
|
+----+-------------+----------+...+-----------
+-----------------------------------------------------------------+
| 1 | SIMPLE | customer |...| 5798330 | Using where; Using index; Using temporary;
Using filesort |
| 1 | SIMPLE | orders |...| 154545408 | Using where; Using join buffer (Hash Join
Outer table orders) |
| 1 | SIMPLE | lineitem |...| 606119300 | Using where; Using join buffer (Hash Join
Outer table lineitem) |
+----+-------------+----------+...+-----------
+-----------------------------------------------------------------+
After parallel query is enabled, two steps in this execution plan can use the parallel query optimization,
as shown under the Extra column in the EXPLAIN output. The I/O-intensive and CPU-intensive
processing for those steps is pushed down to the storage layer.
580
Amazon Aurora User Guide for Aurora
Verifying Parallel Query Usage
+----+...
+------------------------------------------------------------------------------------------------------
+
| id |...| Extra
|
+----+...
+------------------------------------------------------------------------------------------------------
+
| 1 |...| Using where; Using index; Using temporary; Using filesort
|
| 1 |...| Using where; Using join buffer (Hash Join Outer table orders); Using parallel
query (4 columns, 1 filters, 1 exprs; 0 extra) |
| 1 |...| Using where; Using join buffer (Hash Join Outer table lineitem); Using parallel
query (4 columns, 1 filters, 1 exprs; 0 extra) |
+----+...
+------------------------------------------------------------------------------------------------------
+
For information about how to interpret EXPLAIN output for a parallel query and the parts
of SQL statements that parallel query can apply to, see How Parallel Query Works with SQL
Constructs (p. 584).
The following example output shows the results of running the preceding query on a db.r4.2xlarge
instance with a cold buffer pool. The query runs substantially faster when using parallel query.
Note
Because timings depend on many environmental factors, and this example query ran using
an early version of parallel query, your results might be different. Always conduct your own
performance tests to confirm the findings with your own environment, workload, and so on.
Many of the sample queries throughout this section use the tables from this TPC-H dataset, particularly
the PART table, which has 20 million rows and the following definition.
+---------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+-------+
| p_partkey | int(11) | NO | PRI | NULL | |
581
Amazon Aurora User Guide for Aurora
Monitoring
Experiment with your workload to get a sense of whether individual SQL statements can take advantage
of parallel query. Then, use the following monitoring techniques to help verify how often parallel query
is used in real workloads over time. For real workloads, extra factors such as concurrency limits apply.
A parallel query session isn't necessarily a one-to-one mapping with an executed query. For example,
suppose your execution plan has two steps that use parallel query. In that case, the query involves two
parallel sessions and the counters for requests attempted and requests successful are incremented by
two.
When you experiment with parallel query by issuing EXPLAIN statements, expect to see increases in the
counters designated as "not chosen" even though the queries aren't actually running. When you work
with parallel query in production, you can check if the "not chosen" counters are increasing faster than
you expect. You can then adjust your cluster settings, query mix, DB instances where parallel query is
enabled, and so on, so that parallel query runs for the queries that you expect.
These counters are tracked at the DB instance level. When you connect to a different endpoint, you
might see different metrics because each DB instance runs its own set of parallel queries. You might also
see different metrics when the reader endpoint connects to a different DB instance for each session.
Name Description
582
Amazon Aurora User Guide for Aurora
Monitoring
583
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
The decision to use parallel query relies on many factors that occur at the moment that the statement
runs. Thus, parallel query might be used for certain queries always, never, or only under certain
conditions.
Topics
• EXPLAIN statement (p. 584)
• WHERE Clause (p. 586)
• Function Calls in WHERE Clause (p. 587)
• Aggregate Functions, GROUP BY Clauses, and HAVING Clauses (p. 588)
• Comparison Operators (p. 589)
• Joins (p. 589)
• Subqueries (p. 590)
• UNION (p. 591)
• Views (p. 591)
• Data Manipulation Language (DML) Statements (p. 592)
• Transactions and Locking (p. 592)
• Indexes (p. 594)
• Built-In Caching Mechanisms (p. 594)
• MyISAM Temporary Tables (p. 595)
EXPLAIN statement
As shown in examples throughout this section, the EXPLAIN statement indicates whether each stage of
a query is currently eligible for parallel query. It also indicates which aspects of a query can be pushed
down to the storage layer. The most important items in the execution plan are the following:
• A value other than NULL for the key column suggests that the query can be performed efficiently
using index lookups, and parallel query is unlikely.
• A small value for the rows column (that is, a value not in the millions) suggests that the query isn't
accessing enough data to make parallel query worthwhile, and parallel query is unlikely.
584
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
• The Extra column shows you if parallel query is expected to be used. This output looks like the
following example.
The columns number represents how many columns are referred to in the query block.
The filters number represents the number of WHERE predicates representing a simple comparison
of a column value to a constant. The comparison can be for equality, inequality, or a range. Aurora can
parallelize these kinds of predicates most effectively.
The exprs number represents the number of expressions such as function calls, operators, or other
expressions that can also be parallelized, though not as effectively as a filter condition.
The extra number represents how many expressions can't be pushed down and are performed by the
head node.
The information from the Extra column shows that five columns are extracted from each row to
evaluate the query conditions and construct the result set. One WHERE predicate involves a filter, that
is, a column that is directly tested in the WHERE clause. Two WHERE clauses require evaluating more
complicated expressions, in this case involving function calls. The 0 extra field confirms that all
the operations in the WHERE clause are pushed down to the storage layer as part of parallel query
processing.
In cases where parallel query isn't chosen, you can typically deduce the reason from the other columns of
the EXPLAIN output. For example, the rows value might be too small, or the possible_keys column
might indicate that the query can use an index lookup instead of a data-intensive scan. The following
example shows a query where the optimizer can estimate, based on the characteristics of the primary
key, that the query will scan only a small number of rows. In this case, parallel query isn't required.
mysql> explain select count(*) from part where p_partkey between 1 and 100;
+----+-------------+-------+-------+---------------+---------+---------+------+------
+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows |
Extra |
+----+-------------+-------+-------+---------------+---------+---------+------+------
+--------------------------+
| 1 | SIMPLE | part | range | PRIMARY | PRIMARY | 4 | NULL | 99 |
Using where; Using index |
585
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
+----+-------------+-------+-------+---------------+---------+---------+------+------
+--------------------------+
The output showing whether parallel query will be used takes into account all available factors at the
moment that the EXPLAIN statement is run. The optimizer might make a different choice when the
query is actually run, if the situation changed in the meantime. For example, EXPLAIN might report that
a statement will use parallel query. But when the query is actually run later, it might not use parallel
query based on the conditions then. Such conditions can include several other parallel queries running
concurrently, rows being deleted from the table, a new index being created, too much time passing
within an open transaction, and so on.
WHERE Clause
For a query to use the parallel query optimization, it must include a WHERE clause.
The parallel query optimization speeds up many kinds of expressions used in the WHERE clause:
• Simple comparisons of a column value to a constant, known as filters. These comparisons benefit the
most from being pushed down to the storage layer. The number of filter expressions in a query is
reported in the EXPLAIN output.
• Other kinds of expressions in the WHERE clause are also pushed down to the storage layer where
possible. The number of such expressions in a query is reported in the EXPLAIN output. These
expressions can be function calls, LIKE operators, CASE expressions, and so on.
• Certain functions and operators aren't currently pushed down by parallel query. The number of such
expressions in a query is reported as the extra counter in the EXPLAIN output. The rest of the query
can still use parallel query.
• While expressions in the select list aren't pushed down, queries containing such functions can still
benefit from reduced network traffic for the intermediate results of parallel queries. For example,
queries that call aggregation functions in the select list can benefit from parallel query, even though
the aggregation functions aren't pushed down.
For example, the following query does a full-table scan and processes all the values for the P_BRAND
column. However, it doesn't use parallel query because the query doesn't include any WHERE clause.
In contrast, the following query includes WHERE predicates that filter the results, so parallel query can be
applied:
mysql> explain select count(*), p_brand from part where p_name is not null
-> and p_mfgr in ('Manufacturer#1', 'Manufacturer#3') and p_retailprice > 1000
-> group by p_brand;
+----+...+----------
+------------------------------------------------------------------------------------------------------
+
586
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
If the optimizer estimates that the number of returned rows for a query block is small, parallel query
isn't used for that query block. The following example shows a case where a greater-than operator on
the primary key column applies to millions of rows, which causes parallel query to be used. The converse
less-than test is estimated to apply to only a few rows and doesn't use parallel query.
mysql> explain select count(*) from part where p_partkey > 10;
+----+...+----------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
+----+...+----------
+----------------------------------------------------------------------------+
| 1 |...| 20427936 | Using where; Using parallel query (1 columns, 1 filters, 0 exprs; 0
extra) |
+----+...+----------
+----------------------------------------------------------------------------+
mysql> explain select count(*) from part where p_partkey < 10;
+----+...+------+--------------------------+
| id |...| rows | Extra |
+----+...+------+--------------------------+
| 1 |...| 9 | Using where; Using index |
+----+...+------+--------------------------+
Currently, the parallelization doesn't apply to function calls in the select list. Those functions are
evaluated by the head node, even if identical function calls appear in the WHERE clause. The original
values from relevant columns are included in the tuples transmitted from the storage nodes back to the
head node. The head node performs any transformations such as UPPER(), CONCATENATE(), and so on
to produce the final values for the result set.
In the following example, parallel query parallelizes the call to LOWER() because it appears in the WHERE
clause. Parallel query doesn't affect the calls to SUBSTR() and UPPER() because they appear in the
select list.
587
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
+----+...
+---------------------------------------------------------------------------------------------
+
| 1 |...| Using where; Using temporary; Using parallel query (2 columns, 0 filters, 1
exprs; 0 extra) |
+----+...
+---------------------------------------------------------------------------------------------
+
The same considerations apply to other expressions, such as CASE expressions or LIKE operators. For
example, the following example shows that parallel query evaluates the CASE expression and LIKE
operators in the WHERE clause.
The following simple examples illustrate the kinds of aggregate queries that can benefit from parallel
query. They do so by returning intermediate results in compact form to the head node, filtering
nonmatching rows from the intermediate results, or both.
mysql> explain select sql_no_cache count(distinct p_brand) from part where p_mfgr =
'Manufacturer#5';
+----+...+----------------------------------------------------------------------------+
| id |...| Extra |
+----+...+----------------------------------------------------------------------------+
| 1 |...| Using where; Using parallel query (2 columns, 1 filters, 0 exprs; 0 extra) |
+----+...+----------------------------------------------------------------------------+
mysql> explain select sql_no_cache p_mfgr from part where p_retailprice > 1000 group by
p_mfgr having count(*) > 100;
588
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
+----+...
+------------------------------------------------------------------------------------------------------
+
| id |...| Extra
|
+----+...
+------------------------------------------------------------------------------------------------------
+
| 1 |...| Using where; Using temporary; Using filesort; Using parallel query (3 columns, 0
filters, 1 exprs; 0 extra) |
+----+...
+------------------------------------------------------------------------------------------------------
+
Comparison Operators
The optimizer estimates how many rows to scan to evaluate comparison operators, and determines
whether to use parallel query based on that estimate.
The first example following shows that an equality comparison against the primary key column can
be performed efficiently without parallel query. The second example following shows that a similar
comparison against an unindexed column requires scanning millions of rows and therefore can benefit
from parallel query.
mysql> explain select * from part where p_type = 'LARGE BRUSHED BRASS';
+----+...+----------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
+----+...+----------
+----------------------------------------------------------------------------+
| 1 |...| 20427936 | Using where; Using parallel query (9 columns, 1 filters, 0 exprs; 0
extra) |
+----+...+----------
+----------------------------------------------------------------------------+
The same considerations apply for not-equals tests and for range comparisons such as less than, greater
than or equal to, or BETWEEN. The optimizer estimates the number of rows to scan, and determines
whether parallel query is worthwhile based on the overall volume of I/O.
Joins
Join queries with large tables typically involve data-intensive operations that benefit from the parallel
query optimization. The comparisons of column values between multiple tables (that is, the join
predicates themselves) currently aren't parallelized. However, parallel query can push down some of the
internal processing for other join phases, such as constructing the Bloom filter during a hash join. Parallel
query can apply to join queries even without a WHERE clause. Therefore, a join query is an exception to
the rule that a WHERE clause is required to use parallel query.
Each phase of join processing is evaluated to check if it is eligible for parallel query. If more than one
phase can use parallel query, these phases are executed in sequence. Thus, each join query counts as a
single parallel query session in terms of concurrency limits.
589
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
For example, when a join query includes WHERE predicates to filter the rows from one of the joined
tables, that filtering option can use parallel query. As another example, suppose that a join query uses
the hash join mechanism, for example to join a big table with a small table. In this case, the table scan to
produce the Bloom filter data structure might be able to use parallel query.
Note
Hash joins are always available in parallel query-enabled clusters. Parallel query is typically used
for the kinds of resource-intensive queries that benefit from the hash join optimization.
mysql> explain select count(*) from orders join customer where o_custkey = c_custkey;
+----+...+----------+-------+---------------+-------------+...+-----------
+------------------------------------------------------------------------------------------------------
+
| id |...| table | type | possible_keys | key |...| rows | Extra
|
+----+...+----------+-------+---------------+-------------+...+-----------
+------------------------------------------------------------------------------------------------------
+
| 1 |...| customer | index | PRIMARY | c_nationkey |...| 15051972 | Using index
|
| 1 |...| orders | ALL | o_custkey | NULL |...| 154545408 | Using join
buffer (Hash Join Outer table orders); Using parallel query (1 columns, 0 filters, 1
exprs; 0 extra) |
+----+...+----------+-------+---------------+-------------+...+-----------
+------------------------------------------------------------------------------------------------------
+
For a join query that uses the nested loop mechanism, the outermost nested loop block might use
parallel query. The use of parallel query depends on the same factors as usual, such as the presence of
additional filter conditions in the WHERE clause.
mysql> -- Nested loop join with extra filter conditions can use parallel query.
mysql> explain select count(*) from part, partsupp where p_partkey != ps_partkey and p_name
is not null and ps_availqty > 0;
+----+-------------+----------+...+----------
+----------------------------------------------------------------------------+
| id | select_type | table |...| rows | Extra
|
+----+-------------+----------+...+----------
+----------------------------------------------------------------------------+
| 1 | SIMPLE | part |...| 20427936 | Using where; Using parallel query (2
columns, 1 filters, 0 exprs; 0 extra) |
| 1 | SIMPLE | partsupp |...| 78164450 | Using where; Using join buffer (Block Nested
Loop) |
+----+-------------+----------+...+----------
+----------------------------------------------------------------------------+
Subqueries
The outer query block and inner subquery block might each use parallel query, or not, based on the
usual characteristics of the table, WHERE clause, and so on, for each block. For example, the following
query uses parallel query for the subquery block but not the outer block.
590
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
+----+-------------+...+----------
+----------------------------------------------------------------------------+
| id | select_type |...| rows | Extra
|
+----+-------------+...+----------
+----------------------------------------------------------------------------+
| 1 | PRIMARY |...| NULL | Impossible WHERE noticed after reading const tables
|
| 2 | SUBQUERY |...| 20427936 | Using where; Using parallel query (2 columns, 0
filters, 1 exprs; 0 extra) |
+----+-------------+...+----------
+----------------------------------------------------------------------------+
UNION
Each query block in a UNION query can use parallel query, or not, based on the usual characteristics of
the table, WHERE clause, and so on, for each part of the UNION.
mysql> explain select p_partkey from part where p_name like '%choco_ate%'
-> union select p_partkey from part where p_name like '%vanil_a%';
+----+----------------+...+----------
+----------------------------------------------------------------------------+
| id | select_type |...| rows | Extra
|
+----+----------------+...+----------
+----------------------------------------------------------------------------+
| 1 | PRIMARY |...| 20427936 | Using where; Using parallel query (2 columns, 0
filters, 1 exprs; 0 extra) |
| 2 | UNION |...| 20427936 | Using where; Using parallel query (2 columns, 0
filters, 1 exprs; 0 extra) |
| NULL | UNION RESULT | <union1,2> |...| NULL | Using temporary
|
+----+--------------+...+----------
+----------------------------------------------------------------------------+
Note
Each UNION clause within the query is run sequentially. Even if the query includes multiple
stages that all use parallel query, it only runs a single parallel query at any one time. Therefore,
even a complex multistage query only counts as 1 toward the limit of concurrent parallel
queries.
Views
The optimizer rewrites any query using a view as a longer query using the underlying tables. Thus,
parallel query works the same whether table references are views or real tables. All the same
considerations about whether to use parallel query for a query, and which parts are pushed down, apply
to the final rewritten query.
For example, the following execution plan shows a view definition that usually doesn't use parallel query.
When the view is queried with additional WHERE clauses, Aurora MySQL uses parallel query.
mysql> explain select count(*) from part_view where p_partkey is not null;
+----+...+----------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
591
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
+----+...+----------
+----------------------------------------------------------------------------+
| 1 |...| 20427936 | Using where; Using parallel query (1 columns, 0 filters, 0 exprs; 1
extra) |
+----+...+----------
+----------------------------------------------------------------------------+
mysql> explain insert into part_subset select * from part where p_mfgr = 'Manufacturer#1';
+----+...+----------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
+----+...+----------
+----------------------------------------------------------------------------+
| 1 |...| 20427936 | Using where; Using parallel query (9 columns, 1 filters, 0 exprs; 0
extra) |
+----+...+----------
+----------------------------------------------------------------------------+
Note
Typically, after an INSERT statement, the data for the newly inserted rows is in the buffer pool.
Therefore, a table might not be eligible for parallel query immediately after inserting a large
number of rows. Later, after the data is evicted from the buffer pool during normal operation,
queries against the table might begin using parallel query again.
The CREATE TABLE AS SELECT statement doesn't use parallel query, even if the SELECT portion of
the statement would otherwise be eligible for parallel query. The DDL aspect of this statement makes
it incompatible with parallel query processing. In contrast, in the INSERT ... SELECT statement, the
SELECT portion can use parallel query.
Parallel query is never used for DELETE or UPDATE statements, regardless of the size of the table and
predicates in the WHERE clause.
After a big transaction is finished, the table statistics might be stale. Such stale statistics might require
an ANALYZE TABLE statement before Aurora can accurately estimate the number of rows. A large-scale
DML statement might also bring a substantial portion of the table data into the buffer pool. Having this
data in the buffer pool can lead to parallel query being chosen less frequently for that table until the
data is evicted from the pool.
592
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
When your session is inside a long-running transaction (by default, 10 minutes), further queries inside
that session don't use parallel query. A timeout can also occur during a single long-running query. This
type of timeout might happen if the query runs for longer than the maximum interval (currently 10
minutes) before the parallel query processing starts.
You can reduce the chance of starting long-running transactions accidentally by setting autocommit=1
in mysql sessions where you perform ad hoc (one-time) queries. Even a SELECT statement against a
table begins a transaction by creating a read view. A read view is a consistent set of data for subsequent
queries that remains until the transaction is committed. Be aware of this restriction also when using
JDBC or ODBC applications with Aurora, because such applications might run with the autocommit
setting turned off.
The following example shows how, with the autocommit setting turned off, running a query against
a table creates a read view that implicitly begins a transaction. Queries that are run shortly afterward
can still use parallel query. However, after a pause of several minutes, queries are no longer eligible for
parallel query. Ending the transaction with COMMIT or ROLLBACK restores parallel query eligibility.
mysql> explain select sql_no_cache count(*) from part_txn where p_retailprice > 10.0;
+----+...+---------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
+----+...+---------
+----------------------------------------------------------------------------+
| 1 |...| 2976129 | Using where; Using parallel query (1 columns, 1 filters, 0 exprs; 0
extra) |
+----+...+---------
+----------------------------------------------------------------------------+
mysql> select sleep(720); explain select sql_no_cache count(*) from part_txn where
p_retailprice > 10.0;
+------------+
| sleep(720) |
+------------+
| 0 |
+------------+
1 row in set (12 min 0.00 sec)
+----+...+---------+-------------+
| id |...| rows | Extra |
+----+...+---------+-------------+
| 1 |...| 2976129 | Using where |
+----+...+---------+-------------+
mysql> commit;
mysql> explain select sql_no_cache count(*) from part_txn where p_retailprice > 10.0;
+----+...+---------
+----------------------------------------------------------------------------+
| id |...| rows | Extra
|
+----+...+---------
+----------------------------------------------------------------------------+
| 1 |...| 2976129 | Using where; Using parallel query (1 columns, 1 filters, 0 exprs; 0
extra) |
+----+...+---------
+----------------------------------------------------------------------------+
To see how many times queries weren't eligible for parallel query because they were inside long-running
transactions, check the status variable Aurora_pq_not_chosen_long_trx.
593
Amazon Aurora User Guide for Aurora
Parallel Query and SQL Constructs
Any SELECT statement that acquires locks, such as the SELECT FOR UPDATE or SELECT LOCK IN
SHARE MODE syntax, can't use parallel query.
Parallel query can work for a table that is locked by a LOCK TABLES statement.
Indexes
The statistics gathered by the ANALYZE TABLE statement help the optimizer to decide when to use
parallel query or index lookups, based on the characteristics of the data for each column. Keep statistics
current by running ANALYZE TABLE after DML operations that make substantial changes to the data
within a table.
If index lookups can perform a query efficiently without a data-intensive scan, Aurora might use index
lookups. Doing so avoids the overhead of parallel query processing. There are also concurrency limits on
the number of parallel queries that can run simultaneously on any Aurora DB cluster. Make sure to use
best practices for indexing your tables, so that your most frequent and most highly concurrent queries
use index lookups.
When a parallel query filters rows and transforms and extracts column values, data is transmitted back
to the head node as tuples rather than as data pages. Therefore, running a parallel query doesn't add any
pages to the buffer pool, or evict pages that are already in the buffer pool.
Aurora checks the number of pages of table data that are present in the buffer pool, and what
proportion of the table data that number represents. Aurora uses that information to determine whether
594
Amazon Aurora User Guide for Aurora
Advanced Auditing with Aurora MySQL
it is more efficient to use parallel query (and bypass the data in the buffer pool). Alternatively, Aurora
might use the nonparallel query execution path, which uses data cached in the buffer pool. Which pages
are cached and how data-intensive queries affect caching and eviction depends on configuration settings
related to the buffer pool. Therefore, it can be hard to predict whether any particular query uses parallel
query, because the choice depends on the ever-changing data within the buffer pool.
Also, Aurora imposes concurrency limits on parallel queries. Because not every query uses parallel query,
tables that are accessed by multiple queries simultaneously typically have a substantial portion of their
data in the buffer pool. Therefore, Aurora often doesn't choose these tables for parallel queries.
When you run a sequence of nonparallel queries on the same table, the first query might be slow due to
the data not being in the buffer pool. Then the second and subsequent queries are much faster because
the buffer pool is now "warmed up". Parallel queries typically show consistent performance from the
very first query against the table. When conducting performance tests, benchmark the nonparallel
queries with both a cold and a warm buffer pool. In some cases, the results with a warm buffer pool can
compare well to parallel query times. In these cases, consider factors such as the frequency of queries
against that table and whether it is worthwhile to keep the data for that table in the buffer pool.
The query cache avoids re-executing a query when an identical query is submitted and the underlying
table data hasn't changed. Queries optimized by parallel query feature can go into the query cache,
effectively making them instantaneous when run again.
Note
When conducting performance comparisons, the query cache can produce artificially low timing
numbers. Therefore, in benchmark-like situations, you can use the sql_no_cache hint. This
hint prevents the result from being served from the query cache, even if the same query had
been run previously. The hint comes immediately after the SELECT statement in a query. Many
parallel query examples in this topic include this hint, to make query times comparable between
versions of the query that are enabled with parallel query and not.
Make sure that you remove this hint from your source when you move to production use of
parallel query.
595
Amazon Aurora User Guide for Aurora
Enabling Advanced Auditing
Use the server_audit_logging parameter to enable or disable Advanced Auditing, and the
server_audit_events parameter to specify what events to log.
Configure Advanced Auditing by setting these parameters in the parameter group used by your DB
cluster. You can use the procedure shown in Modifying Parameters in a DB Parameter Group (p. 210)
to modify DB cluster parameters using the AWS Management Console. You can use the modify-db-
cluster-parameter-group AWS CLI command or the ModifyDBClusterParameterGroup Amazon RDS API
command to modify DB cluster parameters programmatically.
server_audit_logging
Enables or disables Advanced Auditing. This parameter defaults to OFF; set it to ON to enable Advanced
Auditing.
server_audit_events
Contains the comma-delimited list of events to log. Events must be specified in all caps, and there
should be no white space between the list elements, for example: CONNECT,QUERY_DDL. This parameter
defaults to an empty string.
• CONNECT – Logs both successful and failed connections and also disconnections. This event includes
user information.
• QUERY – Logs all queries in plain text, including queries that fail due to syntax or permission errors.
• QUERY_DCL – Similar to the QUERY event, but returns only data control language (DCL) queries
(GRANT, REVOKE, and so on).
• QUERY_DDL – Similar to the QUERY event, but returns only data definition language (DDL) queries
(CREATE, ALTER, and so on).
• QUERY_DML – Similar to the QUERY event, but returns only data manipulation language (DML) queries
(INSERT, UPDATE, and so on, and also SELECT).
• TABLE – Logs the tables that were affected by query execution.
server_audit_excl_users
Contains the comma-delimited list of user names for users whose activity isn't logged. There should be
no white space between the list elements, for example: rdsadmin,user_1,user_2. This parameter
defaults to an empty string. The maximum length is 1024 characters. Specified user names must match
corresponding values in the User column of the mysql.user table. For more information about user
names, see the MySQL documentation.
Connect and disconnect events aren't affected by this variable; they are always logged if specified. A
user is logged if that user is also specified in the server_audit_incl_users parameter, because that
setting has higher priority than server_audit_excl_users.
596
Amazon Aurora User Guide for Aurora
Viewing Audit Logs
server_audit_incl_users
Contains the comma-delimited list of user names for users whose activity is logged. There should be no
white space between the list elements, for example: user_3,user_4. This parameter defaults to an
empty string. The maximum length is 1024 characters. Specified user names must match corresponding
values in the User column of the mysql.user table. For more information about user names, see the
MySQL documentation.
Connect and disconnect events aren't affected by this variable; they are always logged if specified. A
user is logged even if that user is also specified in the server_audit_excl_users parameter, because
server_audit_incl_users has higher priority.
To download a log file, choose that file in the Logs section and then choose Download.
You can also get a list of the log files by using the describe-db-log-files AWS CLI command. You can
download the contents of a log file by using the download-db-log-file-portion AWS CLI command. For
more information, see Viewing and Listing Database Log Files (p. 489) and Downloading a Database Log
File (p. 489).
Log entries are not in sequential order. You can use the timestamp value for ordering.
Log files are rotated when they reach 100 MB in aggregate. This limit is not configurable.
The audit log files include the following comma-delimited information in rows, in the specified order:
Field Description
timestamp The Unix time stamp for the logged event with microsecond precision.
serverhost The name of the instance that the event is logged for.
597
Amazon Aurora User Guide for Aurora
Single-Master Replication with Aurora MySQL
Field Description
queryid The query ID number, which can be used for finding the relational table events and
related queries. For TABLE events, multiple lines are added.
operation The recorded action type. Possible values are: CONNECT, QUERY, READ, WRITE,
CREATE, ALTER, RENAME, and DROP.
object For QUERY events, this value indicates the executed query. For TABLE events, it
indicates the table name.
All the replicas work from the same underlying data. If some database instances go offline, others remain
available to continue processing queries or to take over as the writer if needed. Aurora automatically
spreads your read-only connections across multiple database instances, helping an Aurora cluster to
support query-intensive workloads.
Following, you can find information about how Aurora MySQL replication works and how to fine-tune
replication settings for best availability and performance.
Note
Following, you can learn about replication features for Aurora clusters using single-master
replication. This kind of cluster is the default for Aurora. For information about Aurora multi-
master clusters, see Working with Aurora Multi-Master Clusters (p. 628).
Topics
• Using Aurora Replicas (p. 598)
• Replication Options for Amazon Aurora MySQL (p. 599)
• Performance Considerations for Amazon Aurora MySQL Replication (p. 600)
• High Availability Considerations for Amazon Aurora MySQL Replication (p. 600)
• Monitoring Amazon Aurora MySQL Replication (p. 600)
• Replicating Amazon Aurora MySQL DB Clusters Across AWS Regions (p. 601)
• Replication Between Aurora and MySQL or Between Aurora and Another Aurora DB Cluster (p. 611)
• Using GTID-Based Replication for Aurora MySQL (p. 624)
598
Amazon Aurora User Guide for Aurora
Options
to the primary instance and to Aurora Replicas in the DB cluster. For more information about Aurora
Replicas, see Aurora Replicas (p. 60).
Aurora Replicas work well for read scaling because they are fully dedicated to read operations on your
cluster volume. Write operations are managed by the primary instance. Because the cluster volume is
shared among all instances in your Aurora MySQL DB cluster, no additional work is required to replicate
a copy of the data for each Aurora Replica. In contrast, MySQL read replicas must replay, on a single
thread, all write operations from the master DB instance to their local data store. This limitation can
affect the ability of MySQL read replicas to support large volumes of read traffic.
With Aurora MySQL, when an Aurora Replica is deleted, its instance endpoint is removed immediately,
and the Aurora Replica is removed from the reader endpoint. If there are statements executing on the
Aurora Replica that is being deleted, there is a three minute grace period. Existing statements can finish
gracefully during the grace period. When the grace period ends, the Aurora Replica is shut down and
deleted.
Important
Aurora Replicas for Aurora MySQL always use the REPEATABLE READ default transaction
isolation level for operations on InnoDB tables. You can use the SET TRANSACTION
ISOLATION LEVEL command to change the transaction level only for the primary instance
of an Aurora MySQL DB cluster. This restriction avoids user-level locks on Aurora Replicas,
and allows Aurora Replicas to scale to support thousands of active user connections while still
keeping replica lag to a minimum.
Note
DDL statements executed on the primary instance might interrupt database connections on the
associated Aurora Replicas. If an Aurora Replica connection is actively using a database object,
such as a table, and that object is modified on the primary instance using a DDL statement, the
Aurora Replica connection is interrupted.
Note
The China (Ningxia) Region does not support cross-Region read replicas.
• Two Aurora MySQL DB clusters in different AWS Regions, by creating an Aurora Read Replica of an
Aurora MySQL DB cluster in a different AWS Region.
For more information, see Replicating Amazon Aurora MySQL DB Clusters Across AWS
Regions (p. 601).
• Two Aurora MySQL DB clusters in the same AWS Region, by using MySQL binary log (binlog)
replication.
For more information, see Replication Between Aurora and MySQL or Between Aurora and Another
Aurora DB Cluster (p. 611).
• An Amazon RDS MySQL DB instance as the master and an Aurora MySQL DB cluster, by creating an
Aurora Read Replica of an Amazon RDS MySQL DB instance.
Typically, this approach is used for migration to Aurora MySQL, rather than for ongoing replication.
For more information, see Migrating Data from a MySQL DB Instance to an Amazon Aurora MySQL DB
Cluster by Using a DB Snapshot (p. 534).
Note
Rebooting the primary instance of an Amazon Aurora DB cluster also automatically reboots the
Aurora Replicas for that DB cluster, in order to re-establish an entry point that guarantees read/
write consistency across the DB cluster.
599
Amazon Aurora User Guide for Aurora
Performance
The replica log compression feature automatically reduces network bandwidth for replication messages.
Because each message is transmitted to all Aurora Replicas, the benefits are greater for larger clusters.
This feature involves some CPU overhead on the writer node to perform the compression. Thus, the
feature is only available on the 8xlarge and 16xlarge instance classes, which have high CPU capacity.
It is enabled by default on these instance classes. You can control this feature by turning off the
aurora_enable_replica_log_compression parameter. For example, you might turn off replica log
compression for larger instance classes if your writer node is near its maximum CPU capacity.
The binlog filtering feature automatically reduces network bandwidth for replication messages. Because
the Aurora Replicas don't use the binlog information that is included in the replication messages,
that data is omitted from the messages sent to those nodes. You control this feature by changing the
aurora_enable_repl_bin_log_filtering parameter. This parameter is on by default. Because
this optimization is intended to be transparent, you might turn off this setting only during diagnosis or
troubleshooting for issues related to replication. For example, you can do so to match the behavior of an
older Aurora MySQL cluster where this feature was not available.
The tradeoff with having multiple Aurora Replicas is that replicas become unavailable for brief periods
when the underlying database instances are restarted. These restarts can happen during maintenance
operations, or when a replica begins to lag too far behind the master. Restarting a replica interrupts
existing connections to the corresponding database instance. Restarting an Aurora cluster causes all the
replicas to become unavailable at the same time.
Starting in Aurora MySQL 1.17.4, the following feature helps to ensure high availability even during
these intervals when replicas are restarted.
The zero-downtime restart (ZDR) feature preserves existing connections when an Aurora MySQL Replica is
restarted, for example if the replica falls too far behind the master. Any open transaction is rolled back,
and your application must retry it. To enable this feature, turn on the aurora_enable_zdr parameter
in the cluster parameter group. This parameter is off by default.
600
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
DB cluster. The AuroraReplicaLagMinimum metric records the minimum amount of lag between the
primary DB instance and each Aurora Replica in the DB cluster.
If you need the most current value for Aurora Replica lag, you can query the
mysql.ro_replica_status table on the primary instance in your Aurora MySQL DB cluster and check
the value in the Replica_lag_in_msec column. This column value is provided to Amazon CloudWatch
as the value for the AuroraReplicaLag metric. The Aurora Replica lag is also recorded on each Aurora
Replica in the INFORMATION_SCHEMA.REPLICA_HOST_STATUS table in your Aurora MySQL DB cluster.
For more information on monitoring RDS instances and CloudWatch metrics, see Monitoring an Amazon
Aurora DB Cluster (p. 353).
You can create read replicas of both encrypted and unencrypted DB clusters. The read replica must be
encrypted if the source DB cluster is encrypted.
For each source DB cluster, you can have up to five cross-Region DB clusters that are read replicas. When
you create an Aurora MySQL DB cluster read replica in another AWS Region, you should be aware of the
following:
• Both your source DB cluster and your cross-Region read replica DB cluster can have up to 15 Aurora
Replicas, along with the primary instance for the DB cluster. By using this functionality, you can scale
read operations for both your source AWS Region and your replication target AWS Region.
• In a cross-Region scenario, there is more lag time between the source DB cluster and the read replica
due to the longer network channels between AWS Regions.
• Data transferred for cross-Region replication incurs Amazon RDS data transfer charges. The following
cross-Region replication actions generate charges for the data transferred out of the source AWS
Region:
• When you create the read replica, Amazon RDS takes a snapshot of the source cluster and transfers
the snapshot to the AWS Region that holds the read replica.
• For each data modification made in the source databases, Amazon RDS transfers data from the
source region to the AWS Region that holds the read replica.
For more information about Amazon RDS data transfer pricing, see Amazon Aurora Pricing.
• You can run multiple concurrent create or delete actions for read replicas that reference the same
source DB cluster. However, you must stay within the limit of five read replicas for each source DB
cluster.
• For replication to operate effectively, each read replica should have the same amount of compute and
storage resources as the source DB cluster. If you scale the source DB cluster, you should also scale the
read replicas.
Topics
• Before You Begin (p. 602)
• Creating an Amazon Aurora MySQL DB Cluster That Is a Cross-Region Read Replica (p. 602)
• Viewing Amazon Aurora MySQL Cross-Region Replicas (p. 608)
• Promoting a Read Replica to Be a DB Cluster (p. 609)
• Troubleshooting Amazon Aurora MySQL Cross Region Replicas (p. 610)
601
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
To enable binary logging on an Aurora MySQL DB cluster, update the binlog_format parameter for
your source DB cluster. The binlog_format parameter is a cluster-level parameter that is in the default
cluster parameter group. If your DB cluster uses the default DB cluster parameter group, create a new
DB cluster parameter group to modify binlog_format settings. We recommend that you set the
binlog_format to MIXED. However, you can also set binlog_format to ROW or STATEMENT if you
need a specific binlog format. Reboot your Aurora DB cluster for the change to take effect.
For more information, see Amazon Aurora DB Cluster and DB Instance Parameters (p. 207) and Working
with DB Parameter Groups and DB Cluster Parameter Groups (p. 205).
When you create a cross-Region read replica for Aurora MySQL by using the AWS Management Console,
Amazon RDS creates a DB cluster in the target AWS Region, and then automatically creates a DB instance
that is the primary instance for that DB cluster.
When you create a cross-Region read replica using the AWS CLI or RDS API, you first create the DB cluster
in the target AWS Region and wait for it to become active. Once it is active, you then create a DB instance
that is the primary instance for that DB cluster.
Replication begins when the primary instance of the read replica DB cluster becomes available.
Use the following procedures to create a cross-Region read replica from an Aurora MySQL DB cluster.
These procedures work for creating read replicas from either encrypted or unencrypted DB clusters.
Console
To create an Aurora MySQL DB cluster that is a cross-Region read replica with 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 top-right corner of the AWS Management Console, select the AWS Region that hosts your
source DB cluster.
3. In the navigation pane, choose Instances.
4. Choose the check box for the DB instance that you want to create a cross-Region read replica for. For
Actions, choose Create cross region read replica.
5. On the Create cross region read replica page, choose the option settings for your cross-Region read
replica DB cluster, as described in the following table.
Option Description
Destination region Choose the AWS Region to host the new cross-Region
read replica DB cluster.
602
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
Option Description
Destination DB subnet group Choose the DB subnet group to use for the cross-Region
read replica DB cluster.
DB instance identifier Type a name for the primary instance in your cross-
Region read replica DB cluster. This identifier is used in
the endpoint address for the primary instance of the new
DB cluster.
603
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
Option Description
DB cluster identifier Type a name for your cross-Region read replica DB cluster
that is unique for your account in the target AWS Region
for your replica. This identifier is used in the cluster
endpoint address for your DB cluster. For information
on the cluster endpoint, see Amazon Aurora Connection
Management (p. 12).
Database port Specify the port for applications and utilities to use to
access the database. Aurora DB clusters default to the
default MySQL port, 3306. Firewalls at some companies
block connections to this port. If your company firewall
blocks the default port, choose another port for the new
DB cluster.
Auto minor version upgrade This setting doesn't apply to Aurora MySQL DB clusters.
604
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
AWS CLI
To create an Aurora MySQL DB cluster that is a cross-Region read replica with the CLI
1. Call the AWS CLI create-db-cluster command in the AWS Region where you want to create the
read replica DB cluster. Include the --replication-source-identifier option and specify the
Amazon Resource Name (ARN) of the source DB cluster to create a read replica for.
The following code example creates a read replica in the us-east-1 Region from an unencrypted DB
cluster snapshot in the us-west-2 Region. The command is called in the us-east-1 Region.
For Windows:
The following code example creates a read replica in the us-east-1 Region from an encrypted DB
cluster snapshot in the us-west-2 Region. The command is called in the us-east-1 Region.
605
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
--storage-encrypted
For Windows:
2. Check that the DB cluster has become available to use by using the AWS CLI describe-db-
clusters command, as shown in the following example.
When the describe-db-clusters results show a status of available, create the primary
instance for the DB cluster so that replication can begin. To do so, use the AWS CLI create-db-
instance command as shown in the following example.
For Windows:
When the DB instance is created and available, replication begins. You can determine if the DB
instance is available by calling the AWS CLI describe-db-instances command.
RDS API
To create an Aurora MySQL DB cluster that is a cross-Region read replica with the API
1. Call the RDS API CreateDBCluster action in the AWS Region where you want to create the read
replica DB cluster. Include the ReplicationSourceIdentifier parameter and specify the
Amazon Resource Name (ARN) of the source DB cluster to create a read replica for.
606
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
to true. You must also specify the PreSignedUrl parameter. The presigned URL must be a valid
request for the CreateDBCluster API operation that can be executed in the source AWS Region
that contains the encrypted DB cluster to be replicated. The KMS key ID is used to encrypt the read
replica, and must be a KMS encryption key valid for the destination AWS Region. To automatically
rather than manually generate a presigned URL, use the AWS CLI create-db-cluster command
with the --source-region option instead.
Note
You can set up cross-Region replication from an unencrypted DB cluster to an encrypted
read replica by specifying StorageEncrypted as true and providing a value for
KmsKeyId. In this case, you don't need to specify PreSignedUrl.
You don't need to include the MasterUsername and MasterUserPassword parameters, because
those values are taken from the source DB cluster.
The following code example creates a read replica in the us-east-1 Region from an unencrypted DB
cluster snapshot in the us-west-2 Region. The action is called in the us-east-1 Region.
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBCluster
&ReplicationSourceIdentifier=arn:aws:rds:us-west-2:123456789012:cluster:sample-
master-cluster
&DBClusterIdentifier=sample-replica-cluster
&Engine=aurora
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20161117/us-east-1/rds/aws4_request
&X-Amz-Date=20160201T001547Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=a04c831a0b54b5e4cd236a90dcb9f5fab7185eb3b72b5ebe9a70a4e95790c8b7
The following code example creates a read replica in the us-east-1 Region from an encrypted DB
cluster snapshot in the us-west-2 Region. The action is called in the us-east-1 Region.
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBCluster
&KmsKeyId=my-us-east-1-key
&StorageEncrypted=true
&PreSignedUrl=https%253A%252F%252Frds.us-west-2.amazonaws.com%252F
%253FAction%253DCreateDBCluster
%2526DestinationRegion%253Dus-east-1
%2526KmsKeyId%253Dmy-us-east-1-key
%2526ReplicationSourceIdentifier%253Darn%25253Aaws%25253Ards%25253Aus-
west-2%25253A123456789012%25253Acluster%25253Asample-master-cluster
%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
&ReplicationSourceIdentifier=arn:aws:rds:us-west-2:123456789012:cluster:sample-
master-cluster
&DBClusterIdentifier=sample-replica-cluster
607
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
&Engine=aurora
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20161117/us-east-1/rds/aws4_request
&X-Amz-Date=20160201T001547Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=a04c831a0b54b5e4cd236a90dcb9f5fab7185eb3b72b5ebe9a70a4e95790c8b7
2. Check that the DB cluster has become available to use by using the RDS API DescribeDBClusters
action, as shown in the following example.
https://rds.us-east-1.amazonaws.com/
?Action=DescribeDBClusters
&DBClusterIdentifier=sample-replica-cluster
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20161117/us-east-1/rds/aws4_request
&X-Amz-Date=20160201T002223Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=84c2e4f8fba7c577ac5d820711e34c6e45ffcd35be8a6b7c50f329a74f35f426
When the DescribeDBClusters results show a status of available, create the primary instance
for the DB cluster so that replication can begin. To do so, use the RDS API CreateDBInstance
action as shown in the following example.
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBInstance
&DBClusterIdentifier=sample-replica-cluster
&DBInstanceClass=db.r3.large
&DBInstanceIdentifier=sample-replica-instance
&Engine=aurora
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20161117/us-east-1/rds/aws4_request
&X-Amz-Date=20160201T003808Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=125fe575959f5bbcebd53f2365f907179757a08b5d7a16a378dfa59387f58cdb
When the DB instance is created and available, replication begins. You can determine if the DB
instance is available by calling the AWS CLI DescribeDBInstances command.
608
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
Typically, you promote an Aurora MySQL Read Replica to a standalone DB cluster as a data recovery
scheme if the source DB cluster fails.
To do this, first create a read replica and then monitor the source DB cluster for failures. In the event of a
failure, do the following:
When you promote a read replica, the read replica becomes a standalone Aurora DB cluster. 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 cluster, it's just like any other DB cluster. For
example, you can create read replicas from it and perform point-in-time restore operations. You can also
create Aurora Replicas for the DB cluster.
Because the promoted DB cluster is no longer a read replica, you can't use it as a replication target.
The following steps show the general process for promoting a read replica to a DB cluster:
1. Stop any transactions from being written to the read replica source DB cluster, 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 source DB cluster, and this replication lag can vary significantly. Use the ReplicaLag
metric to determine when all updates have been made to the read replica. The ReplicaLag metric
records the amount of time a read replica DB instance lags behind the source DB instance. When the
ReplicaLag metric reaches 0, the read replica has caught up to the source DB instance.
2. Promote the read replica by using the Promote option on the Amazon RDS console, the AWS CLI
command promote-read-replica-db-cluster, or the PromoteReadReplicaDBCluster
Amazon RDS API operation.
You choose an Aurora MySQL DB instance to promote the read replica. After the read replica is
promoted, the Aurora MySQL DB cluster is promoted to a standalone DB cluster. The DB instance with
the highest failover priority is promoted to the primary DB instance for the DB cluster. The other DB
instances become Aurora Replicas.
Note
The promotion process takes a few minutes to complete. When you promote a read replica,
replication is stopped and the DB instances are rebooted. When the reboot is complete, the
read replica is available as a new DB cluster.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. On the console, choose Instances.
609
Amazon Aurora User Guide for Aurora
Replicating Amazon Aurora MySQL
DB Clusters Across AWS Regions
AWS CLI
Example
For Windows:
RDS API
Source cluster [DB cluster ARN] doesn't have cluster parameter group in sync on
writer
You receive this error if you have updated the binlog_format DB cluster parameter, but have not
rebooted the primary instance for the DB cluster. Reboot the primary instance (that is, the writer) for the
DB cluster and try again.
Source cluster [DB cluster ARN] already has a read replica in this region
You can only have one cross-Region DB cluster that is a read replica for each source DB cluster in any
AWS Region. To create a new cross-Region DB cluster that is a read replica in a particular AWS Region,
you must delete the existing one.
DB cluster [DB cluster ARN] requires a database engine upgrade for cross-Region
replication support
To resolve this issue, upgrade the database engine version for all of the instances in the source DB cluster
to the most recent database engine version, and then try creating a cross-Region read replica DB again.
610
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
You can also replicate with an Amazon RDS MySQL DB instance or Aurora MySQL DB cluster in another
AWS Region. When you're performing replication across AWS Regions, ensure that your DB clusters and
DB instances are publicly accessible. Aurora MySQL DB clusters must be part of a public subnet in your
VPC.
If you want to configure replication between an Aurora MySQL DB cluster and an Aurora MySQL DB
cluster in another region, you can create an Aurora MySQL DB cluster as a read replica in a different AWS
Region than the source DB cluster. For more information, see Replicating Amazon Aurora MySQL DB
Clusters Across AWS Regions (p. 601).
With Aurora MySQL 2.04 and higher, you can replicate between Aurora MySQL and an external
source or target that uses global transaction identifiers (GTIDs) for replication. Ensure that the GTID-
related parameters in the Aurora MySQL DB cluster have settings that are compatible with the GTID
status of the external database. To learn how to do this, see Using GTID-Based Replication for Aurora
MySQL (p. 624).
Warning
When you replicate between Aurora MySQL and MySQL, ensure that you use only InnoDB tables.
If you have MyISAM tables that you want to replicate, you can convert them to InnoDB before
setting up replication with the following command.
Setting up MySQL replication with Aurora MySQL involves the following steps, which are discussed in
detail following in this topic:
2. Retain Binary Logs on the Replication Master Until No Longer Needed (p. 615)
611
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
• Enable automated backups for the DB instance. You can enable automated backups
when you create a DB instance, or you can enable backups by modifying an existing
DB instance. For more information, see Creating a DB Instance in the Amazon RDS User
Guide.
• Create a read replica for the DB instance. For more information, see Working with Read
Replicas in the Amazon RDS User Guide.
Currently, encrypted replication with an external MySQL database is only supported for
Aurora MySQL version 5.6.
Note
If you don't need to use encrypted replication, you can skip these steps.
• Secure Sockets Layer (SSL) must be enabled on the external MySQL master database.
• A client key and client certificate must be prepared for the Aurora MySQL DB cluster.
During encrypted replication, the Aurora MySQL DB cluster acts a client to the MySQL
database server. The certificates and keys for the Aurora MySQL client are in files in .pem
format.
• If you don't have SSL enabled on the external MySQL master database and
don't have a client key and client certificate prepared, enable SSL on the MySQL
database server and generate the required client key and client certificate.
• If SSL is enabled on the external master, supply a client key and certificate for
the Aurora MySQL DB cluster. If you don't have these, generate a new key and
certificate for the Aurora MySQL DB cluster. To sign the client certificate, you must
have the certificate authority key that you used to configure SSL on the external
MySQL master database.
612
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
For more information, see Creating SSL Certificates and Keys Using openssl in the
MySQL documentation.
You need the certificate authority certificate, the client key, and the client certificate.
2. Connect to the Aurora MySQL DB cluster as the master user using SSL.
For information about connecting to an Aurora MySQL DB cluster with SSL, see Using
SSL with Aurora MySQL DB Clusters (p. 509).
3. Run the mysql.rds_import_binlog_ssl_material stored procedure to import
the SSL information into the Aurora MySQL DB cluster.
For the ssl_material_value parameter, insert the information from the .pem
format files for the Aurora MySQL DB cluster in the correct JSON payload.
The following example imports SSL information into an Aurora MySQL DB cluster.
In .pem format files, the body code typically is longer than the body code shown in
the example.
call mysql.rds_import_binlog_ssl_material(
'{"ssl_ca":"-----BEGIN CERTIFICATE-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/
d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/
cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi
+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END CERTIFICATE-----\n","ssl_cert":"-----BEGIN CERTIFICATE-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/
d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/
cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi
+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END CERTIFICATE-----\n","ssl_key":"-----BEGIN RSA PRIVATE KEY-----
AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/
d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/
cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi
+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
-----END RSA PRIVATE KEY-----\n"}');
613
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
To enable binary logging on an external MySQL database
sudo vi /etc/my.cnf
Add the log_bin and server_id options to the [mysqld] section. The log_bin
option provides a file name identifier for binary log files. The server_id option
provides a unique identifier for the server in master-replica relationships.
If encrypted replication isn't required, ensure that the external MySQL database is
started with binlogs enabled and SSL disabled.
The following are the relevant entries in the /etc/my.cnf file for unencrypted data.
log-bin=mysql-bin
server-id=2133421
innodb_flush_log_at_trx_commit=1
sync_binlog=1
If encrypted replication is required, ensure that the external MySQL database is started
with SSL and binlogs enabled.
The entries in the /etc/my.cnf file include the .pem file locations for the MySQL
database server.
log-bin=mysql-bin
server-id=2133421
innodb_flush_log_at_trx_commit=1
sync_binlog=1
# Setup SSL.
ssl-ca=/home/sslcerts/ca.pem
ssl-cert=/home/sslcerts/server-cert.pem
ssl-key=/home/sslcerts/server-key.pem
Additionally, the sql_mode option for your MySQL DB instance must be set to 0, or
must not be included in your my.cnf file.
While connected to the external MySQL database, record the external MySQL
database's binary log position.
614
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
+------------------+----------+--------------+------------------
+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
Executed_Gtid_Set |
+------------------+----------+--------------+------------------
+-------------------+
| mysql-bin.000031 | 107 | | |
|
+------------------+----------+--------------+------------------
+-------------------+
1 row in set (0.00 sec)
For more information, see Setting the Replication Master Configuration in the MySQL
documentation.
3. Start the mysql service.
Find instructions on how to retain binary logs for your database engine following.
Database Instructions
Engine
You do not have access to the binlog files for an Aurora MySQL DB cluster. As a result,
you must choose a time frame to retain the binlog files on your replication master long
enough to ensure that the changes have been applied to your replica before the binlog
file is deleted by Amazon RDS. You can retain binlog files on an Aurora MySQL DB cluster
for up to 90 days.
If you are setting up replication with a MySQL database or RDS MySQL DB instance as
the replica, and the database that you are creating a replica for is very large, choose a
large time frame to retain binlog files until the initial copy of the database to the replica
is complete and the replica lag has reached 0.
To set the binlog retention time frame, use the mysql_rds_set_configuration procedure
and specify a configuration parameter of 'binlog retention hours' along with
the number of hours to retain binlog files on the DB cluster, up to 2160 (90 days). The
following example that sets the retention period for binlog files to 6 days:
615
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
After replication has been started, you can verify that changes have been applied to your
replica by running the SHOW SLAVE STATUS command on your replica and checking the
Seconds behind master field. If the Seconds behind master field is 0, then there is no
replica lag. When there is no replica lag, reduce the length of time that binlog files are
retained by setting the binlog retention hours configuration parameter to a smaller
time frame.
If you specify a value for 'binlog retention hours' that is higher than 2160, then
2160 is used.
You can also retain binlog files on an Amazon RDS DB instance by creating a read replica
for the DB instance. This read replica is temporary and solely for the purpose of retaining
binlog files. After the read replica has been created, call the mysql_rds_stop_replication
procedure on the read replica (the mysql.rds_stop_replication procedure is only
available for MySQL versions 5.5, 5.6 and later, and 5.7 and later). While replication is
stopped, Amazon RDS doesn't delete any of the binlog files on the replication master.
After you have set up replication with your permanent replica, you can delete the read
replica when the replica lag (Seconds behind master field) between your replication
master and your permanent replica reaches 0.
After replication has been started, you can verify that changes have been applied to your
replica by running the SHOW SLAVE STATUS command on your replica and checking the
Seconds behind master field. If the Seconds behind master field is 0, then there is no
replica lag. When there is no replica lag, you can delete old binlog files.
Find instructions on how to create a snapshot of your replication master for your database engine
following.
Database Instructions
Engine
1. Create a DB cluster snapshot of your Amazon Aurora DB cluster. For more information,
see Creating a DB Cluster Snapshot (p. 290).
2. Create a new Aurora DB cluster by restoring from the DB cluster snapshot that you
just created. Be sure to retain the same DB parameter group for your restored DB
cluster as your original DB cluster. Doing this ensures that the copy of your DB cluster
616
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
has binary logging enabled. For more information, see Restoring from a DB Cluster
Snapshot (p. 292).
3. In the console, choose Databases and choose the primary instance (writer) for your
restored Aurora DB cluster to show its details. Scroll to Recent Events. An event
message shows that includes the binlog file name and position. The event message is
in the following format.
Save the binlog file name and position values for when you start replication.
You can also get the binlog file name and position by calling the describe-events
command from the AWS CLI. The following shows an example describe-events
command with example output.
{
"Events": [
{
"EventCategories": [],
"SourceType": "db-instance",
"SourceArn": "arn:aws:rds:us-west-2:123456789012:db:sample-
restored-instance",
"Date": "2016-10-28T19:43:46.862Z",
"Message": "Binlog position from crash recovery is mysql-bin-
changelog.000003 4278",
"SourceIdentifier": "sample-restored-instance"
}
]
}
You can also get the binlog file name and position by checking the
MySQL error log for the last MySQL binlog file position or for the
DB_CRASH_RECOVERY_BINLOG_POSITION entry.
4. If your replica target is an Aurora DB cluster owned by another AWS account, an
external MySQL database, or an RDS MySQL DB instance, then you can't load the data
from an Amazon Aurora DB cluster snapshot. Instead, create a dump of your Amazon
Aurora DB cluster by connecting to your DB cluster using a MySQL client and issuing
the mysqldump command. Be sure to run the mysqldump command against the copy
of your Amazon Aurora DB cluster that you created. The following is an example.
5. When you have finished creating the dump of your data from the newly created Aurora
DB cluster, delete that DB cluster as it is no longer needed.
617
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
2. Create a dump of your MySQL database using the mysqldump command as shown
following:
3. After you have created the snapshot, unlock the tables in your MySQL database with
the following command:
Find instructions on how to load the snapshot of your replication master into your replica target for your
database engine following.
618
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
• If the snapshot of your replication master is a DB cluster snapshot, then you can restore
from the DB cluster snapshot to create a new Aurora MySQL DB cluster as your replica
target. For more information, see Restoring from a DB Cluster Snapshot (p. 292).
• If the snapshot of your replication master is a DB snapshot, then you can migrate
the data from your DB snapshot into a new Aurora MySQL DB cluster. For more
information, see Migrating Data to an Amazon Aurora DB Cluster (p. 226).
• If the snapshot of your replication master is the output from the mysqldump
command, then follow these steps:
1. Copy the output of the mysqldump command from your replication master to a
location that can also connect to your Aurora MySQL DB cluster.
2. Connect to your Aurora MySQL DB cluster using the mysql command. The following
is an example.
3. At the mysql prompt, run the source command and pass it the name of your
database dump file to load the data into the Aurora MySQL DB cluster, for example:
3. At the mysql prompt, run the source command and pass it the name of your
database dump file to load the data into the MySQL DB instance, for example:
1. Copy the output of the mysqldump command from your replication master to a
location that can also connect to your MySQL database.
2. Connect to your MySQL database using the mysql command. The following is an
example.
619
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
3. At the mysql prompt, run the source command and pass it the name of your
database dump file to load the data into your MySQL database. The following is an
example.
Also, create a user ID that is used solely for replication. The following is an example.
The user requires the REPLICATION CLIENT and REPLICATION SLAVE privileges. Grant these
privileges to the user.
If you need to use encrypted replication, require SSL connections for the replication user. For example,
you can use one of the following statement to require SSL connections on the user account repl_user.
Note
If REQUIRE SSL isn't included, the replication connection might silently fall back to an
unencrypted connection.
Find instructions on how to enable replication for your database engine following.
Database Instructions
Engine
1. If your DB cluster replica target was created from a DB cluster snapshot, then connect
to the DB cluster replica target and issue the SHOW MASTER STATUS command.
Retrieve the current binary log file name from the File field and the log file position
from the Position field.
If your DB cluster replica target was created from a DB snapshot, then you need the
binlog file and binlog position that are the starting place for replication. You retrieved
these values from the SHOW SLAVE STATUS command when you created the snapshot
of your replication master.
620
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
2. Connect to the DB cluster and issue the mysql_rds_set_external_master and
mysql_rds_start_replication procedures to start replication with your replication master
using the binary log file name and location from the previous step. The following is an
example.
621
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
--
-- Position to start replication or point-in-time recovery from
--
2. Connect to the external MySQL replica target, and issue CHANGE MASTER TO and
START SLAVE to start replication with your replication master using the binary log file
name and location from the previous step, for example:
CHANGE MASTER TO
MASTER_HOST = 'mydbcluster.cluster-123456789012.us-
east-1.rds.amazonaws.com',
MASTER_PORT = 3306,
MASTER_USER = 'repl_user',
MASTER_PASSWORD = '<password>',
MASTER_LOG_FILE = 'mysql-bin-changelog.000031',
MASTER_LOG_POS = 107;
START SLAVE;
You can also monitor how far the replica target is behind the replication master by connecting to the
replica target and running the SHOW SLAVE STATUS command. In the command output, the Seconds
Behind Master field tells you how far the replica target is behind the master.
622
Amazon Aurora User Guide for Aurora
Replication Between Aurora and MySQL or
Between Aurora and Another Aurora DB Cluster
Database Instructions
Engine
Connect to the Aurora DB cluster that is the replica target, and call the
mysql_rds_stop_replication procedure. The mysql.rds_stop_replication procedure
is only available for MySQL versions 5.5 and later, 5.6 and later, and 5.7 and later.
Database Instructions
Engine
1. Connect to the Aurora DB cluster that is the replication master, and set the
binlog retention time frame to 0. To set the binlog retention time frame, use the
mysql_rds_set_configuration procedure and specify a configuration parameter of
'binlog retention hours' along with the number of hours to retain binlog files on
the DB cluster, in this case 0, as shown in the following example.
After you have changed the binlog_format parameter value, reboot your DB cluster
for the change to take effect.
1. Disable automated backups for the DB instance. You can disable automated backups
by modifying an existing DB instance and setting the Backup Retention Period to 0.
For more information, see Modifying an Amazon RDS DB Instance and Working With
Backups in the Amazon Relational Database Service User Guide.
623
Amazon Aurora User Guide for Aurora
Using GTID-Based Replication
Database Instructions
Engine
2. Delete all read replicas for the DB instance. For more information, see Working with
Read Replicas of MariaDB, MySQL, and PostgreSQL DB Instances in the Amazon
Relational Database Service User Guide.
sudo vi /etc/my.cnf
Delete the log_bin and server_id options from the [mysqld] section.
For more information, see Setting the Replication Master Configuration in the MySQL
documentation.
3. Start the mysql service.
If you use binlog replication and aren't familiar with GTID-based replication with MySQL, see Replication
with Global Transaction Identifiers in the MySQL documentation for background.
Note
GTID-based replication is supported for MySQL 5.7-compatible clusters in Aurora MySQL version
2.04 and later. GTID-based replication isn't supported for MySQL 5.6-compatible clusters in
Aurora MySQL version 1.
Topics
• Overview of Global Transaction Identifiers (GTIDs) (p. 625)
• Parameters for GTID-Based Replication (p. 625)
• Configuring GTID-Based Replication for an Aurora MySQL Cluster (p. 626)
• Disabling GTID-Based Replication for an Aurora MySQL DB Cluster (p. 626)
624
Amazon Aurora User Guide for Aurora
Using GTID-Based Replication
In a replication configuration, GTIDs are unique across all DB instances. GTIDs simplify replication
configuration because when you use them, you don't have to refer to log file positions. GTIDs also make
it easier to track replicated transactions and determine whether masters and replicas are consistent.
You typically use GTID-based replication with Aurora when replicating from an external MySQL-
compatible database into an Aurora cluster. You can set up this replication configuration as part of a
migration from an on-premises or Amazon RDS database into Aurora MySQL. If the external database
already uses GTIDs, enabling GTID-based replication for the Aurora cluster simplifies the replication
process.
You configure GTID-based replication for an Aurora MySQL cluster by first setting the relevant
configuration parameters in a DB cluster parameter group. You then associate that parameter group with
the cluster.
gtid_mode OFF, OFF_PERMISSIVE, OFF specifies that new transactions are anonymous
ON_PERMISSIVE, ON transactions (that is, don't have GTIDs), and a
transaction must be anonymous to be replicated.
enforce_gtid_consistency
OFF, ON, WARN OFF allows transactions to violate GTID
consistency.
625
Amazon Aurora User Guide for Aurora
Using GTID-Based Replication
For GTID-based replication, use these settings for the DB cluster parameter group for your Aurora MySQL
DB cluster:
• ON and ON_PERMISSIVE apply only to outgoing replication from an RDS DB instance or Aurora
MySQL cluster. Both of these values cause your RDS DB instance or Aurora DB cluster to use GTIDs for
transactions that are replicated to an external database. ON requires that the external database also
use GTID-based replication. ON_PERMISSIVE makes GTID-based replication optional on the external
database.
• OFF_PERMISSIVE, if set, means that your RDS DB instances or Aurora DB cluster can accept incoming
replication from an external database. It can do this whether the external database uses GTID-based
replication or not.
• OFF, if set, means that your RDS DB instances or Aurora DB cluster only accept incoming replication
from external databases that don't use GTID-based replication.
Tip
Incoming replication is the most common binlog replication scenario for Aurora MySQL clusters.
For incoming replication, we recommend that you set the GTID mode to OFF_PERMISSIVE. That
setting allows incoming replication from external databases regardless of the GTID settings at
the replication source.
For more information about parameter groups, see Working with DB Parameter Groups and DB Cluster
Parameter Groups (p. 205).
Note
In the AWS Management Console, the gtid_mode parameter appears as gtid-mode.
1. Create or edit a DB cluster parameter group using the following parameter settings:
• gtid_mode – ON or ON_PERMISSIVE
• enforce_gtid_consistency – ON
2. Associate the DB cluster parameter group with the Aurora MySQL cluster. To do so, follow the
procedures in Working with DB Parameter Groups and DB Cluster Parameter Groups (p. 205).
626
Amazon Aurora User Guide for Aurora
Using GTID-Based Replication
Note
In the following procedure, read replica means the replication target in an Aurora configuration
with binlog replication to or from an external database. It doesn't mean the read-only Aurora
Replica DB instances. For example, when an Aurora cluster accepts incoming replication from an
external source, the Aurora primary instance acts as the read replica for binlog replication.
For more details about the stored procedures mentioned in this section, see Aurora MySQL Stored
Procedures (p. 730).
CALL mysql.rds_set_master_auto_position(0);
a. Make sure that the DB cluster parameter group associated with the Aurora MySQL cluster has
gtid_mode set to ON_PERMISSIVE.
For more information about setting configuration parameters using parameter groups, see
Working with DB Parameter Groups and DB Cluster Parameter Groups (p. 205).
b. Restart the Aurora MySQL DB cluster.
3. Reset the gtid_mode to OFF_PERMISSIVE:
a. Make sure that the DB cluster parameter group associated with the Aurora MySQL cluster has
gtid_mode set to OFF_PERMISSIVE.
b. Restart the Aurora MySQL DB cluster.
4. a. On the Aurora primary instance, run the SHOW MASTER STATUS command.
File Position
------------------------------------
mysql-bin-changelog.000031 107
------------------------------------
For example, if the file name is mysql-bin-changelog.000031 and the position is 107, run
the following statement.
If the read replica is past the specified position, the query returns immediately. Otherwise, the
function waits. When the query returns for all read replicas, go to the next step.
5. Reset the GTID parameters to disable GTID-based replication:
627
Amazon Aurora User Guide for Aurora
Working with Multi-Master Clusters
a. Make sure that the DB cluster parameter group associated with the Aurora MySQL cluster has
the following parameter settings:
• gtid_mode – OFF
• enforce_gtid_consistency – OFF
b. Restart the Aurora MySQL DB cluster.
Topics
• Overview of Aurora Multi-Master Clusters (p. 628)
• Creating an Aurora Multi-Master Cluster (p. 633)
• Managing Aurora Multi-Master Clusters (p. 638)
• Application Considerations for Aurora Multi-Master Clusters (p. 641)
• Performance Considerations for Aurora Multi-Master Clusters (p. 650)
• Approaches to Aurora Multi-Master Clusters (p. 652)
For each new Amazon Aurora cluster, you can choose whether to create a single-master or multi-master
cluster.
Most kinds of Aurora clusters are single-master clusters. For example, provisioned, Aurora Serverless,
parallel query, and Global Database clusters are all single-master clusters. In a single-master cluster, a
single DB instance performs all write operations and any other DB instances are read-only. If the writer
DB instance becomes unavailable, a failover mechanism promotes one of the read-only instances to be
the new writer.
In a multi-master cluster, all DB instances can perform write operations. The notions of a single read-
write primary instance and multiple read-only Aurora Replicas don't apply. There isn't any failover when
a writer DB instance becomes unavailable, because another writer DB instance is immediately available
to take over the work of the failed instance. We refer to this type of availability as continuous availability,
to distinguish it from the high availability (with brief downtime during failover) offered by a single-
master cluster.
Multi-master clusters work differently in many ways from the other kinds of Aurora clusters, such as
provisioned, Aurora Serverless, and parallel query clusters. With multi-master clusters, you consider
different factors in areas such as high availability, monitoring, connection management, and database
features. For example, in applications where you can't afford even brief downtime for database write
operations, a multi-master cluster can help to avoid an outage when a writer instance becomes
unavailable. The multi-master cluster doesn't use the failover mechanism, because it doesn't need to
promote another DB instance to have read-write capability. With a multi-master cluster, you examine
metrics related to DML throughput, latency, and deadlocks for all DB instances instead of a single
primary instance.
628
Amazon Aurora User Guide for Aurora
Overview of Multi-Master Clusters
Currently, multi-master clusters require Aurora MySQL version 1, which is compatible with MySQL 5.6.
To create a multi-master cluster, you choose Multiple writers under Database features when creating
the cluster. Doing so enables different behavior for replication among DB instances, availability, and
performance than other kinds of Aurora clusters. This choice remains in effect for the life of the cluster.
Make sure that you understand the specialized use cases that are appropriate for multi-master clusters.
Topics
• Multi-Master Cluster Terminology (p. 629)
• Multi-Master Cluster Architecture (p. 630)
• Recommended Workloads for Multi-Master Clusters (p. 631)
• Advantages of Multi-Master Clusters (p. 632)
• Limitations of Multi-Master Clusters (p. 632)
Writer
A DB instance that can perform write operations. In an Aurora multi-master cluster, all DB instances
are writers. This is a significant difference from Aurora single-master clusters, where only one DB
instance can act as a writer. With a single-master cluster, if the writer becomes unavailable, the
failover mechanism promotes another DB instance to become the new writer. With a multi-master
cluster, your application can redirect write operations from the failed DB instance to any other DB
instance in the cluster.
Multi-master
An architecture for Aurora clusters where each DB instance can perform both read and write
operations. Contrast this with single-master. Multi-master clusters are best suited for segmented
workloads, such as for multitenant applications.
Single-master
The default architecture for Aurora clusters. A single DB instance (the primary instance) performs
writes. All other DB instances (the Aurora Replicas) handle read-only query traffic. Contrast this with
multi-master. This architecture is appropriate for general-purpose applications. In such applications,
a single DB instance can handle all the data manipulation language (DML) and data definition
language (DDL) statements. Scalability issues mostly involve SELECT queries.
Write conflict
A situation that occurs when different DB instances attempt to modify the same data page at
the same time. Aurora reports a write conflict to your application as a deadlock error. This error
condition causes the transaction to roll back. Your application must detect the error code and retry
the transaction.
The main design consideration and performance tuning goal with Aurora multi-master clusters is
to divide your write operations between DB instances in a way that minimizes write conflicts. That
is why multi-master clusters are well-suited for sharded applications. For details about the write
conflict mechanism, see Conflict Resolution for Multi-Master Clusters (p. 651).
Sharding
A particular class of segmented workloads. The data is physically divided into many partitions,
tables, databases, or even separate clusters. The containers for specific portions of the data are
known as shards. In an Aurora multi-master cluster, each shard is managed by a specific DB instance,
629
Amazon Aurora User Guide for Aurora
Overview of Multi-Master Clusters
and a DB instance can be responsible for multiple shards. A sharded schema design maps well to the
way you manage connections in an Aurora multi-master cluster.
Shard
The unit of granularity within a sharded deployment. It might be a table, a set of related tables,
a database, a partition, or even an entire cluster. With Aurora multi-master clusters, you can
consolidate the data for a sharded application into a single Aurora shared storage volume, making
the database continuously available and the data easy to manage. You decide which shards are
managed by each DB instance. You can change this mapping at any time, without physically
reorganizing the data.
Resharding
Physically reorganizing sharded data so that different DB instances can handle specific tables or
databases. You don't need to physically reorganize data inside Aurora multi-master clusters in
response to changing workload or DB instance failures. You can avoid resharding operations because
all DB instances in a cluster can access all databases and tables through the shared storage volume.
Multitenant
A particular class of segmented workloads. The data for each customer, client, or user is kept in a
separate table or database. This design ensures isolation and helps you to manage capacity and
resources at the level of individual users.
Bring-your-own-shard (BYOS)
A situation where you already have a database schema and associated applications that use
sharding. You can transfer such deployments relatively easily to Aurora multi-master clusters. In this
case, you can devote your effort to investigating the Aurora benefits such as server consolidation
and high availability. You don't need to create new application logic to handle multiple connections
for write requests.
Global read-after-write (GRAW)
A setting that introduces synchronization so that any read operations always see the most current
state of the data. By default, the data seen by a read operation in a multi-master cluster is subject
to replication lag, typically a few milliseconds. During this brief interval, a query on one DB instance
might retrieve stale data if the same data is modified at the same time by a different DB instance. To
enable this setting, change aurora_mm_session_consistency_level from its default setting of
INSTANCE_RAW to REGIONAL_RAW. Doing so ensures cluster-wide consistency for read operations
regardless of the DB instances that perform the reads and writes. For details on GRAW mode, see
Consistency Model for Multi-Master Clusters (p. 643).
Your application controls which write requests are handled by which DB instance. Thus, with a multi-
master cluster, you connect to individual instance endpoints to issue DML and DDL statements. That's
different than other kinds of Aurora clusters, where you typically direct all write operations to the single
cluster endpoint and all read operations to the single reader endpoint.
The underlying storage for Aurora multi-master clusters is similar to storage for single-master clusters.
Your data is still stored in a highly reliable, shared storage volume that grows automatically. The core
difference lies in the number and type of DB instances. In multi-master clusters, there are N read-write
nodes. Currently, the maximum for N is 2.
630
Amazon Aurora User Guide for Aurora
Overview of Multi-Master Clusters
Multi-master clusters have no dedicated read-only nodes. Thus, the Aurora procedures and guidelines
about Aurora Replicas don't apply to multi-master clusters. You can temporarily make a DB instance
read-only to place read and write workloads on different DB instances. To do so, see Using Instance
Read-Only Mode (p. 650).
Multi-master cluster nodes are connected using low-latency and low-lag Aurora replication. Multi-master
clusters use all-to-all peer-to-peer replication. Replication works directly between writers. Every writer
replicates its changes to all other writers.
DB instances in a multi-master cluster handle restart and recovery independently. If a writer restarts,
there is no requirement for other writers to also restart. For details, see High Availability Considerations
for Aurora Multi-Master Clusters (p. 640).
Multi-master clusters keep track of all changes to data within all database instances. The unit of
measurement is the data page, which has a fixed size of 16 KB. These changes include modifications
to table data, secondary indexes, and system tables. Changes can also result from Aurora internal
housekeeping tasks. Aurora ensures consistency between the multiple physical copies that Aurora keeps
for each data page in the shared storage volume, and in memory on the DB instances.
If two DB instances attempt to modify the same data page at almost the same instant, a write conflict
occurs. The earliest change request is approved using a quorum voting mechanism. That change is saved
to permanent storage. The DB instance whose change isn't approved rolls back the entire transaction
containing the attempted change. Rolling back the transaction ensures that data is kept in a consistent
state, and applications always see a predictable view of the data. Your application can detect the
deadlock condition and retry the entire transaction.
For details about how to minimize write conflicts and associated performance overhead, see Conflict
Resolution for Multi-Master Clusters (p. 651).
Active-Passive Workloads
With an active-passive workload, you perform all read and write operations on one DB instance at a
time. You hold any other DB instances in the Aurora cluster in reserve. If the original active DB instance
becomes unavailable, you immediately switch all read and write operations to the other DB instance.
With this configuration, you minimize any downtime for write operations. The other DB instance can take
over all processing for your application without performing a failover.
Active-Active Workloads
With an active-active workload, you perform read and write operations to all the DB instances at the
same time. In this configuration, you typically segment the workload so that the different DB instances
don't modify the same underlying data at the same time. Doing so minimizes the chance for write
conflicts.
Multi-master clusters work well with application logic that's designed for a segmented workload. In this
type of workload, you divide write operations by database instance, database, table, or table partition.
For example, you can run multiple applications on the same cluster, each assigned to a specific DB
instance. Alternatively, you can run an application that uses multiple small tables, such as one table for
each user of an online service. Ideally, you design your schema so that write operations for different DB
instances don't perform simultaneous updates to overlapping rows within the same tables. Sharded
applications are one example of this kind of architecture.
For examples of designs for active-active workloads, see Using a Multi-Master Cluster for a Sharded
Database (p. 652).
631
Amazon Aurora User Guide for Aurora
Overview of Multi-Master Clusters
• Multi-master clusters improve Aurora's already high availability. You can restart a read-write DB
instance without causing other DB instances in the cluster to restart. There is no failover process and
associated delay when a read-write DB instance becomes unavailable.
• Multi-master clusters are well-suited to sharded or multitenant applications. As you manage the data,
you can avoid complex resharding operations. You might be able to consolidate sharded applications
with a smaller number of clusters or DB instances. For details, see Using a Multi-Master Cluster for a
Sharded Database (p. 652).
• Aurora detects write conflicts immediately, not when the transaction commits. For details about the
write conflict mechanism, see Conflict Resolution for Multi-Master Clusters (p. 651).
632
Amazon Aurora User Guide for Aurora
Creating a Multi-Master Cluster
• You can't use the parallel query, Aurora Serverless, or Global Database features on a multi-master
cluster.
The multi-master aspect is a permanent choice for a cluster. You can't switch an existing Aurora cluster
between a multi-master cluster and another kind such as Aurora Serverless or parallel query.
• The zero-downtime patching (ZDP) and zero-downtime restart (ZDR) features aren't available for
multi-master clusters.
• Integration with other AWS services such as AWS Lambda, Amazon S3, and AWS Identity and Access
Management isn't available for multi-master clusters.
• The Performance Insights feature isn't available for multi-master clusters.
• You can't clone a multi-master cluster.
• You can't enable the backtrack feature for multi-master clusters.
• You can't perform binary log (binlog) replication to or from a multi-master cluster. This limitation
means you also can't use global transaction ID (GTID) replication in a multi-master cluster.
• The event scheduler isn't available for multi-master clusters.
• The hash join optimization isn't enabled on multi-master clusters.
• The query cache isn't available on multi-master clusters.
• You can't use certain SQL language features on multi-master clusters. For the full list of SQL
differences, and instructions about adapting your SQL code to address these limitations, see SQL
Considerations for Multi-Master Clusters (p. 641).
Console
To create an Aurora multi-master cluster from the AWS Management Console, you make the following
choices. On the first screen, you select an Aurora cluster:
633
Amazon Aurora User Guide for Aurora
Creating a Multi-Master Cluster
634
Amazon Aurora User Guide for Aurora
Creating a Multi-Master Cluster
635
Amazon Aurora User Guide for Aurora
Creating a Multi-Master Cluster
Fill in the other settings for the cluster. This part of the procedure is the same as the general procedure
for creating an Aurora cluster in Creating a DB Cluster (p. 102).
After you create the multi-master cluster, add two DB instances to it by following the procedure in
Adding Aurora Replicas to a DB Cluster (p. 248). Use the same AWS instance class for all DB instances
within the multi-master cluster.
After you create the multi-master cluster and associated DB instances, you see the cluster in the AWS
Management Console Databases page as follows. All DB instances show the role Writer.
636
Amazon Aurora User Guide for Aurora
Creating a Multi-Master Cluster
AWS CLI
To create a multi-master cluster with the AWS CLI, run the create-db-cluster AWS CLI command and
include the option --engine_mode=multimaster.
The following command shows the syntax for creating an Aurora cluster with multi-master replication.
For the general procedure to create an Aurora cluster, see Creating a DB Cluster (p. 102).
For Windows:
After you create the multi-master cluster, add a second DB instance to it by following the procedure in
Adding Aurora Replicas to a DB Cluster (p. 248). Use the same AWS instance class for all DB instances
within the multi-master cluster.
637
Amazon Aurora User Guide for Aurora
Managing Multi-Master Clusters
RDS API
To create a multi-master cluster with the RDS API, run the CreateDBCluster operation. Specify the value
multimaster for the EngineMode parameter. For the general procedure to create an Aurora cluster, see
Creating a DB Cluster (p. 102).
After you create the multi-master cluster, add two DB instances to it by following the procedure in
Adding Aurora Replicas to a DB Cluster (p. 248). Use the same AWS instance class for all DB instances
within the multi-master cluster.
Topics
• Monitoring an Aurora Multi-Master Cluster (p. 638)
• Data Ingestion Performance for Multi-Master Clusters (p. 639)
• Exporting Data from a Multi-Master Cluster (p. 639)
• High Availability Considerations for Aurora Multi-Master Clusters (p. 640)
• Replication Between Multi-Master Clusters and Other Clusters (p. 640)
• Upgrading a Multi-Master Cluster (p. 640)
Aurora multi-master clusters don't currently support the following monitoring features:
• Performance Insights.
638
Amazon Aurora User Guide for Aurora
Managing Multi-Master Clusters
1. Issue a separate mysqldump command for each database, table, or other object in your schema.
Store the results of each mysqldump in a file whose name reflects the object being dumped. As an
alternative, you can use a specialized dump and import tool that can automatically dump multiple
tables in parallel, such as mydumper.
2. Run a separate mysql session for each data file, connecting to the appropriate instance endpoint
that handles the corresponding schema object. Again, as an alternative, you can use a specialized
parallel import command, such as myloader.
3. Run the import sessions in parallel across the DB instances in the multi-master cluster, instead of
waiting for each to finish before starting the next.
You can use the following techniques to import data into an Aurora multi-master cluster:
• You can import logical (SQL-format) dumps from other MySQL-compatible servers to Aurora multi-
master clusters, if the statements don't use any features that aren't supported in Aurora. For example,
a logical dump from a table containing MySQL Full-Text Search (FTS) indexes doesn't work because the
FTS feature is not supported on multi-master clusters.
• You can use managed services such as DMS to migrate data into an Aurora multi-master cluster.
• For migrations into an Aurora multi-master cluster from a server that isn't compatible with MySQL,
follow existing instructions for heterogeneous Aurora migrations.
• Aurora multi-master clusters can produce MySQL-compatible logical dumps in SQL format. Any
migration tool (for example, AWS DMS) that can understand such format can consume data dumps
from Aurora multi-master clusters.
• Aurora doesn't support binary logging with the multi-master cluster as the binlog master or worker.
You can't use binlog-based CDC tools with multi-master clusters.
• When migrating from non-MySQL-compatible servers, you can replicate into a multi-master cluster
using the continuous change data capture (CDC) feature of AWS DMS. That type of replication
transmits SQL statements to the destination cluster, thus the restriction on binlog replication doesn't
apply.
For a detailed discussion of migration techniques and recommendations, see the Amazon Aurora
Migration Handbook AWS whitepaper. Some of the migration methods listed in the handbook might not
apply to Aurora multi-master clusters, but the document is a great overall source of knowledge about
Aurora migration topics.
To migrate data from a multi-master cluster to a single-master cluster, use a logical dump and restore
with a tool such as mysqldump.
You can't use a multi-master cluster as the source or destination for binary log replication.
639
Amazon Aurora User Guide for Aurora
Managing Multi-Master Clusters
In a single-master cluster, restarting the primary instance makes write operations unavailable until the
failover mechanism promotes a new primary instance. Read-only operations also experience a brief
downtime because all the Aurora Replicas in the cluster restart.
To minimize downtime for applications in a multi-master cluster, implement frequent SQL-level health
checks. If a DB instance in a multi-master cluster becomes unavailable, you can decide what to do based
on the expected length of the outage and the urgency of write operations in the workload. If you expect
the outage to be brief and the write operations aren't urgent, you can wait for the DB instance to recover
before resuming the workload that is normally handled by that DB instance. Alternatively, you can
redirect that workload to a different DB instance. The underlying data remains available at all time to all
DB instances in the cluster. The highly distributed Aurora storage volume keeps the data continuously
available even in the unlikely event of a failure affecting an entire AZ. For information about the timing
considerations for switching write operations away from an unavailable DB instance, see Using a Multi-
Master Cluster as an Active Standby (p. 653).
When you upgrade an Aurora multi-master cluster, typically the upgrade procedure moves the database
engine from the current version to the next higher version. If you upgrade to an Aurora version that
increments the version number by more than one, the upgrade uses a multi-step approach. Each DB
instance is upgraded to the next higher version, then the next one after that, and so on until it reaches
the specified upgrade version.
The approach is different depending on whether there are any backwards-incompatible changes
between the old and new versions. For example, updates to the system schema are considered
backwards-incompatible changes. You can check whether a specific version contains any backwards-
incompatible changes by consulting the release notes.
If there aren't any incompatible changes between the old and new versions, each DB instance is
upgraded and restarted individually. The upgrades are staggered so that the overall cluster doesn't
experience any downtime. At least one DB instance is available at any time during the upgrade process.
If there are incompatible changes between the old and new versions, Aurora performs the upgrade in
offline mode. All cluster nodes are upgraded and restarted at the same time. The cluster experiences
some downtime, to avoid an older engine writing to newer system tables.
Zero-downtime patching (ZDP) isn't currently supported for Aurora multi-master clusters.
640
Amazon Aurora User Guide for Aurora
Application Considerations
Topics
• SQL Considerations for Multi-Master Clusters (p. 641)
• Connection Management for Multi-Master Clusters (p. 642)
• Consistency Model for Multi-Master Clusters (p. 643)
• Multi-Master Clusters and Transactions (p. 644)
• Write Conflicts and Deadlocks in Multi-Master Clusters (p. 644)
• Multi-Master Clusters and Locking Reads (p. 645)
• Performing DDL Operations on a Multi-Master Cluster (p. 646)
• Using Autoincrement Columns (p. 647)
• Multi-Master Clusters Feature Reference (p. 648)
• In a multi-master cluster, you can't use certain settings or column types that change the row layout.
You can't enable the innodb_large_prefix configuration option. You can't use the column types
MEDIUMTEXT, MEDIUMBLOB, LONGTEXT, or LONGBLOB.
• You can't use the CASCADE clause with any foreign key columns in a multi-master cluster.
• Multi-master clusters can't contain any tables with full-text search (FTS) indexes. Such tables can't be
created on or imported into multi-master clusters.
• DDL works differently on multi-master and single-master clusters. For example, the fast DDL
mechanism isn't available for multi-master clusters. You can't write to a table in a multi-master cluster
while the table is undergoing DDL. For full details on DDL differences, see Performing DDL Operations
on a Multi-Master Cluster (p. 646).
• You can't use the SERIALIZABLE transaction isolation level on multi-master clusters. On Aurora
single-master clusters, you can use this isolation level on the primary instance.
• Autoincrement columns are handled using the auto_increment_increment and
auto_increment_offset parameters. Parameter values are predetermined and not configurable.
The parameter auto_increment_increment is set to 16, which is the maximum number of
instances in any Aurora cluster. However, multi-master clusters currently have a lower limit on the
number of DB instances. For details, see Using Autoincrement Columns (p. 647).
When adapting an application for an Aurora multi-master cluster, approach that activity the same as
a migration. You might have to stop using certain SQL features, and change your application logic for
other SQL features:
• In your CREATE TABLE statements, change any columns defined as MEDIUMTEXT, MEDIUMBLOB,
LONGTEXT, or LONGBLOB to shorter types that don't require off-page storage.
• In your CREATE TABLE statements, remove the CASCADE clause from any foreign key declarations.
Add application logic if necessary to emulate the CASCADE effects through INSERT or DELETE
statements.
641
Amazon Aurora User Guide for Aurora
Application Considerations
• Remove any use of InnoDB fulltext search (FTS) indexes. Check your source code for MATCH()
operators in SELECT statements, and FULLTEXT keywords in DDL statements. Check if any table
names from the INFORMATION_SCHEMA.INNODB_SYS_TABLES system table contain the string FTS_.
• Check the frequency of DDL operations such as CREATE TABLE and DROP TABLE in your application.
Because DDL operations have more overhead in multi-master clusters, avoid running many small
DDL statements. For example, look for opportunities to create needed tables ahead of time. For
information about DDL differences with multi-master clusters, see Performing DDL Operations on a
Multi-Master Cluster (p. 646).
• Examine your use of autoincrement columns. The sequences of values for autoincrement
columns are different for multi-master clusters than other kinds of Aurora clusters. Check for the
AUTO_INCREMENT keyword in DDL statements, the function name last_insert_id() in SELECT
statements, and the name innodb_autoinc_lock_mode in your custom configuration settings. For
details about the differences and how to handle them, see Using Autoincrement Columns (p. 647).
• Check your code for the SERIALIZABLE keyword. You can't use this transaction isolation level with a
multi-master cluster.
Cluster endpoint
This type of endpoint always points to a DB instance with read-write capability. Each multi-master
cluster has one cluster endpoint.
You can also connect to this endpoint to examine the cluster topology when you don't know
the status of the DB instances in the cluster. To learn that procedure, see Describing Cluster
Topology (p. 649).
DB instance endpoint
This type of endpoint connects to specific named DB instances. For Aurora multi-master clusters,
your application typically uses the DB instance endpoints for all or nearly all connections. You decide
which DB instance to use for each SQL statement based on the mapping between your shards and
the DB instances in the cluster. Each DB instance has one such endpoint. Thus the multi-master
cluster has one or more of these endpoints, and the number changes as DB instances are added to or
removed from a multi-master cluster.
The way you use DB instance endpoints is different between single-master and multi-master
clusters. For single-master clusters, you typically don't use this endpoint often.
Custom endpoint
This type of endpoint is optional. You can create one or more custom endpoints to group together
DB instances for a specific purpose. When you connect to the endpoint, Aurora returns the IP address
of a different DB instance each time. In multi-master clusters, you typically use custom endpoints to
designate a set of DB instances to use mostly for read operations. We recommend not using custom
endpoints with multi-master clusters to load-balance write operations, because doing so increases
the chance of write conflicts.
642
Amazon Aurora User Guide for Aurora
Application Considerations
Multi-master clusters don't have reader endpoints. Where practical, issue SELECT queries using the
same DB instance endpoint that normally writes to the same table. Doing so makes more effective use
of cached data from the buffer pool, and avoids potential issues with stale data due to replication lag
within the cluster. If you don't locate SELECT statements on the same DB instances that write to the
same tables, and you require strict read after write guarantee for certain queries, consider running those
queries using the global read-after-write (GRAW) mechanism described in Consistency Model for Multi-
Master Clusters (p. 643).
For general best practices of Aurora and MySQL connection management, see the Amazon Aurora
Migration Handbook AWS whitepaper.
For information about how to emulate read-only DB instances in multi-master DB clusters, see Using
Instance Read-Only Mode (p. 650).
Follow these guidelines when creating custom DNS endpoints and designing drivers and connectors for
Aurora multi-master clusters:
• For DDL, DML, and DCL statements, don't use endpoints or connection routing techniques that operate
in round-robin or random fashion.
• Avoid long-running write queries and long write transactions unless these transactions are guaranteed
not to conflict with other write traffic in the cluster.
• Prefer to use autocommitted transactions. Where practical, avoid autocommit=0 settings at global
or session level. When you use a database connector or database framework for your programming
language, check that autocommit is turned on for applications that use the connector or framework.
If needed, add COMMIT statements at logical points throughout your code to ensure that transactions
are brief.
• When global read consistency or read-after-write guarantee is required, follow recommendations for
global read-after-write (GRAW) described in Consistency Model for Multi-Master Clusters (p. 643).
• Use the cluster endpoint for DDL and DCL statements where practical. The cluster endpoint helps to
minimize the dependency on the hostnames of the individual DB instances. You don't need to divide
DDL and DCL statements by table or database, as you do with DML statements.
When using the GRAW mode, don't enable it for all queries by default. Globally consistent reads are
noticeably slower than local reads. Therefore, use GRAW selectively for queries that require it.
• GRAW involves performance overhead due to the cost of establishing a cluster-wide consistent read
view. The transaction must first determine a cluster-wide consistent point in time, then replication
must catch up to that time. The total delay depends on the workload, but it's typically in the range of
tens of milliseconds.
• You can't change GRAW mode within a transaction.
643
Amazon Aurora User Guide for Aurora
Application Considerations
• When using GRAW without explicit transactions, each individual query incurs the performance
overhead of establishing a globally consistent read view.
• With GRAW enabled, the performance penalty applies to both reads and writes.
• When you use GRAW with explicit transactions, the overhead of establishing a globally consistent
view applies once for each transaction, when the transaction starts. Queries executed later in the
transaction are as fast as if executed without GRAW. If multiple successive statements can all use the
same read view, you can wrap them in a single transaction for a better overall performance. That way,
the penalty is only paid once per transaction instead of per query.
In particular, make your write transactions as short as possible. Doing so reduces the window of
opportunity for write conflicts. The conflict resolution mechanism is optimistic, meaning that it performs
best when write conflicts are rare. The tradeoff is that when conflicts occur, they incur substantial
overhead.
There are certain workloads that benefit from large transactions. For example, bulk data imports
are significantly faster when run using multi-megabyte transactions rather than single-statement
transactions. If you observe an unacceptable number of conflicts while running such workloads, consider
the following options:
In a multi-master cluster, all the DB instances can write to the shared storage volume. For every data
page you modify, Aurora automatically distributes several copies across multiple Availability Zones
(AZs). A write conflict can occur when multiple DB instances try to modify the same data page within a
very short time. The Aurora storage subsystem detects that the changes overlap and performs conflict
resolution before finalizing the write operation.
Aurora detects write conflicts at the level of the physical data pages, which have a fixed size of 16 KiB.
Thus, a conflict can occur even for changes that affect different rows, if the rows are both within the
same data page.
When conflicts do occur, the cleanup operation requires extra work to undo the changes from one of
the DB instances. From the point of view of your application, the transaction that caused the conflict
encounters a deadlock and Aurora rolls back that whole transaction. Your application receives error code
1213.
Undoing the transaction might require modifying many other data pages whose changes were already
applied to the Aurora storage subsystem. Depending on how much data was changed by the transaction,
644
Amazon Aurora User Guide for Aurora
Application Considerations
undoing it might involve substantial overhead. Therefore, minimizing the potential for write conflicts is a
crucial design consideration for an Aurora multi-master cluster.
Some conflicts result from changes that you initiate. These changes include SQL statements,
transactions, and transaction rollbacks. You can minimize these kinds of conflicts through your schema
design and the connection management logic in your application.
Other conflicts happen because of simultaneous changes from both a SQL statement and an internal
server thread. These conflicts are hard to predict because they depend on internal server activity that
you might not be aware of. The two major kinds of internal activity that cause these conflicts are
garbage collection (known as purge), and transaction rollbacks performed automatically by Aurora. For
example, Aurora performs rollbacks automatically during crash recovery or if a client connection is lost.
A transaction rollback physically reverts page changes that were already made. A rollback produces page
changes just like the original transaction does. A rollback takes time, potentially several times as long as
the original transaction. While the rollback is proceeding, the changes it produces can come into conflict
with your transactions.
Garbage collection has to do with multi-version concurrency control (MVCC), which is the concurrency
control method used by the Aurora MySQL transactional engine. With MVCC, data mutations create new
row versions, and the database keeps multiple versions of rows to achieve transaction isolation while
permitting concurrent access to data. Row versions are removed (purged) when they're no longer needed.
Here again, the process of purging produces page changes, which might conflict with your transactions.
Depending on the workload, the database can develop a purge lag: a queue of changes waiting to be
garbage collected. If the lag grows substantially, the database might need a considerable amount of time
to complete the purge, even if you stop submitting SQL statements.
If an internal server thread encounters a write conflict, Aurora retries automatically. In contrast, your
application must handle the retry logic for any transactions that encounter conflicts.
When multiple transactions from the same DB instance cause these kinds of overlapping changes,
Aurora uses the standard transaction concurrency rules. For example, if two transactions on the same
DB instance modify the same row, one of them waits. If the wait is longer than the configured timeout
(innodb_lock_wait_timeout, by default 50 seconds), the waiting transaction aborts with a "Lock wait
timeout exceeded" message.
For more information about locking reads, see the MySQL Reference Manual.
Locking read operations are supported on all nodes, but the lock scope is local to the node on which
the command was executed. A locking read executed on one writer doesn't prevent other writers from
accessing or modifying the locked rows. Despite this limitation, you can still work with locking reads
in use cases that guarantee strict workload scope separation between writers, such as in sharded or
multitenant databases.
• Remember that a node can always see its own changes immediately and without delay. When possible,
you can colocate reads and writes on the same node to eliminate the GRAW requirement.
• If read-only queries must be run with globally consistent results, use GRAW.
645
Amazon Aurora User Guide for Aurora
Application Considerations
• If read-only queries care about data visibility but not global consistency, use GRAW or introduce a
timed wait before each read. For example, a single application thread might maintain connections
C1 and C2 to two different nodes. The application writes on C1 and reads on C2. In such case, the
application can issue a read immediately using GRAW, or it can sleep before issuing a read. The sleep
time should be equal to or longer than the replication lag (usually approximately 20–30 ms).
For DDL statements, Aurora automatically delegates the execution to a special server process in the
cluster. Because Aurora centralizes the changes to the INFORMATION_SCHEMA tables, this mechanism
avoids the potential for write conflicts between DDL statements.
DDL operations prevent concurrent writes to that table. During a DDL operation on a table, all DB
instances in the multi-master cluster are limited to read-only access to that table until the DDL
statement finishes.
The following DDL behaviors are the same in Aurora single-master and multi-master clusters:
• A DDL executed on one DB instance causes other instances to terminate any connections actively using
the table.
• Session-level temporary tables can be created on any node using the MyISAM or MEMORY storage
engines.
• DDL operations on very large tables might fail if the DB instance doesn't have sufficient local
temporary storage.
• Try to avoid issuing large numbers of short DDL statements in your application. Create databases,
tables, partitions, columns, and so on, in advance where practical. Replication overhead can impose
significant performance overhead for simple DDL statements that are typically very quick. The
statement doesn't finish until the changes are replicated to all DB instances in the cluster. For example,
multi-master clusters take longer than other Aurora clusters to create empty tables, drop tables, or
drop schemas containing many tables.
If you do need to perform a large set of DDL operations, you can reduce the network and coordination
overhead by issuing the statements in parallel through multiple threads.
• Long-running DDL statements are less affected, because the replication delay is only a small fraction
of the total time for the DDL statement.
• Performance of DDLs on session-level temporary tables should be roughly equivalent on Aurora
single-master and multi-master clusters. Operations on temporary tables happen locally and are not
subject to synchronous replication overhead.
646
Amazon Aurora User Guide for Aurora
Application Considerations
The potential contention point occurs while the data is being transferred to the new table. When the
new table is initially created, it's completely empty and therefore can become a locking hot point. The
same is true in other kinds of database systems. Because triggers are synchronous, the impact from the
hot point can propagate back to your queries.
In multi-master clusters, the impact can be more visible. This visibility is because the new table not only
provokes lock contention, but also increases the likelihood of write conflicts. The table initially has very
few pages in it, which means that writes are highly localized and therefore prone to conflicts. After the
table grows, writes should spread out and write conflicts should no longer be a problem.
You can use the online schema change tool with multi-master clusters. However, it might require more
careful testing and its effects on the ongoing workload might be slightly more visible in the first minutes
of the operation.
Parameter values are predetermined and you can't change them. Specifically, the
auto_increment_increment parameter is hardcoded to 16, which is the maximum number of DB
instances in any kind of Aurora cluster.
Due to the hard-coded increment setting, autoincrement values are consumed much more quickly than
in single-master clusters. This is true even if a given table is only ever modified by a single DB instance.
For best results, always use a BIGINT data type instead of INT for your autoincrement columns.
In a multi-master cluster, your application logic must be prepared to tolerate autoincrement columns
that have the following properties:
The following example shows how the sequence of autoincrement values in a multi-master cluster can
be different from what you might expect.
647
Amazon Aurora User Guide for Aurora
Application Considerations
mysql> create table autoinc (id bigint not null auto_increment, s varchar(64), primary key
(id));
mysql> insert into autoinc (s) values ('row 1'), ('row 2'), ('row 3');
Query OK, 3 rows affected (0.02 sec)
You can change the AUTO_INCREMENT table property. Using a nondefault value only works reliably if
that value is larger than any of the primary key values already in the table. You can't use smaller values
to fill in an empty interval in the table. If you do, the change takes effect either temporarily or not at all.
This behavior is inherited from MySQL 5.6 and is not specific to the Aurora implementation.
Using Read-After-Write
The read-after-write feature is controlled using the aurora_mm_session_consistency_level
session variable. The valid values are INSTANCE_RAW for local consistency mode (default) and
REGIONAL_RAW for cluster-wide consistency.
An example follows.
648
Amazon Aurora User Guide for Aurora
Application Considerations
To find this information for all the DB instances in a multi-master cluster, see Describing Cluster
Topology (p. 649).
• The has_primary column identifies the role of the node. For multi-master clusters, this value is true
for the DB instance that handles all DDL and DCL statements. Aurora forwards such requests to one of
the DB instances in a multi-master cluster.
• The replica_lag_in_milliseconds column reports replication lag on all DB instances.
• The last_reported_status column reports the status of the DB instance. It can be Online,
Recovery, or Offline.
An example follows.
649
Amazon Aurora User Guide for Aurora
Performance Considerations
If you need to run a query-intensive workload across multiple tables, you might designate one of more
DB instances within a multi-master cluster as read-only.
To put an entire DB instance into read-only mode at runtime, call the mysql.rds_set_read_only
stored procedure.
Calling the stored procedure is equivalent to running SET GLOBAL read_only = 0|1. That setting is
runtime only and doesn't survive an engine restart. You can permanently set the DB instance to read-
only by setting the read_only parameter to true in the parameter group for your DB instance.
Avoid running all the time at 100 percent utilization. Doing so lets Aurora keep up with internal
maintenance work. To learn how to measure how busy a multi-master cluster is and how much
maintenance work is needed, see Monitoring an Aurora Multi-Master Cluster (p. 638).
Topics
• Query Performance for Multi-Master Clusters (p. 651)
• Conflict Resolution for Multi-Master Clusters (p. 651)
• Optimizing Buffer Pool and Dictionary Cache Usage (p. 651)
650
Amazon Aurora User Guide for Aurora
Performance Considerations
You can use the following approaches to optimize query performance for a multi-master cluster:
• Perform SELECT statements on the DB instance that handles the shard containing the associated
table, database, or other schema objects involved in the query. This technique maximizes reuse of data
in the buffer pool. It also avoids the same data being cached on more than one DB instance. For more
details about this technique, see Optimizing Buffer Pool and Dictionary Cache Usage (p. 651).
• If you need read-write workload isolation, designate one or more DB instances as read-only, as
described in Using Instance Read-Only Mode (p. 650). You can direct read-only sessions to those DB
instances by connecting to the corresponding instance endpoints, or by defining a custom endpoint
that is associated with all the read-only instances.
• Spread read-only queries across all DB instances. This approach is the least efficient. Use one of the
other approaches where practical, especially as you move from the development and test phase
towards production.
• Wherever practical, make all changes to a particular table and its associated indexes using the same
DB instance. If only one DB instance ever modifies a data page, changing that page cannot trigger any
write conflicts. This access pattern is common in sharded or multitenant database deployments. Thus,
it's relatively easy to switch such deployments to use multi-master clusters.
• A multi-master cluster doesn't have a reader endpoint. The reader endpoint load-balances incoming
connections, freeing you from knowing which DB instance is handling a particular connection. In a
multi-master cluster, managing connections involves being aware which DB instance is used for each
connection. That way, modifications to a particular database or table can always be routed to the same
DB instance.
• A write conflict for a small amount of data (one 16-KB page) can trigger a substantial amount of work
to roll back the entire transaction. Thus, ideally you keep the transactions for a multi-master cluster
relatively brief and small. This best practice for OLTP applications is especially important for Aurora
multi-master clusters.
Conflicts are detected at page level. A conflict could occur because proposed changes from different DB
instances modify different rows within the page. All page changes introduced in the system are subject
to conflict detection. This rule applies regardless of whether the source is a user transaction or a server
background process. It also applies whether the data page is from a table, secondary index, undo space,
and so on.
You can divide the write operations so that each DB instance handles all write operations for a set of
schema objects. In this case, all the changes to each data page are made by one specific instance.
651
Amazon Aurora User Guide for Aurora
Approaches to Multi-Master Clusters
Using memory efficiently can help the performance of multi-master clusters and reduce I/O cost. Use
a sharded design to physically separate the data and write to each shard from a particular DB instance.
Doing so makes the most efficient use of the buffer cache on each DB instance. Try to assign SELECT
statements for a table to the same DB instance that performs write operations for that table. Doing so
helps those queries to reuse the cached data on that DB instance. If you have a large number of tables or
partitions, this technique also reduces the number of unique table handlers and dictionary objects held
in memory by each DB instance.
Topics
• Using a Multi-Master Cluster for a Sharded Database (p. 652)
• Using a Multi-Master Cluster Without Sharding (p. 652)
• Using a Multi-Master Cluster as an Active Standby (p. 653)
Applications that use a sharded schema design are good candidates to use with Aurora multi-master
clusters. The way the data is physically divided in a sharded system helps to avoid write conflicts. You
map each shard to a schema object such as a partition, a table, or a database. Your application directs all
write operations for a particular shard to the appropriate DB instance.
Bring-your-own-shard (BYOS) describes a use case where you already have a sharded/partitioned
database and an application capable of accessing it. The shards are already physically separated. Thus,
you can easily move the workload to Aurora multi-master clusters without changing your schema design.
The same simple migration path applies to multitenant databases, where each tenant uses a dedicated
table, a set of tables, or an entire database.
You map shards or tenants to DB instances in a one-to-one or many-to-one fashion. Each DB instance
handles one or more shards. The sharded design primarily applies to write operations. You can issue
SELECT queries for any shard from any DB instance with equivalent performance.
Suppose that as time goes on, one of the shards becomes much more active. To rebalance the workload,
you can switch which DB instance is responsible for that shard. In a non-Aurora system, you might have
to physically move the data to a different server. With an Aurora multi-master cluster, you can reshard
like this by directing all write operations for the shard to some other DB instance that has unused
compute capacity. The Aurora shared storage model avoids the need to physically reorganize the data.
652
Amazon Aurora User Guide for Aurora
Integrating Aurora MySQL with AWS Services
You might see some performance overhead, and your application might have to deal with occasional
transaction rollbacks when write conflicts are treated as deadlock conditions. Write conflicts are more
likely during write operations for small tables. If a table contains few data pages, rows from different
parts of the primary key range might be in the same data page. This overlap might lead to write conflicts
if those rows are changed simultaneously by different DB instances.
You should also minimize the number of secondary indexes in this case. When you make a change to
indexed columns in a table, Aurora makes corresponding changes in the associated secondary indexes.
A change to an index could cause a write conflict because the order and grouping of rows is different
between a secondary index and the associated table.
Because you might still experience some write conflicts when using this technique, Amazon recommends
using a different approach if practical. See if you can use an alternative database design that subdivides
the data into different schema objects.
You can use multi-master clusters in an active standby configuration by directing all traffic, both read-
write and read-only, to a single DB instance. If that DB instance becomes unavailable, your application
must detect the problem and switch all connections to a different DB instance. In this case, Aurora
doesn't perform any failover because the other DB instance is already available to accept read-write
connections. By only writing to a single DB instance at any one time, you avoid write conflicts. Thus, you
don't need to have a sharded database schema to use multi-master clusters in this way.
Tip
If your application can tolerate a brief pause, you can wait several seconds after a DB instance
becomes unavailable before redirecting write traffic to another instance. When an instance
becomes unavailable because of a restart, it becomes available again after approximately
10–20 seconds. If the instance can't restart quickly, Aurora might initiate recovery for that
instance. When an instance is shut down, it performs some additional cleanup activities as part
of the shutdown. If you begin writing to a different instance while the instance is restarting,
undergoing recovery, or being shut down, you can encounter write conflicts. The conflicts can
occur between SQL statements on the new instance, and recovery operations such as rollback
and purge on the instance that was restarted or shut down.
• Synchronously or asynchronously invoke an AWS Lambda function using the native functions
lambda_sync or lambda_async. For more information, see Invoking a Lambda Function with an
Aurora MySQL Native Function (p. 679).
• Load data from text or XML files stored in an Amazon Simple Storage Service (Amazon S3) bucket
into your DB cluster using the LOAD DATA FROM S3 or LOAD XML FROM S3 command. For more
information, see Loading Data into an Amazon Aurora MySQL DB Cluster from Text Files in an Amazon
S3 Bucket (p. 665).
653
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
• Save data to text files stored in an Amazon S3 bucket from your DB cluster using the SELECT INTO
OUTFILE S3 command. For more information, see Saving Data from an Amazon Aurora MySQL DB
Cluster into Text Files in an Amazon S3 Bucket (p. 673).
• Automatically add or remove Aurora Replicas with Application Auto Scaling. For more information, see
Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270).
• Perform sentiment analysis with Amazon Comprehend, or a wide variety of machine learning
algorithms with Amazon SageMaker. For more information, see Using Machine Learning (ML)
Capabilities with Amazon Aurora (p. 285).
Aurora secures the ability to access other AWS services by using AWS Identity and Access Management
(IAM). You grant permission to access other AWS services by creating an IAM role with the necessary
permissions, and then associating the role with your DB cluster. For details and instructions on how
to permit your Aurora MySQL DB cluster to access other AWS services on your behalf, see Authorizing
Amazon Aurora MySQL to Access Other AWS Services on Your Behalf (p. 654).
For your Aurora MySQL DB cluster to access other services on your behalf, create and configure an
AWS Identity and Access Management (IAM) role. This role authorizes database users in your DB
cluster to access other AWS services. For more information, see Setting Up IAM Roles to Access AWS
Services (p. 654).
You must also configure your Aurora DB cluster to allow outbound connections to the target AWS
service. For more information, see Enabling Network Communication from Amazon Aurora MySQL to
Other AWS Services (p. 664).
If you do so, your database users can perform these actions using other AWS services:
• Synchronously or asynchronously invoke an AWS Lambda function using the native functions
lambda_sync or lambda_async. Or, asynchronously invoke an AWS Lambda function using the
mysql.lambda_async procedure. For more information, see Invoking a Lambda Function with an
Aurora MySQL Native Function (p. 679).
• Load data from text or XML files stored in an Amazon S3 bucket into your DB cluster by using the LOAD
DATA FROM S3 or LOAD XML FROM S3 statement. For more information, see Loading Data into an
Amazon Aurora MySQL DB Cluster from Text Files in an Amazon S3 Bucket (p. 665).
• Save data from your DB cluster into text files stored in an Amazon S3 bucket by using the SELECT
INTO OUTFILE S3 statement. For more information, see Saving Data from an Amazon Aurora MySQL
DB Cluster into Text Files in an Amazon S3 Bucket (p. 673).
• Export log data to Amazon CloudWatch Logs MySQL. For more information, see Publishing Amazon
Aurora MySQL Logs to Amazon CloudWatch Logs (p. 685).
• Automatically add or remove Aurora Replicas with Application Auto Scaling. For more information, see
Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270).
654
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
1. Create an IAM policy that grants permission to the AWS service. For more information, see:
• Creating an IAM Policy to Access Amazon S3 Resources (p. 655)
• Creating an IAM Policy to Access AWS Lambda Resources (p. 656)
• Creating an IAM Policy to Access CloudWatch Logs Resources (p. 657)
• Creating an IAM Policy to Access AWS KMS Resources (p. 659)
2. Create an IAM role and attach the policy that you created. For more information, see Creating an IAM
Role to Allow Amazon Aurora to Access AWS Services (p. 660).
3. Associate that IAM role with your Aurora DB cluster. For more information, see Associating an IAM
Role with an Amazon Aurora MySQL DB Cluster (p. 660).
The following table lists the Aurora features that can access an Amazon S3 bucket on your behalf, and
the minimum required bucket and object permissions required by each feature.
GetObjectVersion
GetObjectVersion
DeleteObject
GetObject
ListMultipartUploadParts
PutObject
Note
Other permissions might be required. For example, if your Amazon S3 bucket is encrypted, you
need to add kms:Decrypt permissions.
You can use the following steps to create an IAM policy that provides the minimum required permissions
for Aurora to access an Amazon S3 bucket on your behalf. To allow Aurora to access all of your
Amazon S3 buckets, you can skip these steps and use either the AmazonS3ReadOnlyAccess or
AmazonS3FullAccess predefined IAM policy instead of creating your own.
655
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
5. For Actions, choose Expand all, and then choose the bucket permissions and object permissions
needed for the IAM policy.
Object permissions are permissions for object operations in Amazon S3, and need to be granted
for objects in a bucket, not the bucket itself. For more information about permissions for object
operations in Amazon S3, see Permissions for Object Operations.
6. Choose Resources, and choose Add ARN for bucket.
7. In the Add ARN(s) dialog box, provide the details about your resource, and choose Add.
Specify the Amazon S3 bucket to allow access to. For instance, if you want to allow Aurora to access
the Amazon S3 bucket named example-bucket, then set the Amazon Resource Name (ARN) value
to arn:aws:s3:::example-bucket.
8. If the object resource is listed, choose Add ARN for object.
9. In the Add ARN(s) dialog box, provide the details about your resource.
For the Amazon S3 bucket, specify the Amazon S3 bucket to allow access to. For the object, you can
choose Any to grant permissions to any object in the bucket.
Note
You can set Amazon Resource Name (ARN) to a more specific ARN value in order to allow
Aurora to access only specific files or folders in an Amazon S3 bucket. For more information
about how to define an access policy for Amazon S3, see Managing Access Permissions to
Your Amazon S3 Resources.
10. (Optional) Choose Add additional permissions to add another Amazon S3 bucket to the policy, and
repeat the previous steps for the bucket.
Note
You can repeat this to add corresponding bucket permission statements to your policy for
each Amazon S3 bucket that you want Aurora to access. Optionally, you can also grant
access to all buckets and objects in Amazon S3.
11. Choose Review policy.
12. For Name, enter a name for your IAM policy, for example AllowAuroraToExampleBucket. You use
this name when you create an IAM role to associate with your Aurora DB cluster. You can also add an
optional Description value.
13. Choose Create policy.
14. Complete the steps in Creating an IAM Role to Allow Amazon Aurora to Access AWS
Services (p. 660).
The following policy adds the permissions required by Aurora to invoke an AWS Lambda function on your
behalf.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAuroraToExampleFunction",
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource":
"arn:aws:lambda:<region>:<123456789012>:function:<example_function>"
}
]
656
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
You can use the following steps to create an IAM policy that provides the minimum required permissions
for Aurora to invoke an AWS Lambda function on your behalf. To allow Aurora to invoke all of your AWS
Lambda functions, you can skip these steps and use the predefined AWSLambdaRole policy instead of
creating your own.
Ensure that InvokeFunction is selected. It is the minimum required permission to enable Amazon
Aurora to invoke an AWS Lambda function.
6. Choose Resources and choose Add ARN for function.
7. In the Add ARN(s) dialog box, provide the details about your resource.
Specify the Lambda function to allow access to. For instance, if you want to allow Aurora
to access a Lambda function named example_function, then set the ARN value to
arn:aws:lambda:::function:example_function.
For more information on how to define an access policy for AWS Lambda, see Authentication and
Access Control for AWS Lambda.
8. Optionally, choose Add additional permissions to add another AWS Lambda function to the policy,
and repeat the previous steps for the function.
Note
You can repeat this to add corresponding function permission statements to your policy for
each AWS Lambda function that you want Aurora to access.
9. Choose Review policy.
10. Set Name to a name for your IAM policy, for example AllowAuroraToExampleFunction. You use
this name when you create an IAM role to associate with your Aurora DB cluster. You can also add an
optional Description value.
11. Choose Create policy.
12. Complete the steps in Creating an IAM Role to Allow Amazon Aurora to Access AWS
Services (p. 660).
The following policy adds the permissions required by Aurora to access Amazon CloudWatch Logs on
your behalf, and the minimum required permissions to create log groups and export data.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableCreationAndManagementOfRDSCloudwatchLogGroups",
657
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:PutRetentionPolicy"
],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/rds/*"
]
},
{
"Sid": "EnableCreationAndManagementOfRDSCloudwatchLogStreams",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams",
"logs:GetLogEvents"
],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/rds/*:log-stream:*"
]
}
]
}
You can use the following steps to create an IAM policy that provides the minimum required permissions
for Aurora to access CloudWatch Logs on your behalf. To allow Aurora full access to CloudWatch Logs,
you can skip these steps and use the CloudWatchLogsFullAccess predefined IAM policy instead of
creating your own. For more information, see Using Identity-Based Policies (IAM Policies) for CloudWatch
Logs in the Amazon CloudWatch User Guide.
• CreateLogGroup
• CreateLogStream
• DescribeLogStreams
• GetLogEvents
• PutLogEvents
• PutRetentionPolicy
6. Choose Resources and choose Add ARN for log-group.
7. In the Add ARN(s) dialog box, enter log-group:/aws/rds/* for Log Group Name, and choose
Add.
8. Choose Add ARN for log-stream.
9. In the Add ARN(s) dialog box, enter the following values:
658
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
The following policy adds the permissions required by Aurora to access KMS keys on your behalf.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
],
"Resource": "arn:aws:kms:<region>:<123456789012>:key/<key-ID>"
}
]
}
You can use the following steps to create an IAM policy that provides the minimum required permissions
for Aurora to access KMS keys on your behalf.
659
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
To create an IAM role to permit your Amazon RDS cluster to communicate with other AWS services on
your behalf, take the following steps.
• Add the role to the list of associated roles for a DB cluster by using the RDS console, the add-role-to-
db-cluster AWS CLI command, or the AddRoleToDBCluster RDS API operation.
You can add a maximum of five IAM roles for each Aurora DB cluster.
• Set the cluster-level parameter for the related AWS service to the ARN for the associated IAM role.
The following table describes the cluster-level parameter names for the IAM roles used to access other
AWS services.
Cluster-Level Description
Parameter
660
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
Cluster-Level Description
Parameter
To associate an IAM role to permit your Amazon RDS cluster to communicate with other AWS services on
your behalf, take the following steps.
661
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
662
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
f. Choose Create.
9. On the Parameter groups page, select your DB cluster parameter group and choose Edit for
Parameter group actions.
10. Set the appropriate cluster-level parameters to the related IAM role ARN values. For example, you
can set just the aws_default_s3_role parameter to arn:aws:iam::123456789012:role/
AllowAuroraS3Role.
11. Choose Save changes.
12. To change the DB cluster parameter group for your DB cluster, complete the following steps:
When the instance has rebooted, your IAM role is associated with your DB cluster.
For more information about cluster parameter groups, see Aurora MySQL Parameters (p. 711).
1. Call the add-role-to-db-cluster command from the AWS CLI to add the ARNs for your IAM
roles to the DB cluster, as shown following.
663
Amazon Aurora User Guide for Aurora
Authorizing Aurora MySQL to Access AWS Services
2. If you are using the default DB cluster parameter group, create a new DB cluster parameter group.
If you are already using a custom DB parameter group, you can use that group instead of creating a
new DB cluster parameter group.
4. Modify the DB cluster to use the new DB cluster parameter group and then reboot the cluster, as
shown following.
When the instance has rebooted, your IAM roles are associated with your DB cluster.
For more information about cluster parameter groups, see Aurora MySQL Parameters (p. 711).
ERROR 1873 (HY000): Lambda API returned error: Network Connection. Unable to connect to
endpoint
664
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
If you encounter these messages while invoking AWS Lambda functions or accessing files from Amazon
S3, check if your Aurora DB cluster is public or private. If your Aurora DB cluster is private, you must
configure it to enable connections.
For an Aurora DB cluster to be public, it must be marked as publicly accessible. If you look at the details
for the DB cluster in the AWS Management Console, Publicly Accessible is Yes if this is the case. The DB
cluster must also be in an Amazon VPC public subnet. For more information about publicly accessible DB
instances, see Working with a DB Instance in a VPC (p. 1077). For more information about public Amazon
VPC subnets, see Your VPC and Subnets.
If your Aurora DB cluster isn’t publicly accessible and in a VPC public subnet, it is private. You might have
a DB cluster that is private and want to invoke AWS Lambda functions or access Amazon S3 files. If so,
configure the cluster so it can connect to Internet addresses through Network Address Translation (NAT).
As an alternative for Amazon S3, you can instead configure the VPC to have a VPC endpoint for Amazon
S3 associated with the DB cluster’s route table. For more information about configuring NAT in your VPC,
see NAT Gateways. For more information about configuring VPC endpoints, see VPC Endpoints.
Related Topics
• Integrating Aurora with Other AWS Services (p. 269)
• Managing an Amazon Aurora DB Cluster (p. 227)
1. Create an AWS Identity and Access Management (IAM) policy that provides the bucket and object
permissions that allow your Aurora MySQL DB cluster to access Amazon S3. For instructions, see
Creating an IAM Policy to Access Amazon S3 Resources (p. 655).
2. Create an IAM role, and attach the IAM policy you created in Creating an IAM Policy to Access
Amazon S3 Resources (p. 655) to the new IAM role. For instructions, see Creating an IAM Role to
Allow Amazon Aurora to Access AWS Services (p. 660).
3. Make sure the DB cluster is using a custom DB cluster parameter group.
For more information about creating a custom DB cluster parameter group, see Creating a DB
Cluster Parameter Group (p. 209).
665
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
If the cluster is part of an Aurora global database, set this parameter for each Aurora cluster in the
global database. Although only the primary cluster in an Aurora global database can load data,
another cluster might be promoted by the failover mechanism and become the primary cluster.
For more information about DB cluster parameters, see Amazon Aurora DB Cluster and DB Instance
Parameters (p. 207).
5. To permit database users in an Aurora MySQL DB cluster to access Amazon S3, associate the role
that you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS Services (p. 660)
with the DB cluster. For an Aurora global database, associate the role with each Aurora cluster in the
global database. For information about associating an IAM role with a DB cluster, see Associating an
IAM Role with an Amazon Aurora MySQL DB Cluster (p. 660).
6. Configure your Aurora MySQL DB cluster to allow outbound connections to Amazon S3. For
instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
For an Aurora global database, enable outbound connections for each Aurora cluster in the global
database.
The LOAD FROM S3 privilege is specific to Amazon Aurora and is not available for MySQL databases or
RDS MySQL DB instances. If you have set up replication between an Aurora DB cluster as the replication
master and a MySQL database as the replication client, then the GRANT LOAD FROM S3 statement
causes replication to stop with an error. You can safely skip the error to resume replication. To skip the
error on an RDS MySQL DB instance, use the mysql_rds_skip_repl_error procedure. To skip the error on
an external MySQL database, use the SET GLOBAL sql_slave_skip_counter statement.
s3-region://bucket-name/file-name-or-prefix
• region (optional) – The AWS Region that contains the Amazon S3 bucket to load from. This value is
optional. If you don't specify a region value, then Aurora loads your file from Amazon S3 in the same
region as your DB cluster.
• bucket-name – The name of the Amazon S3 bucket that contains the data to load. Object prefixes
that identify a virtual folder path are supported.
• file-name-or-prefix – The name of the Amazon S3 text file or XML file, or a prefix that identifies
one or more text or XML files to load. You can also specify a manifest file that identifies one or more
666
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
text files to load. For more information about using a manifest file to load text files from Amazon S3,
see Using a Manifest to Specify Data Files to Load (p. 668).
Syntax
Parameters
Following, you can find a list of the required and optional parameters used by the LOAD DATA FROM S3
statement. You can find more details about some of these parameters in LOAD DATA INFILE Syntax in the
MySQL documentation.
• FILE | PREFIX | MANIFEST – Identifies whether to load the data from a single file, from all files that
match a given prefix, or from all files in a specified manifest. FILE is the default.
• S3-URI – Specifies the URI for a text or manifest file to load, or an Amazon S3 prefix to use. Specify the
URI using the syntax described in Specifying a Path to an Amazon S3 Bucket (p. 666).
• REPLACE | IGNORE – Determines what action to take if an input row as the same unique key values as
an existing row in the database table.
• Specify REPLACE if you want the input row to replace the existing row in the table.
• Specify IGNORE if you want to discard the input row.
• INTO TABLE – Identifies the name of the database table to load the input rows into.
• PARTITION – Requires that all input rows be inserted into the partitions identified by the specified
list of comma-separated partition names. If an input row cannot be inserted into one of the specified
partitions, then the statement fails and an error is returned.
• CHARACTER SET – Identifies the character set of the data in the input file.
• FIELDS | COLUMNS – Identifies how the fields or columns in the input file are delimited. Fields are tab-
delimited by default.
• LINES – Identifies how the lines in the input file are delimited. Lines are delimited by a carriage return
by default.
• IGNORE number LINES | ROWS – Specifies to ignore a certain number of lines or rows at the start of
the input file. For example, you can use IGNORE 1 LINES to skip over an initial header line containing
667
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
column names, or IGNORE 2 ROWS to skip over the first two rows of data in the input file. If you also
use PREFIX, IGNORE skips a certain number of lines or rows at the start of the first input file.
• col_name_or_user_var, ... – Specifies a comma-separated list of one or more column names or user
variables that identify which columns to load by name. The name of a user variable used for this
purpose must match the name of an element from the text file, prefixed with @. You can employ user
variables to store the corresponding field values for subsequent reuse.
For example, the following statement loads the first column from the input file into the first column
of table1, and sets the value of the table_column2 column in table1 to the input value of the
second column divided by 100.
• SET – Specifies a comma-separated list of assignment operations that set the values of columns in the
table to values not included in the input file.
For example, the following statement sets the first two columns of table1 to the values in the first
two columns from the input file, and then sets the value of the column3 in table1 to the current
time stamp.
You can use subqueries in the right side of SET assignments. For a subquery that returns a value to be
assigned to a column, you can use only a scalar subquery. Also, you cannot use a subquery to select
from the table that is being loaded.
You cannot use the LOCAL keyword of the LOAD DATA FROM S3 statement if you are loading data from
an Amazon S3 bucket.
The following JSON schema describes the format and content of a manifest file.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"definitions": {},
"id": "Aurora_LoadFromS3_Manifest",
"properties": {
"entries": {
"additionalItems": false,
"id": "/properties/entries",
"items": {
"additionalProperties": false,
"id": "/properties/entries/items",
"properties": {
"mandatory": {
"default": "false"
"id": "/properties/entries/items/properties/mandatory",
668
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
"type": "boolean"
},
"url": {
"id": "/properties/entries/items/properties/url",
"maxLength": 1024,
"minLength": 1,
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
},
"type": "array",
"uniqueItems": true
}
},
"required": [
"entries"
],
"type": "object"
}
Each url in the manifest must specify a URL with the bucket name and full object path for the file, not
just a prefix. You can use a manifest to load files from different buckets, different regions, or files that
do not share the same prefix. If a region is not specified in the URL, the region of the target Aurora DB
cluster is used. The following example shows a manifest file that loads four files from different buckets.
{
"entries": [
{
"url":"s3://aurora-bucket/2013-10-04-customerdata",
"mandatory":true
},
{
"url":"s3-us-west-2://aurora-bucket-usw2/2013-10-05-customerdata",
"mandatory":true
},
{
"url":"s3://aurora-bucket/2013-10-04-customerdata",
"mandatory":false
},
{
"url":"s3://aurora-bucket/2013-10-05-customerdata"
}
]
}
The optional mandatory flag specifies whether LOAD DATA FROM S3 should return an error if the file
is not found. The mandatory flag defaults to false. Regardless of how mandatory is set, LOAD DATA
FROM S3 terminates if no files are found.
Manifest files can have any extension. The following example runs the LOAD DATA FROM S3 statement
with the manifest in the previous example, which is named customer.manifest.
669
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
After the statement completes, an entry for each successfully loaded file is written to the
aurora_s3_load_history table.
Every successful LOAD DATA FROM S3 statement updates the aurora_s3_load_history table in the
mysql schema with an entry for each file that was loaded.
After you run the LOAD DATA FROM S3 statement, you can verify which files were loaded by querying
the aurora_s3_load_history table. To see the files that were loaded from one execution of the
statement, use the WHERE clause to filter the records on the Amazon S3 URI for the manifest file used
in the statement. If you have used the same manifest file before, filter the results using the timestamp
field.
Field Description
load_prefix The URI that was specified in the load statement. This URI can map
to any of the following:
file_name The name of a file that was loaded into Aurora from Amazon S3
using the URI identified in the load_prefix field.
version_number The version number of the file identified by the file_name field
that was loaded, if the Amazon S3 bucket has a version number.
Examples
The following statement loads data from an Amazon S3 bucket that is in the same region as the Aurora
DB cluster. The statement reads the comma-delimited data in the file customerdata.txt that is in
the dbbucket Amazon S3 bucket, and then loads the data into the table store-schema.customer-
table.
The following statement loads data from an Amazon S3 bucket that is in a different region from
the Aurora DB cluster. The statement reads the comma-delimited data from all files that match the
670
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
employee-data object prefix in the my-data Amazon S3 bucket in the us-west-2 region, and then
loads the data into the employees table.
The following statement loads data from the files specified in a JSON manifest file named q1_sales.json
into the sales table.
• Column names as attributes of a <row> element. The attribute value identifies the contents of the
table field.
• Column names as child elements of a <row> element. The value of the child element identifies the
contents of the table field.
<row>
<column1>value1</column1>
<column2>value2</column2>
</row>
• Column names in the name attribute of <field> elements in a <row> element. The value of the
<field> element identifies the contents of the table field.
<row>
<field name='column1'>value1</field>
<field name='column2'>value2</field>
</row>
Syntax
671
Amazon Aurora User Guide for Aurora
Loading Data From Text Files in Amazon S3
Parameters
Following, you can find a list of the required and optional parameters used by the LOAD DATA FROM S3
statement. You can find more details about some of these parameters in LOAD XML Syntax in the MySQL
documentation.
• FILE | PREFIX – Identifies whether to load the data from a single file, or from all files that match a
given prefix. FILE is the default.
• REPLACE | IGNORE – Determines what action to take if an input row as the same unique key values as
an existing row in the database table.
• Specify REPLACE if you want the input row to replace the existing row in the table.
• Specify IGNORE if you want to discard the input row. IGNORE is the default.
• INTO TABLE – Identifies the name of the database table to load the input rows into.
• PARTITION – Requires that all input rows be inserted into the partitions identified by the specified
list of comma-separated partition names. If an input row cannot be inserted into one of the specified
partitions, then the statement fails and an error is returned.
• CHARACTER SET – Identifies the character set of the data in the input file.
• ROWS IDENTIFIED BY – Identifies the element name that identifies a row in the input file. The default
is <row>.
• IGNORE number LINES | ROWS – Specifies to ignore a certain number of lines or rows at the start of
the input file. For example, you can use IGNORE 1 LINES to skip over the first line in the text file, or
IGNORE 2 ROWS to skip over the first two rows of data in the input XML.
• field_name_or_user_var, ... – Specifies a comma-separated list of one or more XML element names or
user variables that identify which elements to load by name. The name of a user variable used for this
purpose must match the name of an element from the XML file, prefixed with @. You can employ user
variables to store the corresponding field values for subsequent reuse.
For example, the following statement loads the first column from the input file into the first column
of table1, and sets the value of the table_column2 column in table1 to the input value of the
second column divided by 100.
• SET – Specifies a comma-separated list of assignment operations that set the values of columns in the
table to values not included in the input file.
For example, the following statement sets the first two columns of table1 to the values in the first
two columns from the input file, and then sets the value of the column3 in table1 to the current
time stamp.
You can use subqueries in the right side of SET assignments. For a subquery that returns a value to be
assigned to a column, you can use only a scalar subquery. Also, you cannot use a subquery to select
from the table that is being loaded.
672
Amazon Aurora User Guide for Aurora
Saving Data into Text Files in Amazon S3
Related Topics
• Integrating Amazon Aurora MySQL with Other AWS Services (p. 653)
• Saving Data from an Amazon Aurora MySQL DB Cluster into Text Files in an Amazon S3
Bucket (p. 673)
• Managing an Amazon Aurora DB Cluster (p. 227)
• Migrating Data to an Amazon Aurora DB Cluster (p. 226)
1. Create an AWS Identity and Access Management (IAM) policy that provides the bucket and object
permissions that allow your Aurora MySQL DB cluster to access Amazon S3. For instructions, see
Creating an IAM Policy to Access Amazon S3 Resources (p. 655).
2. Create an IAM role, and attach the IAM policy you created in Creating an IAM Policy to Access
Amazon S3 Resources (p. 655) to the new IAM role. For instructions, see Creating an IAM Role to
Allow Amazon Aurora to Access AWS Services (p. 660).
3. Set either the aurora_select_into_s3_role or aws_default_s3_role DB cluster parameter
to the Amazon Resource Name (ARN) of the new IAM role. If an IAM role isn't specified for
aurora_select_into_s3_role, Aurora uses the IAM role specified in aws_default_s3_role.
If the cluster is part of an Aurora global database, set this parameter for each Aurora cluster in the
global database.
For more information about DB cluster parameters, see Amazon Aurora DB Cluster and DB Instance
Parameters (p. 207).
4. To permit database users in an Aurora MySQL DB cluster to access Amazon S3, associate the role
that you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS Services (p. 660)
with the DB cluster.
For an Aurora global database, associate the role with each Aurora cluster in the global database.
For information about associating an IAM role with a DB cluster, see Associating an IAM Role with an
Amazon Aurora MySQL DB Cluster (p. 660).
5. Configure your Aurora MySQL DB cluster to allow outbound connections to Amazon S3. For
instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
673
Amazon Aurora User Guide for Aurora
Saving Data into Text Files in Amazon S3
For an Aurora global database, enable outbound connections for each Aurora cluster in the global
database.
The SELECT INTO S3 privilege is specific to Amazon Aurora MySQL and is not available for MySQL
databases or RDS MySQL DB instances. If you have set up replication between an Aurora MySQL DB
cluster as the replication master and a MySQL database as the replication client, then the GRANT
SELECT INTO S3 statement causes replication to stop with an error. You can safely skip the error to
resume replication. To skip the error on an RDS MySQL DB instance, use the mysql_rds_skip_repl_error
procedure. To skip the error on an external MySQL database, use the SET GLOBAL sql_slave_skip_counter
statement.
s3-region://bucket-name/file-prefix
• region (optional) – The AWS Region that contains the Amazon S3 bucket to save the data into. This
value is optional. If you don't specify a region value, then Aurora saves your files into Amazon S3 in
the same region as your DB cluster.
• bucket-name – The name of the Amazon S3 bucket to save the data into. Object prefixes that identify
a virtual folder path are supported.
• file-prefix – The Amazon S3 object prefix that identifies the files to be saved in Amazon S3.
The data files created by the SELECT INTO OUTFILE S3 statement use the following path, in which
00000 represents a 5-digit, zero-based integer number.
s3-region://bucket-name/file-prefix.part_00000
For example, suppose that a SELECT INTO OUTFILE S3 statement specifies s3-us-west-2://
bucket/prefix as the path in which to store data files and creates three data files. The specified
Amazon S3 bucket contains the following data files.
• s3-us-west-2://bucket/prefix.part_00000
• s3-us-west-2://bucket/prefix.part_00001
• s3-us-west-2://bucket/prefix.part_00002
674
Amazon Aurora User Guide for Aurora
Saving Data into Text Files in Amazon S3
The data files included in the manifest created by the SELECT INTO OUTFILE S3 statement are listed
in the order that they're created by the statement. For example, suppose that a SELECT INTO OUTFILE
S3 statement specified s3-us-west-2://bucket/prefix as the path in which to store data files
and creates three data files and a manifest file. The specified Amazon S3 bucket contains a manifest file
named s3-us-west-2://bucket/prefix.manifest, that contains the following information.
{
"entries": [
{
"url":"s3-us-west-2://bucket/prefix.part_00000"
},
{
"url":"s3-us-west-2://bucket/prefix.part_00001"
},
{
"url":"s3-us-west-2://bucket/prefix.part_00002"
}
]
}
Syntax
SELECT
[ALL | DISTINCT | DISTINCTROW ]
[HIGH_PRIORITY]
[STRAIGHT_JOIN]
[SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
[SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
select_expr [, select_expr ...]
[FROM table_references
[PARTITION partition_list]
[WHERE where_condition]
[GROUP BY {col_name | expr | position}
[ASC | DESC], ... [WITH ROLLUP]]
[HAVING where_condition]
[ORDER BY {col_name | expr | position}
[ASC | DESC], ...]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
[PROCEDURE procedure_name(argument_list)]
INTO OUTFILE S3 's3_uri'
[CHARACTER SET charset_name]
[export_options]
[MANIFEST {ON | OFF}]
[OVERWRITE {ON | OFF}]
export_options:
675
Amazon Aurora User Guide for Aurora
Saving Data into Text Files in Amazon S3
Parameters
Following, you can find a list of the required and optional parameters used by the SELECT INTO
OUTFILE S3 statement that are specific to Aurora.
• s3-uri – Specifies the URI for an Amazon S3 prefix to use. Specify the URI using the syntax described in
Specifying a Path to an Amazon S3 Bucket (p. 674).
• FORMAT {CSV|TEXT} [HEADER] – Optionally saves the data in CSV format. The TEXT option is the
default and produces the existing MySQL export format. The CSV option produces comma-separated
data values. The CSV format follows the specification in RFC-4180. If you specify the optional keyword
HEADER, the output file contains one header line. The labels in the header line correspond to the
column names from the SELECT statement. You can use the CSV files for training data models for use
with AWS ML services. For more information about using exported Aurora data with AWS ML services,
see Exporting Data to Amazon S3 for Amazon SageMaker Model Training (p. 694).
• MANIFEST {ON | OFF} – Indicates whether a manifest file is created in Amazon S3. The manifest file is
a JavaScript Object Notation (JSON) file that can be used to load data into an Aurora DB cluster with
the LOAD DATA FROM S3 MANIFEST statement. For more information about LOAD DATA FROM S3
MANIFEST, see Loading Data into an Amazon Aurora MySQL DB Cluster from Text Files in an Amazon
S3 Bucket (p. 665).
If MANIFEST ON is specified in the query, the manifest file is created in Amazon S3 after all data files
have been created and uploaded. The manifest file is created using the following path:
s3-region://bucket-name/file-prefix.manifest
For more information about the format of the manifest file's contents, see Creating a Manifest to List
Data Files (p. 675).
• OVERWRITE {ON | OFF} – Indicates whether existing files in the specified Amazon S3 bucket are
overwritten. If OVERWRITE ON is specified, existing files that match the file prefix in the URI specified
in s3-uriare overwritten. Otherwise, an error occurs.
You can find more details about other parameters in SELECT Syntax and LOAD DATA INFILE Syntax, in
the MySQL documentation.
Considerations
The number of files written to the Amazon S3 bucket depends on the amount of data selected by the
SELECT INTO OUTFILE S3 statement and the file size threshold for Aurora MySQL. The default
file size threshold is 6 gigabytes (GB). If the data selected by the statement is less than the file size
threshold, a single file is created; otherwise, multiple files are created. Other considerations for files
created by this statement include the following:
• Aurora MySQL guarantees that rows in data files are not split across file boundaries. For multiple
files, the size of every data file except the last is typically close to the file size threshold. However,
occasionally staying under the file size threshold results in a row being split across two data files. In
676
Amazon Aurora User Guide for Aurora
Saving Data into Text Files in Amazon S3
this case, Aurora MySQL creates a data file that keeps the row intact, but might be larger than the file
size threshold.
• Because each SELECT statement in Aurora MySQL runs as an atomic transaction, a SELECT INTO
OUTFILE S3 statement that selects a large data set might run for some time. If the statement fails
for any reason, you might need to start over and execute the statement again. If the statement fails,
however, files already uploaded to Amazon S3 remain in the specified Amazon S3 bucket. You can use
another statement to upload the remaining data instead of starting over again.
• If the amount of data to be selected is large (more than 25 GB), we recommend that you use multiple
SELECT INTO OUTFILE S3 statements to save the data to Amazon S3. Each statement should select
a different portion of the data to be saved, and also specify a different file_prefix in the s3-
uri parameter to use when saving the data files. Partitioning the data to be selected with multiple
statements makes it easier to recover from execution error, because only a portion of data needs to
be re-selected and uploaded to Amazon S3 if an error occurs during the execution of a particular
statement. Using multiple statements also helps to avoid a single long-running transaction, which can
improve performance.
• If multiple SELECT INTO OUTFILE S3 statements that use the same file_prefix in the s3-uri
parameter run in parallel to select data into Amazon S3, the behavior is undefined.
• Metadata, such as table schema or file metadata, is not uploaded by Aurora MySQL to Amazon S3.
• In some cases, you might re-run a SELECT INTO OUTFILE S3 query, such as to recover from a
failure. In these cases, you must either remove any existing data files in the Amazon S3 bucket with the
same file prefix specified in s3-uri, or include OVERWRITE ON in the SELECT INTO OUTFILE S3
query.
The SELECT INTO OUTFILE S3 statement returns a typical MySQL error number and response on
success or failure. If you don't have access to the MySQL error number and response, the easiest way to
determine when it's done is by specifying MANIFEST ON in the statement. The manifest file is the last
file written by the statement. In other words, if you have a manifest file, the statement has completed
execution.
Currently, there's no way to directly monitor the progress of the SELECT INTO OUTFILE S3 statement
during execution. However, suppose that you're writing a large amount of data from Aurora MySQL to
Amazon S3 using this statement, and you know the size of the data selected by the statement. In this
case, you can estimate progress by monitoring the creation of data files in Amazon S3.
To do so, you can use the fact that a data file is created in the specified Amazon S3 bucket for about
every 6 GB of data selected by the statement. Divide the size of the data selected by 6 GB to get the
estimated number of data files to create. You can then estimate the progress of the statement by
monitoring the number of files uploaded to Amazon S3 during execution.
Examples
The following statement selects all of the data in the employees table and saves the data into an
Amazon S3 bucket that is in a different region from the Aurora MySQL DB cluster. The statement creates
data files in which each field is terminated by a comma (,) character and each row is terminated by a
newline (\n) character. The statement returns an error if files that match the sample_employee_data
file prefix exist in the specified Amazon S3 bucket.
The following statement selects all of the data in the employees table and saves the data into an
Amazon S3 bucket that is in the same region as the Aurora MySQL DB cluster. The statement creates
data files in which each field is terminated by a comma (,) character and each row is terminated by a
677
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
newline (\n) character, and also a manifest file. The statement returns an error if files that match the
sample_employee_data file prefix exist in the specified Amazon S3 bucket.
The following statement selects all of the data in the employees table and saves the data into an
Amazon S3 bucket that is in a different region from the Aurora DB cluster. The statement creates data
files in which each field is terminated by a comma (,) character and each row is terminated by a newline
(\n) character. The statement overwrites any existing files that match the sample_employee_data file
prefix in the specified Amazon S3 bucket.
The following statement selects all of the data in the employees table and saves the data into an
Amazon S3 bucket that is in the same region as the Aurora MySQL DB cluster. The statement creates
data files in which each field is terminated by a comma (,) character and each row is terminated by a
newline (\n) character, and also a manifest file. The statement overwrites any existing files that match
the sample_employee_data file prefix in the specified Amazon S3 bucket.
Related Topics
• Integrating Aurora with Other AWS Services (p. 269)
• Loading Data into an Amazon Aurora MySQL DB Cluster from Text Files in an Amazon S3
Bucket (p. 665)
• Managing an Amazon Aurora DB Cluster (p. 227)
• Migrating Data to an Amazon Aurora DB Cluster (p. 226)
In recent Aurora MySQL versions, using a stored procedure is deprecated. We strongly recommend using
an Aurora MySQL native function if you are using one of the following Aurora MySQL versions:
• Aurora MySQL version 1.16 and later, for MySQL 5.6-compatible clusters.
678
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
• Aurora MySQL version 2.06 and later, for MySQL 5.7-compatible clusters.
Topics
• Giving Aurora Access to Lambda (p. 679)
• Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679)
• Invoking a Lambda Function with an Aurora MySQL Stored Procedure (p. 682)
1. Create an AWS Identity and Access Management (IAM) policy that provides the permissions that
allow your Aurora MySQL DB cluster to invoke Lambda functions. For instructions, see Creating an
IAM Policy to Access AWS Lambda Resources (p. 656).
2. Create an IAM role, and attach the IAM policy you created in Creating an IAM Policy to Access AWS
Lambda Resources (p. 656) to the new IAM role. For instructions, see Creating an IAM Role to Allow
Amazon Aurora to Access AWS Services (p. 660).
3. Set the aws_default_lambda_role DB cluster parameter to the Amazon Resource Name (ARN) of
the new IAM role.
If the cluster is part of an Aurora global database, apply the same setting for each Aurora cluster in
the global database.
For more information about DB cluster parameters, see Amazon Aurora DB Cluster and DB Instance
Parameters (p. 207).
4. To permit database users in an Aurora MySQL DB cluster to invoke Lambda functions, associate
the role that you created in Creating an IAM Role to Allow Amazon Aurora to Access AWS
Services (p. 660) with the DB cluster. For information about associating an IAM role with a DB
cluster, see Associating an IAM Role with an Amazon Aurora MySQL DB Cluster (p. 660).
If the cluster is part of an Aurora global database, associate the role with each Aurora cluster in the
global database.
5. Configure your Aurora MySQL DB cluster to allow outbound connections to Lambda. For
instructions, see Enabling Network Communication from Amazon Aurora MySQL to Other AWS
Services (p. 664).
If the cluster is part of an Aurora global database, enable outbound connections for each Aurora
cluster in the global database.
You can invoke an AWS Lambda function from an Aurora MySQL DB cluster by calling the native
functions lambda_sync and lambda_async. This approach can be useful when you want to integrate
your database running on Aurora MySQL with other AWS services. For example, you might want to send
679
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
a notification using Amazon Simple Notification Service (Amazon SNS) whenever a row is inserted into a
specific table in your database.
The user invoking a native function must be granted the INVOKE LAMBDA privilege. To grant this
privilege to a user, connect to the DB instance as the master user, and run the following statement.
You invoke the lambda_sync function synchronously with the RequestResponse invocation type. The
function returns the result of the Lambda invocation in a JSON payload. The function has the following
syntax.
lambda_sync (
lambda_function_ARN,
JSON_payload
)
Note
You can use triggers to call Lambda on data-modifying statements. Remember that triggers
are not executed once per SQL statement, but once per row modified, one row at a time.
Trigger execution is synchronous, and the data-modifying statement will not return until trigger
execution completes.
Be careful when invoking an AWS Lambda function from triggers on tables that experience
high write traffic. INSERT, UPDATE, and DELETE triggers are activated per row. A write-heavy
workload on a table with INSERT, UPDATE, or DELETE triggers results in a large number of calls
to your AWS Lambda function.
lambda_function_ARN
680
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
Note
Aurora MySQL doesn't support JSON parsing. JSON parsing isn't required when a Lambda
function returns an atomic value, such as a number or a string.
The following query based on lambda_sync invokes the Lambda function BasicTestLambda
synchronously using the function ARN. The payload for the function is {"operation": "ping"}.
SELECT lambda_sync(
'arn:aws:lambda:us-east-1:868710585169:function:BasicTestLambda',
'{"operation": "ping"}');
You invoke the lambda_async function asynchronously with the Event invocation type. The function
returns the result of the Lambda invocation in a JSON payload. The function has the following syntax.
lambda_async (
lambda_function_ARN,
JSON_payload
)
lambda_function_ARN
Note
Aurora MySQL doesn't support JSON parsing. JSON parsing isn't required when a Lambda
function returns an atomic value, such as a number or a string.
The following query based on lambda_async invokes the Lambda function BasicTestLambda
asynchronously using the function ARN. The payload for the function is {"operation": "ping"}.
SELECT lambda_async(
'arn:aws:lambda:us-east-1:868710585169:function:BasicTestLambda',
'{"operation": "ping"}');
Related Topics
• Integrating Aurora with Other AWS Services (p. 269)
• Managing an Amazon Aurora DB Cluster (p. 227)
• AWS Lambda Developer Guide
681
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
Currently, in Aurora MySQL 2.* you cannot use the native function technique to invoke a lambda
function. For an Aurora MySQL 5.7-compatible cluster, use the stored procedure technique described in
the following section.
Syntax
CALL mysql.lambda_async (
lambda_function_ARN,
lambda_function_input
)
Parameters
lambda_function_ARN
The input string, in JSON format, for the invoked Lambda function.
Examples
As a best practice, we recommend that you wrap calls to the mysql.lambda_async procedure in a
stored procedure that can be called from different sources such as triggers or client code. This approach
can help to avoid impedance mismatch issues and make it easier to invoke Lambda functions.
Note
Be careful when invoking an AWS Lambda function from triggers on tables that experience
high write traffic. INSERT, UPDATE, and DELETE triggers are activated per row. A write-heavy
682
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
workload on a table with INSERT, UPDATE, or DELETE triggers results in a large number of calls
to your AWS Lambda function.
Although calls to the mysql.lambda_async procedure are asynchronous, triggers are
synchronous. A statement that results in a large number of trigger activations doesn't wait for
the call to the AWS Lambda function to complete, but it does wait for the triggers to complete
before returning control to the client.
The following example creates a stored procedure that you can call in your database code to send an
email using a Lambda function.
import boto3
ses = boto3.client('ses')
return ses.send_email(
Source=event['email_from'],
Destination={
'ToAddresses': [
event['email_to'],
]
},
Message={
'Subject': {
'Data': event['email_subject']
},
'Body': {
'Text': {
'Data': event['email_body']
}
}
}
)
Stored Procedure
683
Amazon Aurora User Guide for Aurora
Invoking a Lambda Function from Aurora MySQL
Example Example: Invoke an AWS Lambda Function to Publish an Event from a Trigger
The following example creates a stored procedure that publishes an event by using Amazon SNS. The
code calls the procedure from a trigger when a row is added to a table.
import boto3
sns = boto3.client('sns')
return sns.publish(
TopicArn='arn:aws:sns:us-west-2:123456789012:Sample_Topic',
Message=event['message'],
Subject=event['subject'],
MessageStructure='string'
)
Stored Procedure
Table
Trigger
DELIMITER ;;
CREATE TRIGGER TR_Customer_Feedback_AI
AFTER INSERT ON Customer_Feedback
FOR EACH ROW
BEGIN
SELECT CONCAT('New customer feedback from ', NEW.customer_name), NEW.customer_feedback
INTO @subject, @feedback;
684
Amazon Aurora User Guide for Aurora
Publishing Aurora MySQL Logs to CloudWatch Logs
Related Topics
• Integrating Aurora with Other AWS Services (p. 269)
• Managing an Amazon Aurora DB Cluster (p. 227)
• AWS Lambda Developer Guide
To publish logs to CloudWatch Logs, the respective logs must be enabled. Error logs are enabled
by default, but you must enable the other types of logs explicitly. For information about enabling
logs in MySQL, see Selecting General Query and Slow Query Log Output Destinations in the MySQL
documentation. For more information about enabling Aurora MySQL audit logs, see Enabling Advanced
Auditing (p. 595).
Note
Be aware of the following:
• You can't publish logs to CloudWatch Logs for the China (Ningxia) region.
• If exporting log data is disabled, Aurora doesn't delete existing log groups or log streams.
If exporting log data is disabled, existing log data remains available in CloudWatch Logs,
depending on log retention, and you still incur charges for stored audit log data. You can
delete log streams and log groups using the CloudWatch Logs console, the AWS CLI, or the
CloudWatch Logs API.
• An alternative way to publish audit logs to CloudWatch Logs is by enabling advanced auditing
and setting the cluster-level DB parameter server_audit_logs_upload to 1. The default
for the server_audit_logs_upload parameter is 0.
If you use this alternative method, you must have an IAM role to access CloudWatch
Logs and set the aws_default_logs_role cluster-level parameter to the ARN for this
role. For information about creating the role, see Setting Up IAM Roles to Access AWS
Services (p. 654). However, if you have the AWSServiceRoleForRDS service-linked
role, it provides access to CloudWatch Logs and overrides any custom-defined roles. For
information service-linked roles for Amazon RDS, see Using Service-Linked Roles for Amazon
Aurora (p. 1063).
• If you don't want to export audit logs to CloudWatch Logs, make sure that all methods of
exporting audit logs are disabled. These methods are the AWS Management Console, the AWS
CLI, the RDS API, and the server_audit_logs_upload parameter.
685
Amazon Aurora User Guide for Aurora
Publishing Aurora MySQL Logs to CloudWatch Logs
• The procedure is slightly different for Aurora Serverless clusters than for provisioned clusters.
Serverless clusters automatically upload all the kinds of logs that you enable through the
configuration parameters. Therefore, you enable or disable log upload for Serverless clusters
by turning different log types on and off in the DB cluster parameter group. You don't modify
the settings of the cluster itself through the AWS Management Console, AWS CLI, or RDS API.
For information about enabling MySQL logs for Serverless clusters, see Aurora Serverless and
Parameter Groups (p. 122).
Console
You can publish Aurora MySQL logs for provisioned clusters to CloudWatch Logs with the console.
AWS CLI
You can publish Aurora MySQL logs for provisioned clusters with the AWS CLI. To do so, you run the
modify-db-cluster AWS CLI command with the following options:
You can also publish Aurora MySQL logs by running one of the following AWS CLI commands:
• create-db-cluster
• restore-db-cluster-from-s3
• restore-db-cluster-from-snapshot
• restore-db-cluster-to-point-in-time
Run one of these AWS CLI commands with the following options:
Other options might be required depending on the AWS CLI command that you run.
Example
The following command modifies an existing Aurora MySQL DB cluster to publish log files to CloudWatch
Logs.
686
Amazon Aurora User Guide for Aurora
Publishing Aurora MySQL Logs to CloudWatch Logs
For Windows:
Example
The following command creates an Aurora MySQL DB cluster to publish log files to CloudWatch Logs.
For Windows:
RDS API
You can publish Aurora MySQL logs for provisioned clusters with the RDS API. To do so, you run the
ModifyDBCluster operation with the following options:
You can also publish Aurora MySQL logs with the RDS API by running one of the following RDS API
operations:
• CreateDBCluster
• RestoreDBClusterFromS3
• RestoreDBClusterFromSnapshot
• RestoreDBClusterToPointInTime
687
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
Other parameters might be required depending on the AWS CLI command that you run.
/aws/rds/cluster/cluster-name/log_type
For example, if you configure the export function to include the slow query log for a DB cluster named
mydbcluster, slow query data is stored in the /aws/rds/cluster/mydbcluster/slowquery log
group.
All of the events from all of the DB instances in a DB cluster are pushed to a log group using different log
streams.
If a log group with the specified name exists, Aurora uses that log group to export log data for the
Aurora DB cluster. You can use automated configuration, such as AWS CloudFormation, to create log
groups with predefined log retention periods, metric filters, and customer access. Otherwise, a new log
group is automatically created using the default log retention period, Never Expire, in CloudWatch Logs.
You can use the CloudWatch Logs console, the AWS CLI, or the CloudWatch Logs API to change the log
retention period. For more information about changing log retention periods in CloudWatch Logs, see
Change Log Data Retention in CloudWatch Logs.
You can use the CloudWatch Logs console, the AWS CLI, or the CloudWatch Logs API to search for
information within the log events for a DB cluster. For more information about searching and filtering
log data, see Searching and Filtering Log Data.
• You can add ML-based predictions to your existing database applications. You don't need to build
custom integrations or learn separate tools. You can embed machine learning processing directly into
your SQL query as calls to stored functions.
• The ML integration is a fast way to enable ML services to work with transactional data. You don't have
to move the data out of the database to perform the machine learning operations. You don't have
to convert or reimport the results of the machine learning operations to use them in your database
application.
• You can use your existing governance policies to control who has access to the underlying data and to
the generated insights.
AWS ML Services are managed services that are set up and run in their own production environments.
Currently, Aurora Machine Learning integrates with Amazon Comprehend for sentiment analysis and
Amazon SageMaker for a wide variety of ML algorithms.
688
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
For general information about Amazon Comprehend, see Amazon Comprehend. For details about
using Aurora and Amazon Comprehend together, see Using Amazon Comprehend for Sentiment
Detection (p. 697).
For general information about Amazon SageMaker, see Amazon SageMaker. For details about
using Aurora and Amazon SageMaker together, see Using Amazon SageMaker to Run Your Own ML
Models (p. 695).
Topics
• Prerequisites for Aurora Machine Learning (p. 689)
• Enabling Aurora Machine Learning (p. 689)
• Exporting Data to Amazon S3 for Amazon SageMaker Model Training (p. 694)
• Using Amazon SageMaker to Run Your Own ML Models (p. 695)
• Using Amazon Comprehend for Sentiment Detection (p. 697)
• Performance Considerations for Aurora Machine Learning (p. 698)
• Monitoring Aurora Machine Learning (p. 699)
• Limitations of Aurora Machine Learning (p. 700)
• You enable the Aurora cluster to access the Amazon machine learning services Amazon SageMaker or
Amazon Comprehend, depending the kinds of ML algorithms you want for your application.
• For Amazon SageMaker, then you use the Aurora CREATE FUNCTION statement to set up stored
functions that access inference features.
Note
Aurora machine learning includes built-in functions that call Amazon Comprehend for
sentiment analysis. You don't need to run any CREATE FUNCTION statements if you only use
Amazon Comprehend.
Topics
• Setting Up IAM Access to Amazon Comprehend and Amazon SageMaker (p. 689)
• Granting SQL Privileges for Invoking Aurora Machine Learning Services (p. 694)
• Enabling Network Communication from Aurora MySQL to Other AWS Services (p. 694)
When you use the AWS Management Console, AWS does the IAM setup for you automatically. You can
skip the following information and follow the procedure in Connecting an Aurora DB Cluster to Amazon
S3, Amazon SageMaker, or Amazon Comprehend Using the Console (p. 690).
689
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
Setting up the IAM roles for Amazon SageMaker or Amazon Comprehend using the AWS CLI or the RDS
API consists of the following steps:
1. Create an IAM policy to specify which Amazon SageMaker endpoints tan be invoked by your Aurora
MySQL cluster or to enable access to Amazon Comprehend.
2. Create an IAM role to permit your Aurora MySQL database cluster to access AWS ML services. The IAM
Policy created above is attached to the IAM role.
3. To permit the Aurora MySQL database cluster to access AWS ML services, you associate the IAM role
that you created above to the database cluster.
4. To permit database applications to invoke AWS ML services, you must also grant privileges to specific
database users. For Amazon SageMaker, because the calls to the endpoints are wrapped inside a
stored function, you also grant EXECUTE privileges on the stored functions to any database users that
call them.
For general information about how to permit your Aurora MySQL DB cluster to access other AWS
services on your behalf, see Authorizing Amazon Aurora MySQL to Access Other AWS Services on Your
Behalf (p. 654).
Aurora machine learning requires that your DB cluster use some combination of Amazon S3, Amazon
SageMaker, and Amazon Comprehend. Amazon Comprehend is for sentiment analysis. Amazon
SageMaker is for a wide variety of machine learning algorithms. For Aurora Machine Learning, Amazon
S3 is only for training Amazon SageMaker models. You only need to use Amazon S3 with Aurora machine
learning if you don't already have a trained model available and the training is your responsibility. To
connect a DB cluster to these services requires that you set up an AWS Identity and Access Management
(IAM) role for each Amazon service. The IAM role enables users of your DB cluster to authenticate with
the corresponding service.
To generate the IAM roles for Amazon S3, Amazon SageMaker, or Amazon Comprehend, repeat the
following steps for each service that you need.
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 Aurora MySQL DB cluster that you
want to use.
3. Choose the Connectivity & security tab.
4. Choose Select a service to connect to this cluster in the Manage IAM roles section.
5. Choose the service that you want to connect to from the dropdown list.
• Amazon S3
• Amazon Comprehend
• Amazon SageMaker
6. Choose Connect service.
7. Enter the required information for the specific service on the Connect cluster window:
• For Amazon SageMaker, enter the Amazon Resource Name (ARN) of an Amazon SageMaker
endpoint. For details about what the endpoint represents, see Deploy a Model on Amazon
SageMaker Hosting Services.
In the navigation pane of the Amazon SageMaker console, choose Endpoints and copy the ARN of
the endpoint you want to use.
690
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
For more about an Amazon S3 bucket ARN, see Specifying Resources in a Policy in the Amazon
Simple Storage Service Developer Guide. For more about using an Amazon S3 bucket with
Amazon SageMaker, see Step 1: Create an Amazon Amazon S3 Bucket in the Amazon SageMaker
Developer Guide.
8. Choose Connect service.
9. Aurora creates a new IAM role and adds it to the DB cluster's list of Current IAM roles for this
cluster. The IAM role's status is initially In progress. The IAM role name is autogenerated with the
following pattern for each connected service:
Aurora also creates a new IAM policy and attaches it to the role. The policy name follows a similar
naming convention and also has a timestamp.
The following policy adds the permissions required by Aurora MySQL to invoke an Amazon SageMaker
function on your behalf. You can specify all of your Amazon SageMaker endpoints that you need your
database applications to access from your Aurora MySQL cluster in a single policy. The policy allows you
to specify the AWS Region for an Amazon SageMaker endpoint. However, an Aurora MySQL cluster can
only invoke Amazon SageMaker models deployed in the same AWS Region as the cluster.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAuroraToInvokeRCFEndPoint",
"Effect": "Allow",
"Action": "sagemaker:InvokeEndpoint",
"Resource": "arn:aws:sagemaker:region:123456789012:endpoint/endpointName"
}
]
}
The following command performs the same operation through the AWS CLI.
691
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
The following policy adds the permissions required by Aurora MySQL to invoke AWS Amazon
Comprehend on your behalf.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAuroraToInvokeComprehendDetectSentiment",
"Effect": "Allow",
"Action": [
"comprehend:DetectSentiment",
"comprehend:BatchDetectSentiment"
],
"Resource": "*"
}
]
}
The following command performs the same operation through the AWS CLI.
After you create the IAM policies, create an IAM role that the Aurora MySQL cluster can assume on behalf
of your database users to access ML services. To create an IAM role, you can use the AWS Management
Console or the AWS CLI. To create an IAM role and attach the preceding policies to the role, follow the
692
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
steps described in Creating an IAM Role to Allow Amazon Aurora to Access AWS Services (p. 660). For
more information about IAM roles, see IAM Roles in the AWS Identity and Access Management User Guide.
You can only use a global IAM role for authentication. You can't use an IAM role associated with a
database user or a session. This requirement is the same as for Aurora integration with the Lambda and
Amazon S3 services.
Associating an IAM Role with an Aurora MySQL DB Cluster (AWS CLI Only)
Note
When you use the AWS Management Console, Aurora creates the IAM policy automatically. In
that case, you can skip this section.
The last step is to associate the IAM role with the attached IAM policy with your Aurora MySQL DB
cluster. To associate an IAM role with an Aurora DB cluster, you do two things:
1. Add the role to the list of associated roles for a DB cluster by using the AWS Management Console, the
add-role-to-db-cluster AWS CLI command, or the AddRoleToDBCluster RDS API operation.
2. Set the cluster-level parameter for the related AWS ML service to the ARN for the associated IAM role.
Use the aws_default_sagemaker_role, aws_default_comprehend_role, or both parameters
depending on which AWS ML services you intend to use with your Aurora cluster.
Cluster-level parameters are grouped into DB cluster parameter groups. To set the preceding cluster
parameters, use an existing custom DB cluster group or create an new one. To create a new DB cluster
parameter group, call the create-db-cluster-parameter-group command from the AWS CLI, as
shown following.
Set the appropriate cluster-level parameter or parameters and the related IAM role ARN values in your
DB cluster parameter group, as shown in the following.
Modify the DB cluster to use the new DB cluster parameter group. Then, reboot the cluster. The
following shows how.
When the instance has rebooted, your IAM roles are associated with your DB cluster.
693
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
The database user invoking a native function must be granted the INVOKE SAGEMAKER or INVOKE
COMPREHEND privilege. To grant this privilege to a user, connect to the DB instance as the master user,
and run the following statements. Substitute the appropriate details for the database user.
For Amazon SageMaker, user-defined functions define the parameters to be sent to the model for
producing the inference and to configure the endpoint name to be invoked. You grant EXECUTE
permission to the stored functions configured for Amazon SageMaker for each of the database users who
intend to invoke the endpoint.
You can use VPC endpoints to connect to Amazon S3. AWS PrivateLink can't be used to connect Aurora
to AWS machine learning services or Amazon S3 at this time.
To train Amazon SageMaker models, you export data to an Amazon S3 bucket. The Amazon S3 bucket is
used by a Jupyter Amazon SageMaker notebook instance to train your model before it is deployed. You
can use the SELECT INTO OUTFILE S3 statement to query data from an Aurora MySQL DB cluster and
save it directly into text files stored in an Amazon S3 bucket. Then the notebook instance consumes the
data from the Amazon S3 bucket for training.
Aurora Machine Learning extends the existing SELECT INTO OUTFILE syntax in Aurora MySQL to
export data to CSV format. The generated CSV file can be directly consumed by models that need this
format for training purposes.
• Format TEXT is the same as the existing MySQL export format. This is the default format.
• Format CSV is a newly introduced format that follows the specification in RFC-4180.
694
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
• If you specify the optional keyword HEADER, the output file contains one header line. The labels in the
header line correspond to the column names from the SELECT statement.
• You can still use the keywords CSV and HEADER as identifiers.
Currently, Aurora Machine Learning supports any Amazon SageMaker endpoint that can read and write
comma-separated value format, through a ContentType of text/csv. The built-in Amazon SageMaker
algorithms that currently accept this format are Random Cut Forest, Linear Learner, 1P, XGBoost, and 3P.
If the algorithms return multiple outputs per item, the Aurora Machine Learning function returns only
the first item. This first item is expected to be a representative result.
Aurora machine learning always invokes Amazon SageMaker endpoints in the same AWS Region as your
Aurora cluster. Therefore, for a single-region Aurora cluster, always deploy the model in the same AWS
Region as your Aurora MySQL cluster.
If you are using an Aurora global database, you set up the same integration between the services for
each AWS Region that's part of the global database. In particular, make sure the following conditions are
satisfied for all AWS Regions in the global database:
• Configure the appropriate IAM roles for accessing external services such as Amazon SageMaker,
Amazon Comprehend, or Lambda for the global database cluster in each AWS Region.
• Ensure that all AWS Regions have the same trained Amazon SageMaker models deployed with the
same endpoint names. Do so before running the CREATE FUNCTION statement for your Aurora
Machine Learning function in the primary AWS Region. In a global database, all CREATE FUNCTION
statements you run in the primary AWS Region are immediately run in all the secondary regions also.
To use models deployed in Amazon SageMaker for inference, you create user-defined functions using
the familiar MySQL data definition language (DDL) statements for stored functions. Each stored function
represents the Amazon SageMaker endpoint hosting the model. When you define such a function, you
695
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
specify the input parameters to the model, the specific Amazon SageMaker endpoint to invoke, and the
return type. The function returns the inference computed by the Amazon SageMaker endpoint after
executing the model on the input parameters. All Aurora Machine Learning stored functions return
numeric types or VARCHAR. You can use any numeric type except BIT. Other types, such as JSON, BLOB,
TEXT, and DATE are not allowed. Use model input parameters that are the same as the input parameters
that you exported to Amazon S3 for model training.
CREATE FUNCTION function_name (arg1 type1, arg2 type2, ...) -- variable number of arguments
[DEFINER = user] -- same as existing MySQL
CREATE FUNCTION
RETURNS mysql_type -- For example, INTEGER, REAL, ...
[SQL SECURITY { DEFINER | INVOKER } ] -- same as existing MySQL
CREATE FUNCTION
ALIAS AWS_SAGEMAKER_INVOKE_ENDPOINT -- ALIAS replaces the stored function body. Only
AWS_SAGEMAKER_INVOKE_ENDPOINT is supported for now.
ENDPOINT NAME 'endpoint_name'
[MAX_BATCH_SIZE max_batch_size]; -- default is 10,000
This is a variation of the existing CREATE FUNCTION DDL statement. In the CREATE FUNCTION
statement that defines the Amazon SageMaker function, you don't specify a function body. Instead,
you specify the new keyword ALIAS where the function body usually goes. Currently, Aurora Machine
Learning only supports aws_sagemaker_invoke_endpoint for this extended syntax. You must specify
the endpoint_name parameter. The optional parameter max_batch_size restricts the maximum
number of inputs processed in an actual batched request to Amazon SageMaker. An Amazon SageMaker
endpoint can have different characteristics for each model. The max_batch_size parameter can
help to avoid an error caused by inputs that are too large, or to make Amazon SageMaker return a
response more quickly. The max_batch_size parameter affects the size of an internal buffer used for ML
request processing. Specifying too large a value for max_batch_size might cause substantial memory
overhead on your DB instance.
We recommend leaving the MANIFEST setting at its default value of OFF. Although you can use the
MANIFEST ON option, some Amazon SageMaker features can't directly use the CSV exported with
this option. The manifest format is not compatible with the expected manifest format from Amazon
SageMaker.
You create a separate stored function for each of your Amazon SageMaker models. This mapping of
functions to models is required because an endpoint is associated with a specific model, and each model
accepts different parameters. Using SQL types for the model inputs and the model output type helps
to avoid type conversion errors passing data back and forth between the AWS services. You can control
who can execute the model. You can also control the runtime characteristics by specifying a parameter
representing the maximum batch size.
Currently, all Aurora Machine Learning functions have the NOT DETERMINISTIC property. If you don't
specify that property explicitly, Aurora sets NOT DETERMINISTIC automatically. This requirement is
because the ML model can be changed without any notification to the database. If that happens, calls
to an Aurora Machine Learning function might return different results for the same input within a single
transaction.
You can't use the characteristics CONTAINS SQL, NO SQL, READS SQL DATA, or MODIFIES SQL DATA
in your CREATE FUNCTION statement.
Following is an example usage of invoking an Amazon SageMaker endpoint to detect anomalies. There
is an Amazon SageMaker endpoint random-cut-forest-model. The corresponding model is already
trained by the random-cut-forest algorithm. For each input, the model returns an anomaly score.
This example shows the data points whose score is greater than 3 standard deviations (approximately
the 99.9th percentile) from the mean score.
696
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
Currently, each Amazon SageMaker function that returns a string uses the character set utf8mb4 for
the return value. The return value uses this character set even if your ML function declares a different
character set for its return type implicitly or explicitly. If your ML function declares a different character
set for the return value, the returned data might be silently truncated if you store it in a table column
that isn't long enough. For example, a query with a DISTINCT clause creates a temporary table. Thus,
the ML function result might be truncated due to the way strings are handled internally during a query.
You can also combine sentiment analysis with analysis of other information in your database using a
single query. For example, you can detect the average sentiment of call-in center documents for issues
that combine the following:
697
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
The max_batch_size helps you to tune the performance of the Amazon Comprehend function calls. A
large batch size trades off faster performance for greater memory usage on the Aurora cluster. For more
information, see Performance Considerations for Aurora Machine Learning (p. 698).
For information about parameters and return types for the sentiment detection functions in Amazon
Comprehend, see DetectSentiment
A typical Amazon Comprehend query looks for rows where the sentiment is a certain value, with a
confidence level greater than a certain number. For example, the following query shows how you can
determine the average sentiment of documents in your database. The query considers only documents
where the confidence of the assessment is at least 80%.
Note
Amazon Comprehend is currently available only in some AWS Regions. To check in which AWS
Regions you can use Amazon Comprehend, see the AWS Region Table page.
Query Cache
The Aurora MySQL query cache doesn't work for ML functions. Aurora MySQL doesn't store query results
in the query cache for any SQL statements that call ML functions.
698
Amazon Aurora User Guide for Aurora
Using Machine Learning with Aurora MySQL
When you create an Aurora stored function that's connected to an Amazon SageMaker endpoint, you
define the batch size parameter. This parameter influences how many rows are transferred for every
underlying call to Amazon SageMaker. For queries that process large numbers of rows, the overhead
to make a separate Amazon SageMaker call for each row can be substantial. The larger the data set
processed by the stored procedure, the larger you can make the batch size.
If the batch mode optimization can be applied to an Amazon SageMaker function, you can tell by
checking the execution plan produced by the EXPLAIN PLAN statement. In this case, the extra column
in the execution plan includes Batched machine learning. The following example shows a call to an
Amazon SageMaker function that uses batch mode.
When you call one of the built-in Amazon Comprehend functions, you can control the batch size by
specifying the optional max_batch_size parameter. his parameter restricts the maximum number
of input_text values processed in each batch. By sending multiple items at once, it reduces the
number of round trips between Aurora and Amazon Comprehend. Limiting the batch size is useful in
situations such as a query with a LIMIT clause. By using a small value for max_batch_size, you can
avoid invoking Amazon Comprehend more times than you have input texts.
The batch optimization for evaluating Aurora Machine Learning functions applies in the following cases:
• Function calls within the select list or the WHERE clause of SELECT statements. There are some
exceptions, as described following.
• Function calls in the VALUES list of INSERT and REPLACE statements.
• ML functions in SET values in UPDATE statements.
699
Amazon Aurora User Guide for Aurora
Aurora MySQL Lab Mode
You can reset these status variables by using a FLUSH STATUS statement. Thus, all of the figures
represent totals, averages, and so on, since the last time the variable was reset.
Aurora_ml_logical_response_cnt
The aggregate response count that Aurora MySQL receives from the ML services across all queries
executed by users of the DB instance.
Aurora_ml_actual_request_cnt
The aggregate request count that Aurora MySQL receives from the ML services across all queries run
by users of the DB instance.
Aurora_ml_actual_response_cnt
The aggregate response count that Aurora MySQL receives from the ML services across all queries
executed by users of the DB instance.
Aurora_ml_cache_hit_cnt
The aggregate internal cache hit count that Aurora MySQL receives from the ML services across all
queries run by users of the DB instance.
Aurora_ml_single_request_cnt
The aggregate count of ML functions that are evaluated by non-batch mode across all queries run by
users of the DB instance.
For information about monitoring the performance of the Amazon SageMaker operations called from
Aurora Machine Learning functions, see Monitor Amazon SageMaker.
You can't use an Aurora machine learning function for a generated-always column. The same limitation
applies to any Aurora MySQL stored function. functions aren't compatible with this binary log (binlog)
format. See the MySQL documentation for information about generated columns.
The setting —binlog-format=STATEMENT throws an exception for calls to Aurora machine learning
functions. The reason for the error is that Aurora Machine Learning considers all ML functions to be
nondeterministic, and nondeterministic stored functions aren't compatible with this binlog format. See
the MySQL documentation for information about this binlog format.
The aurora_lab_mode parameter is an instance-level parameter that is in the default parameter group.
The parameter is set to 0 (disabled) in the default parameter group. To enable Aurora lab mode, create a
custom parameter group, set the aurora_lab_mode parameter to 1 (enabled) in the custom parameter
group, and modify one or more DB instances in your Aurora cluster to use the custom parameter group.
Then connect to the appropriate instance endpoint to try the lab mode features. For information on
modifying a DB parameter group, see Modifying Parameters in a DB Parameter Group (p. 210). For
information on parameter groups and Amazon Aurora, see Aurora MySQL Parameters (p. 711).
700
Amazon Aurora User Guide for Aurora
Aurora Lab Mode Features
Feature Description
Topics
• Determining Which DB Instance You Are Connected To (p. 702)
• Using T2 Instances (p. 702)
• Invoking an AWS Lambda Function (p. 703)
• Working with Asynchronous Key Prefetch in Amazon Aurora (p. 703)
• Working with Multi-Threaded Replication Slaves in Amazon Aurora MySQL (p. 705)
• Using Amazon Aurora to Scale Reads for Your MySQL Database (p. 706)
• Using Amazon Aurora for Disaster Recovery with Your MySQL Databases (p. 708)
• Migrating from MySQL to Amazon Aurora MySQL with Reduced Downtime (p. 709)
• Using XA Transactions with Amazon Aurora MySQL (p. 709)
• Working with Hash Joins in Aurora MySQL (p. 709)
701
Amazon Aurora User Guide for Aurora
Determining Which DB Instance You Are Connected To
The innodb_read_only variable is set to ON if you are connected to an Aurora Replica and OFF if you
are connected to the primary instance.
This approach can be helpful if you want to add logic to your application code to balance the workload
or to ensure that a write operation is using the correct connection. This technique only applies to Aurora
clusters using single-master replication. For multi-master clusters, all the DB instances have the setting
innodb_read_only=OFF.
Using T2 Instances
Amazon Aurora MySQL instances that use the db.t2.small or db.t2.medium DB instance classes
are best suited for applications that do not support a high workload for an extended amount of time.
T2 instances are designed to provide moderate baseline performance and the capability to burst to
significantly higher performance as required by your workload. They are intended for workloads that
don't use the full CPU often or consistently, but occasionally need to burst. We recommend only using
the db.t2.small and db.t2.medium DB instance classes for development and test servers, or other
non-production servers. For more details on T2 instances, see T2 Instances.
Do not enable the MySQL Performance Schema on Amazon Aurora MySQL T2 instances. If the
Performance Schema is enabled, the T2 instance might run out of memory.
When you use a T2 instance as a DB instance in an Aurora MySQL DB cluster, we recommend the
following:
• If you use a T2 instance as a DB instance class in your DB cluster, then we recommend that all instances
in your DB cluster use the same DB instance class. For example, if you use db.t2.medium for your
primary instance, then we recommend that you use db.t2.medium for your Aurora Replicas as well.
• Monitor your CPU Credit Balance (CPUCreditBalance) to ensure that it is at a sustainable level. That
is, CPU credits are being accumulated at the same rate as they are being used.
When you have exhausted the CPU credits for an instance, you see an immediate drop in the available
CPU and an increase in the read and write latency for the instance. This situation results in a severe
decrease in the overall performance of the instance.
If your CPU credit balance is not at a sustainable level, then we recommend that you modify your DB
instance to use a one of the supported R3 DB instance classes (scale compute).
For more information on monitoring metrics, see Monitoring Amazon Aurora DB Cluster
Metrics (p. 377).
• For your Aurora MySQL DB clusters using single-master replication, monitor the replica lag
(AuroraReplicaLag) between the primary instance and the Aurora Replicas.
If an Aurora Replica runs out of CPU credits before the primary instance, the lag behind the primary
instance results in the Aurora Replica frequently restarting. This result is common when an application
702
Amazon Aurora User Guide for Aurora
Invoking an AWS Lambda Function
has a heavy load of read operations distributed among Aurora Replicas in an Aurora MySQL DB cluster,
at the same time that the primary instance has a minimal load of write operations.
If you see a sustained increase in replica lag, make sure that your CPU credit balance for the Aurora
Replicas in your DB cluster is not being exhausted.
If your CPU credit balance is not at a sustainable level, then we recommend that you modify your DB
instance to use one of the supported R3 DB instance classes (scale compute).
• Keep the number of inserts per transaction below 1 million for DB clusters that have binary logging
enabled.
If the DB cluster parameter group for your DB cluster has the binlog_format parameter set to a
value other than OFF, then your DB cluster might experience out-of-memory conditions if the DB
cluster receives transactions that contain over 1 million rows to insert. You can monitor the freeable
memory (FreeableMemory) metric to determine if your DB cluster is running out of available
memory. You then check the write operations (VolumeWriteIOPS) metric to see if a writer instance is
receiving a heavy load of write operations. If this is the case, then we recommend that you update your
application to limit the number of inserts in a transaction to less than 1 million. Alternatively, you can
modify your instance to use one of the supported R3 DB instance classes (scale compute).
If you are using the deprecated mysql.lambda_async procedure, we recommend that you wrap calls
to the mysql.lambda_async procedure in a stored procedure. You can call this stored procedure from
different sources, such as triggers or client code. This approach can help to avoid impedance mismatch
issues and make it easier for your database programmers to invoke Lambda functions.
For more information on invoking Lambda functions from Amazon Aurora, see Invoking a Lambda
Function from an Amazon Aurora MySQL DB Cluster (p. 678).
Amazon Aurora can use AKP to improve the performance of queries that join tables across indexes. This
feature improves performance by anticipating the rows needed to run queries in which a JOIN query
requires use of the Batched Key Access (BKA) Join algorithm and Multi-Range Read (MRR) optimization
features. For more information about BKA and MRR, see Block Nested-Loop and Batched Key Access
Joins and Multi-Range Read Optimization in the MySQL documentation.
To take advantage of the AKP feature, a query must use both BKA and MRR. Typically, such a query
occurs when the JOIN clause of a query uses a secondary index, but also needs some columns from
the primary index. For example, you can use AKP when a JOIN clause represents an equijoin on index
values between a small outer and large inner table, and the index is highly selective on the larger table.
AKP works in concert with BKA and MRR to perform a secondary to primary index lookup during the
evaluation of the JOIN clause. AKP identifies the rows required to run the query during the evaluation
of the JOIN clause. It then uses a background thread to asynchronously load the pages containing those
rows into memory before running the query.
703
Amazon Aurora User Guide for Aurora
Working with Asynchronous Key Prefetch
• Set batched_key_access to on. This value controls the use of the BKA Join algorithm. By default,
this value is set to off.
• Set mrr_cost_based to off. This value controls the use of cost-based MRR functionality. By default,
this value is set to on.
Currently, you can set these values only at the session level. The following example illustrates how to set
these values to enable AKP for the current session by executing SET statements.
Similarly, you can use SET statements to disable AKP and the BKA Join algorithm and re-enable cost-
based MRR functionality for the current session, as shown in the following example.
For more information about the batched_key_access and mrr_cost_based optimizer switches, see
Switchable Optimizations in the MySQL documentation.
In the output for the EXPLAIN statement, the Extra column describes additional information included
with the execution plan. If the AKP feature applies to a table used in the query, this column includes one
of the following values:
The following example shows use of EXPLAIN with EXTENDED to view the execution plan for a query
that can take advantage of AKP.
704
Amazon Aurora User Guide for Aurora
Working with Multi-Threaded Replication
Slaves in Amazon Aurora MySQL
-> group by
-> ps_partkey having
-> sum(ps_supplycost * ps_availqty) > (
-> select
-> sum(ps_supplycost * ps_availqty) * 0.0000003333
-> from
-> partsupp,
-> supplier,
-> nation
-> where
-> ps_suppkey = s_suppkey
-> and s_nationkey = n_nationkey
-> and n_name = 'ETHIOPIA'
-> )
-> order by
-> value desc;
+----+-------------+----------+------+-----------------------+---------------
+---------+----------------------------------+------+----------
+-------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len |
ref | rows | filtered | Extra
|
+----+-------------+----------+------+-----------------------+---------------
+---------+----------------------------------+------+----------
+-------------------------------------------------------------+
| 1 | PRIMARY | nation | ALL | PRIMARY | NULL | NULL |
NULL | 25 | 100.00 | Using where; Using temporary; Using
filesort |
| 1 | PRIMARY | supplier | ref | PRIMARY,i_s_nationkey | i_s_nationkey | 5 |
dbt3_scale_10.nation.n_nationkey | 2057 | 100.00 | Using index
|
| 1 | PRIMARY | partsupp | ref | i_ps_suppkey | i_ps_suppkey | 4 |
dbt3_scale_10.supplier.s_suppkey | 42 | 100.00 | Using join buffer (Batched Key Access
with Key Prefetching) |
| 2 | SUBQUERY | nation | ALL | PRIMARY | NULL | NULL |
NULL | 25 | 100.00 | Using where
|
| 2 | SUBQUERY | supplier | ref | PRIMARY,i_s_nationkey | i_s_nationkey | 5 |
dbt3_scale_10.nation.n_nationkey | 2057 | 100.00 | Using index
|
| 2 | SUBQUERY | partsupp | ref | i_ps_suppkey | i_ps_suppkey | 4 |
dbt3_scale_10.supplier.s_suppkey | 42 | 100.00 | Using join buffer (Batched Key Access
with Key Prefetching) |
+----+-------------+----------+------+-----------------------+---------------
+---------+----------------------------------+------+----------
+-------------------------------------------------------------+
6 rows in set, 1 warning (0.00 sec)
For more information about the extended EXPLAIN output format, see Extended EXPLAIN Output
Format in the MySQL product documentation.
For more information about using replication in Amazon Aurora, see Replication with Amazon
Aurora (p. 60).
705
Amazon Aurora User Guide for Aurora
Using Amazon Aurora to Scale
Reads for Your MySQL Database
For information on creating an Amazon Aurora DB cluster, see Creating an Amazon Aurora DB
Cluster (p. 101).
When you set up replication between your MySQL DB instance and your Amazon Aurora DB cluster, be
sure to follow these guidelines:
• Use the Amazon Aurora DB cluster endpoint address when you reference your Amazon Aurora MySQL
DB cluster. If a failover occurs, then the Aurora Replica that is promoted to the primary instance for the
Aurora MySQL DB cluster continues to use the DB cluster endpoint address.
• Maintain the binlogs on your master instance until you have verified that they have been applied to
the Aurora Replica. This maintenance ensures that you can restore your master instance in the event of
a failure.
Important
When using self-managed replication, you're responsible for monitoring and resolving any
replication issues that may occur. For more information, see Diagnosing and Resolving Lag
Between Read Replicas (p. 1094).
Note
The permissions required to start replication on an Amazon Aurora MySQL DB cluster are
restricted and not available to your Amazon RDS master user. Because of this, you must use the
Amazon RDS mysql_rds_set_external_master and mysql_rds_start_replication procedures to
set up replication between your Amazon Aurora MySQL DB cluster and your MySQL DB instance.
2. Run the SHOW MASTER STATUS command on the source MySQL DB instance to determine the binlog
location. You receive output similar to the following example:
File Position
------------------------------------
mysql-bin-changelog.000031 107
------------------------------------
3. Copy the database from the external MySQL DB instance to the Amazon Aurora MySQL DB cluster
using mysqldump. For very large databases, you might want to use the procedure in Importing Data
to an Amazon RDS MySQL or MariaDB DB Instance with Reduced Downtime in the Amazon Relational
Database Service User Guide.
706
Amazon Aurora User Guide for Aurora
Using Amazon Aurora to Scale
Reads for Your MySQL Database
mysqldump \
--databases <database_name> \
--single-transaction \
--compress \
--order-by-primary \
-u <local_user> \
-p <local_password> | mysql \
--host aurora_cluster_endpoint_address \
--port 3306 \
-u <RDS_user_name> \
-p <RDS_password>
For Windows:
mysqldump ^
--databases <database_name> ^
--single-transaction ^
--compress ^
--order-by-primary ^
-u <local_user> ^
-p <local_password> | mysql ^
--host aurora_cluster_endpoint_address ^
--port 3306 ^
-u <RDS_user_name> ^
-p <RDS_password>
Note
Make sure that there is not a space between the -p option and the entered password.
Use the --host, --user (-u), --port and -p options in the mysql command to specify
the hostname, user name, port, and password to connect to your Aurora DB cluster. The
host name is the DNS name from the Amazon Aurora DB cluster endpoint, for example,
mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com. You can find the
endpoint value in the cluster details in the Amazon RDS Management Console.
4. Make the source MySQL DB instance writeable again:
For more information on making backups for use with replication, see Backing Up a Master or Slave by
Making It Read Only in the MySQL documentation.
5. In the Amazon RDS Management Console, add the IP address of the server that hosts the source
MySQL database to the VPC security group for the Amazon Aurora DB cluster. For more information
on modifying a VPC security group, see Security Groups for Your VPC in the Amazon Virtual Private
Cloud User Guide.
You might also need to configure your local network to permit connections from the IP address of
your Amazon Aurora DB cluster, so that it can communicate with your source MySQL instance. To find
the IP address of the Amazon Aurora DB cluster, use the host command.
host <aurora_endpoint_address>
The host name is the DNS name from the Amazon Aurora DB cluster endpoint.
707
Amazon Aurora User Guide for Aurora
Using Amazon Aurora for Disaster
Recovery with Your MySQL Databases
6. Using the client of your choice, connect to the external MySQL instance and create a MySQL user to be
used for replication. This account is used solely for replication and must be restricted to your domain
to improve security. The following is an example.
7. For the external MySQL instance, grant REPLICATION CLIENT and REPLICATION SLAVE privileges
to your replication user. For example, to grant the REPLICATION CLIENT and REPLICATION SLAVE
privileges on all databases for the 'repl_user' user for your domain, issue the following command.
8. Take a manual snapshot of the Aurora MySQL DB cluster to be the replication slave before setting up
replication. If you need to reestablish replication with the DB cluster as a replication slave, you can
restore the Aurora MySQL DB cluster from this snapshot instead of having to import the data from
your MySQL DB instance into a new Aurora MySQL DB cluster.
9. Make the Amazon Aurora DB cluster the replica. Connect to the Amazon Aurora DB cluster as
the master user and identify the source MySQL database as the replication master by using the
mysql_rds_set_external_master procedure. Use the master log file name and master log position that
you determined in Step 2. The following is an example.
10.On the Amazon Aurora DB cluster, issue the mysql_rds_start_replication procedure to start
replication.
CALL mysql.rds_start_replication;
After you have established replication between your source MySQL DB instance and your Amazon Aurora
DB cluster, you can add Aurora Replicas to your Amazon Aurora DB cluster. You can then connect to
the Aurora Replicas to read scale your data. For information on creating an Aurora Replica, see Adding
Aurora Replicas to a DB Cluster (p. 248).
For instructions on how to create an Amazon Aurora MySQL DB cluster and make it a replication slave of
your MySQL DB instance, follow the procedure in Using Amazon Aurora to Scale Reads for Your MySQL
Database (p. 706).
708
Amazon Aurora User Guide for Aurora
Migrating from MySQL to Amazon
Aurora MySQL with Reduced Downtime
The procedure lists steps to transfer a copy of your database data to an Amazon EC2 instance and
import the data into a new Amazon RDS MySQL DB instance. Because Amazon Aurora is compatible
with MySQL, you can instead use an Amazon Aurora DB cluster for the target Amazon RDS MySQL DB
instance.
For more information about using XA transactions with MySQL, see XA Transactions in the MySQL
documentation.
A hash join column can be any complex expression. In a hash join column, you can compare across data
types in the following ways:
• You can compare anything across the category of precise numeric data types, such as int, bigint,
numeric, and bit.
• You can compare anything across the category of approximate numeric data types, such as float and
double.
• You can compare items across string types if the string types have the same character set and
collation.
• You can compare items with date and timestamp data types if the types are the same.
Note
Data types in different categories cannot compare.
709
Amazon Aurora User Guide for Aurora
Working with Hash Joins
Note
Single-table updates or deletes are supported.
• BLOB and spatial data type columns cannot be join columns in a hash join.
With this setting, the optimizer chooses to use a hash join based on cost, query characteristics, and
resource availability. If the cost estimation is incorrect, you can force the optimizer to choose a hash join.
You do so by setting hash_join_cost_based, a MySQL server variable, to off. The following example
illustrates how to force the optimizer to choose a hash join.
In the output for the EXPLAIN statement, the Extra column describes additional information included
with the execution plan. If a hash join applies to the tables used in the query, this column includes values
similar to the following:
• Using where; Using join buffer (Hash Join Outer table table1_name)
• Using where; Using join buffer (Hash Join Inner table table2_name)
The following example shows the use of EXPLAIN to view the execution plan for a hash join query.
710
Amazon Aurora User Guide for Aurora
Working with Foreign Keys
In the output, the Hash Join Inner table is the table used to build hash table, and the Hash Join
Outer table is the table that is used to probe the hash table.
For more information about the extended EXPLAIN output format, see Extended EXPLAIN Output
Format in the MySQL product documentation.
If you need to insert or update rows that require a transient violation of foreign keys, follow these steps:
1. Set foreign_key_checks to 0.
2. Make your data manipulation language (DML) changes.
3. Make sure that your completed changes don't violate any foreign key constraints.
4. Set foreign_key_checks to 1 (on).
In addition, follow these other best practices for foreign key constraints:
• Make sure that your client applications don't set the foreign_key_checks variable to 0 as a part of
the init_connect variable.
• If a restore from a logical backup such as mysqldump fails or is incomplete, make sure that
foreign_key_checks is set to 1 before starting any other operations in the same session. A logical
backup sets foreign_key_checks to 0 when it starts.
Related Topics
• Managing an Amazon Aurora DB Cluster (p. 227)
Topics
• Aurora MySQL Parameters (p. 711)
• Inapplicable MySQL Parameters and Status Variables (p. 723)
• Aurora MySQL Events (p. 724)
• Aurora MySQL Isolation Levels (p. 726)
• Aurora MySQL Stored Procedures (p. 730)
To manage cluster-level parameters, you use DB cluster parameter groups. To manage instance-
level parameters, you use DB parameter groups. Each DB instance in an Aurora MySQL DB cluster is
711
Amazon Aurora User Guide for Aurora
Parameters
compatible with the MySQL database engine. However, you apply some of the MySQL database engine
parameters at the cluster level, and you manage these parameters using DB cluster parameter groups.
You can't find cluster-level parameters in the DB parameter group for an instance in an Aurora DB
cluster. A list of cluster-level parameters appears later in this topic.
You can manage both cluster-level and instance-level parameters using the AWS Management
Console, the AWS CLI, or the Amazon RDS API. You use separate commands for managing cluster-level
parameters and instance-level parameters. For example, you can use the modify-db-cluster-parameter-
group CLI command to manage cluster-level parameters in a DB cluster parameter group. You can use
the modify-db-parameter-group CLI command to manage instance-level parameters in a DB parameter
group for a DB instance in a DB cluster.
You can view both cluster-level and instance-level parameters in the console, or by using the CLI or RDS
API. For example, you can use the describe-db-cluster-parameters AWS CLI command to view cluster-
level parameters in a DB cluster parameter group. You can use the describe-db-parameters CLI command
to view instance-level parameters in a DB parameter group for a DB instance in a DB cluster.
For more information on DB parameter groups, see Working with DB Parameter Groups and DB Cluster
Parameter Groups (p. 205). For rules and restrictions for Aurora Serverless clusters, see Aurora Serverless
and Parameter Groups (p. 122).
Topics
• Cluster-Level Parameters (p. 712)
• Instance-Level Parameters (p. 715)
Cluster-Level Parameters
The following table shows all of the parameters that apply to the entire Aurora MySQL DB cluster.
Yes
aurora_enable_replica_log_compression Doesn't apply to clusters that are part of
an Aurora global database.
Yes
aurora_enable_repl_bin_log_filtering Doesn't apply to clusters that are part of
an Aurora global database.
auto_increment_increment Yes
auto_increment_offset Yes
712
Amazon Aurora User Guide for Aurora
Parameters
aws_default_s3_role Yes
binlog_checksum Yes
binlog_row_image No
binlog_rows_query_log_events No
character-set-client-handshake Yes
character_set_client Yes
character_set_connection Yes
character_set_database Yes
character_set_filesystem Yes
character_set_results Yes
character_set_server Yes
collation_connection Yes
collation_server Yes
completion_type Yes
innodb_autoinc_lock_mode Yes
innodb_checksums No
innodb_cmp_per_index_enabled Yes
innodb_commit_concurrency Yes
innodb_file_per_table Yes
innodb_flush_log_at_trx_commit Yes
innodb_ft_max_token_size Yes
innodb_ft_min_token_size Yes
innodb_ft_num_word_optimize Yes
innodb_ft_sort_pll_degree Yes
innodb_online_alter_log_max_size Yes
713
Amazon Aurora User Guide for Aurora
Parameters
innodb_optimize_fulltext_only Yes
innodb_page_size No
innodb_purge_batch_size Yes
innodb_purge_threads Yes
innodb_rollback_on_timeout Yes
innodb_rollback_segments Yes
innodb_spin_wait_delay Yes
innodb_strict_mode Yes
innodb_support_xa Yes
innodb_sync_array_size Yes
innodb_sync_spin_loops Yes
innodb_table_locks Yes
innodb_undo_logs Yes
innodb_undo_tablespaces No
lc_time_names Yes
lower_case_table_names Yes
master-info-repository Yes
master_verify_checksum Yes
server_audit_events Yes
server_audit_excl_users Yes
server_audit_incl_users Yes
server_id No
skip-character-set-client- Yes
handshake
skip_name_resolve No
sync_frm Yes
time_zone Yes
714
Amazon Aurora User Guide for Aurora
Parameters
Instance-Level Parameters
The following table shows all of the parameters that apply to a specific DB instance in an Aurora MySQL
DB cluster.
allow-suspicious-udfs No
autocommit Yes
automatic_sp_privileges Yes
back_log Yes
binlog_cache_size Yes
binlog_max_flush_queue_time Yes
binlog_order_commits Yes
binlog_stmt_cache_size Yes
bulk_insert_buffer_size Yes
concurrent_insert Yes
connect_timeout Yes
715
Amazon Aurora User Guide for Aurora
Parameters
default_time_zone No
default_tmp_storage_engine Yes
default_week_format Yes
delay_key_write Yes
delayed_insert_limit Yes
delayed_insert_timeout Yes
delayed_queue_size Yes
div_precision_increment Yes
end_markers_in_json Yes
eq_range_index_dive_limit Yes
event_scheduler Yes
explicit_defaults_for_timestamp Yes
flush No
flush_time Yes
ft_boolean_syntax No
ft_max_word_len Yes
ft_min_word_len Yes
ft_query_expansion_limit Yes
ft_stopword_file Yes
group_concat_max_len Yes
host_cache_size Yes
716
Amazon Aurora User Guide for Aurora
Parameters
init_connect Yes
innodb_adaptive_hash_index Yes
innodb_autoextend_increment Yes
No
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_dump_now No
innodb_buffer_pool_filename No
innodb_buffer_pool_load_abort No
innodb_buffer_pool_load_at_startupNo
innodb_buffer_pool_load_now No
innodb_buffer_pool_size Yes
Yes
innodb_compression_failure_threshold_pct
innodb_compression_level Yes
innodb_compression_pad_pct_max Yes
innodb_file_format Yes
innodb_flush_log_at_timeout No
innodb_flushing_avg_loops No
innodb_force_load_corrupted No
innodb_ft_aux_table Yes
innodb_ft_cache_size Yes
innodb_ft_enable_stopword Yes
innodb_ft_server_stopword_table Yes
innodb_ft_user_stopword_table Yes
innodb_large_prefix Yes
innodb_lock_wait_timeout Yes
innodb_log_compressed_pages No
717
Amazon Aurora User Guide for Aurora
Parameters
innodb_lru_scan_depth Yes
innodb_max_purge_lag Yes
innodb_max_purge_lag_delay Yes
innodb_monitor_disable Yes
innodb_monitor_enable Yes
innodb_monitor_reset Yes
innodb_monitor_reset_all Yes
innodb_old_blocks_pct Yes
innodb_old_blocks_time Yes
innodb_open_files Yes
innodb_print_all_deadlocks Yes
innodb_random_read_ahead Yes
innodb_read_ahead_threshold Yes
innodb_read_io_threads No
innodb_replication_delay Yes
innodb_sort_buffer_size Yes
innodb_stats_auto_recalc Yes
innodb_stats_method Yes
innodb_stats_on_metadata Yes
innodb_stats_persistent Yes
Yes
innodb_stats_persistent_sample_pages
Yes
innodb_stats_transient_sample_pages
innodb_thread_concurrency No
interactive_timeout Yes
718
Amazon Aurora User Guide for Aurora
Parameters
join_buffer_size Yes
keep_files_on_create Yes
key_buffer_size Yes
key_cache_age_threshold Yes
key_cache_block_size Yes
key_cache_division_limit Yes
local_infile Yes
lock_wait_timeout Yes
log_bin_trust_function_creators Yes
log_bin_use_v1_row_events Yes
log_error No
log_output Yes
log_queries_not_using_indexes Yes
log_slave_updates No
Yes
log_throttle_queries_not_using_indexes
log_warnings Yes
long_query_time Yes
low_priority_updates Yes
max_allowed_packet Yes
max_binlog_cache_size Yes
max_binlog_size No
max_binlog_stmt_cache_size Yes
max_connect_errors Yes
max_delayed_threads Yes
719
Amazon Aurora User Guide for Aurora
Parameters
max_error_count Yes
max_heap_table_size Yes
max_insert_delayed_threads Yes
max_join_size Yes
max_length_for_sort_data Yes
max_prepared_stmt_count Yes
max_seeks_for_key Yes
max_sort_length Yes
max_sp_recursion_depth Yes
max_tmp_tables Yes
max_user_connections Yes
max_write_lock_count Yes
metadata_locks_cache_size Yes
min_examined_row_limit Yes
myisam_data_pointer_size Yes
myisam_max_sort_file_size Yes
myisam_mmap_size Yes
myisam_sort_buffer_size Yes
myisam_stats_method Yes
myisam_use_mmap Yes
net_buffer_length Yes
net_read_timeout Yes
net_retry_count Yes
net_write_timeout Yes
old-style-user-limits Yes
old_passwords Yes
optimizer_prune_level Yes
optimizer_search_depth Yes
optimizer_switch Yes
optimizer_trace Yes
optimizer_trace_features Yes
720
Amazon Aurora User Guide for Aurora
Parameters
optimizer_trace_limit Yes
optimizer_trace_max_mem_size Yes
optimizer_trace_offset Yes
performance_schema Yes
pid_file No
preload_buffer_size Yes
profiling_history_size Yes
query_alloc_block_size Yes
query_cache_limit Yes
query_cache_min_res_unit Yes
query_cache_size Yes
query_cache_type Yes
query_cache_wlock_invalidate Yes
query_prealloc_size Yes
range_alloc_block_size Yes
read_buffer_size Yes
read_rnd_buffer_size Yes
relay-log No
relay_log_info_repository Yes
relay_log_recovery No
safe-user-create Yes
secure_auth Yes
721
Amazon Aurora User Guide for Aurora
Parameters
skip-slave-start No
skip_external_locking No
skip_show_database Yes
slave_checkpoint_group Yes
slave_checkpoint_period Yes
slave_parallel_workers Yes
slave_pending_jobs_size_max Yes
slave_sql_verify_checksum Yes
slow_launch_time Yes
socket No
sort_buffer_size Yes
sql_mode Yes
sql_select_limit Yes
stored_program_cache Yes
sync_binlog No
sync_master_info Yes
sync_relay_log Yes
sync_relay_log_info Yes
sysdate-is-now Yes
table_cache_element_entry_ttl No
table_definition_cache Yes
table_open_cache Yes
table_open_cache_instances Yes
temp-pool Yes
722
Amazon Aurora User Guide for Aurora
Inapplicable MySQL Parameters and Status Variables
thread_handling No
thread_stack Yes
timed_mutexes Yes
tmp_table_size Yes
transaction_alloc_block_size Yes
transaction_prealloc_size Yes
tx_isolation Yes
updatable_views_with_limit Yes
validate-password No
validate_password_dictionary_file No
validate_password_length No
validate_password_mixed_case_countNo
validate_password_number_count No
validate_password_policy No
No
validate_password_special_char_count
wait_timeout Yes
• innodb_adaptive_flushing
• innodb_adaptive_flushing_lwm
• innodb_change_buffering
• innodb_checksum_algorithm
• innodb_doublewrite
• innodb_flush_method
• innodb_flush_neighbors
• innodb_io_capacity
• innodb_io_capacity_max
• innodb_log_buffer_size
• innodb_log_file_size
723
Amazon Aurora User Guide for Aurora
Aurora MySQL Events
• innodb_log_files_in_group
• innodb_max_dirty_pages_pct
• innodb_use_native_aio
• innodb_write_io_threads
• thread_cache_size
• innodb_buffer_pool_bytes_dirty
• innodb_buffer_pool_pages_dirty
• innodb_buffer_pool_pages_flushed
Note
These lists are not exhaustive.
io/aurora_redo_log_flush
In this wait event, a session is writing data to Aurora storage. Typically, this wait event is for a write
I/O operation in Aurora MySQL.
io/aurora_respond_to_client
In this wait event, a thread is in the process of returning the result set to the client.
io/file/csv/data
In this wait event, there are threads writing to tables in comma-separated value (CSV) format. Check
your CSV table usage. A typical cause of this event is setting log_output on a table.
io/file/innodb/innodb_data_file
In this wait event, there are threads waiting on I/O operations to storage. This event is more
prevalent in I/O intensive workloads. SQL statements showing a comparatively large proportion of
this wait event might be running disk intensive queries. Or they might be requesting data that can't
be satisfied from the InnoDB buffer pool. To find out, check your query plans and cache hit ratios.
For more information, see Buffering and Caching in the MySQL documentation.
io/file/sql/binlog
In this wait event, there is a thread waiting on a binlog file that is being written to disk.
io/socket/sql/client_connection
This is a table I/O wait event. Typically, these types of events can be followed by a nested event such
as a file I/O event. For more information about 'atom' and 'molecule' events in the Performance
Schema, see Performance Schema Atom and Molecule Events in the MySQL documentation.
724
Amazon Aurora User Guide for Aurora
Aurora MySQL Events
lock/table/sql/handler
This wait event is a table lock wait event handler. For more information about 'atom' and 'molecule'
events in the Performance Schema, see Performance Schema Atom and Molecule Events in the
MySQL documentation.
synch/cond/mysys/my_thread_var::suspend
In this wait event, threads are suspended when they are waiting on a condition. For example, this
event occurs when threads are waiting for table level lock. We recommend that you investigate
your workload to see what threads might be acquiring table locks on your DB instance. For more
information about table locking in MySQL, see Table Locking Issues in the MySQL documentation.
synch/cond/sql/MDL_context::COND_wait_status
In this wait event, there are threads waiting on a table metadata lock. For more information, see
Optimizing Locking Operations in the MySQL documentation.
synch/cond/sql/MYSQL_BIN_LOG::COND_done
In this wait event, there is a thread waiting on a binlog file that is being written to disk. Binary
logging contention can occur on databases with a very high change rate.
synch/mutex/innodb/aurora_lock_thread_slot_futex
In this wait event, there is a thread that is waiting on an InnoDB record lock. If you see this event,
check your database for conflicting workloads. For more information, see InnoDB Locking in the
MySQL documentation.
synch/mutex/innodb/buf_pool_mutex
In this wait event, a thread has acquired a lock on the InnoDB buffer pool.
synch/mutex/sql/LOCK_open
In this wait event, LOCK_open is being used to protect various objects in the data dictionary. This
wait event indicates that there are threads waiting to acquire these locks. Typically, this event is
caused by data dictionary contention.
synch/mutex/sql/LOCK_table_cache
In this wait event, there are threads waiting to acquire a lock on a table cache instance. For more
information, see How MySQL Opens and Closes Tables in the MySQL documentation.
synch/mutex/sql/LOG
In this wait event, there are threads waiting on a log lock. For example, a thread might wait for a
lock to write to the slow query log file.
synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit
In this wait event, there is a thread that is waiting to acquire a lock with the intention of committing
to the binary log. Binary logging contention can occur on databases with a very high change rate.
Depending on your version of MySQL, there are certain locks being used to protect the consistency
and durability of the binary log. In RDS MySQL, binary logs are used for replication and the
automated backup process. In Aurora MySQL, binary logs are not needed for native replication
or backups. They are disabled by default but can be enabled and used for external replication or
change data capture. For more information, see The Binary Log in the MySQL documentation.
synch/mutex/sql/MYSQL_BIN_LOG::LOCK_log
In this wait event, threads are actively locking the binary log file. Binary logging contention can
occur on databases with a very high change rate. Depending on your version of MySQL, there are
certain locks being used to protect the consistency and durability of the binary log.
synch/rwlock/innodb/dict
In this wait event, there are threads waiting on an rwlock held on the InnoDB data dictionary.
725
Amazon Aurora User Guide for Aurora
Aurora MySQL Isolation Levels
In this event, there are threads that are waiting on an rwlock held on the InnoDB data dictionary.
synch/rwlock/innodb/dict_operation_lock
In this wait event, there are threads holding locks on InnoDB data dictionary operations.
If you experience such issues, you can use an Aurora MySQL configuration setting,
aurora_read_replica_read_committed, to use the READ COMMITTED isolation level on Aurora
Replicas. Using this setting can help reduce slowdowns and wasted space that can result from
performing long-running queries at the same time as transactions that modify your tables.
We recommend making sure that you understand the specific Aurora MySQL behavior of the READ
COMMITTED isolation before using this setting. The Aurora Replica READ COMMITTED behavior
complies with the ANSI SQL standard. However, the isolation is less strict than typical MySQL READ
COMMITTED behavior that you might be familiar with. Thus, you might see different query results
under READ COMMITTED on an Aurora MySQL read replica than for the same query under READ
COMMITTED on the Aurora MySQL primary instance or on Amazon RDS MySQL. You might use the
aurora_read_replica_read_committed setting for such use cases as a comprehensive report that
scans a very large database. You might avoid it for short queries with small result sets, where precision
and repeatability are important.
726
Amazon Aurora User Guide for Aurora
Aurora MySQL Isolation Levels
You might enable this configuration setting temporarily to perform interactive ad hoc (one-time)
queries. You might also want to run a reporting or data analysis application that benefits from the READ
COMMITTED isolation level, while leaving the default unchanged for other applications.
You can enable this feature permanently for one or more Aurora Replicas in your cluster. To do so, turn
on the aurora_read_replica_read_committed setting in the DB parameter group used by the
associated DB instances. Enable this setting on the DB instances where you run the long-running queries.
In this case, connect to the instance endpoints to ensure the queries run on the intended DB instances.
Your queries can experience certain kinds of read anomalies when the
aurora_read_replica_read_committed setting is turned on. Two kinds of anomalies are especially
important to understand and handle in your application code. A non-repeatable read occurs when
another transaction commits while your query is running. A long-running query can see different data
at the start of the query than it sees at the end. A phantom read occurs when other transactions cause
existing rows to be reorganized while your query is running, and one or more rows are read twice by your
query.
Your queries might experience inconsistent row counts as a result of phantom reads. Your queries might
also return incomplete or inconsistent results due to non-repeatable reads. For example, suppose that
a join operation refers to tables that are concurrently modified by SQL statements such as INSERT or
DELETE. In this case, the join query might read a row from one table but not the corresponding row from
another table.
The ANSI SQL standard allows both of these behaviors for the READ COMMITTED isolation level.
However, those behaviors are different than the typical MySQL implementation of READ COMMITTED.
Thus, before enabling the aurora_read_replica_read_committed setting, check any existing SQL
code to verify if it operates as expected under the looser consistency model.
Row counts and other results might not be strongly consistent under the READ COMMITTED isolation
level while this setting is enabled. Thus, you typically enable the setting only while running analytic
queries that aggregate large amounts of data and don't require absolute precision. If you don't have
these kinds of long-running queries alongside a write-intensive workload, you probably don't need the
aurora_read_replica_read_committed setting. Without the combination of long-running queries
and a write-intensive workload, you're unlikely to encounter issues with the length of the history list.
Example Queries Showing Isolation Behavior for READ COMMITTED on Aurora Replicas
The following example shows how READ COMMITTED queries on an Aurora Replica might return non-
repeatable results if transactions modify the associated tables at the same time. The table BIG_TABLE
727
Amazon Aurora User Guide for Aurora
Aurora MySQL Isolation Levels
contains 1 million rows before any queries start. Other data manipulation language (DML) statements
add, remove, or change rows while the are running.
The queries on the Aurora primary instance under the READ COMMITTED isolation level produce
predictable results. However, the overhead of keeping the consistent read view for the lifetime of every
long-running query can lead to expensive garbage collection later.
The queries on the Aurora Replica under the READ COMMITTED isolation level are optimized to
minimize this garbage collection overhead. The tradeoff is that the results might vary depending on
whether the queries retrieve rows that are added, removed, or reorganized by transactions that commit
while the query is running. The queries are allowed to consider these rows but aren't required to. For
demonstration purposes, the queries check only the number of rows in the table by using the COUNT(*)
function.
T1 INSERT INTO
big_table SELECT
* FROM other_table
LIMIT 1000000;
COMMIT;
T3 INSERT INTO
big_table (c1,
c2) VALUES (1,
'one more row');
COMMIT;
T5 DELETE FROM
big_table LIMIT 2;
COMMIT;
T7 UPDATE big_table
SET c2 =
CONCAT(c2,c2,c2);
COMMIT;
728
Amazon Aurora User Guide for Aurora
Aurora MySQL Isolation Levels
If the queries finish quickly, before any other transactions perform DML statements and commit, the
results are predictable and the same between the primary instance and the Aurora Replica.
The results for Q1 are highly predictable, because READ COMMITTED on the primary instance uses a
strong consistency model similar to the REPEATABLE READ isolation level.
The results for Q2 might vary depending on what transactions commit while that query is running. For
example, suppose that other transactions perform DML statements and commit while the queries are
running. In this case, the query on the Aurora Replica with the READ COMMITTED isolation level might or
might not take the changes into account. The row counts are not predictable in the same way as under
the REPEATABLE READ isolation level. They also aren't as predictable as queries running under the READ
COMMITTED isolation level on the primary instance, or on an RDS MySQL instance.
The UPDATE statement at T7 doesn't actually change the number of rows in the table. However, by
changing the length of a variable-length column, this statement can cause rows to be reorganized
internally. A long-running READ COMMITTED transaction might see the old version of a row, and later
within the same query see the new version of the same row. The query can also skip both the old and
new versions of the row. Thus, the row count might be different than expected.
The results of Q5 and Q6 might be identical or slightly different. Query Q6 on the Aurora Replica under
READ COMMITTED is able to see, but is not required to see, the new rows that are committed while the
query is running. It might also see the row from one table but not from the other table. If the join query
doesn't find a matching row in both tables, it returns a count of zero. If the query does find both the new
rows in PARENT_TABLE and CHILD_TABLE, the query returns a count of one. In a long-running query,
the lookups from the joined tables might happen at widely separated times.
Note
These differences in behavior depend on the timing of when transactions are committed
and when the queries process the underlying table rows. Thus, you're most likely to see such
differences in report queries that take minutes or hours and that run on Aurora clusters
processing OLTP transactions at the same time. These are the kinds of mixed workloads that
benefit the most from the READ COMMITTED isolation level on Aurora Replicas.
729
Amazon Aurora User Guide for Aurora
Stored Procedures
Topics
• mysql.rds_set_master_auto_position (p. 730)
• mysql.rds_set_external_master_with_auto_position (p. 730)
• mysql.rds_skip_transaction_with_gtid (p. 732)
mysql.rds_set_master_auto_position
Sets the replication mode to be based on either binary log file positions or on global transaction
identifiers (GTIDs).
Syntax
Parameters
auto_position_mode
A value that indicates whether to use log file position replication or GTID-based replication:
• 0 – Use the replication method based on binary log file position. The default is 0.
• 1 – Use the GTID-based replication method.
Usage Notes
For an Aurora MySQL DB cluster, you call this stored procedure while connected to the primary instance.
For Aurora, this procedure is supported for Aurora MySQL version 2.04 and later MySQL 5.7–compatible
versions. GTID-based replication isn't supported for Aurora MySQL 1.1 or 1.0.
mysql.rds_set_external_master_with_auto_position
Configures an Aurora MySQL primary instance to accept incoming replication from an external MySQL
instance. This procedure also configures replication based on global transaction identifiers (GTIDs).
This procedure is available for both Amazon RDS MySQL and Aurora MySQL. It works differently
depending on the context. When used with Aurora MySQL, this procedure doesn't configure delayed
replication. This limitation is because Amazon RDS MySQL supports delayed replication but Aurora
MySQL doesn't.
Syntax
730
Amazon Aurora User Guide for Aurora
Stored Procedures
CALL mysql.rds_set_external_master_with_auto_position (
host_name
, host_port
, replication_user_name
, replication_user_password
, ssl_encryption
);
Parameters
host_name
The host name or IP address of the MySQL instance running external to Aurora to become the
replication master.
host_port
The port used by the MySQL instance running external to Aurora to be configured as the replication
master. If your network configuration includes Secure Shell (SSH) port replication that converts the
port number, specify the port number that is exposed by SSH.
replication_user_name
The ID of a user with REPLICATION CLIENT and REPLICATION SLAVE permissions on the MySQL
instance running external to Aurora. We recommend that you provide an account that is used solely
for replication with the external instance.
replication_user_password
Usage Notes
For an Aurora MySQL DB cluster, you call this stored procedure while connected to the primary instance.
For Aurora, this procedure is supported for Aurora MySQL version 2.04 and later MySQL 5.7-compatible
versions. GTID-based replication isn't supported for Aurora MySQL 1.1 or 1.0.
1. Using the MySQL client of your choice, connect to the external MySQL instance and create a user
account to be used for replication. The following is an example.
731
Amazon Aurora User Guide for Aurora
Stored Procedures
2. On the external MySQL instance, grant REPLICATION CLIENT and REPLICATION SLAVE privileges
to your replication user. The following example grants REPLICATION CLIENT and REPLICATION
SLAVE privileges on all databases for the 'repl_user' user for your domain.
To skip a specific GTID-based transaction that is known to cause a problem, you can use the
mysql.rds_skip_transaction_with_gtid (p. 732) stored procedure. For more information about working
with GTID-based replication, see Using GTID-Based Replication for Aurora MySQL (p. 624).
Examples
When run on an Aurora primary instance, the following example configures the Aurora cluster to act as a
read replica of an instance of MySQL running external to Aurora.
call mysql.rds_set_external_master_with_auto_position(
'Externaldb.some.com',
3306,
'repl_user'@'mydomain.com',
'SomePassW0rd');
mysql.rds_skip_transaction_with_gtid
Skips replication of a transaction with the specified global transaction identifier (GTID) on an Aurora
primary instance.
You can use this procedure for disaster recovery when a specific GTID transaction is known to cause
a problem. Use this stored procedure to skip the problematic transaction. Examples of problematic
transactions include transactions that disable replication, delete important data, or cause the DB
instance to become unavailable.
Syntax
Parameters
gtid_to_skip
Usage Notes
For an Aurora MySQL DB cluster, you call this stored procedure while connected to the primary instance.
732
Amazon Aurora User Guide for Aurora
Aurora MySQL Updates
For Aurora, this procedure is supported for Aurora MySQL version 2.04 and later MySQL 5.7-compatible
versions. GTID-based replication isn't supported for Aurora MySQL 1.1 or 1.0.
Updates are applied to all instances in a DB cluster at the same time. An update requires a database
restart on all instances in a DB cluster, so you experience 20 to 30 seconds of downtime, after which you
can resume using your DB cluster or clusters. You can view or change your maintenance window settings
from the AWS Management Console.
Aurora versions use the format <major version>.<minor version>. <patch version>. You can
get the version of your Aurora instance by querying for the AURORA_VERSION system variable. To get
the Aurora version, use one of the following queries.
select AURORA_VERSION();
select @@aurora_version;
<mysql-major-version>.mysql_aurora.<aurora-mysql-version>
For example, the engine version for Aurora MySQL 2.03.2 is the following.
5.7.mysql_aurora.2.03.2
Note
All 1.x Aurora MySQL engine versions are wire-compatible with Community MySQL 5.6.10a. All
2.x Aurora MySQL engine versions are wire-compatible with Community MySQL 5.7.12.
For Aurora MySQL 2.x, the engine version for Aurora MySQL version 2.03.1 and lower is 5.7.12.
For Aurora MySQL 1.x, the engine version for Aurora MySQL prior to 1.19.0 is 5.6.10a.
You specify the Aurora MySQL engine version in some AWS CLI commands and RDS API operations. For
example, you specify the --engine-version option when you run the AWS CLI commands create-db-
cluster and modify-db-cluster. You specify the EngineVersion parameter when you run the RDS API
operations CreateDBCluster and ModifyDBCluster.
733
Amazon Aurora User Guide for Aurora
Database Upgrades and Patches for Amazon Aurora MySQL
The process to update the engine version prior to Aurora MySQL 1.19.0 and 2.03.2 is to Apply a Pending
Maintenance Action in the Cluster. This process does not change the Aurora MySQL engine version
displayed by the AWS Management Console.
Prior to Aurora MySQL 1.19.0 and 2.03.2, the engine version displayed by the AWS Management
Console remained the same even after you upgraded the engine in the cluster. In Aurora MySQL
1.19.0 and higher or 2.03.2 and higher, the engine version in the AWS Management Console also
includes the Aurora version. Upgrading the cluster changes the displayed value. For Aurora clusters
managed through AWS CloudFormation, this change in the EngineVersion setting can trigger actions
by AWS CloudFormation. For information about how AWS CloudFormation treats changes to the
EngineVersion setting, see the AWS CloudFormation documentation.
• Modifying the Engine Version (p. 734) (upgrading to version 2.03.2 and higher only)
• Applying Pending Maintenance to an Aurora MySQL DB Cluster (p. 734)
For example, to upgrade to Aurora MySQL version 2.03.2, set the --engine-version option to
5.7.mysql_aurora.2.03.2. Specify the --apply-immediately option to immediately update the
engine version for your DB cluster.
• By using the Amazon RDS API – Call the ModifyDBCluster API operation and specify the name of your
DB cluster for the DBClusterIdentifier parameter and the engine version for the EngineVersion
parameter. Set the ApplyImmediately parameter to true to immediately update the engine version
for your DB cluster.
734
Amazon Aurora User Guide for Aurora
Zero-Downtime Patching
version of your DB cluster by applying the available maintenance action. We recommend applying the
update on a nonproduction DB cluster first, so that you can see how changes in the new version affect
your instances and applications.
For more information on how Amazon RDS manages database and operating system updates, see
Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
If your current Aurora MySQL version is 1.14.x, but it is lower than 1.14.4, you can upgrade only
to 1.14.4 (which supports db.r4 instance classes). Also, to upgrade from 1.14.x to a higher minor
Aurora MySQL version, such as 1.17, the 1.14.x version must be 1.14.4.
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. If ZDP executes successfully, application sessions are preserved
and the database engine restarts while patching. The database engine restart can cause a drop
in throughput lasting approximately 5 seconds. ZDP is available in Aurora MySQL 1.13 and later,
compatible with MySQL 5.6. It's also available in Aurora MySQL 2.07 and later, compatible with MySQL
5.7.
• Long-running queries or transactions are in progress. If Aurora can perform ZDP in this case, any open
transactions are cancelled.
• Binary logging is enabled or binary log replication is in-progress.
• Open SSL connections exist.
• Temporary tables or table locks are in use, for example during DDL statements. If Aurora can perform
ZDP in this case, any open transactions are cancelled.
• Pending parameter changes exist.
Starting in Aurora MySQL 1.19 and 2.07, the ZDP mechanism is improved. These improvements make
ZDP more likely to succeed when there are long-running transactions, binary logging, table locks, or
temporary tables.
735
Amazon Aurora User Guide for Aurora
Aurora MySQL Long-Term Support (LTS) Releases
If no suitable time window for executing ZDP becomes available because of one or more of these
conditions, patching reverts to the standard behavior.
Note
• ZDP applies only to the primary instance of a DB cluster. ZDP isn't applicable to Aurora
Replicas.
• Prepared statements don't prevent ZDP, but they aren't preserved after ZDP executes.
Aurora designates certain Aurora MySQL versions as "long-term support" (LTS) releases. DB clusters that
use LTS releases can stay on the same version longer and undergo fewer upgrade cycles than clusters
that use non-LTS releases. Aurora supports each LTS release for at least one year after that release
becomes available. When a DB cluster that's on an LTS release is required to upgrade, Aurora upgrades it
to the next LTS release. That way, the cluster doesn't need to be upgraded again for a long time.
During the lifetime of an Aurora MySQL LTS release, new patch levels introduce fixes to important issues.
The patch levels don't include any new features. You can choose whether or not to apply such patches to
DB clusters running the LTS release. For certain critical fixes, Amazon might perform a managed upgrade
to a patch level within the same LTS release. Such managed upgrades are performed automatically
within the cluster maintenance window.
We recommend that you upgrade to the latest release, instead of using the LTS release, for most of your
Aurora MySQL clusters. Doing so takes advantage of Aurora as a managed service and gives you access
to the latest features and bug fixes. The LTS releases are intended for clusters that have the following
requirements and business needs:
• You can't afford downtime on your Aurora MySQL application for upgrades outside of rare occurrences
for critical patches.
• The testing cycle for the cluster and associated applications takes a long time for each update to the
Aurora MySQL database engine.
• The database version for your Aurora MySQL cluster has all the DB engine features and bug fixes that
your application needs.
As of the publication date for this Aurora User's Guide, the current LTS releases for Aurora MySQL are:
• Aurora MySQL version 1.19.6. For more details about this version, see Aurora MySQL Database Engine
Updates 2020-03-05 (p. 779).
• Aurora MySQL version 2.04.8. For more details about this version, see Aurora MySQL Database Engine
Updates 2019-11-20 (Version 2.04.8) (p. 746).
Related Topics
• Database Engine Updates for Amazon Aurora MySQL 2.0 (p. 737)
• Database Engine Updates for Amazon Aurora MySQL 1.1 (p. 770)
• MySQL Bugs Fixed by Aurora MySQL Database Engine Updates (p. 812)
• Aurora Lab Mode Features (p. 701)
736
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Aurora MySQL Database Engine Updates 2020-04-17 (Version 2.07.2) (p. 737)
• Aurora MySQL Database Engine Updates 2019-12-23 (Version 2.07.1) (p. 738)
• Aurora MySQL Database Engine Updates 2019-11-25 (Version 2.07.0) (p. 739)
• Aurora MySQL Database Engine Updates 2019-11-22 (Version 2.06.0) (p. 741)
• Aurora MySQL Database Engine Updates 2019-11-11 (Version 2.05.0) (p. 744)
• Aurora MySQL Database Engine Updates 2019-11-20 (Version 2.04.8) (p. 746)
• Aurora MySQL Database Engine Updates 2019-11-14 (Version 2.04.7) (p. 747)
• Aurora MySQL Database Engine Updates 2019-09-19 (Version 2.04.6) (p. 749)
• Aurora MySQL Database Engine Updates 2019-07-08 (Version 2.04.5) (p. 751)
• Aurora MySQL Database Engine Updates 2019-05-29 (Version 2.04.4) (p. 752)
• Aurora MySQL Database Engine Updates 2019-05-09 (Version 2.04.3) (p. 753)
• Aurora MySQL Database Engine Updates 2019-05-02 (Version 2.04.2) (p. 755)
• Aurora MySQL Database Engine Updates 2019-03-25 (Version 2.04.1) (p. 756)
• Aurora MySQL Database Engine Updates 2019-03-25 (Version 2.04) (p. 757)
• Aurora MySQL Database Engine Updates 2019-02-07 (p. 757) (Version 2.03.4)
• Aurora MySQL Database Engine Updates 2019-01-18 (p. 758) (Version 2.03.3)
• Aurora MySQL Database Engine Updates 2019-01-09 (p. 759) (Version 2.03.2)
• Aurora MySQL Database Engine Updates 2018-10-24 (p. 760) (Version 2.03.1)
• Aurora MySQL Database Engine Updates 2018-10-11 (p. 760) (Version 2.03)
• Aurora MySQL Database Engine Updates 2018-10-08 (p. 761) (Version 2.02.5)
• Aurora MySQL Database Engine Updates 2018-09-21 (p. 761) (Version 2.02.4)
• Aurora MySQL Database Engine Updates 2018-08-23 (p. 762) (Version 2.02.3)
• Aurora MySQL Database Engine Updates 2018-06-04 (p. 764) (Version 2.02.2)
• Aurora MySQL Database Engine Updates 2018-05-03 (p. 765) (Version 2.02)
• Aurora MySQL Database Engine Updates 2018-03-13 (p. 767) (Version 2.01.1)
• Aurora MySQL Database Engine Updates 2018-02-06 (p. 769) (Version 2.01)
Aurora MySQL 2.07.2 is generally available. Aurora MySQL 2.* versions are compatible with MySQL 5.7
and Aurora MySQL 1.* versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.*, and 2.07.*.
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.07.2.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL
737
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
2.07.2. You can't upgrade an existing Aurora MySQL 1.* cluster directly to 2.07.2; however, you can
restore its snapshot to Aurora MySQL 2.07.2.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
Note
This version is currently not available in the following AWS Region: [us-gov-east-1], AWS
GovCloud (US-West) [us-gov-west-1]. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
High priority fixes:
• Fixed an issue that caused cloning to take longer on some database clusters with high write loads.
• Fixed an issue that could cause queries on a reader DB instance with execution plans using secondary
indexes to return uncommitted data. The issue is limited to data affected by data manipulation
language (DML) operations that modify primary or secondary index key columns.
General improvements:
• Fixed an issue that resulted in a slow restore of an Aurora 1.x DB cluster containing FTS (Full Text
Search) indexes to an Aurora 2.x DB cluster.
• Fixed an issue that caused slower restores of an Aurora 1.x database snapshot containing partitioned
tables with special characters in table names to an Aurora 2.x DB cluster.
• Fixed an issue that caused errors when querying slow query logs and general logs in reader DB
instances.
Aurora MySQL 2.07.1 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.*, and 2.07.*.
738
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.07.1.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL
2.07.1. You cannot upgrade an existing Aurora MySQL 1.* cluster directly to 2.07.1; however, you can
restore its snapshot to Aurora MySQL 2.07.1.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], and Middle East (Bahrain) [me-south-1]. There will be a
separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
High priority fixes:
• Fixed a slow memory leak in Aurora specific database tracing and logging sub-system that lowers the
freeable memory.
• Fixed a crash during execution of a complex query involving multi-table joins and aggregation that use
intermediate tables internally.
Aurora MySQL 2.07.0 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.*, and 2.07.*.
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.07.0.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL
2.07.0. You cannot upgrade an existing Aurora MySQL 1.* cluster directly to 2.07.0; however, you can
restore its snapshot to Aurora MySQL 2.07.0.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], Middle East (Bahrain) [me-south-1], and South America
(São Paulo) [sa-east-1]. There will be a separate announcement once it is made available.
739
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
New features:
• Global Databases now allow adding secondary read-only replica regions for database clusters
deployed in these AWS Regions: regions: US East (N. Virginia) [us-east-1], US East (Ohio) [us-east-2],
US West (N. California) [us-west-1], US West (Oregon) [us-west-2], Europe (Ireland) [eu-west-1],
Europe (London) [eu-west-2], Europe (Paris) [eu-west-3], Asia Pacific (Tokyo) [ap-northeast-1], Asia
Pacific (Seoul) [ap-northeast-2], Asia Pacific (Singapore) [ap-southeast-1], Asia Pacific (Sydney) [ap-
southeast-2], Canada (Central) [ca-central-1], Europe (Frankfurt) [eu-central-1], and Asia Pacific
(Mumbai) [ap-south-1].
• Amazon Aurora machine learning is a highly optimized integration between the Aurora MySQL
database and AWS machine learning (ML) services. Aurora machine learning allows developers to add
a variety of ML-based predictions to their database applications by invoking ML models using the
familiar SQL programming language they already use for database development, without having to
build custom integrations or learn separate tools. For more information, see Using Machine Learning
(ML) Capabilities with Amazon Aurora.
• Added support for the ANSI READ COMMITTED isolation level on the read replicas. This isolation level
enables long-running queries on the read replica to execute without impacting the high throughput of
writes on the writer node. For more information, see Aurora MySQL Isolation Levels.
Critical fixes:
• CVE-2019-2922
• CVE-2019-2923
• CVE-2019-2924
• CVE-2019-2910
High-priority fixes:
• Fixed an issue in the DDL recovery that resulted in prolonged database downtime. Clusters that
become unavailable after executing multi-table drop statement, for example DROP TABLE t1, t2,
t3, should be updated to this version.
• Fixed an issue in the DDL recovery that resulted in prolonged database downtime. Clusters that
become unavailable after executing INPLACE ALTER TABLE DDL statements should be updated to
this version.
740
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.07.0 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.06.0 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, 2.04.*, 2.05.*, and 2.06.*.
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.06.0.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL
741
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
2.06.0. You cannot upgrade an existing Aurora MySQL 1.* cluster directly to 2.06.0; however, you can
restore its snapshot to Aurora MySQL 2.06.0.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], and Middle East (Bahrain) [me-south-1]. There will be a
separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
New features:
• Aurora MySQL clusters now support the instance types db.r5.8xlarge, db.r5.16xlarge, and
db.r5.24xlarge. For more information about instance types for Aurora MySQL clusters, see DB Instance
Classes (p. 33).
• The hash join feature is now generally available and does not require the Aurora lab mode setting to
be ON. This feature can improve query performance when you need to join a large amount of data
by using an equi-join. For more information about using this feature, see Working with Hash Joins in
Aurora MySQL (p. 709).
• The hot row contention feature is now generally available and does not require the Aurora lab
mode setting to be ON. This feature substantially improves throughput for workloads with many
transactions contending for rows on the same page.
• Aurora MySQL 2.06 and higher support "rewinding" a DB cluster to a specific time, without restoring
data from a backup. This feature, known as Backtrack, provides a quick way to recover from user
errors, such as dropping the wrong table or deleting the wrong row. Backtrack completes within
seconds, even for large databases. Read the AWS blog for an overview, and refer to Backtracking an
Aurora DB Cluster (p. 552) for more details.
Critical fixes:
None.
High-priority fixes:
CVE fixes
• CVE-2019-2805
• CVE-2019-2730
• CVE-2019-2739
• CVE-2019-2778
• CVE-2019-2758
• CVE-2018-3064
• CVE-2018-3058
• CVE-2018-2786
742
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• CVE-2017-3653
• CVE-2017-3455
• CVE-2017-3465
• CVE-2017-3244
• CVE-2016-5612
Connection handling
• Database availability has been improved to better service a surge in client connections while executing
one or more DDLs. It is handled by temporarily creating additional threads when needed. You are
advised to upgrade if the database becomes unresponsive following a surge in connections while
processing DDL.
Engine restart
• Fixed an issue of prolonged unavailability while restarting the engine. This addresses an issue in the
buffer pool initialization. This issue occurs rarely but can potentially impact any supported release.
• Fixed an issue that causes a database configured as a binlog master to restart while a heavy write
workload is running.
• Made improvements where queries accessing uncached data could be slower than usual. Customers
experiencing unexplained elevated read latency while accessing uncached data are encouraged to
upgrade as they may be experiencing this issue.
• Fixed an issue that failed to restore partitioned tables from a database snapshot. Customers who
encounter errors when accessing partitioned tables in a database that has been restored from the
snapshot of an Aurora MySQL 1.* database are advised to use this version.
• Improved stability of the Aurora Replicas by fixing lock contention between threads serving read
queries and the one applying schema changes while a DDL query is in progress on the writer DB
instance.
• Fixed a stability issue related to mysql.innodb_table_stats table update triggered by DDL
operations.
• Fixed an issue that incorrectly reported ERROR 1836 when a nested query is executed against a
temporary table on the Aurora Replica.
Performance enhancements:
• Improved performance of binlog replication by preventing unnecessary API calls to the cache if the
query cache has been disabled on the binlog slave.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
743
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.06.0 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.05.0 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.* and 2.04.*.
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.05.0.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters, up to 2.04.6, to Aurora
MySQL 2.05.0. You cannot upgrade an existing Aurora MySQL 1.* cluster directly to 2.05.0; however, you
can restore its snapshot to Aurora MySQL 2.05.0.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], Europe (Stockholm) [eu-north-1], and Middle East
(Bahrain) [me-south-1]. There will be a separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
744
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Improvements
Critical fixes:
• CVE-2018-0734
• CVE-2019-2534
• CVE-2018-3155
• CVE-2018-2612
• CVE-2017-3599
• CVE-2018-3056
• CVE-2018-2562
• CVE-2017-3329
• CVE-2018-2696
• Fixed an issue where the events in current binlog file on the master were not replicated on the slave if
the value of the parameter sync_binlog was not set to 1.
High-priority fixes:
• Customers with database size close to 64 TiB are strongly advised to upgrade to this version to avoid
downtime due to stability bugs affecting volumes close to the Aurora storage limit.
• The default value of the parameter aurora_binlog_replication_max_yield_seconds has been
changed to zero to prevent an increase in replication lag in favor of foreground query performance on
the binlog master.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
745
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.05.0 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.04.8 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, 2.04.*, and 2.05.*. You can restore a snapshot of any 2.* Aurora MySQL release into Aurora MySQL
2.04.8. You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora
MySQL 2.04.8.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], Asia Pacific (Hong Kong) [ap-east-1],
and and Middle East (Bahrain) [me-south-1]. There will be a separate announcement once it is
made available.
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
New features:
746
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
because these instances can tolerate additional CPU overhead for compression. The parameter for
this feature is aurora_enable_replica_log_compression.
High-priority fixes:
• Improved memory management in the Aurora writer instance that prevents restart of writer due to
out of memory conditions during heavy workload in presence of reader instances within the Aurora DB
cluster.
• Fix for a non-deterministic condition in the scheduler that results in engine restart while accessing the
performance schema object concurrently.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.8 does not currently support the following MySQL 5.7 features:
747
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.04.7 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.* and 2.04.*.
You can restore a snapshot from a currently supported Aurora MySQL release into Aurora MySQL 2.04.7.
You also have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL
2.04.7. You can't upgrade an existing Aurora MySQL 1.* cluster directly to 2.04.7; however, you can
restore its snapshot to Aurora MySQL 2.04.7.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
AWS Management Console, the AWS CLI, or the RDS API.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], Asia Pacific (Hong Kong) [ap-east-1],
and and Middle East (Bahrain) [me-south-1]. There will be a separate announcement once it is
made available.
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
High-priority fixes:
Connection Handling
• Database availability has been improved to better service a surge in client connections while executing
one or more DDLs. It is handled by temporarily creating additional threads when needed. You are
advised to upgrade if the database becomes unresponsive following a surge in connections while
processing DDL.
• Fixed an issue that resulted in an incorrect value for the Threads_running global status variable.
Engine Restart
• Fixed an issue of prolonged unavailability while restarting the engine. This addresses an issue in the
buffer pool initialization. This issue occurs rarely but can potentially impact any supported release.
• Made improvements where queries accessing uncached data could be slower than usual. Customers
experiencing unexplained elevated read latencies while accessing uncached data are encouraged to
upgrade as they may be experiencing this issue.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
748
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.7 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.04.6 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
You have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL 2.04.6. We
do not allow in-place upgrade of Aurora MySQL 1.* clusters. This restriction will be lifted in a later Aurora
MySQL 2.* release. You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*,
2.01.*, 2.02.*, 2.03.* and 2.04.* into Aurora MySQL 2.04.6.
To use an older version of Aurora MySQL, you can create new database clusters by specifying the engine
version through the AWS Management Console, the AWS CLI, or the Amazon RDS API.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the following AWS Regions: Europe (London) [eu-
west-2], AWS GovCloud (US-East) [us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1],
China (Ningxia) [cn-northwest-1], and Asia Pacific (Hong Kong) [ap-east-1]. There will be a
separate announcement once it is made available.
749
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue where the events in current binlog file on the master were not replicated on the slave if
the value of the parameter sync_binlog was not set to 1.
• The default value of the parameter aurora_binlog_replication_max_yield_seconds has been
changed to zero to prevent an increase in replication lag in favor of foreground query performance on
the binlog master.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.6 does not currently support the following MySQL 5.7 features:
750
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.04.5 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
You have the option to upgrade existing Aurora MySQL 2.* database clusters to Aurora MySQL 2.04.5. We
do not allow in-place upgrade of Aurora MySQL 1.* clusters. This restriction will be lifted in a later Aurora
MySQL 2.* release. You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*,
2.01.*, 2.02.*, 2.03.* and 2.04.* into Aurora MySQL 2.04.5.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed a race condition during storage volume growth that caused the database to restart.
• Fixed an internal communication failure during volume open that caused the database to restart.
• Added DDL recovery support for ALTER TABLE ALGORITHM=INPLACE on partitioned tables.
• Fixed an issue with DDL recovery of ALTER TABLE ALGORITHM=COPY that caused the database to
restart.
• Improved Aurora Replica stability under heavy delete workload on the writer.
• Fixed a database restart caused by a deadlatch between the thread performing full-text search index
sync and the thread performing eviction of full-text search table from dictionary cache.
• Fixed a stability issue on the binlog slave during DDL replication while the connection to the binlog
master is unstable.
• Fixed an out-of-memory issue in the full-text search code that caused the database to restart.
• Fixed an issue on the Aurora Writer that caused it to restart when the entire 64 TiB volume is used.
• Fixed a race condition in the Performance Schema feature that caused the database to restart.
• Fixed an issue that caused aborted connections when handling an error in network protocol
management.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
751
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.04.5 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.04.4 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you have the option of
choosing compatibility with either MySQL 5.7 or MySQL 5.6. We do not allow in-place upgrade of Aurora
MySQL 1.* clusters or restore of Aurora MySQL 1.* clusters from an Amazon S3 backup into Aurora
MySQL 2.04.4. We plan to remove these restrictions in a later Aurora MySQL 2.* release.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, and 2.04.* into Aurora MySQL 2.04.4.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1], Europe
(Stockholm) [eu-north-1], China (Ningxia) [cn-northwest-1], and Asia Pacific (Hong Kong) [ap-
east-1] AWS Regions. There will be a separate announcement once it is made available.
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue that could cause failures when loading data into Aurora from S3.
• Fixed an issue that could cause failures when upload data from Aurora to S3.
• Fixed an issue that caused aborted connections when handling an error in network protocol
management.
752
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Fixed an issue that could cause a crash when dealing with partitioned tables.
• Fixed an issue with the Performance Insights feature being unavailable in some regions.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.4 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.04.3 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you have the option of
choosing compatibility with either MySQL 5.7 or MySQL 5.6. We do not allow in-place upgrade of Aurora
MySQL 1.* clusters or restore of Aurora MySQL 1.* clusters from an Amazon S3 backup into Aurora
MySQL 2.04.3. We plan to remove these restrictions in a later Aurora MySQL 2.* release.
753
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, and 2.04.* into Aurora MySQL 2.04.3.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Ningxia) [cn-northwest-1] AWS Regions. There will be a separate announcement once it is
made available.
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed a bug in binlog replication that can cause an issue on Aurora instances configured as binlog slave.
• Fixed an out-of-memory condition when handling large stored routines.
• Fixed an error in handling certain kinds of ALTER TABLE commands.
• Fixed an issue with aborted connections because of an error in network protocol management.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.3 does not currently support the following MySQL 5.7 features:
754
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.04.2 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you have the option of
choosing compatibility with either MySQL 5.7 or MySQL 5.6. We do not allow in-place upgrade of Aurora
MySQL 1.* clusters or restore of Aurora MySQL 1.* clusters from an Amazon S3 backup into Aurora
MySQL 2.04.2. We plan to remove these restrictions in a later Aurora MySQL 2.* release.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, 2.04.0, and 2.04.1 into Aurora MySQL 2.04.2.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Ningxia) [cn-northwest-1] AWS Regions. There will be a separate announcement once it is
made available.
Note
For information on how to upgrade your Aurora MySQL database cluster, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Added support for SSL binlog replication using custom certificates. For information on using SSL
binlog replication in Aurora MySQL, see mysql_rds_import_binlog_ssl_material.
• Fixed a deadlatch on the Aurora primary instance that occurs when a table with a Full Text Search
index is being optimized.
• Fixed an issue on the Aurora Replicas where performance of certain queries using SELECT(*) could be
impacted on tables that have secondary indexes.
• Fixed a condition that resulted in Error 1032 being posted.
• Improved the stability of Aurora Replicas by fixing multiple deadlatches.
755
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Aurora MySQL 2.04.2 does not currently support the following MySQL 5.7 features:
Aurora MySQL 2.04.1 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you have the option of
choosing compatibility with either MySQL 5.7 or MySQL 5.6. We do not allow in-place upgrade of Aurora
MySQL 1.* clusters or restore of Aurora MySQL 1.* clusters from an Amazon S3 backup into Aurora
MySQL 2.04.1. We plan to remove these restrictions in a later Aurora MySQL 2.* release.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 2.01.*, 2.02.*,
2.03.*, 2.04.0 into Aurora MySQL 2.04.1.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] region.
There will be a separate announcement once it is made available.
756
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue where an Aurora MySQL 5.6 snapshot for versions lower than 1.16 could not be restored
to the latest Aurora MySQL 5.7 cluster.
Aurora MySQL 2.04 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7 and
Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you have the option of
choosing compatibility with either MySQL 5.7 or MySQL 5.6. We do not allow in-place upgrade of Aurora
MySQL 1.* clusters or restore of Aurora MySQL 1.* clusters from an Amazon S3 backup into Aurora
MySQL 2.04.0. We plan to remove these restrictions in a later Aurora MySQL 2.* release.
You can restore snapshots of Aurora MySQL 1.19.*, 2.01.*, 2.02.*, and 2.03.* into Aurora MySQL 2.04.0.
You cannot restore snapshots of Aurora MySQL 1.14.* or lower, 1.15.*, 1.16.*, 1.17.*, 1.18.* into Aurora
MySQL 2.04.0. This restriction is removed in Aurora MySQL 2.04.1.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] region.
There will be a separate announcement once it is made available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Supports GTID-based replication. For information about using GTID-based replication with Aurora
MySQL, see Using GTID-Based Replication for Aurora MySQL (p. 624).
• Fixed an issue where an Aurora Replica incorrectly throws aRunning in read-only mode error
when a statement deleting or updating rows in a temporary table contains an InnoDB subquery.
Aurora MySQL 2.03.4 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
757
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you can choose
compatibility with either MySQL 5.7 or MySQL 5.6.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.03.4 or restore to
Aurora MySQL 2.03.4 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Support for UTF8MB4 Unicode 9.0 accent-sensitive and case-insensitive collation,
utf8mb4_0900_as_ci.
Aurora MySQL 2.03.3 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you can choose
compatibility with either MySQL 5.7 or MySQL 5.6.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.03.3 or restore to
Aurora MySQL 2.03.3 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue where an Aurora Replica might become dead-latched when running a backward scan on
an index.
• Fixed an issue where an Aurora Replica might restart when the Aurora primary instance runs in-place
DDL operations on partitioned tables.
• Fixed an issue where an Aurora Replica might restart during query cache invalidation after a DDL
operation on the Aurora primary instance.
758
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Fixed an issue where an Aurora Replica might restart during a SELECT query on a table while the
Aurora primary instance runs truncation on that table.
• Fixed a wrong result issue with MyISAM temporary tables where only indexed columns are accessed.
• Fixed an issue in slow logs that generated incorrect large values for query_time and lock_time
periodically after approximately 40,000 queries.
• Fixed an issue where a schema named "tmp" could cause migration from RDS MySQL to Aurora MySQL
to become stuck.
• Fixed an issue where the audit log might have missing events during log rotation.
• Fixed an issue where the Aurora primary instance restored from an Aurora 5.6 snapshot might restart
when the Fast DDL feature in the lab mode is enabled.
• Fixed an issue where the CPU usage is 100% caused by the dictionary stats thread.
• Fixed an issue where an Aurora Replica might restart when running a CHECK TABLE statement.
Aurora MySQL 2.03.2 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster (including restoring a snapshot), you can choose
compatibility with either MySQL 5.7 or MySQL 5.6.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.03.2 or restore to
Aurora MySQL 2.03.2 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Aurora Version Selector – Starting with Aurora MySQL 2.03.2, you can choose from among multiple
versions of MySQL 5.7-compatible Aurora on the AWS Management Console. For more information,
see Aurora MySQL Engine Versions (p. 733).
759
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.03.1 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 2.01.*, 2.02.*, and 2.03
into Aurora MySQL 2.03.1.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.03.1 or restore to
Aurora MySQL 2.03.1 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Improvements
• Fix an issue where the Aurora Writer might restart when running transaction deadlock detection.
Aurora MySQL 2.03 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7 and
Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 2.01.*, and 2.02.* into
Aurora MySQL 2.03.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.03 or restore to
Aurora MySQL 2.03 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Performance schema is available.
760
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Fixed an issue where zombie sessions with killed state might consume more CPU.
• Fixed a dead latch issue when a read-only transaction is acquiring a lock on a record on the Aurora
Writer.
• Fixed an issue where the Aurora Replica without customer workload might have high CPU utilization.
• Multiple fixes on issues that might cause the Aurora Replica or the Aurora writer to restart.
• Added capability to skip diagnostic logging when the disk throughput limit is reached.
• Fixed a memory leak issue when binlog is enabled on the Aurora Writer.
Aurora MySQL 2.02.5 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 2.01.*, and 2.02.* into
Aurora MySQL 2.02.5. You can also perform an in-place upgrade from Aurora MySQL 2.01.* or 2.02.* to
Aurora MySQL 2.02.5.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.02.5 or restore to
Aurora MySQL 2.02.5 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fix an issue where an Aurora Replica might restart when it is doing a reverse scan on a table.
Aurora MySQL 2.02.4 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
761
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 2.01.*, and 2.02.* into
Aurora MySQL 2.02.4. You can also perform an in-place upgrade from Aurora MySQL 2.01.* or 2.02.* to
Aurora MySQL 2.02.4.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.02.4 or restore to
Aurora MySQL 2.02.4 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed a stability issue related to Full Text Search indexes on tables restored from an Aurora MySQL 5.6
snapshot.
Aurora MySQL 2.02.3 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 2.01.*, and 2.02.* into Aurora
MySQL 2.02.3. You can also perform an in-place upgrade from Aurora MySQL 2.01.* or 2.02.* to Aurora
MySQL 2.02.3.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.02.3 or restore to
Aurora MySQL 2.02.3 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
762
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. These functions are available for
MySQL 5.7-compatible clusters in Aurora MySQL 2.06 and higher. For more information, see Invoking a
Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Currently, Aurora MySQL 2.01 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
Aurora MySQL 2.01 does not currently support the following MySQL 5.7 features:
• Global transaction identifiers (GTIDs). Aurora MySQL supports GTIDs in version 2.04 and higher.
• Group replication plugin
• Increased page size
• InnoDB buffer pool loading at startup
• InnoDB full-text parser plugin
• Multisource replication
• Online buffer pool resizing
• Password validation plugin
• Query rewrite plugins
• Replication filtering
• The CREATE TABLESPACE SQL statement
• X Protocol
CLI differences between Aurora MySQL 2.x and Aurora MySQL 1.x
• The engine name for Aurora MySQL 2.x is aurora-mysql; the engine name for Aurora MySQL 1.x
continues to be aurora.
• The engine version for Aurora MySQL 2.x is 5.7.12; the engine version for Aurora MySQL 1.x
continues to be 5.6.10ann.
• The default parameter group for Aurora MySQL 2.x is default.aurora-mysql5.7; the default
parameter group for Aurora MySQL 1.x continues to be default.aurora5.6.
• The DB cluster parameter group family name for Aurora MySQL 2.x is aurora-mysql5.7; the DB
cluster parameter group family name for Aurora MySQL 1.x continues to be aurora5.6.
Refer to the Aurora documentation for the full set of CLI commands and differences between Aurora
MySQL 2.x and Aurora MySQL 1.x.
763
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Improvements
• Fixed an issue where an Aurora Replica can restart when using optimistic cursor restores while reading
records.
• Updated the default value of the parameter innodb_stats_persistent_sample_pages to 128 to
improve index statistics.
• Fixed an issue where an Aurora Replica might restart when it accesses a small table that is being
concurrently modified on the Aurora primary instance.
• Fixed ANALYZE TABLE to stop flushing the table definition cache.
• Fixed an issue where the Aurora primary instance or an Aurora Replica might restart when converting a
point query for geospatial to a search range.
Aurora MySQL 2.02.2 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14*, 1.15*, 1.16*, 1.17*, 2.01*, and 2.02 into Aurora MySQL
2.02.2. You can also perform an in-place upgrade from Aurora MySQL 2.01* or 2.02 to Aurora MySQL
2.02.2.
We don't allow in-place upgrade of Aurora MySQL 1.* clusters into Aurora MySQL 2.02.2 or restore to
Aurora MySQL 2.02.2 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.* release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
764
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Currently, Aurora MySQL 2.01 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
Aurora MySQL 2.01 does not currently support the following MySQL 5.7 features:
• Global transaction identifiers (GTIDs). Aurora MySQL supports GTIDs in version 2.04 and higher.
• Group replication plugin
• Increased page size
• InnoDB buffer pool loading at startup
• InnoDB full-text parser plugin
• Multisource replication
• Online buffer pool resizing
• Password validation plugin
• Query rewrite plugins
• Replication filtering
• The CREATE TABLESPACE SQL statement
• X Protocol
CLI differences between Aurora MySQL 2.x and Aurora MySQL 1.x
• The engine name for Aurora MySQL 2.x is aurora-mysql; the engine name for Aurora MySQL 1.x
continues to be aurora.
• The engine version for Aurora MySQL 2.x is 5.7.12; the engine version for Aurora MySQL 1.x
continues to be 5.6.10ann.
• The default parameter group for Aurora MySQL 2.x is default.aurora-mysql5.7; the default
parameter group for Aurora MySQL 1.x continues to be default.aurora5.6.
• The DB cluster parameter group family name for Aurora MySQL 2.x is aurora-mysql5.7; the DB
cluster parameter group family name for Aurora MySQL 1.x continues to be aurora5.6.
Refer to the Aurora documentation for the full set of CLI commands and differences between Aurora
MySQL 2.x and Aurora MySQL 1.x.
Improvements
• Fixed an issue where an Aurora Writer can occasionally restart when tracking Aurora Replica progress.
• Fixed an issue where an Aurora Replica restarts or throws an error when a partitioned table is accessed
after running index create or drop statements on the table on the Aurora Writer.
• Fixed an issue where a table on an Aurora Replica is inaccessible while it is applying the changes
caused by running ALTER table ADD/DROP column statements on the Aurora Writer.
765
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
Aurora MySQL 2.02 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7 and
Aurora MySQL 1.x versions are compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14*, 1.15*, 1.16*, 1.17* and 2.01* into Aurora MySQL 2.02.
You can also perform an in-place upgrade from Aurora MySQL 2.01* to Aurora MySQL 2.02.
We don't allow in-place upgrade of Aurora MySQL 1.x clusters into Aurora MySQL 2.02 or restore to
Aurora MySQL 2.02 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.x release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Currently, Aurora MySQL 2.01 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
Aurora MySQL 2.01 does not currently support the following MySQL 5.7 features:
• Global transaction identifiers (GTIDs). Aurora MySQL supports GTIDs in version 2.04 and higher.
• Group replication plugin
• Increased page size
• InnoDB buffer pool loading at startup
• InnoDB full-text parser plugin
• Multisource replication
• Online buffer pool resizing
766
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
CLI differences between Aurora MySQL 2.x and Aurora MySQL 1.x
• The engine name for Aurora MySQL 2.x is aurora-mysql; the engine name for Aurora MySQL 1.x
continues to be aurora.
• The engine version for Aurora MySQL 2.x is 5.7.12; the engine version for Aurora MySQL 1.x
continues to be 5.6.10ann.
• The default parameter group for Aurora MySQL 2.x is default.aurora-mysql5.7; the default
parameter group for Aurora MySQL 1.x continues to be default.aurora5.6.
• The DB cluster parameter group family name for Aurora MySQL 2.x is aurora-mysql5.7; the DB
cluster parameter group family name for Aurora MySQL 1.x continues to be aurora5.6.
Refer to the Aurora documentation for the full set of CLI commands and differences between Aurora
MySQL 2.x and Aurora MySQL 1.x.
Improvements
• Fixed an issue where an Aurora Writer restarts when running INSERT statements and exploiting the
Fast Insert optimization.
• Fixed an issue where an Aurora Replica restarts when running ALTER DATABASE statements on the
Aurora Replica.
• Fixed an issue where an Aurora Replica restarts when running queries on tables that have just been
dropped on the Aurora Writer.
• Fixed an issue where an Aurora Replica restarts when setting innodb_adaptive_hash_index to OFF
on the Aurora Replica.
• Fixed an issue where an Aurora Replica restarts when running TRUNCATE TABLE queries on the Aurora
Writer.
• Fixed an issue where the Aurora Writer freezes in certain circumstances when running INSERT
statements. On a multi-node cluster, this can result in a failover.
• Fixed a memory leak associated with setting session variables.
• Fixed an issue where the Aurora Writer freezes in certain circumstances associated with purging undo
for tables with generated columns.
• Fixed an issue where the Aurora Writer can sometimes restart when binary logging is enabled.
Aurora MySQL 2.01.1 is generally available. Aurora MySQL 2.x versions are compatible with MySQL 5.7
and Aurora MySQL 1.x versions are compatible with MySQL 5.6.
767
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
When creating a new Aurora MySQL DB cluster, you can choose compatibility with either MySQL 5.7 or
MySQL 5.6. When restoring a MySQL 5.6-compatible snapshot, you can choose compatibility with either
MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14*, 1.15*, 1.16*, and 1.17* into Aurora MySQL 2.01.1.
We don't allow in-place upgrade of Aurora MySQL 1.x clusters into Aurora MySQL 2.01.1 or restore to
Aurora MySQL 2.01.1 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.x release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Currently, Aurora MySQL 2.01.1 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
Aurora MySQL 2.01.1 does not currently support the following MySQL 5.7 features:
• Global transaction identifiers (GTIDs). Aurora MySQL supports GTIDs in version 2.04 and higher.
• Group replication plugin
• Increased page size
• InnoDB buffer pool loading at startup
• InnoDB full-text parser plugin
• Multisource replication
• Online buffer pool resizing
• Password validation plugin
• Query rewrite plugins
• Replication filtering
• The CREATE TABLESPACE SQL statement
768
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 2.0
• X Protocol
CLI differences between Aurora MySQL 2.x and Aurora MySQL 1.x
• The engine name for Aurora MySQL 2.x is aurora-mysql; the engine name for Aurora MySQL 1.x
continues to be aurora.
• The engine version for Aurora MySQL 2.x is 5.7.12; the engine version for Aurora MySQL 1.x
continues to be 5.6.10ann.
• The default parameter group for Aurora MySQL 2.x is default.aurora-mysql5.7; the default
parameter group for Aurora MySQL 1.x continues to be default.aurora5.6.
• The DB cluster parameter group family name for Aurora MySQL 2.x is aurora-mysql5.7; the DB
cluster parameter group family name for Aurora MySQL 1.x continues to be aurora5.6.
Refer to the Aurora documentation for the full set of CLI commands and differences between Aurora
MySQL 2.x and Aurora MySQL 1.x.
Improvements
• Fixed an issue with snapshot restore where Aurora-specific database privileges were created incorrectly
when a MySQL 5.6-compatible snapshot was restored with MySQL 5.7 compatibility.
• Added support for 1.17 snapshot restores.
Aurora MySQL 2.01 is generally available. Going forward, Aurora MySQL 2.x versions will be compatible
with MySQL 5.7 and Aurora MySQL 1.x versions will be compatible with MySQL 5.6.
When creating a new Aurora MySQL DB cluster, including those restored from snapshots, you can choose
compatibility with either MySQL 5.7 or MySQL 5.6.
You can restore snapshots of Aurora MySQL 1.14*, 1.15*, and 1.16* into Aurora MySQL 2.01.
We don't allow in-place upgrade of Aurora MySQL 1.x clusters into Aurora MySQL 2.01 or restore to
Aurora MySQL 2.01 from an Amazon S3 backup. We plan to remove these restrictions in a later Aurora
MySQL 2.x release.
The performance schema is disabled for this release of Aurora MySQL 5.7. Upgrade to Aurora 2.03 for
performance schema support.
• Asynchronous key prefetch (AKP). For more information, see Working with Asynchronous Key Prefetch
in Amazon Aurora (p. 703).
• Hash joins. For more information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Native functions for synchronously invoking AWS Lambda functions. For more information, see
Invoking a Lambda Function with an Aurora MySQL Native Function (p. 679).
• Scan batching. For more information, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
769
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Migrating data from MySQL using an Amazon S3 bucket. For more information, see Migrating Data
from MySQL by Using an Amazon S3 Bucket (p. 517).
Currently, Aurora MySQL 2.01 does not support features added in Aurora MySQL version 1.16 and
later. For information about Aurora MySQL version 1.16, see Aurora MySQL Database Engine Updates
2017-12-11 (p. 790).
Aurora MySQL 2.01 does not currently support the following MySQL 5.7 features:
• Global transaction identifiers (GTIDs). Aurora MySQL supports GTIDs in version 2.04 and higher.
• Group replication plugin
• Increased page size
• InnoDB buffer pool loading at startup
• InnoDB full-text parser plugin
• Multisource replication
• Online buffer pool resizing
• Password validation plugin
• Query rewrite plugins
• Replication filtering
• The CREATE TABLESPACE SQL statement
• X Protocol
CLI differences between Aurora MySQL 2.x and Aurora MySQL 1.x
• The engine name for Aurora MySQL 2.x is aurora-mysql; the engine name for Aurora MySQL 1.x
continues to be aurora.
• The engine version for Aurora MySQL 2.x is 5.7.12; the engine version for Aurora MySQL 1.x
continues to be 5.6.10ann.
• The default parameter group for Aurora MySQL 2.x is default.aurora-mysql5.7; the default
parameter group for Aurora MySQL 1.x continues to be default.aurora5.6.
• The DB cluster parameter group family name for Aurora MySQL 2.x is aurora-mysql5.7; the DB
cluster parameter group family name for Aurora MySQL 1.x continues to be aurora5.6.
Refer to the Aurora documentation for the full set of CLI commands and differences between Aurora
MySQL 2.x and Aurora MySQL 1.x.
770
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Aurora MySQL Database Engine Updates 2019-12-23 (Version 1.22.1) (p. 772)
• Aurora MySQL Database Engine Updates 2019-11-25 (Version 1.22.0) (p. 773)
• Aurora MySQL Database Engine Updates 2019-11-25 (Version 1.21.0) (p. 776)
• Aurora MySQL Database Engine Updates 2020-03-05 (p. 777)
• Aurora MySQL Database Engine Updates 2019-11-11 (Version 1.20.0) (p. 778)
• Aurora MySQL Database Engine Updates 2020-03-05 (p. 779)
• Aurora MySQL Database Engine Updates 2019-09-19 (Version 1.19.5) (p. 779)
• Aurora MySQL Database Engine Updates 2019-06-05 (Version 1.19.2) (p. 780)
• Aurora MySQL Database Engine Updates 2019-05-09 (Version 1.19.1) (p. 781)
• Aurora MySQL Database Engine Updates 2019-02-07 (Version 1.19.0) (p. 782)
• Aurora MySQL Database Engine Updates 2018-09-20 (p. 783) (Version 1.18.0)
• Aurora MySQL Database Engine Updates 2020-03-05 (p. 784) (Version 1.17.9)
• Aurora MySQL Database Engine Updates 2019-01-17 (p. 784) (Version 1.17.8)
• Aurora MySQL Database Engine Updates 2018-10-08 (p. 785) (Version 1.17.7)
• Aurora MySQL Database Engine Updates 2018-09-06 (p. 786) (Version 1.17.6)
• Aurora MySQL Database Engine Updates 2018-08-14 (p. 786) (Version 1.17.5)
• Aurora MySQL Database Engine Updates 2018-08-07 (p. 787) (Version 1.17.4)
• Aurora MySQL Database Engine Updates 2018-06-05 (p. 788) (Version 1.17.3)
• Aurora MySQL Database Engine Updates 2018-04-27 (p. 788) (Version 1.17.2)
• Aurora MySQL Database Engine Updates 2018-03-23 (p. 789) (Version 1.17.1)
• Aurora MySQL Database Engine Updates 2018-03-13 (p. 789) (Version 1.17)
• Aurora MySQL Database Engine Updates 2017-12-11 (p. 790) (Version 1.16)
• Aurora MySQL Database Engine Updates 2017-11-20 (p. 791) (Version 1.15.1)
• Aurora MySQL Database Engine Updates 2017-10-24 (p. 792) (Version 1.15)
• Aurora MySQL Database Engine Updates: 2018-03-13 (p. 794) (Version 1.14.4)
• Aurora MySQL Database Engine Updates: 2017-09-22 (p. 794) (Version 1.14.1)
• Aurora MySQL Database Engine Updates: 2017-08-07 (p. 795) (Version 1.14)
• Aurora MySQL Database Engine Updates: 2017-05-15 (p. 796) (Version 1.13)
• Aurora MySQL Database Engine Updates: 2017-04-05 (p. 797) (Version 1.12)
• Aurora MySQL Database Engine Updates: 2017-02-23 (p. 799) (Version 1.11)
• Aurora MySQL Database Engine Updates: 2017-01-12 (p. 801) (Version 1.10.1)
• Aurora MySQL Database Engine Updates: 2016-12-14 (p. 801) (Version 1.10)
• Aurora MySQL Database Engine Updates: 2016-11-10 (p. 802) (Versions 1.9.0, 1.9.1)
• Aurora MySQL Database Engine Updates: 2016-10-26 (p. 803) (Version 1.8.1)
• Aurora MySQL Database Engine Updates: 2016-10-18 (p. 803) (Version 1.8)
• Aurora MySQL Database Engine Updates: 2016-09-20 (p. 805) (Version 1.7.1)
• Aurora MySQL Database Engine Updates: 2016-08-30 (p. 805) (Version 1.7)
• Aurora MySQL Database Engine Updates: 2016-06-01 (p. 806) (Version 1.6.5)
• Aurora MySQL Database Engine Updates: 2016-04-06 (p. 806) (Version 1.6)
• Aurora MySQL Database Engine Updates: 2016-01-11 (p. 808) (Version 1.5)
• Aurora MySQL Database Engine Updates: 2015-12-03 (p. 808) (Version 1.4)
• Aurora MySQL Database Engine Updates: 2015-10-16 (p. 810) (Versions 1.2, 1.3)
• Aurora MySQL Database Engine Updates: 2015-08-24 (p. 812) (Version 1.1)
771
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Aurora MySQL 1.22.2 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.* and 2.07.*. You can restore the snapshot of an Aurora
MySQL 1.* database into Aurora MySQL 1.22.2.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
RDS Console, the AWS CLI, or the Amazon RDS API.
Note
This version is currently not available in the following regions: AWS GovCloud (US-East) [us-gov-
east-1], AWS GovCloud (US-West) [us-gov-west-1]. There will be a separate announcement once
it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
High priority fixes:
Aurora MySQL 1.22.1 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.*, and 2.07.*. To create a cluster with an older version of
Aurora MySQL, please specify the engine version through the AWS Management Console, the AWS CLI
or the RDS API. You have the option to upgrade existing Aurora MySQL 1.* database clusters to Aurora
MySQL 1.22.1.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], and Middle East (Bahrain) [me-south-1. There will be a
separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
772
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
Critical fixes:
• Fixed issues that prevented engine recovery involving table locks and temporary tables.
• Improved the stability of binary log when temporary tables are used.
• Fixed a slow memory leak in Aurora specific database tracing and logging sub-system that lowers the
freeable memory.
Aurora MySQL 1.22.0 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.*, and 2.07.*. To create a cluster with an older version of
Aurora MySQL, please specify the engine version through the AWS Management Console, the AWS CLI
or the RDS API. You have the option to upgrade existing Aurora MySQL 1.* database clusters to Aurora
MySQL 1.22.0.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], Middle East (Bahrain) [me-south-1], and South America
(São Paulo) [sa-east-1]. There will be a separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
New features:
• Aurora MySQL clusters now support the instance types r5.8xlarge, r5.16xlarge and r5.24xlarge.
• Binlog has new enhancements for improved commit time latency when very large transactions are
involved.
• Aurora MySQL now has a mechanism to minimize the time window during which events of a large
transaction are written to binlog on commit. This effectively prevents lengthy offline recovery incurred
when database crashes occur during that time window. This feature also fixes the issue where a large
transaction blocks small transactions on binlog commit. This feature is off by default and can be
enabled by the service team if needed for your workload. When enabled, it will be triggered when a
transaction size is > 500MB.
773
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Added support for the ANSI READ COMMITTED isolation level on the read replicas. This isolation level
enables long-running queries on the read replica to execute without impacting the high throughput of
writes on the writer node. For more information, see Aurora MySQL Isolation Levels.
• Global Databases now allow adding secondary read-only replica regions for database clusters
deployed in these AWS Regions: regions: US East (N. Virginia) [us-east-1], US East (Ohio) [us-east-2],
US West (N. California) [us-west-1], US West (Oregon) [us-west-2], Europe (Ireland) [eu-west-1],
Europe (London) [eu-west-2], Europe (Paris) [eu-west-3], Asia Pacific (Tokyo) [ap-northeast-1], Asia
Pacific (Seoul) [ap-northeast-2], Asia Pacific (Singapore) [ap-southeast-1], Asia Pacific (Sydney) [ap-
southeast-2], Canada (Central) [ca-central-1], Europe (Frankfurt) [eu-central-1], and Asia Pacific
(Mumbai) [ap-south-1].
• The hot row contention feature is now generally available and does not require the Aurora lab
mode setting to be ON. This feature substantially improves throughput for workloads with many
transactions contending for rows on the same page.
• This version has updated timezone files to support the latest Brazil timezone update for new clusters.
Critical fixes:
• CVE-2019-2922
• CVE-2019-2923
• CVE-2019-2924
• CVE-2019-2910
• CVE-2019-2805
• CVE-2019-2730
• CVE-2019-2740
• CVE-2018-3064
• CVE-2018-3058
• CVE-2017-3653
• CVE-2017-3464
• CVE-2017-3244
• CVE-2016-5612
• CVE-2016-5439
• CVE-2016-0606
• CVE-2015-4904
• CVE-2015-4879
• CVE-2015-4864
• CVE-2015-4830
• CVE-2015-4826
• CVE-2015-2620
• CVE-2015-0382
• CVE-2015-0381
• CVE-2014-6555
• CVE-2014-4258
• CVE-2014-4260
• CVE-2014-2444
• CVE-2014-2436
774
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• CVE-2013-5881
• CVE-2014-0393
• CVE-2013-5908
• CVE-2013-5807
• CVE-2013-3806
• CVE-2013-3811
• CVE-2013-3804
• CVE-2013-3807
• CVE-2013-2378
• CVE-2013-2375
• CVE-2013-1523
• CVE-2013-2381
• CVE-2012-5615
• CVE-2014-6489
• Fixed an issue in the DDL recovery component that resulted in prolonged database downtime.
Clusters that become unavailable after executing TRUNCATE TABLE query on a table with an
AUTO_INCREMENT column should be updated.
• Fixed an issue in the DDL recovery component that resulted in prolonged database downtime. Clusters
that become unavailable after executing DROP TABLE query on multiple tables in parallel should be
updated.
• Fixed an issue that caused read replicas to restart during a long-running transaction. Customers who
encounter replica restarts that coincide with an accelerated drop in freeable memory should consider
upgrading to this version.
• Fixed an issue that incorrectly reported ERROR 1836 when a nested query is executed against a
temporary table on the read replica.
• Fixed a parallel query abort error on an Aurora reader instance while a heavy write workload is running
on the Aurora writer instance.
• Fixed an issue that causes a database configured as a Binlog Master to restart while a heavy write
workload is running.
• Fixed an issue of prolonged unavailability while restarting the engine. This addresses an issue in the
buffer pool initialization. This issue occurs rarely but can potentially impact any supported release.
• Fixed an issue that generated inconsistent data in the
information_schema.replica_host_status table.
• Fixed a race condition between the parallel query and the standard execution paths that caused the
Reader nodes to restart intermittently.
• Improved stability of the database when the number of number of client connections exceeds the
max_connections parameter value.
• Improved stability of the reader instances by blocking unsupported DDL and LOAD FROM S3 queries.
775
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Bug #27326796 - MYSQL CRASH WITH INNODB ASSERTION FAILURE IN FILE PARS0PARS.CC
• Bug #20590013 - IF YOU HAVE A FULLTEXT INDEX AND DROP IT YOU CAN NO LONGER PERFORM
ONLINE DDL
Aurora MySQL 1.21.0 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
2.01.*, 2.02.*, 2.03.* and 2.04.*. To create a cluster with an older version of Aurora MySQL, please specify
the engine version through the AWS Management Console, the AWS CLI or the RDS API. You have the
option to upgrade existing Aurora MySQL 1.* database clusters to Aurora MySQL 1.21.0.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], Europe (Stockholm) [eu-north-1], and Middle East
(Bahrain) [me-south-1]. There will be a separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
Critical fixes:
• CVE-2018-0734
• CVE-2019-2534
• CVE-2018-2612
• CVE-2017-3599
• CVE-2018-2562
• CVE-2017-3329
• CVE-2018-2696
• CVE-2015-4737
• Customers with database size close to 64 TiB are strongly advised to upgrade to this version to avoid
downtime due to stability bugs affecting volumes close to the Aurora storage limit.
• Fixed a parallel query abort error on Aurora reader instances while a heavy write workload is running
on the Aurora writer instance.
• Fixed an issue on Aurora reader instances that reduced free memory during long-running transactions
while there is a heavy transaction commit traffic on the writer instance.
776
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• The value of the parameter aurora_disable_hash_join is now persisted after database restart or
host replacement.
• Fixed an issue related to the Full Text Search cache that caused the Aurora instance to run out of
memory. Customers using Full Text Search should upgrade.
• Improved stability of the database when the hash join feature is enabled and the instance is low on
memory. Customers using hash join should upgrade.
• Fixed an issue in the query cache where the "Too many connections" error could cause a reboot.
• Fixed the free memory calculation on T2 instances to include swap memory space to prevent
unnecessary reboots.
Aurora MySQL 1.20.1 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.* and 2.07.*. You can restore the snapshot of an Aurora
MySQL 1.* database into Aurora MySQL 1.20.1.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
RDS Console, the AWS CLI, or the Amazon RDS API.
Note
This version is currently not available in the following regions: AWS GovCloud (US-East) [us-gov-
east-1], AWS GovCloud (US-West) [us-gov-west-1]. There will be a separate announcement once
it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
High priority fixes:
• Fixed a crash during execution of a complex query involving multi-table joins and aggregation that
uses intermediate tables internally.
777
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Aurora MySQL 1.20.0 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 2.01.*,
2.02.*, 2.03.* and 2.04.*. To create a cluster with an older version of Aurora MySQL, please specify the
engine version through the AWS Management Console, the AWS CLI or the RDS API. You have the option
to upgrade existing Aurora MySQL 1.* database clusters, up to 1.19.5, to Aurora MySQL 1.20.0.
Note
This version is currently not available in the following AWS Regions: AWS GovCloud (US-East)
[us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1], China (Ningxia) [cn-northwest-1],
Asia Pacific (Hong Kong) [ap-east-1], Europe (Stockholm) [eu-north-1], and Middle East
(Bahrain) [me-south-1]. There will be a separate announcement once it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
Critical fixes:
• CVE-2018-0734
• CVE-2019-2534
• CVE-2018-2612
• CVE-2017-3599
• CVE-2018-2562
• CVE-2017-3329
• CVE-2018-2696
• CVE-2015-4737
• Customers with database size close to 64 TiB are strongly advised to upgrade to this version to avoid
downtime due to stability bugs affecting volumes close to the Aurora storage limit.
• Fixed a parallel query abort error on Aurora reader instances while a heavy write workload is running
on the Aurora writer instance.
• Fixed an issue on Aurora reader instances that reduced free memory during long-running transactions
while there is a heavy transaction commit traffic on the writer instance.
• The value of the parameter aurora_disable_hash_join is now persisted after database restart or
host replacement.
• Fixed an issue related to the Full Text Search cache that caused the Aurora instance to run out of
memory. Customers using Full Text Search should upgrade.
778
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Improved stability of the database when the hash join feature is enabled and the instance is low on
memory. Customers using hash join should upgrade.
• Fixed an issue in the query cache where the "Too many connections" error could cause a reboot.
• Fixed the free memory calculation on T2 instances to include swap memory space to prevent
unnecessary reboots.
Aurora MySQL 1.19.6 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.* and 2.07.*. You can restore the snapshot of an Aurora
MySQL 1.* database into Aurora MySQL 1.19.6.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
RDS Console, the AWS CLI, or the Amazon RDS API.
Note
This version is currently not available in the following regions: AWS GovCloud (US-East) [us-gov-
east-1], AWS GovCloud (US-West) [us-gov-west-1]. There will be a separate announcement once
it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
High priority fixes:
Aurora MySQL 1.19.5 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
You have the option to upgrade existing database clusters to Aurora MySQL 1.19.5. You can restore
snapshots of Aurora MySQL 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.1, and 1.19.2 into Aurora MySQL
1.19.5.
779
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
To use an older version of Aurora MySQL, you can create new database clusters by specifying the engine
version through the AWS Management Console, the AWS CLI, or the RDS API.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the following AWS Regions: Europe (London) [eu-
west-2], AWS GovCloud (US-East) [us-gov-east-1], AWS GovCloud (US-West) [us-gov-west-1],
China (Ningxia) [cn-northwest-1], and Asia Pacific (Hong Kong) [ap-east-1]. There will be a
separate announcement once it is made available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue on Aurora reader instances that reduced free memory during long-running transactions
while there is a heavy transaction commit traffic on the writer instance.
• Fixed a parallel query abort error on Aurora reader instances while a heavy write workload is running
on the Aurora writer instance.
• The value of the parameter aurora_disable_hash_join is now persisted after database restart or
host replacement.
• Fixed an issue related to the Full Text Search cache that caused the Aurora instance to run out of
memory.
• Improved stability of the database when the volume size is close to the 64 TiB volume limit by
reserving 160 GB of space for the recovery workflow to complete without a failover.
• Improved stability of the database when the hash join feature is enabled and the instance is low on
memory.
• Fixed the free memory calculation to include swap memory space on T2 instances that caused them to
reboot prematurely.
• Fixed an issue in the query cache where the "Too many connections" error could cause a reboot.
Aurora MySQL 1.19.2 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, can be created with 1.17.8, 1.19.0, 1.19.1, or
780
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
1.19.2. You have the option, but are not required, to upgrade existing database clusters to Aurora MySQL
1.19.2. To use an older version, you can create new database clusters in Aurora MySQL 1.14.4, Aurora
MySQL 1.15.1, Aurora MySQL 1.16, Aurora MySQL 1.17.8, or Aurora MySQL 1.18. You can do so using the
AWS CLI or the Amazon RDS API and specifying the engine version.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1], Europe
(Stockholm) [eu-north-1], China (Ningxia) [cn-northwest-1], and Asia Pacific (Hong Kong) [ap-
east-1] AWS Regions. There will be a separate announcement once it is made available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed an issue that could cause failures when loading data into Aurora from Amazon S3.
• Fixed an issue that could cause failures when uploading data from Aurora to Amazon S3.
• Fixed an issue that created zombie sessions left in a killed state.
• Fixed an issue that caused aborted connections when handling an error in network protocol
management.
• Fixed an issue that could cause a crash when dealing with partitioned tables.
• Fixed an issue related to binlog replication of trigger creation.
Aurora MySQL 1.19.1 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, can be created with 1.17.8, 1.19.0, or 1.19.1. You
have the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.19.1.
To use an older version, you can create new database clusters in Aurora MySQL 1.14.4, Aurora MySQL
1.15.1, Aurora MySQL 1.16, Aurora MySQL 1.17.8, or Aurora MySQL 1.18. You can do so using the AWS
CLI or the Amazon RDS API and specifying the engine version.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Improvements
• Fixed a bug in binlog replication that can cause an issue on Aurora instances configured as binlog slave.
• Fixed an error in handling certain kinds of ALTER TABLE commands.
781
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Fixed an issue with aborted connections because of an error in network protocol management.
Aurora MySQL 1.19.0 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, can be created with 1.17.8 or 1.19.0. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.19.0. To use
an older version, you can create new database clusters in Aurora MySQL 1.14.4, Aurora MySQL 1.15.1,
Aurora MySQL 1.16, Aurora MySQL 1.17.8, or Aurora MySQL 1.18.0. You can do so using the AWS CLI or
the Amazon RDS API and specifying the engine version.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
Note
The procedure to upgrade your DB cluster has changed. For more information, see Database
Upgrades and Patches for Amazon Aurora MySQL (p. 734).
Features
• Aurora Version Selector - Starting with Aurora MySQL 1.19.0, you can choose from among multiple
versions of MySQL 5.6 compatible Aurora on the Amazon RDS console. For more information, see
Aurora MySQL Engine Versions (p. 733).
Improvements
• Fixed a stability issue related to the CHECK TABLE query on an Aurora Replica.
• Introduced a new global user variable aurora_disable_hash_join to disable Hash Join.
• Fixed a stability issue when generating the output row during multiple table hash join.
• Fixed an issue that returned a wrong result because of a plan change during Hash Join applicability
check.
• Zero Downtime Patching is supported with long running transactions. This enhancement will come
into effect when upgrading from version 1.19 to a higher one.
• Zero Downtime Patching is now supported when binlog is enabled. This enhancement will come into
effect when upgrading from version 1.19 to a higher one.
• Fixed an issue that caused a spike in CPU utilization on the Aurora Replica unrelated to the workload.
• Fixed a race condition in the lock manager that resulted in a database restart.
• Fixed a race condition in the lock manager component to improve stability of Aurora instances.
• Improved stability of the deadlock detector inside the lock manager component.
• INSERT operation on a table is prohibited if InnoDB detects that the index is corrupted.
• Fixed a stability issue in Fast DDL.
• Improved Aurora stability by reducing the memory consumption in scan batching for single-row
subquery.
782
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Fixed a stability issue that occurred after a foreign key was dropped while the system variable
foreign_key_checks is set to 0.
• Fixed an issue in the Out Of Memory Avoidance feature that erroneously overrode changes to the
table_definition_cache value made by the user.
• Fixed stability issues in the Out Of Memory Avoidance feature.
• Fixed an issue that set query_time and lock_time in slow_query_log to garbage values.
• Fixed a parallel query stability issue triggered by improper handling of string collation internally.
• Fixed a parallel query stability issue triggered by a secondary index search.
• Fixed a parallel query stability issue triggered by a multi-table update.
Aurora MySQL 1.18.0 is generally available. All new Aurora MySQL parallel query clusters with MySQL
5.6 compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.18.0.
You have the option, but are not required, to upgrade existing parallel query clusters to Aurora MySQL
1.18.0. You can create new DB clusters in Aurora MySQL 1.14.4, Aurora MySQL 1.15.1, Aurora MySQL
1.16, or Aurora MySQL 1.17.6. You can do so using the AWS CLI or the Amazon RDS API and specifying
the engine version.
With version 1.18.0 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Important
Aurora MySQL 1.18.0 only applies to Aurora parallel query clusters. If you upgrade a provisioned
5.6.10a cluster, the resulting version is 1.17.8. If you upgrade a parallel query 5.6.10a cluster,
the resulting version is 1.18.0.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Features
• Parallel Query is available with this release, for new clusters and restored snapshots. Aurora MySQL
parallel query is an optimization that parallelizes some of the I/O and computation involved in
processing data-intensive queries. The work that is parallelized includes retrieving rows from storage,
extracting column values, and determining which rows match the conditions in the WHERE clause and
join clauses. This data-intensive work is delegated (in database optimization terms, pushed down) to
multiple nodes in the Aurora distributed storage layer. Without parallel query, each query brings all
the scanned data to a single node within the Aurora MySQL cluster (the head node) and performs all
the query processing there.
• When the parallel query feature is enabled, the Aurora MySQL engine automatically determines
when queries can benefit, without requiring SQL changes such as hints or table attributes.
For more information, see Working with Parallel Query for Amazon Aurora MySQL (p. 570).
• OOM Avoidance: This feature monitors the system memory and tracks memory consumed by various
components of the database. Once the system runs low on memory, it performs a list of actions to
783
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
release memory from various tracked components in an attempt to save the database from running
into Out of Memory (OOM) and thereby avoiding a database restart. This best-effort feature is enabled
by default for t2 instances and can be enabled on other instance classes via a new instance parameter
named aurora_oom_response. The instance parameter takes a string of comma separated actions
that an instance should take when its memory is low. Valid actions include "print", "tune", "decline",
"kill_query" or any combination of these. Any empty string means there should be no actions taken
and effectively renders the feature to be disabled. Note that the default actions for the feature is
"print, tune". Usage examples:
• "print" – Only prints the queries taking high amount of memory.
• "tune" – Tunes the internal table caches to release some memory back to the system.
• "decline" – Declines new queries once the instance is low on memory.
• "kill_query" – Kills the queries in descending order of memory consumption until the instance
memory surfaces above the low threshold. Data definition language (DDL) statements are not killed.
• "print, tune" – Performs actions described for both "print" and "tune".
• "tune, decline, kill_query" – Performs the actions described for "tune", "decline", and "kill_query".
For information about handling out-of-memory conditions and other troubleshooting advice, see
Amazon Aurora MySQL Out of Memory Issues (p. 1094).
Aurora MySQL 1.17.9 is generally available. Aurora MySQL 1.* versions are compatible with MySQL 5.6
and Aurora MySQL 2.* versions are compatible with MySQL 5.7.
Currently supported Aurora MySQL releases are 1.14.*, 1.15.*, 1.16.*, 1.17.*, 1.18.*, 1.19.*, 1.20.*, 1.21.*,
1.22.*, 2.01.*, 2.02.*, 2.03.*, 2.04.*, 2.05.*, 2.06.* and 2.07.*. You can restore the snapshot of an Aurora
MySQL 1.* database into Aurora MySQL 1.17.9.
To create a cluster with an older version of Aurora MySQL, please specify the engine version through the
RDS Console, the AWS CLI, or the Amazon RDS API.
Note
This version is currently not available in the following regions: AWS GovCloud (US-East) [us-gov-
east-1], AWS GovCloud (US-West) [us-gov-west-1]. There will be a separate announcement once
it is made available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
High priority fixes:
Aurora MySQL 1.17.8 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.8. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.8. To use
784
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
an older version, you can create new database clusters in Aurora MySQL 1.14.4, 1.15.1, 1.16, or 1.17.7.
You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.8 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed a performance issue that increased the CPU utilization on an Aurora Replica after a restart.
• Fixed a stability issue for SELECT queries that used hash join.
Aurora MySQL 1.17.7 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.7. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.7. To use
an older version, you can create new database clusters in Aurora MySQL 1.14.4, 1.15.1, 1.16, or 1.17.6.
You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.7 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• The InnoDB status variable innodb_buffer_pool_size has been made publicly visible for the
customers to modify.
• Fixed a stability issue on the Aurora cluster that occurred during failovers.
• Improved cluster availability by fixing a DDL recovery issue that occurred after an unsuccessful
TRUNCATE operation.
• Fixed a stability issue related to the mysql.innodb_table_stats table update, triggered by DDL
operations.
• Fixed Aurora Replica stability issues triggered during query cache invalidation after a DDL operation.
• Fixed a stability issue triggered by invalid memory access during periodic dictionary cache eviction in
the background.
785
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Aurora MySQL 1.17.6 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.6. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.6. To use
an older version, you can create new database clusters in Aurora MySQL 1.14.4, 1.15.1, 1.16, or 1.17.5.
You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.6 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed a stability issue on the Aurora Reader for SELECT queries while the Aurora Writer is performing
DDL operations on the same table.
• Fixed a stability issue caused by the creation and deletion of DDL logs for temporary tables that use
Heap/Memory engine.
• Fixed a stability issue on the Binlog Slave when DDL statements are being replicated while the
connection to the Binlog Master is unstable.
• Fixed a stability issue encountered while writing to the slow query log.
• Fixed an issue with the replica status table that exposed incorrect Aurora Reader lag information.
786
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Aurora MySQL 1.17.5 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.5. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.5. To use
an older version, you can create new database clusters in Aurora MySQL 1.14.4, 1.15.1, 1.16, or 1.17.4.
You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.5 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed an issue where an Aurora Writer might experience a restart after an Aurora cluster is patched
using the Zero-Downtime Patching feature.
Aurora MySQL 1.17.4 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.4. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.4. To use
an older version, you can create new database clusters in Aurora MySQL 1.14.4, 1.15.1, 1.16, or 1.17.3.
You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.4 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Replication improvements:
• Reduced network traffic by not transmitting binlog records to cluster replicas. This improvement is
enabled by default.
• Reduced network traffic by compressing replication messages. This improvement is enabled by
default for 8xlarge and 16xlarge instance classes. Such large instances can sustain a heavy volume of
write traffic that results in substantial network traffic for replication messages.
• Fixes to the replica query cache.
• Fixed an issue where ORDER BY LOWER(col_name) could produce incorrect ordering while using the
utf8_bin collation.
• Fixed an issue where DDL statements (especially TRUNCATE TABLE) could cause problems on Aurora
replicas, including instability or missing tables.
787
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Fixed an issue where sockets are left in a half-open state when storage nodes are restarted.
• The following new DB cluster parameters are available:
• aurora_enable_zdr – Allow connections opened on an Aurora Replica to stay active on replica
restart.
• aurora_enable_replica_log_compression – Enable compression of replication payloads to
improve network bandwidth utilization between the master and Aurora Replicas.
• aurora_enable_repl_bin_log_filtering – Enable filtering of replication records that are
unusable by Aurora Replicas on the master.
Aurora MySQL 1.17.3 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.3. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.3. You can
create new database clusters in Aurora MySQL 1.14.4, Aurora MySQL 1.15.1, or Aurora MySQL 1.16. You
can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.3 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
Note
This version is currently not available in the AWS GovCloud (US-West) [us-gov-west-1] and
China (Beijing) [cn-north-1] regions. There will be a separate announcement once it is made
available.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed an issue where an Aurora Replica can restart when using optimistic cursor restores while reading
records.
• Fixed an issue where an Aurora Writer restarts when trying to kill a MySQL session (kill "<session
id>") with performance schema enabled.
• Fixed an issue where an Aurora Writer restarts when computing a threshold for garbage collection.
• Fixed an issue where an Aurora Writer can occasionally restart when tracking Aurora Replica progress
in log application.
• Fixed an issue with the Query Cache when auto-commit is off and that could potentially cause stale
reads.
Aurora MySQL 1.17.2 is generally available. All new Aurora MySQL database clusters with MySQL 5.6
compatibility, including those restored from snapshots, will be created in Aurora MySQL 1.17.2. You have
the option, but are not required, to upgrade existing database clusters to Aurora MySQL 1.17.2. You can
create new database clusters in Aurora MySQL 1.14.4, Aurora MySQL 1.15.1, or Aurora MySQL 1.16. You
can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17.2 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time.
788
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed an issue which was causing restarts during certain DDL partition operations.
• Fixed an issue which was causing support for invocation of AWS Lambda functions via native Aurora
MySQL functions to be disabled.
• Fixed an issue with cache invalidation which was causing restarts on Aurora Replicas.
• Fixed an issue in lock manager which was causing restarts.
Aurora MySQL 1.17.1 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora MySQL 1.17.1. You have the option, but are not required, to upgrade
existing database clusters to Aurora MySQL 1.17.1. You can create new DB clusters in Aurora MySQL
1.15.1, Aurora MySQL 1.16, or Aurora MySQL 1.17. You can do so using the AWS CLI or the Amazon RDS
API and specifying the engine version.
With version 1.17.1 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora DB cluster are patched at the same time. This release fixes some known engine issues as well as
regressions.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Note
There is an issue in the latest version of the Aurora MySQL engine. After upgrading to 1.17.1,
the engine version is reported incorrectly as 1.17. If you upgraded to 1.17.1, you can confirm
the upgrade by checking the Maintenance column for the DB cluster in the AWS Management
Console. If it displays none, then the engine is upgraded to 1.17.1.
Improvements
• Fixed an issue in binary log recovery that resulted in longer recovery times for situations with large
binary log index files which can happen if binary logs rotate very often.
• Fixed an issue in the query optimizer that generated an inefficient query plan for partitioned tables.
• Fixed an issue in the query optimizer due to which a range query resulted in a restart of the database
engine.
Aurora MySQL 1.17 is generally available. Aurora MySQL 1.x versions are only compatible with MySQL
5.6, and not MySQL 5.7. All new 5.6-compatible database clusters, including those restored from
snapshots, will be created in Aurora 1.17. You have the option, but are not required, to upgrade existing
database clusters to Aurora 1.17. You can create new DB clusters in Aurora 1.14.1, Aurora 1.15.1, or
Aurora 1.16. You can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.17 of Aurora, we are using a cluster patching model where all nodes in an Aurora DB
cluster are patched at the same time. We support zero-downtime patching, which works on a best-effort
789
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
basis to preserve client connections through the patching process. For more information, see Maintaining
an Amazon Aurora DB Cluster (p. 328).
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support.
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
New Features
• Aurora MySQL now supports lock compression, which optimizes the lock manager’s memory usage.
Starting in version 1.17, you can use this feature without enabling lab mode.
Improvements
• Fixed an issue predominantly seen on instances with fewer cores where a single core might have 100%
CPU utilization even when the database is idle.
• Improved the performance of fetching binary logs from Aurora clusters.
• Fixed an issue where Aurora Replicas attempt to write table statistics to persistent storage, and crash.
• Fixed an issue where query cache did not work as expected on Aurora Replicas.
• Fixed a race condition in lock manager that resulted in an engine restart.
• Fixed an issue where locks taken by read-only, auto-commit transactions resulted in an engine restart.
• Fixed an issue where some queries are not written to the audit logs.
• Fixed an issue with recovery of certain partition maintenance operations on failover.
Aurora MySQL 1.16 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora 1.16. You have the option, but are not required, to upgrade existing
database clusters to Aurora 1.16. You can create new DB clusters in Aurora 1.14.1 or Aurora 1.15.1. You
can do so using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.16 of Aurora, we are using a cluster patching model where all nodes in an Aurora DB
cluster are patched at the same time. We are enabling zero-downtime patching, which works on a best-
effort basis to preserve client connections through the patching process. For more information, see
Maintaining an Amazon Aurora DB Cluster (p. 328).
790
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support.
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
New Features
• Aurora MySQL now supports synchronous AWS Lambda invocations via the native function
lambda_sync(). Also available is native function lambda_async(), which can be used as
an alternative to the existing stored procedure for asynchronous Lambda invocation. For more
information, see Invoking a Lambda Function from an Amazon Aurora MySQL DB Cluster (p. 678).
• Aurora MySQL now supports hash joins to speed up equijoin queries. Aurora's cost-based optimizer
can automatically decide when to use hash joins; you can also force their use in a query plan. For more
information, see Working with Hash Joins in Aurora MySQL (p. 709).
• Aurora MySQL now supports scan batching to speed up in-memory scan-oriented queries significantly.
The feature boosts the performance of table full scans, index full scans, and index range scans by
batch processing.
Improvements
• Fixed an issue where read replicas crashed when running queries on tables that have just been dropped
on the master.
• Fixed an issue where restarting the writer on a database cluster with a very large number of FULLTEXT
indexes results in longer than expected recovery.
• Fixed an issue where flushing binary logs causes LOST_EVENTS incidents in binlog events.
• Fixed stability issues with the scheduler when performance schema is enabled.
• Fixed an issue where a subquery that uses temporary tables could return partial results.
Aurora MySQL 1.15.1 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora 1.15.1. You have the option, but are not required, to upgrade
existing DB clusters to Aurora 1.15.1. You can create new DB clusters in Aurora 1.14.1. You can do so
using the AWS CLI or the Amazon RDS API and specifying the engine version.
With version 1.15.1 of Aurora, we are using a cluster patching model where all nodes in an Aurora DB
cluster are patched at the same time. We are enabling zero-downtime patching, which works on a best-
effort basis to preserve client connections through the patching process. For more information, see
Maintaining an Amazon Aurora DB Cluster (p. 328).
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support. For more information, see Maintaining an
Amazon Aurora DB Cluster (p. 328).
791
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
Improvements
• Fixed an issue in the adaptive segment selector for a read request that would cause it to choose the
same segment twice causing a spike in read latency under certain conditions.
• Fixed an issue that stems from an optimization in Aurora MySQL for the thread scheduler. This
problem manifests itself into what are spurious errors while writing to the slow log, while the
associated queries themselves perform fine.
• Fixed an issue with stability of read replicas on large (> 5 TB) volumes.
• Fixed an issue where worker thread count increases continuously due to a bogus outstanding
connection count.
• Fixed an issue with table locks that caused long semaphore waits during insert workloads.
• Reverted the following MySQL bug fixes included in Aurora MySQL 1.15:
• MySQL instance stalling “doing SYNC index” (Bug #73816)
• Assert RBT_EMPTY(INDEX_CACHE->WORDS) in ALTER TABLE CHANGE COLUMN (Bug #17536995)
• InnoDB Fulltext search doesn't find records when savepoints are involved (Bug #70333)
Aurora MySQL 1.15 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora 1.15. You have the option, but are not required, to upgrade existing
DB clusters to Aurora 1.15. You can create new DB clusters in Aurora 1.14.1. You can do so using the AWS
CLI or the Amazon RDS API and specifying the engine version.
With version 1.15 of Aurora, we are using a cluster patching model where all nodes in an Aurora DB
cluster are patched at the same time. Updates require a database restart, so you will experience 20 to 30
seconds of downtime, after which you can resume using your DB cluster or clusters. If your DB clusters
are currently running Aurora 1.14 or Aurora 1.14.1, the zero-downtime patching feature in Aurora
MySQL might allow client connections to your Aurora MySQL primary instance to persist through the
upgrade, depending on your workload.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support. For more information, see Maintaining an
Amazon Aurora DB Cluster (p. 328).
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
New Features
• Asynchronous Key Prefetch – Asynchronous key prefetch (AKP) is a feature targeted to improve
the performance of non-cached index joins, by prefetching keys in memory ahead of when they
792
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
are needed. The primary use case targeted by AKP is an index join between a small outer and large
inner table, where the index is highly selective on the larger table. Also, when the Multi-Range Read
(MRR) interface is enabled, AKP will be leveraged for a secondary to primary index lookup. Smaller
instances which have memory constraints might in some cases be able to leverage AKP, given the
right key cardinality. For more information, see Working with Asynchronous Key Prefetch in Amazon
Aurora (p. 703).
• Fast DDL – We have extended the feature that was released in Aurora 1.13 (p. 796) to operations
that include default values. With this extension, Fast DDL is applicable for operations that add
a nullable column at the end of a table, with or without default values. The feature remains
under Aurora lab mode. For more information, see Altering Tables in Amazon Aurora Using Fast
DDL (p. 568).
Improvements
• Fixed a calculation error during optimization of WITHIN/CONTAINS spatial queries which previously
resulted in an empty result set.
• Fixed SHOW VARIABLE command to show the updated innodb_buffer_pool_size parameter value
whenever it is changed in the parameter group.
• Improved stability of primary instance during bulk insert into a table altered using Fast DDL when
adaptive hash indexing is disabled and the record to be inserted is the first record of a page.
• Improved stability of Aurora when the user attempts to set server_audit_events DB cluster parameter
value to default.
• Fixed an issue in which a database character set change for an ALTER TABLE statement that ran on the
Aurora primary instance was not being replicated on the Aurora Replicas until they were restarted.
• Improved stability by fixing a race condition on the primary instance which previously allowed it to
register an Aurora Replica even if the primary instance had closed its own volume.
• Improved performance of the primary instance during index creation on a large table by changing the
locking protocol to enable concurrent data manipulation language (DML) statements during index
build.
• Fixed InnoDB metadata inconsistency during ALTER TABLE RENAME query which improved stability.
Example: When columns of table t1(c1, c2) are renamed cyclically to t1(c2,c3) within the same ALTER
statement.
• Improved stability of Aurora Replicas for the scenario where an Aurora Replica has no active workload
and the primary instance is unresponsive.
• Improved availability of Aurora Replicas for a scenario in which the Aurora Replica holds an explicit
lock on a table and blocks the replication thread from applying any DDL changes received from the
primary instance.
• Improved stability of the primary instance when a foreign key and a column are being added to a table
from two separate sessions at the same time and Fast DDL has been enabled.
• Improved stability of the purge thread on the primary instance during a heavy write workload by
blocking truncate of undo records until they have been purged.
• Improved stability by fixing the lock release order during commit process of transactions which drop
tables.
• Fixed a defect for Aurora Replicas in which the DB instance could not complete startup and
complained that port 3306 was already in use.
• Fixed a race condition in which a SELECT query run on certain information_schema tables (innodb_trx,
innodb_lock, innodb_lock_waits) increased cluster instability.
793
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• The partitioning engine adds fields to the read bit set to be able to return entries sorted from a
partitioned index. This leads to the join buffer will try to read unneeded fields. Fixed by not adding all
partitioning fields to the read_set,but instead only sort on the already set prefix fields in the read_set.
Added a DBUG_ASSERT that if doing key_cmp, at least the first field must be read (Bug #16367691).
• MySQL instance stalling “doing SYNC index” (Bug #73816)
• Assert RBT_EMPTY(INDEX_CACHE->WORDS) in ALTER TABLE CHANGE COLUMN (Bug #17536995)
• InnoDB Fulltext search doesn't find records when savepoints are involved (Bug #70333)
Aurora MySQL 1.14.4 is generally available. You can create new DB clusters in Aurora 1.14.4, using the
AWS CLI or the Amazon RDS API and specifying the engine version. You have the option, but are not
required, to upgrade existing 1.14.x DB clusters to Aurora 1.14.4.
With version 1.14.4 of Aurora, we are using a cluster-patching model where all nodes in an Aurora DB
cluster are patched at the same time. We support zero-downtime patching, which works on a best-effort
basis to preserve client connections through the patching process. For more information, see Maintaining
an Amazon Aurora DB Cluster (p. 328).
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support. For more information, see Maintaining an
Amazon Aurora DB Cluster (p. 328).
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
New Features
• Aurora MySQL now supports db.r4 instance classes.
Improvements
• Fixed an issue where LOST_EVENTS were generated when writing large binlog events.
Aurora MySQL 1.14.1 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora MySQL 1.14.1. Aurora MySQL 1.14.1 is also a mandatory upgrade for
existing Aurora MySQL DB clusters. For more information, see Announcement: Extension to Mandatory
Upgrade Schedule for Amazon Aurora on the AWS Developer Forums website.
794
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
With version 1.14.1 of Aurora MySQL, we are using a cluster patching model where all nodes in an
Aurora MySQL DB cluster are patched at the same time. Updates require a database restart, so you will
experience 20 to 30 seconds of downtime, after which you can resume using your DB cluster or clusters.
If your DB clusters are currently running version 1.13 or greater, the zero-downtime patching feature in
Aurora MySQL might allow client connections to your Aurora MySQL primary instance to persist through
the upgrade, depending on your workload.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support.
Improvements
• Fixed race conditions associated with inserts and purge to improve the stability of the Fast DDL
feature, which remains in Aurora MySQL lab mode.
Aurora MySQL 1.14 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora MySQL 1.14. Aurora MySQL 1.14 is also a mandatory upgrade
for existing Aurora MySQL DB clusters. We will send a separate announcement with the timeline for
deprecating earlier versions of Aurora MySQL.
With version 1.14 of Aurora MySQL, we are using a cluster patching model where all nodes in an Aurora
DB cluster are patched at the same time. Updates require a database restart, so you will experience
20 to 30 seconds of downtime, after which you can resume using your DB cluster or clusters. If your
DB clusters are currently running version 1.13, Aurora's zero-downtime patching feature may allow
client connections to your Aurora primary instance to persist through the upgrade, depending on your
workload.
If you have any questions or concerns, AWS Support is available on the community forums and through
AWS Premium Support at http://aws.amazon.com/support.
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
Improvements
• Fixed an incorrect "record not found" error when a record is found in the secondary index but not in
the primary index.
• Fixed a stability issue that can occur due to a defensive assertion (added in 1.12) that was too strong
in the case when an individual write spans over 32 pages. Such a situation can occur, for instance, with
large BLOB values.
• Fixed a stability issue because of inconsistencies between the tablespace cache and the dictionary
cache.
• Fixed an issue in which an Aurora Replica becomes unresponsive after it has exceeded the maximum
number of attempts to connect to the primary instance. An Aurora Replica now restarts if the period of
inactivity is more than the heartbeat time period used for health check by the primary instance.
• Fixed a livelock that can occur under very high concurrency when one connection tries to acquire an
exclusive meta data lock (MDL) while issuing a command, such as ALTER TABLE.
• Fixed a stability issue in an Aurora Read Replica in the presence of logical/parallel read ahead.
• Improved LOAD FROM S3 in two ways:
795
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
1. Better handling of Amazon S3 timeout errors by using the SDK retry in addition to the existing retry.
2. Performance optimization when loading very big files or large numbers of files by caching and
reusing client state.
• Fixed the following stability issues with Fast DDL for ALTER TABLE operations:
1. When the ALTER TABLE statement has multiple ADD COLUMN commands and the column names
are not in ascending order.
2. When the name string of the column to be updated and its corresponding name string, fetched
from the internal system table, differs by a null terminating character (/0).
3. Under certain B-tree split operations.
4. When the table has a variable length primary key.
• Fixed a stability issue with Aurora Replicas when it takes too long to make its Full Text Search (FTS)
index cache consistent with that of the primary instance. This can happen if a large portion of the
newly created FTS index entries on the primary instance have not yet been flushed to disk.
• Fixed a stability issue that can happen during index creation.
• New infrastructure that tracks memory consumption per connection and associated telemetry that will
be used for building out Out-Of-Memory (OOM) avoidance strategies.
• Fixed an issue where ANALYZE TABLE was incorrectly allowed on Aurora Replicas. This has now been
blocked.
• Fixed a stability issue caused by a rare deadlock as a result of a race condition between logical read-
ahead and purge.
Aurora MySQL 1.13 is generally available. All new database clusters, including those restored from
snapshots, will be created in Aurora MySQL 1.13. You have the option, but are not required, to upgrade
existing database clusters to Aurora MySQL 1.13. With version 1.13 of Aurora, we are using a cluster
patching model where all nodes in an Aurora DB cluster are patched at the same time. We are enabling
zero-downtime patching, which works on a best-effort basis to preserve client connections through the
patching process. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Zero-Downtime Patching
The zero-downtime patching (ZDP) feature attempts, on a best-effort basis, to preserve client
connections through an engine patch. For more information about ZDP, see Zero-Downtime
Patching (p. 735).
New Features:
• SELECT INTO OUTFILE S3 – Aurora MySQL now allows you to upload the results of a query to one or
more files in an Amazon S3 bucket. For more information, see Saving Data from an Amazon Aurora
MySQL DB Cluster into Text Files in an Amazon S3 Bucket (p. 673).
796
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Improvements:
• Implemented truncation of CSV format log files at engine startup to avoid long recovery time. The
general_log_backup, general_log, slow_log_backup, and slow_log tables now don't survive
a database restart.
• Fixed an issue where migration of a database named test would fail.
• Improved stability in the lock manager’s garbage collector by reusing the correct lock segments.
• Improved stability of the lock manager by removing invalid assertions during deadlock detection
algorithm.
• Re-enabled asynchronous replication, and fixed an associated issue which caused incorrect replica lag
to be reported under no-load or read-only workload. The replication pipeline improvements that were
introduced in version 1.10. These improvements were introduced in order to apply log stream updates
to the buffer cache of an Aurora Replica. which helps to improve read performance and stability on
Aurora Replicas.
• Fixed an issue where autocommit=OFF leads to scheduled events being blocked and long transactions
being held open until the server reboots.
• Fixed an issue where general, audit, and slow query logs could not log queries handled by
asynchronous commit.
• Improved the performance of the logical read ahead (LRA) feature by up to 2.5 times. This was done by
allowing pre-fetches to continue across intermediate pages in a B-tree.
• Added parameter validation for audit variables to trim unnecessary spaces.
• Fixed a regression, introduced in Aurora MySQL version 1.11, in which queries can return incorrect
results when using the SQL_CALC_FOUND_ROWS option and invoking the FOUND_ROWS() function.
• Fixed a stability issue when the Metadata Lock list was incorrectly formed.
• Improved stability when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH and the command SHOW
FUNCTION STATUS WHERE Db='string' is executed.
• Fixed a rare case when instances would not come up after Aurora version upgrade because of a false
volume consistency check.
• Fixed the performance issue, introduced in Aurora MySQL version 1.12, where the performance of the
Aurora writer was reduced when users have a large number of tables.
• Improved stability issue when the Aurora writer is configured as a binlog slave and the number of
connections approaches 16,000.
• Fixed a rare issue where an Aurora Replica could restart when a connection gets blocked waiting for
Metadata Lock when running DDL on the Aurora master.
797
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Aurora MySQL 1.12 is now the preferred version for the creation of new DB clusters, including restores
from snapshots.
This is not a mandatory upgrade for existing clusters. You will have the option to upgrade existing
clusters to version 1.12 after we complete the fleet-wide patch to 1.11 (see Aurora 1.11 release
notes (p. 799) and corresponding forum announcement). With version 1.12 of Aurora, we are using a
cluster patching model where all nodes in an Aurora DB cluster are patched at the same time. For more
information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
New Features
• Fast DDL – Aurora MySQL now allows you to execute an ALTER TABLE tbl_name ADD COLUMN
col_name column_definition operation nearly instantaneously. The operation completes without
requiring the table to be copied and without materially impacting other DML statements. Since it does
not consume temporary storage for a table copy, it makes DDL statements practical even for large
tables on small instance classes. Fast DDL is currently only supported for adding a nullable column,
without a default value, at the end of a table. This feature is currently available in Aurora lab mode.
For more information, see Altering Tables in Amazon Aurora Using Fast DDL (p. 568).
• Show volume status – We have added a new monitoring command, SHOW VOLUME STATUS, to
display the number of nodes and disks in a volume. For more information, see Displaying Volume
Status for an Aurora DB Cluster (p. 569).
Improvements
• Implemented changes to lock compression to further reduce memory allocated per lock object. This
improvement is available in lab mode.
• Fixed an issue where the trx_active_transactions metric decrements rapidly even when the
database is idle.
• Fixed an invalid error message regarding fault injection query syntax when simulating failure in disks
and nodes.
• Fixed multiple issues related to race conditions and dead latches in the lock manager.
• Fixed an issue causing a buffer overflow in the query optimizer.
• Fixed a stability issue in Aurora read replicas when the underlying storage nodes experience low
available memory.
• Fixed an issue where idle connections persisted past the wait_timeout parameter setting.
• Fixed an issue where query_cache_size returns an unexpected value after reboot of the instance.
• Fixed a performance issue that is the result of a diagnostic thread probing the network too often in the
event that writes are not progressing to storage.
798
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
We will patch all Aurora MySQL DB clusters with the latest version over a short period following the
release. DB clusters are patched using the legacy procedure with a downtime of about 5-30 seconds.
Patching occurs during the system maintenance window that you have specified for each of your
database instances. You can view or change this window using the AWS Management Console. For more
information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Alternatively, you can apply the patch immediately in the AWS Management Console by choosing a DB
cluster, choosing Cluster Actions, and then choosing Upgrade Now.
With version 1.11 of Aurora MySQL, we are using a cluster patching model where all nodes in an Aurora
DB cluster are patched at the same time.
New Features
• MANIFEST option for LOAD DATA FROM S3 – LOAD DATA FROM S3 was released in version 1.8. The
options for this command have been expanded, and you can now specify a list of files to be loaded
into an Aurora DB cluster from Amazon S3 by using a manifest file. This makes it easy to load data
from specific files in one or more locations, as opposed to loading data from a single file by using
the FILE option or loading data from multiple files that have the same location and prefix by using
the PREFIX option. The manifest file format is the same as that used by Amazon Redshift. For more
information about using LOAD DATA FROM S3 with the MANIFEST option, see Using a Manifest to
Specify Data Files to Load (p. 668).
• Spatial indexing enabled by default – This feature was released in lab mode in version 1.10, and is
now turned on by default. Spatial indexing improves query performance on large datasets for queries
that use spatial data. For more information about using spatial indexing, see Amazon Aurora MySQL
and Spatial Data (p. 506).
• Advanced Auditing timing change – This feature was released in version 1.10.1 to provide a
high-performance facility for auditing database activity. In this release, the precision of audit log
timestamps has been changed from one second to one microsecond. The more accurate timestamps
allow you to better understand when an audit event happened. For more information about audit, see
Using Advanced Auditing with an Amazon Aurora MySQL DB Cluster (p. 595).
Improvements
• Modified the thread_handling parameter to prevent you from setting it to anything other than
multiple-connections-per-thread, which is the only supported model with Aurora’s thread
pool.
• Fixed an issue caused when you set either the buffer_pool_size or the query_cache_size
parameter to be larger than the DB cluster's total memory. In this circumstance, Aurora sets the
modified parameter to the default value, so the DB cluster can start up and not crash.
• Fixed an issue in the query cache where a transaction gets stale read results if the table is invalidated
in another transaction.
• Fixed an issue where binlog files marked for deletion are removed after a small delay rather than right
away.
• Fixed an issue where a database created with the name tmp is treated as a system database stored on
ephemeral storage and not persisted to Aurora distributed storage.
• Modified the behavior of SHOW TABLES to exclude certain internal system tables. This change helps
avoid an unnecessary failover caused by mysqldump locking all files listed in SHOW TABLES, which in
turn prevents writes on the internal system table, causing the failover.
799
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Fixed an issue where an Aurora Replica incorrectly restarts when creating a temporary table from a
query that invokes a function whose argument is a column of an InnoDB table.
• Fixed an issue related to a metadata lock conflict in an Aurora Replica node that causes the Aurora
Replica to fall behind the primary DB cluster and eventually get restarted.
• Fixed a dead latch in the replication pipeline in reader nodes, which causes an Aurora Replica to fall
behind and eventually get restarted.
• Fixed an issue where an Aurora Replica lags too much with encrypted volumes larger than 1 terabyte
(TB).
• Improved Aurora Replica dead latch detection by using an improved way to read the system clock time.
• Fixed an issue where an Aurora Replica can restart twice instead of once following de-registration by
the writer.
• Fixed a slow query performance issue on Aurora Replicas that occurs when transient statistics cause
statistics discrepancy on non-unique index columns.
• Fixed an issue where an Aurora Replica can crash when a DDL statement is replicated on the Aurora
Replica at the same time that the Aurora Replica is processing a related query.
• Changed the replication pipeline improvements that were introduced in version 1.10 from enabled
by default to disabled by default. These improvements were introduced in order to apply log stream
updates to the buffer cache of an Aurora Replica, and although this feature helps to improve read
performance and stability on Aurora Replicas, it increases replica lag in certain workloads.
• Fixed an issue where the simultaneous occurrence of an ongoing DDL statement and pending Parallel
Read Ahead on the same table causes an assertion failure during the commit phase of the DDL
transaction.
• Enhanced the general log and slow query log to survive DB cluster restart.
• Fixed an out-of-memory issue for certain long running queries by reducing memory consumption in
the ACL module.
• Fixed a restart issue that occurs when a table has non-spatial indexes, there are spatial predicates
in the query, the planner chooses to use a non-spatial index, and the planner incorrectly pushes the
spatial condition down to the index.
• Fixed an issue where the DB cluster restarts when there is a delete, update, or purge of very large
geospatial objects that are stored externally (like LOBs).
• Fixed an issue where fault simulation using ALTER SYSTEM SIMULATE … FOR INTERVAL isn't working
properly.
• Fixed a stability issue caused by an invalid assertion on an incorrect invariant in the lock manager.
• Disabled the following two improvements to InnoDB Full-Text Search that were introduced in version
1.10 because they introduce stability issues for some demanding workloads:
• Updating the cache only after a read request to an Aurora Replica in order to improve full-text
search index cache replication speed.
• Offloading the cache sync task to a separate thread as soon as the cache size crosses 10% of the
total size, in order to avoid MySQL queries stalling for too long during FTS cache sync to disk. (Bugs
#22516559, #73816).
800
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Version 1.10.1 of Aurora MySQL is an opt-in version and is not used to patch your database instances.
It is available for creating new Aurora instances and for upgrading existing instances. You can apply the
patch by choosing a cluster in the Amazon RDS console, choosing Cluster Actions, and then choosing
Upgrade Now. Patching requires a database restart with downtime typically lasting 5-30 seconds, after
which you can resume using your DB clusters. This patch is using a cluster patching model where all
nodes in an Aurora cluster are patched at the same time.
New Features
• Advanced Auditing – Aurora MySQL provides a high-performance Advanced Auditing feature, which
you can use to audit database activity. For more information about enabling and using Advanced
Auditing, see Using Advanced Auditing with an Amazon Aurora MySQL DB Cluster (p. 595).
Improvements
• Fixed an issue with spatial indexing when creating a column and adding an index on it in the same
statement.
• Fixed an issue where spatial statistics aren't persisted across DB cluster restart.
New Features
• Zero downtime patch – This feature allows a DB instance to be patched without any downtime. That
is, database upgrades are performed without disconnecting client applications, or rebooting the
database. This approach increases the availability of your Aurora DB clusters during the maintenance
window. Note that temporary data like that in the performance schema is reset during the upgrade
process. This feature applies to service-delivered patches during a maintenance window as well as
user-initiated patches.
When a patch is initiated, the service ensures there are no open locks, transactions or temporary
tables, and then waits for a suitable window during which the database can be patched and restarted.
Application sessions are preserved, although there is a drop in throughput while the patch is in
progress (for approximately 5 seconds). If no suitable window can be found, then patching defaults to
the standard patching behavior.
Zero downtime patching takes place on a best-effort basis, subject to certain limitations as described
following:
• This feature is currently applicable for patching single-node DB clusters or writer instances in multi-
node DB clusters.
• SSL connections are not supported in conjunction with this feature. If there are active SSL
connections, Amazon Aurora MySQL won't perform a zero downtime patch, and instead will retry
periodically to see if the SSL connections have terminated. If they have, zero downtime patching
proceeds. If the SSL connections persist after more than a couple seconds, standard patching with
downtime proceeds.
• The feature is available in Aurora release 1.10 and beyond. Going forward, we will identify any
releases or patches that can't be applied by using zero downtime patching.
• This feature is not applicable if replication based on binary logging is active.
801
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Spatial indexing – Spatial indexing improves query performance on large datasets for queries that
use spatial data. For more information about using spatial indexing, see Amazon Aurora MySQL and
Spatial Data (p. 506).
This feature is disabled by default and can be activated by enabling Aurora lab mode. For information,
see Amazon Aurora MySQL Lab Mode (p. 700).
• Replication pipeline improvements – Aurora MySQL now uses an improved mechanism to apply log
stream updates to the buffer cache of an Aurora Replica. This feature improves the read performance
and stability on Aurora Replicas when there is a heavy write load on the master as well as a significant
read load on the Replica. This feature is enabled by default.
• Throughput improvement for workloads with cached reads – Aurora MySQL now uses a latch-free
concurrent algorithm to implement read views, which leads to better throughput for read queries
served by the buffer cache. As a result of this and other improvements, Amazon Aurora MySQL can
achieve throughput of up to 625K reads per second compared to 164K reads per second by MySQL 5.7
for a SysBench SELECT-only workload.
• Throughput improvement for workloads with hot row contention – Aurora MySQL uses a new lock
release algorithm that improves performance, particularly when there is hot page contention (that is,
many transactions contending for the rows on the same page). In tests with the TPC-C benchmark, this
can result in up to16x throughput improvement in transactions per minute relative to MySQL 5.7. This
feature is disabled by default and can be activated by enabling Aurora lab mode. For information, see
Amazon Aurora MySQL Lab Mode (p. 700).
Improvements
• Full-text search index cache replication speed has been improved by updating the cache only after a
read request to an Aurora Replica. This approach avoids any reads from disk by the replication thread.
• Fixed an issue where dictionary cache invalidation does not work on an Aurora Replica for tables that
have a special character in the database name or table name.
• Fixed a STUCK IO issue during data migration for distributed storage nodes when storage heat
management is enabled.
• Fixed an issue in the lock manager where an assertion check fails for the transaction lock wait thread
when preparing to rollback or commit a transaction.
• Fixed an issue when opening a corrupted dictionary table by correctly updating the reference count to
the dictionary table entries.
• Fixed a bug where the DB cluster minimum read point can be held by slow Aurora Replicas.
• Fixed a potential memory leak in the query cache.
• Fixed a bug where an Aurora Replica places a row-level lock on a table when a query is used in an IF
statement of a stored procedure.
802
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
New Features
• Improved index build – The implementation for building secondary indexes now operates by building
the index in a bottom-up fashion, which eliminates unnecessary page splits. This can reduce the time
needed to create an index or rebuild a table by up to 75% (based on an db.r3.8xlarge DB instance
class). This feature was in lab mode in Aurora MySQL version 1.7 and is enabled by default in Aurora
version 1.9 and later. For information, see Amazon Aurora MySQL Lab Mode (p. 700).
• Lock compression (lab mode) – This implementation significantly reduces the amount of memory
that lock manager consumes by up to 66%. Lock manager can acquire more row locks without
encountering an out-of-memory exception. This feature is disabled by default and can be activated by
enabling Aurora lab mode. For information, see Amazon Aurora MySQL Lab Mode (p. 700).
• Performance schema – Aurora MySQL now includes support for performance schema with minimal
impact on performance. In our testing using SysBench, enabling performance schema could degrade
MySQL performance by up to 60%.
SysBench testing of an Aurora DB cluster showed an impact on performance that is 4x less than
MySQL. Running the db.r3.8xlarge DB instance class resulted in 100K SQL writes/sec and over
550K SQL reads/sec, even with performance schema enabled.
• Hot row contention improvement – This feature reduces CPU utilization and increases throughput
when a small number of hot rows are accessed by a large number of connections. This feature also
eliminates error 188 when there is hot row contention.
• Improved out-of-memory handling – When non-essential, locking SQL statements are executed and
the reserved memory pool is breached, Aurora forces rollback of those SQL statements. This feature
frees memory and prevents engine crashes due to out-of-memory exceptions.
• Smart read selector – This implementation improves read latency by choosing the optimal storage
segment among different segments for every read, resulting in improved read throughput. SysBench
testing has shown up to a 27% performance increase for write workloads .
Improvements
• Fixed an issue where an Aurora Replica encounters a shared lock during engine start up.
• Fixed a potential crash on an Aurora Replica when the read view pointer in the purge system is NULL.
Improvements
• Fixed an issue where bulk inserts that use triggers that invoke AWS Lambda procedures fail.
• Fixed an issue where catalog migration fails when autocommit is off globally.
• Resolved a connection failure to Aurora when using SSL and improved Diffie-Hellman group to deal
with LogJam attacks.
803
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
New Features
• AWS Lambda integration – You can now asynchronously invoke an AWS Lambda function from an
Aurora DB cluster using the mysql.lambda_async procedure. For more information, see Invoking a
Lambda Function from an Amazon Aurora MySQL DB Cluster (p. 678).
• Load data from Amazon S3 – You can now load text or XML files from an Amazon S3 bucket into
your Aurora DB cluster using the LOAD DATA FROM S3 or LOAD XML FROM S3 commands. For more
information, see Loading Data into an Amazon Aurora MySQL DB Cluster from Text Files in an Amazon
S3 Bucket (p. 665).
• Catalog migration – Aurora now persists catalog metadata in the cluster volume to support
versioning. This enables seamless catalog migration across versions and restores.
• Cluster-level maintenance and patching – Aurora now manages maintenance updates for an entire
DB cluster. For more information, see Maintaining an Amazon Aurora DB Cluster (p. 328).
Improvements
• Fixed an issue where an Aurora Replica crashes when not granting a metadata lock to an inflight DDL
table.
• Allowed Aurora Replicas to modify non-InnoDB tables to facilitate rotation of the slow and general log
CSV files where log_output=TABLE.
• Fixed a lag when updating statistics from the primary instance to an Aurora Replica. Without this fix,
the statistics of the Aurora Replica can get out of sync with the statistics of the primary instance and
result in a different (and possibly under-performing) query plan on an Aurora Replica.
• Fixed a race condition that ensures that an Aurora Replica does not acquire locks.
• Fixed a rare scenario where an Aurora Replica that registers or de-registers with the primary instance
could fail.
• Fixed a race condition that could lead to a deadlock on db.r3.large instances when opening or
closing a volume.
• Fixed an out-of-memory issue that can occur due to a combination of a large write workload and
failures in the Aurora Distributed Storage service.
• Fixed an issue with high CPU consumption because of the purge thread spinning in the presence of a
long-running transaction.
• Fixed an issue when running information schema queries to get information about locks under heavy
load.
• Fixed an issue with a diagnostics process that could in rare cases cause Aurora writes to storage nodes
to stall and restart/fail-over.
• Fixed a condition where a successfully created table might be deleted during crash recovery if the
crash occurred while a CREATE TABLE [if not exists] statement was being handled.
• Fixed a case where the log rotation procedure is broken when the general log and slow log are not
stored on disk using catalog mitigation.
• Fixed a crash when a user creates a temporary table within a user defined function, and then uses the
user defined function in the select list of the query.
• Fixed a crash that occurred when replaying GTID events. GTID is not supported by Aurora MySQL.
804
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Fixed an auto-increment bug when a user alters a table to change the AUTO_INCREMENT value to less
than the maximum auto-increment column value. (Bug # 16310273)
Improvements
• Fixes an issue where an Aurora Replica crashes if the InnoDB full-text search cache is full.
• Fixes an issue where the database engine crashes if a worker thread in the thread pool waits for itself.
• Fixes an issue where an Aurora Replica crashes if a metadata lock on a table causes a deadlock.
• Fixes an issue where the database engine crashes due to a race condition between two worker threads
in the thread pool.
• Fixes an issue where an unnecessary failover occurs under heavy load if the monitoring agent doesn't
detect the advancement of write operations to the distributed storage subsystem.
New Features
• NUMA aware scheduler – The task scheduler for the Aurora MySQL engine is now Non-Uniform
Memory Access (NUMA) aware. This minimizes cross-CPU socket contention resulting in improved
performance throughput for the db.r3.8xlarge DB instance class.
• Parallel read-ahead operates asynchronously in the background – Parallel read-ahead has been
revised to improve performance by using a dedicated thread to reduce thread contention.
• Improved index build (lab mode) – The implementation for building secondary indexes now operates
by building the index in a bottom-up fashion, which eliminates unnecessary page splits. This can
reduce the time needed to create an index or rebuild a table. This feature is disabled by default and
can be activated by enabling Aurora lab mode. For information, see Amazon Aurora MySQL Lab
Mode (p. 700).
Improvements
• Fixed an issue where establishing a connection was taking a long time if there was a surge in the
number of connections requested for an instance.
• Fixed an issue where a crash occurred if ALTER TABLE was run on a partitioned table that did not use
InnoDB.
• Fixed an issue where heavy write workload can cause a failover.
• Fixed an erroneous assertion that caused a failure if RENAME TABLE was run on a partitioned table.
• Improved stability when rolling back a transaction during insert-heavy workload.
• Fixed an issue where full-text search indexes were not viable on an Aurora Replica.
805
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• MySQL gives the wrong result with some special usage. (Bug #11751794)
• Crash in GET_SEL_ARG_FOR_KEYPART – caused by patch for bug #11751794. (Bug #16208709)
• Wrong results for a simple query with GROUP BY. (Bug #17909656)
• Extra rows on semijoin query with range predicates. (Bug #16221623)
• Adding an ORDER BY clause following an IN subquery could cause duplicate rows to be returned. (Bug
#16308085)
• Crash with explain for a query with loose scan for GROUP BY, MyISAM. (Bug #16222245)
• Loose index scan with quoted int predicate returns random data. (Bug #16394084)
• If the optimizer was using a loose index scan, the server could exit while attempting to create a
temporary table. (Bug #16436567)
• COUNT(DISTINCT) should not count NULL values, but they were counted when the optimizer used
loose index scan. (Bug #17222452)
• If a query had both MIN()/MAX() and aggregate_function(DISTINCT) (for example, SUM(DISTINCT))
and was executed using loose index scan, the result values of MIN()/MAX() were set improperly. (Bug
#17217128)
New Features
• Efficient storage of Binary Logs – Efficient storage of binary logs is now enabled by default for all
Aurora MySQL DB clusters, and is not configurable. Efficient storage of binary logs was introduced
in the April 2016 update. For more information, see Aurora MySQL Database Engine Updates:
2016-04-06 (p. 806).
Improvements
• Improved stability for Aurora Replicas when the primary instance is encountering a heavy workload.
• Improved stability for Aurora Replicas when running queries on partitioned tables and tables with
special characters in the table name.
• Fixed connection issues when using secure connections.
New Features
• Parallel read-ahead – Parallel read-ahead is now enabled by default for all Aurora MySQL DB clusters,
and is not configurable. Parallel read-ahead was introduced in the December 2015 update. For more
information, see Aurora MySQL Database Engine Updates: 2015-12-03 (p. 808).
806
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
In addition to enabling parallel read-ahead by default, this release includes the following
improvements to parallel read-ahead:
• Improved logic so that parallel read-ahead is less aggressive, which is beneficial when your DB
cluster encounters many parallel workloads.
• Improved stability on smaller tables.
• Efficient storage of Binary Logs (lab mode) – MySQL binary log files are now stored more efficiently
in Aurora MySQL. The new storage implementation enables binary log files to be deleted much earlier
and improves system performance for an instance in an Aurora MySQL DB cluster that is a binary log
replication master.
To enable efficient storage of binary logs, set the aurora_lab_mode parameter to 1 in the parameter
group for your primary instance or Aurora Replica. The aurora_lab_mode parameter is an instance-
level parameter that is in the default.aurora5.6 parameter group by default. For information on
modifying a DB parameter group, see Modifying Parameters in a DB Parameter Group (p. 210). For
information on parameter groups and Aurora MySQL, see Aurora MySQL Parameters (p. 711).
Only turn on efficient storage of binary logs for instances in an Aurora MySQL DB cluster that are
MySQL binary log replication master instances.
• AURORA_VERSION system variable – You can now get the Aurora version of your Aurora MySQL DB
cluster by querying for the AURORA_VERSION system variable.
select AURORA_VERSION();
select @@aurora_version;
show variables like '%version';
You can also see the Aurora version in the AWS Management Console when you modify a DB cluster,
or by calling the describe-db-engine-versions AWS CLI command or the DescribeDBEngineVersions API
operation.
• Lock manager memory usage metric – Information about lock manager memory usage is now
available as a metric.
To get the lock manager memory usage metric, use one of the following queries:
Improvements
• Improved stability during binlog and XA transaction recovery.
• Fixed a memory issue resulting from a large number of connections.
• Improved accuracy in the following metrics: Read Throughput, Read IOPS, Read Latency, Write
Throughput, Write IOPS, Write Latency, and Disk Queue Depth.
• Fixed a stability issue causing slow startup for large instances after a crash.
• Improved concurrency in the data dictionary regarding synchronization mechanisms and cache
eviction.
• Stability and performance improvements for Aurora Replicas:
• Fixed a stability issue for Aurora Replicas during heavy or burst write workloads for the primary
instance.
807
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
Improvements
• Fixed a 10 second pause of write operations for idle instances during Aurora storage deployments.
• Logical read-ahead now works when innodb_file_per_table is set to No. For more information on
logical read-ahead, see Aurora MySQL Database Engine Updates: 2015-12-03 (p. 808).
• Fixed issues with Aurora Replicas reconnecting with the primary instance. This improvement also
fixes an issue when you specify a large value for the quantity parameter when testing Aurora
Replica failures using fault-injection queries. For more information, see Testing an Aurora Replica
Failure (p. 566).
• Improved monitoring of Aurora Replicas falling behind and restarting.
• Fixed an issue that caused an Aurora Replica to lag, become deregistered, and then restart.
• Fixed an issue when you run the show innodb status command during a deadlock.
• Fixed an issue with failovers for larger instances during high write throughput.
808
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
New Features
• Fast Insert – Accelerates parallel inserts sorted by primary key. For more information, see Amazon
Aurora MySQL Performance Enhancements (p. 505).
• Large dataset read performance – Aurora MySQL automatically detects an IO heavy workload and
launches more threads in order to boost the performance of the DB cluster. The Aurora scheduler looks
into IO activity and decides to dynamically adjust the optimal number of threads in the system, quickly
adjusting between IO heavy and CPU heavy workloads with low overhead.
• Parallel read-ahead – Improves the performance of B-Tree scans that are too large for the memory
available on your primary instance or Aurora Replica (including range queries). Parallel read-ahead
automatically detects page read patterns and pre-fetches pages into the buffer cache in advance of
when they are needed. Parallel read-ahead works multiple tables at the same time within the same
transaction.
Improvements:
• Fixed brief Aurora database availability issues during Aurora storage deployments.
• Correctly enforce the max_connection limit.
• Improve binlog purging where Aurora is the binlog master and the database is restarting after a heavy
data load.
• Fixed memory management issues with the table cache.
• Add support for huge pages in shared memory buffer cache for faster recovery.
• Fixed an issue with thread-local storage not being initialized.
• Allow 16K connections by default.
• Dynamic thread pool for IO heavy workloads.
• Fixed an issue with properly invalidating views involving UNION in the query cache.
• Fixed a stability issue with the dictionary stats thread.
• Fixed a memory leak in the dictionary subsystem related to cache eviction.
• Fixed high read latency issue on Aurora Replicas when there is very low write load on the master.
• Fixed stability issues on Aurora Replicas when performing operations on DDL partitioned tables such
as ALTER TABLE ... REORGANIZE PARTITION on the master.
• Fixed stability issues on Aurora Replicas during volume growth.
• Fixed performance issue for scans on non-clustered indexes in Aurora Replicas.
• Fix stability issue that makes Aurora Replicas lag and eventually get deregistered and re-started.
809
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• Mutex issue in SQL/SQL_SHOW.CC resulting in SIG6. Source likely FILL_VARIABLES. (Bug #20788853)
• Backport bug #18008907 to 5.5+ versions. (Bug #18903155)
• Adapt fix for a stack overflow error in MySQL 5.7. (Bug #19678930)
Fixes
• Resolved out-of-memory issue in the new lock manager with long-running transactions
• Resolved security vulnerability when replicating with non-RDS MySQL databases
• Updated to ensure that quorum writes retry correctly with storage failures
• Updated to report replica lag more accurately
• Improved performance by reducing contention when many concurrent transactions are trying to
modify the same row
• Resolved query cache invalidation for views that are created by joining two tables
• Disabled query cache for transactions with UNCOMMITTED_READ isolation
Improvements
• Better performance for slow catalog queries on warm caches
• Improved concurrency in dictionary statistics
• Better stability for the new query cache resource manager, extent management, files stored in Amazon
Aurora smart storage, and batch writes of log records
810
Amazon Aurora User Guide for Aurora
Database Engine Updates for Amazon Aurora MySQL 1.1
• A full-text query using Boolean mode could return zero results in some cases where the search term
was a quoted phrase. (Bug #16206253)
• The optimizer's attempt to remove redundant subquery clauses raised an assertion when executing a
prepared statement with a subquery in the ON clause of a join in a subquery. (Bug #16318585)
• GROUP_CONCAT unstable, crash in ITEM_SUM::CLEAN_UP_AFTER_REMOVAL. (Bug #16347450)
• Attempting to replace the default InnoDB full-text search (FTS) stopword list by creating an InnoDB
table with the same structure as INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD would
result in an error. (Bug #16373868)
• After the client thread on a slave performed a FLUSH TABLES WITH READ LOCK and was followed by
some updates on the master, the slave hung when executing SHOW SLAVE STATUS. (Bug #16387720)
• When parsing a delimited search string such as "abc-def" in a full-text search, InnoDB now uses the
same word delimiters as MyISAM. (Bug #16419661)
• Crash in FTS_AST_TERM_SET_WILDCARD. (Bug #16429306)
• SEGFAULT in FTS_AST_VISIT() for FTS RQG test. (Bug # 16435855)
• For debug builds, when the optimizer removed an Item_ref pointing to a subquery, it caused a server
exit. (Bug #16509874)
• Full-text search on InnoDB tables failed on searches for literal phrases combined with + or - operators.
(Bug #16516193)
• START SLAVE failed when the server was started with the options --master-info-repository=TABLE
relay-log-info-repository=TABLE and with autocommit set to 0, together with --skip-slave-start. (Bug
#16533802)
• Very large InnoDB full-text search (FTS) results could consume an excessive amount of memory. (Bug
#16625973)
• In debug builds, an assertion could occur in OPT_CHECK_ORDER_BY when using binary directly
in a search string, as binary might include NULL bytes and other non-meaningful characters. (Bug
#16766016)
• For some statements, memory leaks could result when the optimizer removed unneeded subquery
clauses. (Bug #16807641)
• It was possible to cause a deadlock after issuing FLUSH TABLES WITH READ LOCK by issuing STOP
SLAVE in a new connection to the slave, then issuing SHOW SLAVE STATUS using the original
connection. (Bug #16856735)
• GROUP_CONCAT() with an invalid separator could cause a server exit. (Bug #16870783)
• The server did excessive locking on the LOCK_active_mi and active_mi->rli->data_lock mutexes for
any SHOW STATUS LIKE 'pattern' statement, even when the pattern did not match status variables
that use those mutexes (Slave_heartbeat_period, Slave_last_heartbeat, Slave_received_heartbeats,
Slave_retried_transactions, Slave_running). (Bug #16904035)
• A full-text search using the IN BOOLEAN MODE modifier would result in an assertion failure. (Bug
#16927092)
• Full-text search on InnoDB tables failed on searches that used the + boolean operator. (Bug
#17280122)
• 4-way deadlock: zombies, purging binlogs, show processlist, show binlogs. (Bug #17283409)
• When an SQL thread which was waiting for a commit lock was killed and restarted it caused a
transaction to be skipped on slave. (Bug #17450876)
• An InnoDB full-text search failure would occur due to an "unended" token. The string and string length
should be passed for string comparison. (Bug #17659310)
• Large numbers of partitioned InnoDB tables could consume much more memory when used in MySQL
5.6 or 5.7 than the memory used by the same tables used in previous releases of the MySQL Server.
(Bug #17780517)
• For full-text queries, a failure to check that num_token is less than max_proximity_item could result in
an assertion. (Bug #18233051)
811
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
• Certain queries for the INFORMATION_SCHEMA TABLES and COLUMNS tables could lead to excessive
memory use when there were large numbers of empty InnoDB tables. (Bug #18592390)
• When committing a transaction, a flag is now used to check whether a thread has been created, rather
than checking the thread itself, which uses more resources, particularly when running the server with
master_info_repository=TABLE. (Bug #18684222)
• If a client thread on a slave executed FLUSH TABLES WITH READ LOCK while the master executed a
DML, executing SHOW SLAVE STATUS in the same client became blocked, causing a deadlock. (Bug
#19843808)
• Ordering by a GROUP_CONCAT() result could cause a server exit. (Bug #19880368)
• Replication stability improvements when replicating with a MySQL database (binlog replication). For
information on Aurora MySQL replication with MySQL, see Replication with Amazon Aurora (p. 60).
• A 1 gigabyte (GB) limit on the size of the relay logs accumulated for an Aurora MySQL DB cluster that
is a replication slave. This improves the file management for the Aurora DB clusters.
• Stability improvements in the areas of read ahead, recursive foreign-key relationships, and Aurora
replication.
• Integration of MySQL bug fixes.
• InnoDB databases with names beginning with a digit cause a full-text search (FTS) parser error. (Bug
#17607956)
• InnoDB full-text searches fail in databases whose names began with a digit. (Bug #17161372)
• For InnoDB databases on Windows, the full-text search (FTS) object ID is not in the expected
hexadecimal format. (Bug #16559254)
• A code regression introduced in MySQL 5.6 negatively impacted DROP TABLE and ALTER TABLE
performance. This could cause a performance drop between MySQL Server 5.5.x and 5.6.x. (Bug
#16864741)
• Simplified logging to reduce the size of log files and the amount of storage that they require.
Topics
• MySQL Bugs Fixed by Aurora MySQL 2.x Database Engine Updates (p. 812)
• MySQL Bugs Fixed by Aurora MySQL 1.x Database Engine Updates (p. 814)
812
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 2.07.0 • Bug #26251621: INCORRECT BEHAVIOR WITH TRIGGER AND
Database GCOL
Engine Updates • Bug #22574695: ASSERTION `!TABLE || (!TABLE->READ_SET ||
2019-11-25 (Version BITMAP_IS_SET(TABLE->READ_SET, FIEL
2.07.0) (p. 739)
• Bug #25966845: INSERT ON DUPLICATE KEY GENERATE A
DEADLOCK
• Bug #23070734: CONCURRENT TRUNCATE TABLES CAUSE STALL
• Bug #26191879: FOREIGN KEY CASCADES USE EXCESSIVE
MEMORY
• Bug #20989615: INNODB AUTO_INCREMENT PRODUCES SAME
VALUE TWICE
Aurora MySQL 2.05.0 • Bug#23054591: PURGE BINARY LOGS TO is reading the whole
Database binlog file and causing MySql to Stall
Engine Updates
2019-11-11 (Version
2.05.0) (p. 744)
Aurora MySQL 2.04.6 • Bug#23054591: PURGE BINARY LOGS TO is reading the whole
Database binlog file and causing MySql to Stall
Engine Updates
2019-09-19 (Version
2.04.6) (p. 749)
Aurora MySQL 2.03 • REVERSE SCAN ON A PARTITIONED TABLE DOES ICP - ORDER BY
Database DESC (Bug #24929748).
Engine Updates • JSON_OBJECT CREATES INVALID JSON CODE (Bug#26867509).
2018-10-11 (p. 760)
• INSERTING LARGE JSON DATA TAKES AN INORDINATE AMOUNT
OF TIME (Bug #22843444).
• PARTITIONED TABLES USE MORE MEMORY IN 5.7 THAN 5.6 (Bug
#25080442).
Aurora MySQL 2.02 Left join returns incorrect results on the outer side (Bug
Database #22833364)
Engine Updates
2018-05-03 (p. 765)
813
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.1 • InnoDB databases with names beginning with a digit cause a full-
Database text search (FTS) parser error. (Bug #17607956)
Engine Updates: • InnoDB full-text searches fail in databases whose names began
2015-08-24 (p. 812) with a digit. (Bug #17161372)
• For InnoDB databases on Windows, the full-text search (FTS)
object ID is not in the expected hexadecimal format. (Bug
#16559254)
• A code regression introduced in MySQL 5.6 negatively impacted
DROP TABLE and ALTER TABLE performance. This could cause a
performance drop between MySQL Server 5.5.x and 5.6.x. (Bug
#16864741)
Aurora MySQL 1.2, 1.3 • Killing a query inside innodb causes it to eventually crash with an
Database assertion. (Bug #1608883)
Engine Updates: • For failure to create a new thread for the event scheduler, event
2015-10-16 (p. 810) execution, or new connection, no message was written to the
error log. (Bug #16865959)
• If one connection changed its default database and
simultaneously another connection executed SHOW
PROCESSLIST, the second connection could access invalid
memory when attempting to display the first connection's
default database memory. (Bug #11765252)
• PURGE BINARY LOGS by design does not remove binary log files
that are in use or active, but did not provide any notice when this
occurred. (Bug #13727933)
• For some statements, memory leaks could result when the
optimizer removed unneeded subquery clauses. (Bug #15875919)
• During shutdown, the server could attempt to lock an
uninitialized mutex. (Bug #16016493)
• A prepared statement that used GROUP_CONCAT() and an
ORDER BY clause that named multiple columns could cause the
server to exit. ( Bug #16075310)
814
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
815
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
816
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.5 • Addressed incomplete fix in MySQL full text search affecting
Database tables where the database name begins with a digit. (Port Bug
Engine Updates: #17607956)
2016-01-11 (p. 808)
Aurora MySQL 1.6.5 • SLAVE CAN'T CONTINUE REPLICATION AFTER MASTER'S CRASH
Database RECOVERY (Port Bug #17632285)
Engine Updates:
2016-06-01 (p. 806)
817
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.8 • When dropping all indexes on a column with multiple indexes,
Database InnoDB failed to block a DROP INDEX operation when a foreign
Engine Updates: key constraint requires an index. (Bug #16896810)
2016-10-18 (p. 803) • Solve add foreign key constraint crash. (Bug #16413976)
• Fixed a crash when fetching a cursor in a stored procedure,
and analyzing or flushing the table at the same time. (Bug #
18158639)
• Fixed an auto-increment bug when a user alters a table to change
the AUTO_INCREMENT value to less than the maximum auto-
increment column value. (Bug # 16310273)
Aurora MySQL 1.8.1 • OpenSSL changed the Diffie-Hellman key length parameters due
Database to the LogJam issue. (Bug #18367167)
Engine Updates:
2016-10-26 (p. 803)
818
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.10 • UNION of derived tables returns wrong results with '1=0/false'-
Database clauses. (Bug #69471)
Engine Updates: • Server crashes in ITEM_FUNC_GROUP_CONCAT::FIX_FIELDS on
2016-12-14 (p. 801) 2nd execution of stored procedure. (Bug #20755389)
• Avoid MySQL queries from stalling for too long during FTS cache
sync to disk by offloading the cache sync task to a separate
thread, as soon as the cache size crosses 10% of the total size.
(Bugs #22516559, #73816)
Aurora MySQL 1.11 • Running ALTER table DROP foreign key simultaneously with
Database another DROP operation causes the table to disappear. (Bug
Engine Updates: #16095573)
2017-02-23 (p. 799) • Some INFORMATION_SCHEMA queries that used ORDER BY
did not use a filesort optimization as they did previously. (Bug
#16423536)
• FOUND_ROWS () returns the wrong count of rows on a table.
(Bug #68458)
• The server fails instead of giving an error when too many temp
tables are open. (Bug #18948649)
Aurora MySQL 1.12 • Reloading a table that was evicted while empty caused an
Database AUTO_INCREMENT value to be reset. (Bug #21454472, Bug
Engine Updates: #77743)
2017-04-05 (p. 797) • An index record was not found on rollback due to inconsistencies
in the purge_node_t structure. The inconsistency resulted in
warnings and error messages such as “error in sec index entry
update”, “unable to purge a record”, and “tried to purge sec index
entry not marked for deletion”. (Bug #19138298, Bug #70214,
Bug #21126772, Bug #21065746)
• Wrong stack size calculation for qsort operation leads to stack
overflow. (Bug #73979)
• Record not found in an index upon rollback. (Bug #70214, Bug
#72419)
• ALTER TABLE add column TIMESTAMP on update
CURRENT_TIMESTAMP inserts ZERO-datas (Bug #17392)
Aurora MySQL 1.13 • Reloading a table that was evicted while empty caused an
Database AUTO_INCREMENT value to be reset. (Bug #21454472, Bug
Engine Updates: #77743)
2017-05-15 (p. 796) • An index record was not found on rollback due to inconsistencies
in the purge_node_t structure. The inconsistency resulted in
warnings and error messages such as “error in sec index entry
update”, “unable to purge a record”, and “tried to purge sec index
entry not marked for deletion”. (Bug #19138298, Bug #70214,
Bug #21126772, Bug #21065746)
• Wrong stack size calculation for qsort operation leads to stack
overflow. (Bug #73979)
• Record not found in an index upon rollback. (Bug #70214, Bug
#72419)
• ALTER TABLE add column TIMESTAMP on update
CURRENT_TIMESTAMP inserts ZERO-datas (Bug #17392)
819
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.14 A full-text search combined with derived tables (subqueries in the
Database FROM clause) caused a server exit. Now, if a full-text operation
Engine Updates: depends on a derived table, the server produces an error indicating
2017-08-07 (p. 795) that a full-text search cannot be done on a materialized table. (Bug
#68751, Bug #16539903)
Aurora MySQL 1.14.4 • Ignorable events don't work and are not tested (Bug #74683)
Database • NEW->OLD ASSERT FAILURE 'GTID_MODE > 0' (Bug #20436436)
Engine Updates:
2018-03-13 (p. 794)
Aurora MySQL 1.15 • CREATE USER accepts plugin and password hash, but ignores the
Database password hash (Bug #78033)
Engine Updates • The partitioning engine adds fields to the read bit set to be able
2017-10-24 (p. 792) to return entries sorted from a partitioned index. This leads to
the join buffer will try to read unneeded fields. Fixed by not
adding all partitioning fields to the read_set,but instead only
sort on the already set prefix fields in the read_set. Added a
DBUG_ASSERT that if doing key_cmp, at least the first field must
be read (Bug #16367691).
• MySQL instance stalling “doing SYNC index” (Bug #73816)
• Assert RBT_EMPTY(INDEX_CACHE->WORDS) in ALTER TABLE
CHANGE COLUMN (Bug #17536995)
• InnoDB Fulltext search doesn't find records when savepoints are
involved (Bug #70333)
Aurora MySQL 1.15.1 • Reverted — MySQL instance stalling “doing SYNC index” (Bug
Database #73816)
Engine Updates • Reverted — Assert RBT_EMPTY(INDEX_CACHE->WORDS) in
2017-11-20 (p. 791) ALTER TABLE CHANGE COLUMN (Bug #17536995)
• Reverted — InnoDB Fulltext search doesn't find records when
savepoints are involved (Bug #70333)
Aurora MySQL 1.17.6 • For an ALTER TABLE statement that renamed or changed the
Database default value of a BINARY column, the alteration was done using
Engine Updates a table copy and not in place. (Bug #67141, Bug #14735373, Bug
2018-09-06 (p. 786) #69580, Bug #17024290)
• An outer join between a regular table and a derived table that is
implicitly groups could cause a server exit. (Bug #16177639)
820
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
Aurora MySQL 1.17.7 • Drop index on a foreign key column leads to missing table. (Bug
Database #16208542)
Engine Updates • Memory leak in add_derived_key(). (Bug #76349)
2018-10-08 (p. 785)
• For partitioned tables, queries could return different results
depending on whether Index Merge was used. (Bug #16862316)
• Queries using the index_merge optimization (see Index Merge
Optimization) could return invalid results when run against tables
that were partitioned by HASH. (Bug #17588348)
Aurora MySQL 1.17.8 • BUG #13418638: CREATE TABLE IF NOT EXISTS METADATA LOCK
Database IS TOO RESTRICTIVE
Engine Updates
2019-01-17 (p. 784)
Aurora MySQL 1.19.0 • BUG #32917: DETECT ORPHAN TEMP-POOL FILES, AND HANDLE
Database GRACEFULLY
Engine Updates • BUG #63144 CREATE TABLE IF NOT EXISTS METADATA LOCK IS
2019-02-07 (Version TOO RESTRICTIVE
1.19.0) (p. 782)
821
Amazon Aurora User Guide for Aurora
MySQL Bugs Fixed by Aurora MySQL Updates
822
Amazon Aurora User Guide for Aurora
Security with Aurora PostgreSQL
Aurora PostgreSQL can work with many industry standards. For example, you can use Aurora PostgreSQL
databases to build HIPAA-compliant applications and to store healthcare related information, including
protected health information (PHI), under an executed Business Associate Agreement (BAA) with AWS.
Aurora PostgreSQL is FedRAMP HIGH eligible. For details about AWS and compliance efforts, see AWS
Services In Scope by Compliance Program.
Topics
• Security with Amazon Aurora PostgreSQL (p. 823)
• Updating Applications to Connect to Aurora PostgreSQL DB Clusters Using New SSL/TLS
Certificates (p. 827)
• Migrating Data to Amazon Aurora with PostgreSQL Compatibility (p. 831)
• Managing Amazon Aurora PostgreSQL (p. 854)
• Replication with Amazon Aurora PostgreSQL (p. 859)
• Integrating Amazon Aurora PostgreSQL with Other AWS Services (p. 864)
• Exporting Data from an Aurora PostgreSQL DB Cluster to Amazon S3 (p. 864)
• Managing Query Execution Plans for Aurora PostgreSQL (p. 873)
• Publishing Aurora PostgreSQL Logs to Amazon CloudWatch Logs (p. 899)
• Using Machine Learning (ML) with Aurora PostgreSQL (p. 902)
• Fast Recovery After Failover with Cluster Cache Management for Aurora PostgreSQL (p. 921)
• Upgrading the PostgreSQL DB Engine for Aurora PostgreSQL (p. 925)
• Best Practices with Amazon Aurora PostgreSQL (p. 931)
• Using Kerberos Authentication with Aurora PostgreSQL (p. 939)
• Amazon Aurora PostgreSQL Reference (p. 950)
• Database Engine Updates for Amazon Aurora PostgreSQL (p. 960)
• To control who can perform Amazon RDS management actions on Aurora MySQL DB clusters and DB
instances, you use AWS Identity and Access Management (IAM). When you connect to AWS using IAM
credentials, your AWS account must have IAM policies that grant the permissions required to perform
823
Amazon Aurora User Guide for Aurora
Restricting Password Management
Amazon RDS management operations. For more information, see Identity and Access Management in
Amazon Aurora (p. 1019).
If you are using IAM to access the Amazon RDS console, you must first sign on to the AWS
Management Console with your IAM user credentials. Then go to the Amazon RDS console at https://
console.aws.amazon.com/rds/.
• Aurora DB clusters must be created in an Amazon Virtual Private Cloud (VPC). To control which devices
and Amazon EC2 instances can open connections to the endpoint and port of the DB instance for
Aurora DB clusters in a VPC, you use a VPC security group. These endpoint and port connections can be
made using Secure Sockets Layer (SSL). In addition, firewall rules at your company can control whether
devices running at your company can open connections to a DB instance. For more information on
VPCs, see Amazon Virtual Private Cloud VPCs and Amazon Aurora (p. 1067).
Aurora PostgreSQL supports db.r4 and db.t3 instance classes with default VPC only. With default VPC
tenancy, the VPC runs on shared hardware. With dedicated VPC tenancy, the VPC runs on a dedicated
hardware instance. For more information about instance classes, see DB Instance Classes (p. 33). For
more information about default and dedicated VPC tenancy, see Dedicated Instances in the Amazon
EC2 User Guide for Linux Instances.
• To authenticate login and permissions for an Amazon Aurora DB cluster, you can take the same
approach as with a stand-alone instance of PostgreSQL.
Commands such as CREATE ROLE, ALTER ROLE, GRANT, and REVOKE work just as they do in on-
premises databases, as does directly modifying database schema tables. For more information, see
Client Authentication in the PostgreSQL documentation.
Note
The Salted Challenge Response Authentication Mechanism (SCRAM) is not supported with
Aurora PostgreSQL.
When you create an Amazon Aurora PostgreSQL DB instance, the master user has the following default
privileges:
• LOGIN
• NOSUPERUSER
• INHERIT
• CREATEDB
• CREATEROLE
• NOREPLICATION
• VALID UNTIL 'infinity'
To provide management services for each DB cluster, the rdsadmin user is created when the DB cluster
is created. Attempting to drop, rename, change the password, or change privileges for the rdsadmin
account will result in an error.
824
Amazon Aurora User Guide for Aurora
Securing Aurora PostgreSQL Data with SSL
To use restricted password management, your DB cluster must be running Amazon Aurora for
PostgreSQL 10.6 or higher. Because the rds.restrict_password_commands parameter is static,
changing this parameter requires a database restart.
When a database has restricted password management enabled, if you try to run restricted SQL
commands you get the following error: ERROR: must be a member of rds_password to alter passwords.
Following are some examples of SQL commands that are restricted when restricted password
management is enabled.
Some ALTER ROLE commands that include RENAME TO might also be restricted. They might be
restricted because renaming a PostgreSQL role that has an MD5 password clears the password.
The rds_superuser role has membership for the rds_password role by default, and you can't
change this. You can give other roles membership for the rds_password role by using the GRANT SQL
command. We recommend that you give membership to rds_password to only a few roles that you use
solely for password management. These roles require the CREATEROLE attribute to modify other roles.
Make sure that you verify password requirements such as expiration and needed complexity on the
client side. We recommend that you restrict password-related changes by using your own client-side
utility. This utility should have a role that is a member of rds_password and has the CREATEROLE role
attribute.
For general information about SSL support and PostgreSQL databases, see SSL Support in the
PostgreSQL documentation. For information about using an SSL connection over JDBC, see Configuring
the Client in the PostgreSQL documentation.
Topics
• Requiring an SSL Connection to an Aurora PostgreSQL DB cluster (p. 826)
• Determining the SSL Connection Status (p. 826)
SSL support is available in all AWS Regions for Aurora PostgreSQL. Amazon RDS creates an SSL
certificate for your Aurora PostgreSQL DB cluster when the DB cluster is created. If you enable SSL
certificate verification, then the SSL certificate includes the DB cluster endpoint as the Common Name
(CN) for the SSL certificate to guard against spoofing attacks.
For information about downloading certificates, see Using SSL/TLS to Encrypt a Connection to a DB
Cluster (p. 1005).
2. Import the certificate into your operating system.
3. Connect to your Aurora PostgreSQL DB cluster over SSL.
825
Amazon Aurora User Guide for Aurora
Securing Aurora PostgreSQL Data with SSL
When you connect using SSL, your client can choose to verify the certificate chain or not. If your
connection parameters specify sslmode=verify-ca or sslmode=verify-full, then your client
requires the RDS CA certificates to be in their trust store or referenced in the connection URL. This
requirement is to verify the certificate chain that signs your database certificate.
When a client, such as psql or JDBC, is configured with SSL support, the client first tries to connect
to the database with SSL by default. If the client can't connect with SSL, it reverts to connecting
without SSL. The default sslmode mode used is different between libpq-based clients (such as psql)
and JDBC. The libpq-based clients default to prefer, where JDBC clients default to verify-full.
Use the sslrootcert parameter to reference the certificate, for example sslrootcert=rds-
ssl-ca-cert.pem.
You can set the rds.force_ssl parameter value by updating the DB cluster parameter group for your
DB cluster. If the DB cluster parameter group isn't the default one, and the ssl parameter is already set
to 1 when you set rds.force_ssl to 1, you don't need to reboot your DB cluster. Otherwise, you must
reboot your DB cluster for the change to take effect. For more information on parameter groups, see
Working with DB Parameter Groups and DB Cluster Parameter Groups (p. 205).
When the rds.force_ssl parameter is set to 1 for a DB cluster, you see output similar to the following
when you connect, indicating that SSL is now required:
postgres=>
826
Amazon Aurora User Guide for Aurora
Updating Applications for New SSL/TLS Certificates
postgres=>
You can also load the sslinfo extension and then call the ssl_is_used() function to determine if
SSL is being used. The function returns t if the connection is using SSL, otherwise it returns f.
You can use the select ssl_cipher() command to determine the SSL cipher:
If you enable set rds.force_ssl and restart your DB cluster, non-SSL connections are refused with
the following message:
$ export PGSSLMODE=disable
$ psql postgres -h SOMEHOST.amazonaws.com -p 8192 -U someuser
psql: FATAL: no pg_hba.conf entry for host "host.ip", user "someuser", database "postgres",
SSL off
$
For information about the sslmode option, see Database Connection Control Functions in the
PostgreSQL documentation.
This topic can help you to determine whether any client applications use SSL/TLS to connect to your DB
clusters. If they do, you can further check whether those applications require certificate verification to
connect.
827
Amazon Aurora User Guide for Aurora
Determining Whether Applications Are Connecting
to Aurora PostgreSQL DB Clusters Using SSL
Note
Some applications are configured to connect to Aurora PostgreSQL DB clusters only if they can
successfully verify the certificate on the server.
For such applications, you must update your client application trust stores to include the new CA
certificates.
After you update your CA certificates in the client application trust stores, you can rotate the certificates
on your DB clusters. We strongly recommend testing these procedures in a development or staging
environment before implementing them in your production environments.
For more information about certificate rotation, see Rotating Your SSL/TLS Certificate (p. 1007). For
more information about downloading certificates, see Using SSL/TLS to Encrypt a Connection to a
DB Cluster (p. 1005). For information about using SSL/TLS with PostgreSQL DB clusters, see Securing
Aurora PostgreSQL Data with SSL (p. 825).
Topics
• Determining Whether Applications Are Connecting to Aurora PostgreSQL DB Clusters Using
SSL (p. 828)
• Determining Whether a Client Requires Certificate Verification in Order to Connect (p. 829)
• Updating Your Application Trust Store (p. 829)
• Using SSL/TLS Connections for Different Types of Applications (p. 830)
If rds.force_ssl isn't set to 1 (on), query the pg_stat_ssl view to check connections using SSL. For
example, the following query returns only SSL connections and information about the clients using SSL.
select datname, usename, ssl, client_addr from pg_stat_ssl inner join pg_stat_activity on
pg_stat_ssl.pid = pg_stat_activity.pid where ssl is true and usename<>'rdsadmin';
Only rows using SSL/TLS connections are displayed with information about the connection. The
following is sample output.
The preceding query displays only the current connections at the time of the query. The absence of
results doesn't indicate that no applications are using SSL connections. Other SSL connections might be
established at a different time.
828
Amazon Aurora User Guide for Aurora
Determining Whether a Client Requires
Certificate Verification in Order to Connect
Use PGSSLROOTCERT to verify the certificate with the PGSSLMODE environment variable, with
PGSSLMODE set to require, verify-ca, or verify-full.
Use the sslrootcert argument to verify the certificate with sslmode in connection string format, with
sslmode set to require, verify-ca, or verify-full.
For example, in the preceding case, if you use an invalid root certificate, you see an error similar to the
following on your client.
1. Download the 2019 root certificate that works for all AWS Regions and put the file in your trust
store directory.
For information about downloading the root certificate, see Using SSL/TLS to Encrypt a Connection
to a DB Cluster (p. 1005).
829
Amazon Aurora User Guide for Aurora
Using SSL/TLS Connections for
Different Types of Applications
Replace the file name with the one that you downloaded.
3. Import the certificate into the key store using the following command.
Enter the key store password when you are prompted for it.
rds-root,date, trustedCertEntry,
Certificate fingerprint (SHA1):
D4:0D:DB:29:E3:75:0D:FF:A6:71:C3:14:0B:BF:5F:47:8D:1C:80:96
# This fingerprint should match the output from the below command
openssl x509 -fingerprint -in rds-ca-2019-root.pem -noout
• psql
The client is invoked from the command line by specifying options either as a connection string or
as environment variables. For SSL/TLS connections, the relevant options are sslmode (environment
variable PGSSLMODE), sslrootcert (environment variable PGSSLROOTCERT).
For the complete list of options, see Parameter Key Words in the PostgreSQL documentation. For the
complete list of environment variables, see Environment Variables in the PostgreSQL documentation.
• pgAdmin
This browser-based client is a more user-friendly interface for connecting to a PostgreSQL database.
830
Amazon Aurora User Guide for Aurora
Migrating Data to Aurora PostgreSQL
For general information about connecting to a PostgreSQL database with JDBC, see Connecting to
the Database in the PostgreSQL documentation. For information about connecting with SSL/TLS, see
Configuring the Client in the PostgreSQL documentation.
• Python
For information about using psycopg2, see the psycopg2 documentation. For a short tutorial on
how to connect to a PostgreSQL database, see Psycopg2 Tutorial. You can find information about the
options the connect command accepts in The psycopg2 module content.
Important
After you have determined that your database connections use SSL/TLS and have updated your
application trust store, you can update your database to use the rds-ca-2019 certificates. For
instructions, see step 3 in Updating Your CA Certificate by Modifying Your DB Instance (p. 1008).
You can migrate data directly from an Amazon RDS PostgreSQL DB snapshot to an Aurora
PostgreSQL DB cluster. For more information, see Migrating an RDS PostgreSQL DB Snapshot to an
Aurora PostgreSQL DB Cluster (p. 832).
You can also migrate from an RDS PostgreSQL DB instance by creating an Aurora PostgreSQL Read
Replica of a PostgreSQL DB instance. When the replica lag between the PostgreSQL DB instance and
the Aurora PostgreSQL Read Replica is zero, you can stop replication. At this point, you can make the
Aurora Read Replica a standalone Aurora PostgreSQL DB cluster for reading and writing. For more
information, see Migrating Data from an RDS PostgreSQL DB Instance to an Aurora PostgreSQL DB
Cluster by Using an Aurora Read Replica (p. 834).
Migrating from a database that is not PostgreSQL-compatible
You can use AWS Database Migration Service (AWS DMS) to migrate data from a database that is not
PostgreSQL-compatible. For more information on AWS DMS, see What Is AWS Database Migration
Service?
Importing Amazon S3 data
You can migrate by importing data from Amazon S3 into a table belonging to an Aurora PostgreSQL
DB cluster for an RDS PostgreSQL DB instance. For more information, see Importing Amazon S3
Data into an Aurora PostgreSQL DB Cluster (p. 843).
For a list of AWS Regions where Aurora is available, see Amazon Aurora in the AWS General Reference.
831
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB Snapshot
In some cases, the DB snapshot might not be in the AWS Region where you want to locate your data. If
so, use the Amazon RDS console to copy the DB snapshot to that AWS Region. For information about
copying a DB snapshot, see Copying a DB Snapshot.
When you migrate the DB snapshot by using the console, the console takes the actions necessary to
create both the DB cluster and the primary instance.
You can also choose for your new Aurora PostgreSQL DB cluster to be encrypted at rest by using an AWS
Key Management Service (AWS KMS) encryption key. This option is available only for unencrypted DB
snapshots.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose Snapshots.
3. On the Snapshots page, choose the snapshot that you want to migrate into an Aurora PostgreSQL
DB cluster.
4. Choose Migrate Database.
5. Set the following values on the Migrate Database page:
• DB Instance Class: Choose a DB instance class that has the required storage and capacity for
your database, for example db.r3.large. Aurora cluster volumes automatically grow as the
amount of data in your database increases, up to a maximum size of 64 tebibytes (TiB). So you
only need to choose a DB instance class that meets your current storage requirements. For more
information, see Overview of Aurora Storage (p. 37).
• DB Instance Identifier: Enter a name for the DB cluster that is unique for your account in the AWS
Region that you chose. This identifier is used in the endpoint addresses for the instances in your
DB cluster. You might choose to add some intelligence to the name, such as including the AWS
Region and DB engine that you chose, for example aurora-cluster1.
Otherwise, you can choose to have Amazon RDS create a VPC for you by choosing Create a new
VPC.
• Subnet Group: If you have an existing subnet group, then you can use that subnet group with your
Aurora PostgreSQL DB cluster by choosing your subnet group identifier, for example gs-subnet-
group1.
832
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB Snapshot
Otherwise, you can choose to have Amazon RDS create a subnet group for you by choosing Create
a new subnet group.
• Publicly Accessible: Choose No to specify that instances in your DB cluster can only be accessed
by resources inside of your VPC. Choose Yes to specify that instances in your DB cluster can be
accessed by resources on the public network. The default is Yes.
Note
Your production DB cluster might not need to be in a public subnet, because only your
application servers require access to your DB cluster. If your DB cluster doesn't need to be
in a public subnet, set Publicly Accessible to No.
• Availability Zone: Choose the Availability Zone to host the primary instance for your Aurora
PostgreSQL DB cluster. To have Amazon RDS choose an Availability Zone for you, choose No
Preference.
• Database Port: Enter the default port to be used when connecting to instances in the Aurora
PostgreSQL DB cluster. The default is 5432.
Note
You might be behind a corporate firewall that doesn't allow access to default ports
such as the PostgreSQL default port, 5432. In this case, provide a port value that your
corporate firewall allows. Remember that port value later when you connect to the
Aurora PostgreSQL DB cluster.
• Enable Encryption: Choose Yes for your new Aurora PostgreSQL DB cluster to be encrypted at
rest. If you choose Yes, also choose an AWS KMS encryption key as the Master Key value.
• Auto minor version upgrade: Choose Enable auto minor version upgrade to enable your Aurora
PostgreSQL DB cluster to receive minor PostgreSQL DB engine version upgrades automatically
when they become available.
The Auto Minor Version Upgrade option only applies to upgrades to PostgreSQL minor engine
versions for your Aurora PostgreSQL DB cluster. It doesn't apply to regular patches applied to
maintain system stability.
6. Choose Migrate to migrate your DB snapshot.
7. Choose Instances, and then choose the arrow icon to show the DB cluster details and monitor the
progress of the migration. On the details page, you can find the cluster endpoint used to connect to
the primary instance of the DB cluster. For more information on connecting to an Aurora PostgreSQL
DB cluster, see Connecting to an Amazon Aurora DB Cluster (p. 169).
833
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
In this case, Amazon RDS uses the PostgreSQL DB engine's streaming replication functionality to create
a special type of DB cluster for the source PostgreSQL DB instance. This type of DB cluster is called an
Aurora Read Replica. Updates made to the source PostgreSQL DB instance are asynchronously replicated
to the Aurora Read Replica.
Topics
• Overview of Migrating Data by Using an Aurora Read Replica (p. 834)
• Preparing to Migrate Data by Using an Aurora Read Replica (p. 835)
• Creating an Aurora Read Replica (p. 835)
• Promoting an Aurora Read Replica (p. 841)
Be prepared for migration to take a while, roughly several hours per tebibyte (TiB) of data. While the
migration is in progress, your Amazon RDS PostgreSQL instance accumulates write ahead log (WAL)
segments. Make sure that your Amazon RDS instance has sufficient storage capacity for these segments.
When you create an Aurora Read Replica of a PostgreSQL DB instance, Amazon RDS creates a DB
snapshot of your source PostgreSQL DB instance. This snapshot is private to Amazon RDS and incurs no
charges. Amazon RDS then migrates the data from the DB snapshot to the Aurora Read Replica. After the
DB snapshot data is migrated to the new Aurora PostgreSQL DB cluster, RDS starts replication between
your PostgreSQL DB instance and the Aurora PostgreSQL DB cluster.
You can only have one Aurora Read Replica for a PostgreSQL DB instance. If you try to create an Aurora
Read Replica for your Amazon RDS PostgreSQL instance and you already have a read replica, the request
is rejected.
Note
Replication issues can arise due to feature differences between Aurora PostgreSQL and the
PostgreSQL engine version of your RDS PostgreSQL DB instance that is the replication master.
You can replicate only from an Amazon RDS PostgreSQL instance that is compatible with the
Aurora PostgreSQL version in question. For example, if the supported Aurora PostgreSQL
version is 9.6.3, the Amazon RDS PostgreSQL DB instance must be running version 9.6.1 or
greater. If you encounter an error, you can find help in the Amazon RDS Community Forum or by
contacting AWS Support.
For more information on PostgreSQL read replicas, see Working with Read Replicas in the Amazon RDS
User Guide.
834
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
Metric Description
Units: Bytes
OldestReplicationSlotLag The size of the lag for WAL data in the replica that
is lagging the most.
Units: Megabytes
Units: Megabytes
For more information about monitoring your RDS instance, see Monitoring in the Amazon RDS User
Guide.
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 PostgreSQL DB instance that you want to use as the source for your Aurora Read Replica,
and choose Create Aurora read replica for Actions.
835
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
4. Choose the DB cluster specifications that you want to use for the Aurora Read Replica, as described
in the following table.
Option Description
DB instance identifier Enter a name for the primary instance in your Aurora Read
Replica DB cluster. This identifier is used in the endpoint
address for the primary instance of the new DB cluster.
836
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
Option Description
Replica are the same as the master user name and master
password for the source DB instance.
Virtual Private Cloud (VPC) Choose the VPC to host the DB cluster. Choose Create
new VPC to have Amazon RDS create a VPC for you. For
more information, see DB Cluster Prerequisites (p. 101).
Subnet group Choose the DB subnet group to use for the DB cluster.
Choose Create new DB Subnet Group to have Amazon
RDS create a DB subnet group for you. For more
information, see DB Cluster Prerequisites (p. 101).
VPC security groups Choose one or more VPC security groups to secure
network access to the DB cluster. Choose Create new
VPC security group to have Amazon RDS create a VPC
security group for you. For more information, see DB
Cluster Prerequisites (p. 101).
Database port Specify the port for applications and utilities to use to
access the database. Aurora PostgreSQL DB clusters
default to the default PostgreSQL port, 5432. Firewalls
at some companies block connections to this port. If your
company firewall blocks the default port, choose another
port for the new DB cluster.
DB cluster parameter group Choose a DB cluster parameter group for the Aurora
PostgreSQL DB cluster. Aurora has a default DB cluster
parameter group you can use, or you can create your
own DB cluster parameter group. For more information
about DB cluster parameter groups, see Working
with DB Parameter Groups and DB Cluster Parameter
Groups (p. 205).
837
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
Option Description
Backup retention period Choose the length of time, 1–35 days, for Aurora to retain
backup copies of the database. Backup copies can be used
for point-in-time restores (PITR) of your database down to
the second.
Auto minor version upgrade Choose Yes to enable your Aurora PostgreSQL DB cluster
to receive minor PostgreSQL DB engine version upgrades
automatically when they become available.
Maintenance window Choose the weekly time range during which system
maintenance can occur.
AWS CLI
To create an Aurora Read Replica from a source PostgreSQL DB instance, use the create-db-cluster and
create-db-instance AWS CLI commands to create a new Aurora PostgreSQL DB cluster. When you call
the create-db-cluster command, include the --replication-source-identifier parameter to
identify the Amazon Resource Name (ARN) for the source PostgreSQL DB instance. For more information
about Amazon RDS ARNs, see Amazon Relational Database Service (Amazon RDS) in the AWS General
Reference.
Don't specify the master user name, master password, or database name. The Aurora Read Replica
uses the same master user name, master password, and database name as the source PostgreSQL DB
instance.
838
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
For Windows:
If you use the console to create an Aurora Read Replica, then RDS automatically creates the primary
instance for your DB cluster Aurora Read Replica. If you use the CLI to create an Aurora Read Replica, you
must explicitly create the primary instance for your DB cluster. The primary instance is the first instance
that is created in a DB cluster.
You can create a primary instance for your DB cluster by using the create-db-instance CLI command
with the following parameters:
• --db-cluster-identifier
The name of the DB instance class to use for your primary instance.
• --db-instance-identifier
In the following example, you create a primary instance named myreadreplicainstance for the
DB cluster named myreadreplicacluster. You do this using the DB instance class specified in
myinstanceclass.
Example
For Windows:
839
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
RDS API
To create an Aurora Read Replica from a source PostgreSQL DB instance, use the RDS API operations
CreateDBCluster and CreateDBInstance to create a new Aurora DB cluster and primary instance.
Don't specify the master user name, master password, or database name. The Aurora Read Replica
uses the same master user name, master password, and database name as the source PostgreSQL DB
instance.
You can create a new Aurora DB cluster for an Aurora Read Replica from a source PostgreSQL DB
instance. To do so, use the RDS API operation CreateDBCluster with the following parameters:
• DBClusterIdentifier
The Amazon Resource Name (ARN) for the source PostgreSQL DB instance. For more information
about Amazon RDS ARNs, see Amazon Relational Database Service (Amazon RDS) in the Amazon Web
Services General Reference.
• VpcSecurityGroupIds
The list of Amazon EC2 VPC security groups to associate with this DB cluster.
In the following example, you create a DB cluster named myreadreplicacluster from a source
PostgreSQL DB instance. This cluster has an ARN set to mysqlmasterARN. The cluster is associated with
a DB subnet group named mysubnetgroup and a VPC security group named mysecuritygroup.
Example
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBCluster
&DBClusterIdentifier=myreadreplicacluster
&DBSubnetGroupName=mysubnetgroup
&Engine=aurora-postgresql
&ReplicationSourceIdentifier=mysqlmasterARN
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-10-31
&VpcSecurityGroupIds=mysecuritygroup
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20150927/us-east-1/rds/aws4_request
&X-Amz-Date=20150927T164851Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=6a8f4bd6a98f649c75ea04a6b3929ecc75ac09739588391cd7250f5280e716db
If you use the console to create an Aurora Read Replica, then Amazon RDS automatically creates the
primary instance for your DB cluster Aurora Read Replica. If you use the CLI to create an Aurora Read
Replica, you must explicitly create the primary instance for your DB cluster. The primary instance is the
first instance that is created in a DB cluster.
You can create a primary instance for your DB cluster by using the RDS API operation
CreateDBInstance with the following parameters:
840
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
• DBClusterIdentifier
The name of the DB instance class to use for your primary instance.
• DBInstanceIdentifier
In this example, you create a primary instance named myreadreplicainstance for the DB
cluster named myreadreplicacluster. You do this using the DB instance class specified in
myinstanceclass.
Example
https://rds.us-east-1.amazonaws.com/
?Action=CreateDBInstance
&DBClusterIdentifier=myreadreplicacluster
&DBInstanceClass=myinstanceclass
&DBInstanceIdentifier=myreadreplicainstance
&Engine=aurora-postgresql
&SignatureMethod=HmacSHA256
&SignatureVersion=4
&Version=2014-09-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIADQKE4SARGYLE/20140424/us-east-1/rds/aws4_request
&X-Amz-Date=20140424T194844Z
&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
&X-Amz-Signature=bee4aabc750bf7dad0cd9e22b952bd6089d91e2a16592c2293e532eeaab8bc77
Before you promote your Aurora Read Replica, stop any transactions from being written to the source
PostgreSQL DB instance. Then wait for the replica lag on the Aurora Read Replica to reach zero.
After you promote your read replica, confirm that the promotion has completed. To do this, choose
Instances in the navigation pane and confirm that there is a Promoted Read Replica cluster to stand-
alone database cluster event for your read replica. After promotion is complete, the master PostgreSQL
DB Instance and the Aurora Read Replica are unlinked. At this point, you can safely delete the DB
instance if you want to.
Console
To promote an Aurora Read Replica to an Aurora DB cluster
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
841
Amazon Aurora User Guide for Aurora
Migrating an RDS PostgreSQL DB
Instance Using an Aurora Read Replica
AWS CLI
To promote an Aurora Read Replica to a stand-alone DB cluster, use the promote-read-replica-db-
cluster AWS CLI command.
Example
For Windows:
842
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
For more information on storing data with Amazon S3, see Create a Bucket in the Amazon Simple Storage
Service Getting Started Guide. For instructions on how to upload a file to an Amazon S3 bucket, see Add
an Object to a Bucket in the Amazon Simple Storage Service Getting Started Guide.
Topics
• Overview of Importing Amazon S3 Data (p. 843)
• Setting Up Access to an Amazon S3 Bucket (p. 844)
• Using the aws_s3.table_import_from_s3 Function to Import Amazon S3 Data (p. 848)
• Function Reference (p. 850)
1. Install the required PostgreSQL extensions. These include the aws_s3 and aws_commons
extensions. To do so, start psql and use the following command.
The aws_s3 extension provides the aws_s3.table_import_from_s3 (p. 851) function that you use to
import Amazon S3 data. The aws_commons extension provides additional helper functions.
2. Identify the database table and Amazon S3 file to use.
The aws_s3.table_import_from_s3 (p. 851) function requires the name of the PostgreSQL database
table that you want to import data into. The function also requires that you identify the Amazon S3
file to import. To provide this information, take the following steps.
a. Identify the PostgreSQL database table to put the data in. For example, the following is a
sample t1 database table used in the examples for this topic.
b. Get the following information to identify the Amazon S3 file that you want to import:
843
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
To find how to get this information, see View an Object in the Amazon Simple Storage Service
Getting Started Guide. You can confirm the information by using the AWS CLI command aws s3
cp. If the information is correct, this command downloads a copy of the Amazon S3 file.
aws s3 cp s3://sample_s3_bucket/sample_file_path ./
To import data from an Amazon S3 file, give the Aurora PostgreSQL DB cluster permission to
access the Amazon S3 bucket the file is in. To do this, you use either an AWS Identity and Access
Management (IAM) role or security credentials. For more information, see Setting Up Access to an
Amazon S3 Bucket (p. 844).
4. Import the Amazon S3 data by calling the aws_s3.table_import_from_s3 function.
After you complete the previous preparation tasks, use the aws_s3.table_import_from_s3 (p. 851)
function to import the Amazon S3 data. For more information, see Using the
aws_s3.table_import_from_s3 Function to Import Amazon S3 Data (p. 848).
Topics
• Using an IAM Role to Access an Amazon S3 Bucket (p. 844)
• Using Security Credentials to Access an Amazon S3 Bucket (p. 848)
• Troubleshooting Access to Amazon S3 (p. 848)
To do this, create an IAM policy that provides access to the Amazon S3 bucket. Create an IAM role and
attach the policy to the role. Then assign the IAM role to your DB cluster.
844
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
1. Create an IAM policy. This policy provides the bucket and object permissions that allow your Aurora
PostgreSQL DB cluster to access Amazon S3.
Include in the policy the following required actions to allow the transfer of files from an Amazon S3
bucket to Aurora PostgreSQL:
• s3:GetObject
• s3:ListBucket
Include in the policy the following resources to identify the Amazon S3 bucket and objects in the
bucket. This shows the Amazon Resource Name (ARN) format for accessing Amazon S3.
• arn:aws:s3:::your-s3-bucket
• arn:aws:s3:::your-s3-bucket/*
For more information on creating an IAM policy for Aurora PostgreSQL, see Creating and Using
an IAM Policy for IAM Database Access (p. 1037). 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 rds-s3-import-policy with these
options. It grants access to a bucket named your-s3-bucket.
Note
After you create the policy, note the Amazon Resource Name (ARN) of the policy. You need
the ARN for a subsequent step when you attach the policy to an IAM role.
Example
For Windows:
845
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
{
"Sid": "s3import",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::your-s3-bucket",
"arn:aws:s3:::your-s3-bucket/*"
]
}
]
}'
2. Create an IAM role. You do this so Aurora PostgreSQL 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-
import-role.
Example
For Windows:
3. Attach the IAM policy that you created to the IAM role that you created.
The following AWS CLI command attaches the policy created earlier to the role named rds-s3-
import-role Replace your-policy-arn with the policy ARN that you noted in an earlier step.
846
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
Example
For Windows:
4. Add the IAM role to the DB cluster. You do so by using the AWS Management Console or AWS CLI, as
described following.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. Choose the PostgreSQL DB cluster name to display its details.
3. On the Connectivity & security tab, in the Manage IAM roles section, choose the role to add under
Add IAM roles to this instance.
4. Under Feature, choose s3Import.
5. Choose Add role.
AWS CLI
• Use the following command to add the role to the PostgreSQL DB cluster named my-db-cluster.
Replace your-role-arn with the role ARN that you noted in a previous step. Use s3Import for the
value of the --feature-name option.
Example
For Windows:
847
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
Or you can include the aws_commons.create_aws_credentials (p. 853) function call inline within the
aws_s3.table_import_from_s3 function call.
848
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
'',
'(format csv)',
:'s3_uri'
);
• t1 – The name for the table in the PostgreSQL DB cluster to copy the data into.
• '' – An optional list of columns in the database table. You can use this parameter to indicate which
columns of the S3 data go in which table columns. If no columns are specified, all the columns are
copied to the table. For an example of using a column list, see Importing an Amazon S3 File That Uses
a Custom Delimiter (p. 849).
• (format csv) – PostgreSQL COPY arguments. The copy process uses the arguments and format
of the PostgreSQL COPY command. In the preceding example, the COPY command uses the comma-
separated value (CSV) file format to copy the data.
• s3_uri – A structure that contains the information identifying the Amazon S3 file. For an example of
using the aws_commons.create_s3_uri (p. 853) function to create an s3_uri structure, see Overview
of Importing Amazon S3 Data (p. 843).
For the full reference of this function, see aws_s3.table_import_from_s3 (p. 851).
The following examples show how to specify different kinds of files when importing Amazon S3 data.
Topics
• Importing an Amazon S3 File That Uses a Custom Delimiter (p. 849)
• Importing an Amazon S3 Compressed (gzip) File (p. 850)
• Importing an Encoded Amazon S3 File (p. 850)
For this example, assume that the following information is organized into pipe-delimited columns in the
Amazon S3 file.
1|foo1|bar1|elephant1
2|foo2|bar2|elephant2
3|foo3|bar3|elephant3
4|foo4|bar4|elephant4
...
2. Use the following form of the aws_s3.table_import_from_s3 (p. 851) function to import data from
the Amazon S3 file.
You can include the aws_commons.create_s3_uri (p. 853) function call inline within the
aws_s3.table_import_from_s3 function call to specify the file.
849
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
• Key: Content-Encoding
• Value: gzip
For more about adding these values to Amazon S3 metadata, see How Do I Add Metadata to an S3
Object? in the Amazon Simple Storage Service Console User Guide.
Import the gzip file into your Aurora PostgreSQL DB cluster as shown following.
Function Reference
Functions
• aws_s3.table_import_from_s3 (p. 851)
• aws_commons.create_s3_uri (p. 853)
• aws_commons.create_aws_credentials (p. 853)
850
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
aws_s3.table_import_from_s3
Imports Amazon S3 data into an Aurora PostgreSQL table. The aws_s3 extension provides the
aws_s3.table_import_from_s3 function.
Syntax
The three required parameters are table_name, column_list and options. These identify the
database table and specify how the data is copied into the table.
• The s3_info parameter specifies the Amazon S3 file to import. When you use this parameter, access
to Amazon S3 is provided by an IAM role for the PostgreSQL DB cluster.
aws_s3.table_import_from_s3 (
table_name text,
column_list text,
options text,
s3_info aws_commons._s3_uri_1
)
• The credentials parameter specifies the credentials to access Amazon S3. When you use this
parameter, you don't use an IAM role.
aws_s3.table_import_from_s3 (
table_name text,
column_list text,
options text,
s3_info aws_commons._s3_uri_1,
credentials aws_commons._aws_credentials_1
)
Parameters
table_name
A required text string containing the name of the PostgreSQL database table to import the data
into.
column_list
A required text string containing an optional list of the PostgreSQL database table columns in
which to copy the data. If the string is empty, all columns of the table are used. For an example, see
Importing an Amazon S3 File That Uses a Custom Delimiter (p. 849).
options
A required text string containing arguments for the PostgreSQL COPY command. These arguments
specify how the data is to be copied into the PostgreSQL table. For more details, see the PostgreSQL
COPY documentation.
s3_info
851
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
Alternate Syntax
To help with testing, you can use an expanded set of parameters instead of the s3_info
and credentials parameters. Following are additional syntax variations for the
aws_s3.table_import_from_s3 function:
• Instead of using the s3_info parameter to identify an Amazon S3 file, use the combination of the
bucket, file_path, and region parameters. With this form of the function, access to Amazon S3 is
provided by an IAM role on the PostgreSQL DB instance.
aws_s3.table_import_from_s3 (
table_name text,
column_list text,
options text,
bucket text,
file_path text,
region text
)
• Instead of using the credentials parameter to specify Amazon S3 access, use the combination of
the access_key, session_key, and session_token parameters.
aws_s3.table_import_from_s3 (
table_name text,
column_list text,
options text,
bucket text,
file_path text,
region text,
access_key text,
secret_key text,
session_token text
)
Alternate Parameters
bucket
A text string containing the name of the Amazon S3 bucket that contains the file.
file_path
852
Amazon Aurora User Guide for Aurora
Importing S3 Data into Aurora PostgreSQL
region
A text string containing the AWS Region that the file is in. For a listing of AWS Region names and
associated values, see Regions and Availability Zones (p. 5).
access_key
A text string containing the access key to use for the import operation. The default is NULL.
secret_key
A text string containing the secret key to use for the import operation. The default is NULL.
session_token
(Optional) A text string containing the session key to use for the import operation. The default is
NULL.
aws_commons.create_s3_uri
Creates an aws_commons._s3_uri_1 structure to hold Amazon S3 file information. Use the
results of the aws_commons.create_s3_uri function in the s3_info parameter of the
aws_s3.table_import_from_s3 (p. 851) function.
Syntax
aws_commons.create_s3_uri(
bucket text,
file_path text,
region text
)
Parameters
bucket
A required text string containing the Amazon S3 bucket name for the file.
file_path
A required text string containing the AWS Region that the file is in. For a listing of AWS Region
names and associated values, see Regions and Availability Zones (p. 5).
aws_commons.create_aws_credentials
Sets an access key and secret key in an aws_commons._aws_credentials_1 structure. Use the results
of the aws_commons.create_aws_credentials function in the credentials parameter of the
aws_s3.table_import_from_s3 (p. 851) function.
Syntax
aws_commons.create_aws_credentials(
access_key text,
secret_key text,
session_token text
853
Amazon Aurora User Guide for Aurora
Managing Aurora PostgreSQL
Parameters
access_key
A required text string containing the access key to use for importing an Amazon S3 file. The default
is NULL.
secret_key
A required text string containing the secret key to use for importing an Amazon S3 file. The default
is NULL.
session_token
An optional text string containing the session token to use for importing an Amazon S3 file. The
default is NULL. If you provide an optional session_token, you can use temporary credentials.
Topics
• Scaling Aurora PostgreSQL DB Instances (p. 854)
• Maximum Connections to an Aurora PostgreSQL DB Instance (p. 854)
• Testing Amazon Aurora PostgreSQL Using Fault Injection Queries (p. 855)
• Displaying Volume Status for an Aurora DB Cluster (p. 858)
You can scale your Aurora PostgreSQL DB cluster by modifying the DB instance class for each DB
instance in the DB cluster. Aurora PostgreSQL supports several DB instance classes optimized for Aurora.
For detailed specifications of the DB instance classes supported by Aurora PostgreSQL, see Hardware
Specifications for All Available DB Instance Classes for Aurora (p. 34).
LEAST({DBInstanceClassMemory/9531392},5000).
Setting the max_connections parameter to this equation makes sure that the number of allowed
connection scales well with the size of the instance. For example, suppose your DB instance class is
db.r4.large, which has 15.25 gibibytes (GiB) of memory. Then the maximum connections allowed is 1600,
as shown in the following equation:
854
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora PostgreSQL
Using Fault Injection Queries
The following table lists the resulting default value of max_connections for each DB instance class
available to Aurora PostgreSQL. You can increase the maximum number of connections to your Aurora
PostgreSQL DB instance by scaling the instance up to a DB instance class with more memory, or by
setting a larger value for the max_connections parameter, up to 262,143.
db.r4.large 1600
db.r4.xlarge 3200
db.r4.2xlarge 5000
db.r4.4xlarge 5000
db.r4.8xlarge 5000
db.r4.16xlarge 5000
db.r5.large 1600
db.r5.xlarge 3300
db.r5.2xlarge 5000
db.r5.4xlarge 5000
db.r5.12xlarge 5000
db.r5.24xlarge 5000
db.t3.medium 420
For the list of DB instance classes supported by Aurora PostgreSQL and amount of memory for each, see
Hardware Specifications for All Available DB Instance Classes for Aurora (p. 34).
Topics
• Testing an Instance Crash (p. 856)
• Testing an Aurora Replica Failure (p. 856)
• Testing a Disk Failure (p. 857)
• Testing Disk Congestion (p. 857)
When a fault injection query specifies a crash, it forces a crash of the Aurora PostgreSQL DB instance.
The other fault injection queries result in simulations of failure events, but don't cause the event to
occur. When you submit a fault injection query, you also specify an amount of time for the failure event
simulation to occur.
855
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora PostgreSQL
Using Fault Injection Queries
You can submit a fault injection query to one of your Aurora Replica instances by connecting
to the endpoint for the Aurora Replica. For more information, see Amazon Aurora Connection
Management (p. 12).
Note
Fault injection queries for Aurora PostgreSQL are currently supported only for version 2.4, which
is compatible with PostgreSQL version 10.11.
For this fault injection query, a failover will not occur. If you want to test a failover, then you can choose
the Failover instance action for your DB cluster in the RDS console, or use the failover-db-cluster AWS
CLI command or the FailoverDBCluster RDS API operation.
Syntax
SELECT aurora_inject_crash ('instance' | 'dispatcher' | 'node');
Options
This fault injection query takes one of the following crash types:
• 'instance'— A crash of the PostgreSQL-compatible database for the Amazon Aurora instance is
simulated.
• 'dispacher'—A crash of the dispatcher on the master instance for the Aurora DB cluster is
simulated. The dispatcher writes updates to the cluster volume for an Amazon Aurora DB cluster.
• 'node'—A crash of both the PostgreSQL-compatible database and the dispatcher for the Amazon
Aurora instance is simulated.
An Aurora Replica failure will block all requests to an Aurora Replica or all Aurora Replicas in the DB
cluster for a specified time interval. When the time interval completes, the affected Aurora Replicas will
be automatically synchronized with the primary instance.
Syntax
SELECT aurora_inject_replica_failure(
percentage_of_failure,
quantity,
'replica_name'
);
Options
This fault injection query takes the following parameters:
• percentage_of_failure—The percentage of requests to block during the failure event. This value
can be a double between 0 and 100. If you specify 0, then no requests are blocked. If you specify 100,
then all requests are blocked.
856
Amazon Aurora User Guide for Aurora
Testing Amazon Aurora PostgreSQL
Using Fault Injection Queries
• quantity—The amount of time to simulate the Aurora Replica failure. The interval is in seconds. For
example, if the value is 20 the simulation will run for 20 seconds.
Note
Take care when specifying the time interval for your Aurora Replica failure event. If you
specify too long an interval, and your writer instance writes a large amount of data during the
failure event, then your Aurora DB cluster might assume that your Aurora Replica has crashed
and replace it.
• replica_name—The Aurora Replica in which to inject the failure simulation. Specify the name of an
Aurora Replica to simulate a failure of the single Aurora Replica. Specify an empty string to simulate
failures for all Aurora Replicas in the DB cluster.
To identify replica names, see the server_id column from the aurora_replica_status()
function. For example:
During a disk failure simulation, the Aurora PostgreSQL DB cluster randomly marks disk segments as
faulting. Requests to those segments will be blocked for the duration of the simulation.
Syntax
SELECT aurora_inject_disk_failure(
percentage_of_failure,
index,
is_disk,
quantity
);
Options
This fault injection query takes the following parameters:
• percentage_of_failure — The percentage of the disk to mark as faulting during the failure event.
This value can be a double between 0 and 100. If you specify 0, then none of the disk is marked as
faulting. If you specify 100, then the entire disk is marked as faulting.
• index — A specific logical block of data in which to simulate the failure event. If you exceed the range
of available logical blocks or starage nodes data, you will receive an error that tells you the maximum
index value that you can specify. To avoid this error, see Displaying Volume Status for an Aurora DB
Cluster (p. 858).
• is_disk — Indicates whether the injection failure is to a logical block or a storage node. Specifying
true means injection failures are to a logical block. Specifying false means injection failures are to a
storage node.
• quantity — The amount of time to simulate the Aurora Replica failure. The interval is in seconds. For
example, if the value is 20 the simulation will run for 20 seconds.
857
Amazon Aurora User Guide for Aurora
Displaying Volume Status for an Aurora DB Cluster
During a disk congestion simulation, the Aurora PostgreSQL DB cluster randomly marks disk segments as
congested. Requests to those segments will be delayed between the specified minimum and maximum
delay time for the duration of the simulation.
Syntax
SELECT aurora_inject_disk_congestion(
percentage_of_failure,
index,
is_disk,
quantity,
minimum,
maximum
);
Options
This fault injection query takes the following parameters:
If you exceed the range of available logical blocks or storage nodes of data, you will receive an error
that tells you the maximum index value that you can specify. To avoid this error, see Displaying Volume
Status for an Aurora DB Cluster (p. 858).
• is_disk— Indicates whether the injection failure is to a logical block or a storage node. Specifying
true means injection failures are to a logical block. Specifying false means injection failures are to a
storage node.
• quantity— The amount of time to simulate the Aurora Replica failure. The interval is in seconds. For
example, if the value is 20 the simulation will run for 20 seconds.
• minimum and maximum— The minimum and maximum amount of congestion delay, in milliseconds.
Disk segments marked as congested will be delayed for a random amount of time within the minimum
and maximum range for the duration of the simulation.
The data in each protection group is replicated across six physical storage devices, called storage nodes.
These storage nodes are allocated across three Availability Zones (AZs) in the region where the DB cluster
resides. In turn, each storage node contains one or more logical blocks of data for the DB cluster volume.
For more information about protection groups and storage nodes, see Introducing the Aurora Storage
Engine on the AWS Database Blog.
Use the aurora_show_volume_status() function to return the following server status variables:
• Disks — The total number of logical blocks of data for the DB cluster volume.
• Nodes — The total number of storage nodes for the DB cluster volume.
You can use the aurora_show_volume_status() function to help avoid an error when using the
aurora_inject_disk_failure() fault injection function. The aurora_inject_disk_failure()
858
Amazon Aurora User Guide for Aurora
Replication with Aurora PostgreSQL
fault injection function simulates the failure of an entire storage node, or a single logical block of
data within a storage node. In the function, you specify the index value of a specific logical block of
data or storage node. However, the statement returns an error if you specify an index value greater
than the number of logical blocks of data or storage nodes used by the DB cluster volume. For more
information about fault injection queries, see Testing Amazon Aurora PostgreSQL Using Fault Injection
Queries (p. 855).
Note
The aurora_show_volume_status() function is available for Aurora PostgreSQL version
10.11. For more information about Aurora PostgreSQL versions, see Engine Versions for Amazon
Aurora PostgreSQL (p. 961).
Syntax
SELECT * FROM aurora_show_volume_status();
Example
The following example illustrates a typical result.
Topics
• Using Aurora Replicas (p. 859)
• Monitoring Aurora PostgreSQL Replication (p. 860)
• Using PostgreSQL Logical Replication with Aurora (p. 860)
Aurora Replicas work well for read scaling because they're fully dedicated to read operations on your
cluster volume. The writer DB instance manages write operations. The cluster volume is shared among all
instances in your Aurora PostgreSQL DB cluster. Thus, no additional work is required to replicate a copy
of the data for each Aurora Replica. In contrast, PostgreSQL read replicas must apply, on a single thread,
all write operations from the master DB instance to their local data store. This limitation can affect the
ability of PostgreSQL read replicas to support large volumes of write traffic.
859
Amazon Aurora User Guide for Aurora
Monitoring Replication
Note
Rebooting the writer DB instance of an Amazon Aurora DB cluster also automatically reboots
the Aurora Replicas for that DB cluster. The automatic reboot re-establishes an entry point that
guarantees read/write consistency across the DB cluster.
For more information on monitoring RDS instances and CloudWatch metrics, see Monitoring an Amazon
Aurora DB Cluster (p. 353).
Following, you can find information about how to work with PostgreSQL logical replication and Amazon
Aurora. For more detailed information about the PostgreSQL implementation of logical replication, see
Logical Replication and Logical Decoding Concepts in the PostgreSQL documentation.
Note
Logical replication is available with Aurora PostgreSQL version 2.2.0 (compatible with
PostgreSQL 10.6) and later.
Following, you can find information about how to work with PostgreSQL logical replication and Amazon
Aurora.
Topics
• Configuring Logical Replication (p. 860)
• Example of Logical Replication of a Database Table (p. 861)
• Logical Replication Using the AWS Database Migration Service (p. 862)
Logical replication uses a publish and subscribe model. Publishers and subscribers are the nodes. A
publication is a set of changes generated from one or more database tables. You specify a publication on
a publisher. A subscription defines the connection to another database and one or more publications to
which it subscribes. You specify a subscription on a subscriber. The publication and subscription make the
connection between the publisher and subscriber.
Note
To perform logical replication for a PostgreSQL database, your AWS user account needs the
rds_superuser role.
1. Create a new DB cluster parameter group to use for logical replication, as described in Creating a DB
Cluster Parameter Group (p. 209). Use the following settings:
860
Amazon Aurora User Guide for Aurora
Using Logical Replication
• To use an existing Aurora PostgreSQL DB cluster for the publisher, the engine version must be
10.6 or later. Do the following:
1. Modify the cluster parameter group to set it to the group that you created when you enabled
logical replication. For details about modifying an Aurora PostgreSQL DB cluster, see Modifying
an Amazon Aurora DB Cluster (p. 232).
2. Restart the DB cluster for static parameter changes to take effect. The cluster parameter group
includes a change to the static parameter rds.logical_replication.
• To use a new Aurora PostgreSQL DB cluster for the publisher, create the DB cluster using the
following settings. For details about creating an Aurora PostgreSQL DB cluster, see Creating a DB
Cluster (p. 102).
1. Choose the Amazon Aurora engine and choose the PostgreSQL-compatible edition.
2. For DB engine version, choose an Aurora PostgreSQL engine that is compatible with
PostgreSQL 10.6 or greater.
3. For DB cluster parameter group, choose the group that you created when you enabled logical
replication.
2. Modify the inbound rules of the security group for the publisher to allow the subscriber to connect.
Usually, you do this by including the IP address of the subscriber in the security group. For details
about modifying a security group, see Security Groups for Your VPC in the Amazon Virtual Private
Cloud User Guide.
For this example, table data is replicated from an Aurora PostgreSQL database as the publisher to a
PostgreSQL database as the subscriber. Note that a subscriber database can be an RDS PostgreSQL
database or an Aurora PostgreSQL database. A subscriber can also be an application that uses PosgreSQL
logical replication. After the logical replication mechanism is set up, changes on the publisher are
continually sent to the subscriber as they occur.
1. Configure an Aurora PostgreSQL DB cluster as the publisher. To do so, create a new Aurora
PostgreSQL DB cluster, as described when configuring the publisher in Configuring Logical
Replication (p. 860).
2. Set up the publisher database.
For example, create a table using the following SQL statement on the publisher database.
861
Amazon Aurora User Guide for Aurora
Using Logical Replication
3. Insert data into the publisher database by using the following SQL statement.
For this example, we create an Amazon RDS for PostgreSQL database as the subscriber. For details on
creating a DB instance, see Creating a DB Instance in the Amazon RDS User Guide.
6. Set up the subscriber database.
For this example, create a table like the one created for the publisher by using the following SQL
statement.
7. Verify that there is data in the table at the publisher but no data yet at the subscriber by using the
following SQL statement on both databases.
Use the following SQL statement on the subscriber database and the following settings from the
publisher cluster:
• host – The publisher cluster's writer DB instance.
• port – The port on which the writer DB instance is listening. The default for PostgreSQL is 5432.
• dbname – The DB name of the publisher cluster.
After the subscription is created, a logical replication slot is created at the publisher.
9. To verify for this example that the initial data is replicated on the subscriber, use the following SQL
statement on the subscriber database.
The following example shows how to set up logical replication from an Aurora PostgreSQL database as
the publisher and then use AWS DMS for migration. This example uses the same publisher and subscriber
that were created in Example of Logical Replication of a Database Table (p. 861).
To set up logical replication with AWS DMS, you need details about your publisher and subscriber from
Amazon RDS. In particular, you need details about the publisher's writer DB instance and the subscriber's
DB instance.
• The DB instance ID
• The source engine
To do this, PostgreSQL 10.x and later databases require that you apply AWS DMS wrapper
functions to the publisher database. For details on this and later steps, see the instructions in Using
PostgreSQL Version 10.x and Later as a Source for AWS DMS in the AWS Database Migration Service
User Guide.
2. Sign in to the AWS Management Console and open the AWS DMS console at https://
console.aws.amazon.com/dms. At top right, choose the same AWS Region in which the publisher
and subscriber are located.
3. Create an AWS DMS replication instance.
Choose values that are the same as for your publisher's writer DB instance. These include the
following settings:
• For VPC, choose the same VPC as for the writer DB instance.
• For Replication Subnet Group, choose the same subnet group as for the writer DB instance.
• For Availability zone, choose the same zone as for the writer DB instance.
• For VPC Security Group, choose the same group as for the writer DB instance.
4. Create an AWS DMS endpoint for the source.
Specify the publisher as the source endpoint by using the following settings:
Specify the subscriber as the target endpoint by using the following settings:
863
Amazon Aurora User Guide for Aurora
Integrating Aurora PostgreSQL with AWS Services
You use a database migration task to specify what database tables to migrate, to map data using the
target schema, and to create new tables on the target database. At a minimum, use the following
settings for Task configuration:
• For Replication instance, choose the replication instance that you created in an earlier step.
• For Source database endpoint, choose the publisher source that you created in an earlier step.
• For Target database endpoint, choose the subscriber target that you created in an earlier step.
The rest of the task details depend on your migration project. For more information about specifying
all the details for DMS tasks, see Working with AWS DMS Tasks in the AWS Database Migration
Service User Guide.
After AWS DMS creates the task, it begins migrating data from the publisher to the subscriber.
• Quickly collect, view, and assess performance for your Aurora PostgreSQL DB instances with Amazon
RDS Performance Insights. Performance Insights expands on existing Amazon RDS monitoring features
to illustrate your database's performance and help you analyze any issues that affect it. With the
Performance Insights dashboard, you can visualize the database load and filter the load by waits, SQL
statements, hosts, or users.
For more information about Performance Insights, see Using Amazon RDS Performance
Insights (p. 398).
• Automatically add or remove Aurora Replicas with Aurora Auto Scaling. For more information, see
Using Amazon Aurora Auto Scaling with Aurora Replicas (p. 270).
• Configure your Aurora PostgreSQL DB cluster to publish log data to Amazon CloudWatch Logs.
CloudWatch Logs provide highly durable storage for your log records. With CloudWatch Logs, you can
perform real-time analysis of the log data, and use CloudWatch to create alarms and view metrics. For
more information, see Publishing Aurora PostgreSQL Logs to Amazon CloudWatch Logs (p. 899).
864
Amazon Aurora User Guide for Aurora
Overview of Exporting to S3
Note
To export data to Amazon S3 from Aurora PostgreSQL, your database must be running one of
the following PostgreSQL engine versions:
For more information on storing data with Amazon S3, see Create a Bucket in the Amazon Simple Storage
Service Getting Started Guide.
Topics
• Overview of Exporting Data to Amazon S3 (p. 865)
• Specifying the Amazon S3 File Path to Export to (p. 866)
• Setting Up Access to an Amazon S3 Bucket (p. 866)
• Exporting Query Data Using the aws_s3.export_query_to_s3 Function (p. 869)
• Function Reference (p. 871)
1. Install the required PostgreSQL extensions. These include the aws_s3 and aws_commons
extensions. To do so, start psql and use the following commands.
The aws_s3 extension provides the aws_s3.export_query_to_s3 (p. 871) function that you use to
export data to Amazon S3. The aws_commons extension is included to provide additional helper
functions.
2. Identify an Amazon S3 file path to use for exporting data. For details about this process, see
Specifying the Amazon S3 File Path to Export to (p. 866).
3. Provide permission to access the Amazon S3 bucket.
To export data to an Amazon S3 file, give the Aurora PostgreSQL DB cluster permission to access the
Amazon S3 bucket that the export will use for storage. Doing this includes the following steps:
1. Create an IAM policy that provides access to an Amazon S3 bucket that you want to export to.
2. Create an IAM role.
3. Attach the policy you created to the role you created.
4. Add this IAM role to your DB cluster.
For details about this process, see Setting Up Access to an Amazon S3 Bucket (p. 866).
4. Identify a database query to get the data. Export the query data by calling the
aws_s3.export_query_to_s3 function.
After you complete the preceding preparation tasks, use the aws_s3.export_query_to_s3 (p. 871)
function to export query results to Amazon S3. For details about this process, see Exporting Query
Data Using the aws_s3.export_query_to_s3 Function (p. 869).
865
Amazon Aurora User Guide for Aurora
Specifying the Amazon S3 File Path to Export to
For more information on storing data with Amazon S3, see Create a Bucket and View an Object in the
Amazon Simple Storage Service Getting Started Guide.
• File path – The file path identifies where the export is stored in the Amazon S3 bucket. The file path
consists of the following:
• An optional path prefix that identifies a virtual folder path.
• A file prefix that identifies one or more files to be stored. Larger exports are stored in multiple files,
each with a maximum size of approximately 6 GB. The additional file names have the same file prefix
but with _partXX appended. The XX represents 2, then 3, and so on.
For example, a file path with an exports folder and a query-1-export file prefix is /exports/
query-1-export.
• AWS Region (optional) – The AWS Region where the Amazon S3 bucket is located. If you don't specify
an AWS Region value, then Aurora saves your files into Amazon S3 in the same AWS Region as the
exporting DB cluster.
Note
Currently, the AWS Region must be the same as the region of the exporting DB cluster.
For a listing of AWS Region names and associated values, see Regions and Availability Zones (p. 5).
To hold the Amazon S3 file information about where the export is to be stored, you can use the
aws_commons.create_s3_uri (p. 873) function to create an aws_commons._s3_uri_1 composite
structure as follows.
You later provide this s3_uri_1 value as a parameter in the call to the
aws_s3.export_query_to_s3 (p. 871) function. For examples, see Exporting Query Data Using the
aws_s3.export_query_to_s3 Function (p. 869).
This policy provides the bucket and object permissions that allow your Aurora PostgreSQL DB cluster
to access Amazon S3.
866
Amazon Aurora User Guide for Aurora
Setting Up Access to an Amazon S3 Bucket
a. Include in the policy the following required actions to allow the transfer of files from your
Aurora PostgreSQL cluster to an Amazon S3 bucket:
• s3:PutObject
• s3:AbortMultipartUpload
b. Include the Amazon Resource Name (ARN) that identifies the Amazon S3 bucket and objects in
the bucket. The ARN format for accessing Amazon S3 is: arn:aws:s3:::your-s3-bucket/*
For more information on creating an IAM policy for Aurora PostgreSQL, see Creating and Using
an IAM Policy for IAM Database Access (p. 1037). 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 rds-s3-export-policy with these
options. It grants access to a bucket named your-s3-bucket.
Warning
We recommend that you set up your database within a private VPC that has endpoint
policies configured for accessing specific buckets. For more information, see Using
Endpoint Policies for Amazon S3 in the Amazon VPC User Guide.
We strongly recommend that you do not create a policy with all-resource access. This access
can pose a threat for data security. If you create a policy that gives S3:PutObject access
to all resources using "Resource":”*”, then a user with export privileges can export data
to all buckets in your account. In addition, the user can export data to any publicly writable
bucket within your AWS Region.
After you create the policy, note the Amazon Resource Name (ARN) of the policy. You need the ARN
for a subsequent step when you attach the policy to an IAM role.
You do this so Aurora PostgreSQL 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.
867
Amazon Aurora User Guide for Aurora
Setting Up Access to an Amazon S3 Bucket
"Principal": {
"Service": "rds.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}'
3. Attach the IAM policy that you created to the IAM role that you created.
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.
4. Add the IAM role to the DB cluster. You do so by using the AWS Management Console or AWS CLI, as
described following.
Console
To add an IAM role for a PostgreSQL DB cluster 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 the PostgreSQL DB cluster name to display its details.
3. On the Connectivity & security tab, in the Manage IAM roles section, choose the role to add under
Add IAM roles to this instance.
4. Under Feature, choose s3Export.
5. Choose Add role.
AWS CLI
To add an IAM role for a PostgreSQL DB cluster using the CLI
• Use the following command to add the role to the PostgreSQL DB cluster named my-db-cluster.
Replace your-role-arn with the role ARN that you noted in a previous step. Use s3Export for the
value of the --feature-name option.
Example
For Windows:
868
Amazon Aurora User Guide for Aurora
Exporting Query Data Using the
aws_s3.export_query_to_s3 Function
Topics
• Prerequisites (p. 869)
• Calling aws_s3.export_query_to_s3 (p. 869)
• Exporting to a CSV File That Uses a Custom Delimiter (p. 870)
• Exporting to a Binary File with Encoding (p. 870)
• Troubleshooting Access to Amazon S3 (p. 871)
Prerequisites
Before you use the aws_s3.export_query_to_s3 function, be sure to complete the following
prerequisites:
• Install the required PostgreSQL extensions as described in Overview of Exporting Data to Amazon
S3 (p. 865).
• Determine where to export your data to Amazon S3 as described in Specifying the Amazon S3 File
Path to Export to (p. 866).
• Make sure that the DB cluster has export access to Amazon S3 as described in Setting Up Access to an
Amazon S3 Bucket (p. 866).
The examples following use a database table called sample_table. These examples export the data
into a bucket called sample-bucket. The example table and data are created with the following SQL
statements in psql.
psql=> CREATE TABLE sample_table (bid bigint PRIMARY KEY, name varchar(80));
psql=> INSERT INTO sample_table (bid,name) VALUES (1, 'Monday'), (2,'Tuesday'), (3,
'Wednesday');
Calling aws_s3.export_query_to_s3
The following shows the basic ways of calling the aws_s3.export_query_to_s3 (p. 871) function.
Although the parameters vary, the results are the same for these examples. All rows of the
sample_table table are exported into a bucket called sample-bucket.
• 'select * from sample_table' – The first parameter is a required text string containing an SQL
query. The PostgreSQL engine runs this query. The results of the query are copied to the S3 bucket
identified in other parameters.
• :'s3_uri_1' – This parameter is a structure that contains the information identifying the Amazon
S3 file. Use the aws_commons.create_s3_uri (p. 873) function to create the structure as shown
following.
869
Amazon Aurora User Guide for Aurora
Exporting Query Data Using the
aws_s3.export_query_to_s3 Function
Or you can include the aws_commons.create_s3_uri function call inline within the
aws_s3.query_export_to_s3 function call.
• options :='format text' – The options parameter is an optional text string containing
PostgreSQL COPY arguments. The copy process uses the arguments and format of the PostgreSQL
COPY command.
If the file specified doesn't exist in the Amazon S3 bucket, it's created. If the file already exists, it's
overwritten. The syntax for accessing the exported data in Amazon S3 is the following.
s3-region://bucket-name[/path-prefix]/file-prefix
Larger exports are stored in multiple files, each with a maximum size of approximately 6 GB. The
additional file names have the same file prefix but with _partXX appended. The XX represents 2, then 3,
and so on. For example, suppose that you specify the path where you store data files as the following.
s3-us-west-2://my-bucket/my-prefix
If the export has to create three data files, the Amazon S3 bucket contains the following data files.
s3-us-west-2://my-bucket/my-prefix
s3-us-west-2://my-bucket/my-prefix_part2
s3-us-west-2://my-bucket/my-prefix_part3
For the full reference for this function and additional ways to call it, see
aws_s3.export_query_to_s3 (p. 871). For more about accessing files in Amazon S3, see View an Object
in the Amazon Simple Storage Service Getting Started Guide.
870
Amazon Aurora User Guide for Aurora
Function Reference
Function Reference
Functions
• aws_s3.export_query_to_s3 (p. 871)
• aws_commons.create_s3_uri (p. 873)
aws_s3.export_query_to_s3
Exports a PostgreSQL query result to an Amazon S3 bucket. The aws_s3 extension provides the
aws_s3.export_query_to_s3 function.
The two required parameters are query and s3_info. These define the query to be exported and
identify the Amazon S3 bucket to export to. An optional parameter called options provides for defining
various export parameters. For examples of using the aws_s3.export_query_to_s3 function, see
Exporting Query Data Using the aws_s3.export_query_to_s3 Function (p. 869).
Syntax
aws_s3.query_export_to_s3(
query text,
s3_info aws_commons._s3_uri_1,
options text
)
Input Parameters
query
A required text string containing an SQL query that the PostgreSQL engine runs. The results of this
query are copied to an S3 bucket identified in the s3_info parameter.
s3_info
Currently, this value must be the same AWS Region as that of the exporting DB cluster. The default
is the AWS Region of the exporting DB cluster.
871
Amazon Aurora User Guide for Aurora
Function Reference
options
An optional text string containing arguments for the PostgreSQL COPY command. These arguments
specify how the data is to be copied when exported. For more details, see the PostgreSQL COPY
documentation.
Instead of using the s3_info parameter to identify an Amazon S3 file, use the combination of the
bucket, file_path, and region parameters.
aws_s3.query_export_to_s3(
query text,
bucket text,
file_path text,
region text,
options text
)
query
A required text string containing an SQL query that the PostgreSQL engine runs. The results of this
query are copied to an S3 bucket identified in the s3_info parameter.
bucket
A required text string containing the name of the Amazon S3 bucket that contains the file.
file_path
An optional text string containing the AWS Region that the bucket is in. For a listing of AWS Region
names and associated values, see Regions and Availability Zones (p. 5).
Currently, this value must be the same AWS Region as that of the exporting DB cluster. The default is
the AWS Region of the exporting DB cluster.
options
An optional text string containing arguments for the PostgreSQL COPY command. These arguments
specify how the data is to be copied when exported. For more details, see the PostgreSQL COPY
documentation.
Output Parameters
aws_s3.query_export_to_s3(
OUT rows_uploaded bigint,
OUT files_uploaded bigint,
OUT bytes_uploaded bigint
)
rows_uploaded
The number of table rows that were successfully uploaded to Amazon S3 for the given query.
872
Amazon Aurora User Guide for Aurora
Managing Query Execution Plans for Aurora PostgreSQL
files_uploaded
The number of files uploaded to Amazon S3. Files are created in sizes of approximately 6 GB. Each
additional file created has _partXX appended to the name. The XX represents 2, then 3, and so on
as needed.
bytes_uploaded
Examples
psql=> SELECT * from aws_s3.query_export_to_s3('select * from sample_table', 'sample-
bucket', 'sample-filepath');
psql=> SELECT * from aws_s3.query_export_to_s3('select * from sample_table', 'sample-
bucket', 'sample-filepath','us-west-2');
psql=> SELECT * from aws_s3.query_export_to_s3('select * from sample_table', 'sample-
bucket', 'sample-filepath','us-west-2','format text');
aws_commons.create_s3_uri
Creates an aws_commons._s3_uri_1 structure to hold Amazon S3 file information.
You use the results of the aws_commons.create_s3_uri function in the s3_info
parameter of the aws_s3.export_query_to_s3 (p. 871) function. For an example of using the
aws_commons.create_s3_uri function, see Specifying the Amazon S3 File Path to Export
to (p. 866).
Syntax
aws_commons.create_s3_uri(
bucket text,
file_path text,
region text
)
Input Parameters
bucket
A required text string containing the Amazon S3 bucket name for the file.
file_path
A required text string containing the AWS Region that the file is in. For a listing of AWS Region
names and associated values, see Regions and Availability Zones (p. 5).
873
Amazon Aurora User Guide for Aurora
Enabling Query Plan Management
The quality and consistency of query optimization have a major impact on the performance and stability
of any relational database management system (RDBMS). Query optimizers create a query execution
plan for a SQL statement at a specific point in time. As conditions change, the optimizer might pick a
different plan that makes performance worse. A number of changes can all cause the query optimizer to
choose a different plan and lead to performance regression. These changes include changes in statistics,
constraints, environment settings, query parameter bindings, and software upgrades. Regression is a
major concern for high-performance applications.
With query plan management, you can control execution plans for a set of statements that you want to
manage. You can do the following:
• Improve plan stability by forcing the optimizer to choose from a small number of known, good plans.
• Optimize plans centrally and then distribute the best plans globally.
• Identify indexes that aren't used and assess the impact of creating or dropping an index.
• Automatically detect a new minimum-cost plan discovered by the optimizer.
• Try new optimizer features with less risk, because you can choose to approve only the plan changes
that improve performance.
Topics
• Enabling Query Plan Management for Aurora PostgreSQL (p. 874)
• Upgrading Query Plan Management (p. 875)
• Basics of Query Plan Management (p. 875)
• Best Practices for Query Plan Management (p. 878)
• Examining Plans in the apg_plan_mgmt.dba_plans view (p. 879)
• Capturing Execution Plans (p. 882)
• Using Managed Plans (p. 883)
• Maintaining Execution Plans (p. 886)
• Parameter Reference for Query Plan Management (p. 890)
• Function Reference for Query Plan Management (p. 894)
874
Amazon Aurora User Guide for Aurora
Upgrading Query Plan Management
psql my-database
my-database=> CREATE EXTENSION apg_plan_mgmt;
If you create the apg_plan_mgmt extension in the template1 default database, then the query
plan management extension is available in each new database that you create.
Note
To create the apg_plan_mgmt extension, you need the rds_superuser role. When you
create the apg_plan_mgmt extension, the apg_plan_mgmt role is created. Users must be
granted the apg_plan_mgmt role to administer the apg_plan_mgmt extension.
Topics
• Performing a Manual Plan Capture (p. 875)
• Viewing Captured Plans (p. 876)
• Working with Managed Statements and the SQL Hash (p. 876)
• Working with Automatic Plan Capture (p. 877)
• Validating Plans (p. 877)
• Approving New Plans That Improve Performance (p. 877)
• Deleting Plans (p. 878)
875
Amazon Aurora User Guide for Aurora
Basics
You can either execute SELECT, INSERT, UPDATE, or DELETE statements, or you can include the EXPLAIN
statement as shown above. Use EXPLAIN to capture a plan without the overhead or potential side-effects
of executing the statement. For more about manual capture, see Manually Capturing Plans for Specific
SQL Statements (p. 882).
Each row displayed represents a managed plan. The preceding example displays the following
information.
For more about the apg_plan_mgmt.dba_plans view, see Examining Plans in the
apg_plan_mgmt.dba_plans view (p. 879).
• For manual capture, you provide the specific statements to the optimizer as shown in the previous
example.
• For automatic capture, the optimizer captures plans for statements that run multiple times. Automatic
capture is shown in a later example.
In the apg_plan_mgmt.dba_plans view, you can identify a managed statement with a SQL hash value.
The SQL hash is calculated on a normalized representation of the SQL statement that removes some
differences such as the literal values. Using normalization means that when multiple SQL statements
differ only in their literal or parameter values, they are represented by the same SQL hash in the
apg_plan_mgmt.dba_plans view. Therefore, there can be multiple plans for the same SQL hash where
each plan is optimal under different conditions.
When the optimizer processes any SQL statement, it uses the following rules to create the normalized
SQL statement:
876
Amazon Aurora User Guide for Aurora
Basics
As your application runs, the optimizer captures plans for any statement that runs more than once. The
optimizer always sets the status of a managed statement's first captured plan to approved. A managed
statement's set of approved plans is known as its plan baseline.
As your application continues to run, the optimizer might find additional plans for the managed
statements. The optimizer sets additional captured plans to a status of Unapproved.
The set of all captured plans for a managed statement is known as the plan history. Later, you
can decide if the Unapproved plans perform well and change them to Approved, Rejected,
or Preferred by using the apg_plan_mgmt.evolve_plan_baselines function or the
apg_plan_mgmt.set_plan_status function.
For more about plan capture, see Capturing Execution Plans (p. 882).
Validating Plans
Managed plans can become invalid ("stale") when objects that they depend on are removed, such as an
index. To find and delete all plans that are stale, use the apg_plan_mgmt.validate_plans function.
SELECT apg_plan_mgmt.validate_plans('delete');
The following example automatically approves any unapproved plan that is enabled and faster by at
least 10 percent than the minimum-cost plan in the plan baseline.
SELECT apg_plan_mgmt.evolve_plan_baselines(
877
Amazon Aurora User Guide for Aurora
Best Practices for Query Plan Management
sql_hash,
plan_hash,
1.1,
'approve'
)
FROM apg_plan_mgmt.dba_plans
WHERE status = 'Unapproved' AND enabled = true;
For more information about verifying plans, see Evaluating Plan Performance (p. 886).
Deleting Plans
The optimizer deletes plans automatically if they have not been executed or chosen as the minimum-
cost plan for the plan retention period. By default, the plan retention period is 32 days. To change the
plan retention period, set the apg_plan_mgmt.plan_retention_period parameter.
You can also review the contents of the apg_plan_mgmt.dba_plans view and delete any plans you
don't want by using the apg_plan_mgmt.delete_plan function. For more information, see Deleting
Plans (p. 889).
1. In a development environment, identify the SQL statements that have the greatest impact on
performance or system throughput. Then capture the plans for these statements as described
in Manually Capturing Plans for Specific SQL Statements (p. 882) and Automatically Capturing
Plans (p. 882).
2. Export the captured plans from the development environment and import them into the production
environment. For more information, see Exporting and Importing Plans (p. 889).
3. In production, run your application and enforce the use of approved managed plans. For more
information, see Using Managed Plans (p. 883). While the application runs, also add new plans as the
optimizer discovers them. For more information, see Automatically Capturing Plans (p. 882).
4. Analyze the unapproved plans and approve those that perform well. For more information, see
Evaluating Plan Performance (p. 886).
5. While your application continues to run, the optimizer begins to use the new plans as appropriate.
878
Amazon Aurora User Guide for Aurora
Examining plans in the dba_plans view
1. While your application runs, enforce the use of managed plans and automatically add newly
discovered plans as unapproved. For more information, see Using Managed Plans (p. 883) and
Automatically Capturing Plans (p. 882).
2. Monitor your running application for performance regressions.
3. When you discover a plan regression, set the plan's status to rejected. The next time the optimizer
runs the SQL statement, it automatically ignores the rejected plan and uses a different approved plan
instead. For more information, see Rejecting or Disabling Slower Plans (p. 887).
In some cases, you might prefer to fix a bad plan rather than reject, disable, or delete it. Use the
pg_hint_plan extension to experiment with improving a plan. With pg_hint_plan, you use special
comments to tell the optimizer to override how it normally creates a plan. For more information, see
Fixing Plans Using pg_hint_plan (p. 887).
This view contains the plan history for all of your managed statements. Each managed plan is identified
by the combination of a SQL hash value and a plan hash value. With these identifiers, you can use tools
such as Amazon RDS Performance Insights to track individual plan performance. For more information
on Performance Insights, see Using Amazon RDS Performance Insights.
Note
Access to the apg_plan_mgmt.dba_plans view is restricted to users that hold the
apg_plan_mgmt role.
879
Amazon Aurora User Guide for Aurora
Examining plans in the dba_plans view
cardinality_error A measure of the error between the estimated cardinality versus the
actual cardinality. Cardinality is the number of table rows that the
plan is to process. If the cardinality error is large, then it increases the
likelihood that the plan isn't optimal. This column is populated by the
apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
The estimated optimizer setup cost before the optimizer delivers rows of a
estimated_startup_cost
table.
The execution time benefit in milliseconds of enabling the plan. This column is
execution_time_benefit_ms
populated by the apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
execution_time_ms The estimated time in milliseconds that the plan would run. This column is
populated by the apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
has_side_effects A value that indicates that the SQL statement is a data manipulation language
(DML) statement or a SELECT statement that contains a VOLATILE function.
last_used This value is updated to the current date whenever the plan is either executed
or when the plan is the query optimizer's minimum-cost plan. This value
is stored in shared memory and periodically flushed to disk. To get the
most up-to-date value, read the date from shared memory by calling the
function apg_plan_mgmt.plan_last_used(sql_hash, plan_hash)
instead of reading the last_used value. For additional information, see the
apg_plan_mgmt.plan_retention_period (p. 893) parameter.
last_validated The most recent date and time when it was verified that the plan could be
recreated by either the apg_plan_mgmt.validate_plans (p. 898) function or
the apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
last_verified The most recent date and time when a plan was verified to be
the best-performing plan for the specified parameters by the
apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
param_list The parameter values that were passed to the statement if this is a prepared
statement.
880
Amazon Aurora User Guide for Aurora
Examining plans in the dba_plans view
plan_created The date and time the plan that was created.
plan_hash The plan identifier. The combination of plan_hash and sql_hash uniquely
identifies a specific plan.
plan_outline A representation of the plan that is used to recreate the actual execution
plan, and that is database-independent. Operators in the tree correspond to
operators that appear in the EXPLAIN output.
planning_time_ms The actual time to run the planner, in milliseconds. This column is populated
by the apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
sql_hash A hash value of the SQL statement text, normalized with literals removed.
status A plan's status, which determines how the optimizer uses a plan. Valid values
include the following.
• Approved – A usable plan that the optimizer can choose to run. The
optimizer runs the least-cost plan from a managed statement's set
of approved plans (baseline). To reset a plan to approved, use the
apg_plan_mgmt.evolve_plan_baselines (p. 895) function.
• Unapproved – A captured plan that you have not verified for use. For more
information, see Evaluating Plan Performance (p. 886).
• Rejected – A plan that the optimizer won't use. For more information, see
Rejecting or Disabling Slower Plans (p. 887).
• Preferred – A plan that you have determined is a preferred plan to use for
a managed statement.
stmt_name The name of the SQL statement within a PREPARE statement. This value is
an empty string for an unnamed prepared statement. This value is NULL for a
nonprepared statement.
The total time benefit in milliseconds of enabling this plan. This value
total_time_benefit_ms
considers both planning time and execution time.
881
Amazon Aurora User Guide for Aurora
Capturing Execution Plans
When capturing plans, the optimizer sets the status of a managed statement's first captured plan to
approved. The optimizer sets the status of any additional plans captured for a managed statement to
unapproved. However, more than one plan might occasionally be saved with the approved status. This
can happen when multiple plans are created for a statement in parallel and before the first plan for the
statement is committed.
To control the maximum number of plans that can be captured and stored in the dba_plans view, set
the apg_plan_mgmt.max_plans parameter in your DB instance-level parameter group. A change to
the apg_plan_mgmt.max_plans parameter requires a DB instance restart for a new value to take
effect. For more information, see the apg_plan_mgmt.max_plans (p. 891) parameter.
Topics
• Manually Capturing Plans for Specific SQL Statements (p. 882)
• Automatically Capturing Plans (p. 882)
After capturing a plan for each SQL statement, the optimizer adds a new row to the
apg_plan_mgmt.dba_plans view.
We recommend that you use either EXPLAIN or EXPLAIN EXECUTE statements in the SQL script file.
Make sure that you include enough variations in parameter values to capture all the plans of interest.
If you know of a better plan than the optimizer's minimum cost plan, you might be able to force the
optimizer to use the better plan. To do so, specify one or more optimizer hints. For more information,
see Fixing Plans Using pg_hint_plan (p. 887). To compare the performance of the unapproved and
approved plans and approve, reject, or delete them, see Evaluating Plan Performance (p. 886).
• You don't know the specific SQL statements that you want to manage.
• You have hundreds or thousands of SQL statements to manage.
• Your application uses a client API. For example, JDBC uses unnamed prepared statements or bulk-
mode statements that can't be expressed in psql.
882
Amazon Aurora User Guide for Aurora
Using Managed Plans
As the application runs with default query plan management parameter settings, the optimizer
captures plans for each SQL statement that runs at least twice. Capturing all plans while using the
defaults has very little run-time overhead and can be enabled in production.
You can modify some parameters to capture plans for statements that have the greatest impact on
throughput, run the longest, or have the most volatile performance. However, this extended mode
of automatic plan capture has a noticeable performance overhead.
To measure the performance of the unapproved plans and approve, reject, or delete them, see
Evaluating Plan Performance (p. 886).
While the application runs, this setting causes the optimizer to use the minimum-cost, preferred, or
approved plan that is valid and enabled, for each managed statement.
The following flowchart shows how the query plan management optimizer chooses which plan to run.
883
Amazon Aurora User Guide for Aurora
Using Managed Plans
1. When the optimizer processes every SQL statement, it generates a minimum-cost plan.
2. Without query plan management, the optimizer simply runs its generated plan. The optimizer uses
query plan management if you set one or both of the following parameter settings:
884
Amazon Aurora User Guide for Aurora
Using Managed Plans
For details on how the optimizer captures plans, see Capturing Execution Plans (p. 882).
5. The optimizer runs the generated plan if apg_plan_mgmt.use_plan_baselines is false.
6. If the optimizer's plan isn't in the apg_plan_mgmt.dba_plans view, the optimizer captures the plan
as a new unapproved plan.
7. The optimizer runs the generated plan if the following are both true:
• The optimizer's plan isn't a rejected or disabled plan.
• The plan's total cost is less than the unapproved execution plan threshold.
The optimizer doesn't run disabled plans or any plans that have the rejected status. In most cases,
the optimizer doesn't execute unapproved plans. However, the optimizer runs an unapproved plan if
you set a value for the parameter apg_plan_mgmt.unapproved_plan_execution_threshold
and the plan's total cost is less than the threshold. For more information, see the
apg_plan_mgmt.unapproved_plan_execution_threshold (p. 893) parameter.
8. If the managed statement has any enabled and valid preferred plans, the optimizer runs the
minimum-cost one.
A valid plan is one that the optimizer can run. Managed plans can become invalid for various reasons.
For example, plans become invalid when objects that they depend on are removed, such as an index or
a partition of a partitioned table.
9. The optimizer determines the minimum-cost plan from the managed statement's approved plans that
are both enabled and valid. The optimizer then runs the minimum-cost approved plan.
The optimizer indicates which plan it will run, but notice that in this example that it found a lower-cost
plan. In this case, you capture this new minimum cost plan by turning on automatic plan capture as
described in Automatically Capturing Plans (p. 882).
885
Amazon Aurora User Guide for Aurora
Maintaining Execution Plans
Topics
• Evaluating Plan Performance (p. 886)
• Validating Plans (p. 887)
• Fixing Plans Using pg_hint_plan (p. 887)
• Deleting Plans (p. 889)
• Exporting and Importing Plans (p. 889)
Topics
• Approving Better Plans (p. 886)
• Rejecting or Disabling Slower Plans (p. 887)
SELECT apg_plan_mgmt.evolve_plan_baselines (
sql_hash,
plan_hash,
min_speedup_factor := 1.0,
action := 'approve'
)
FROM apg_plan_mgmt.dba_plans WHERE status = 'Unapproved';
The output shows a performance report for the rangequery statement with parameter bindings of 1
and 10,000. The new unapproved plan (Baseline+1) is better than the best previously approved plan
(Baseline). To confirm that the new plan is now Approved, check the apg_plan_mgmt.dba_plans
view.
886
Amazon Aurora User Guide for Aurora
Maintaining Execution Plans
The managed plan now includes two approved plans that are the statement's plan baseline. You can
also call the apg_plan_mgmt.set_plan_status function to directly set a plan's status field to
'Approved', 'Rejected', 'Unapproved', or 'Preferred'.
SELECT apg_plan_mgmt.evolve_plan_baselines(
sql_hash, -- The managed statement ID
plan_hash, -- The plan ID
1.1, -- number of times faster the plan must be
'disable' -- The action to take. This sets the enabled field to false.
)
FROM apg_plan_mgmt.dba_plans
WHERE status = 'Unapproved' AND -- plan is Unapproved
origin = 'Automatic'; -- plan was auto-captured
You can also directly set a plan to rejected or disabled. To directly set a plan's enabled field
to true or false, call the apg_plan_mgmt.set_plan_enabled function. To directly set a
plan's status field to 'Approved', 'Rejected', 'Unapproved', or 'Preferred', call the
apg_plan_mgmt.set_plan_status function.
Validating Plans
Use the apg_plan_mgmt.validate_plans function to delete or disable plans that are invalid.
Plans can become invalid or stale when objects that they depend on are removed, such as an index or
a table. However, a plan might be invalid only temporarily if the removed object gets recreated. If an
invalid plan can become valid later, you might prefer to disable an invalid plan or do nothing rather than
delete it.
To find and delete all plans that are invalid and haven't been used in the past week, use the
apg_plan_mgmt.validate_plans function as follows.
887
Amazon Aurora User Guide for Aurora
Maintaining Execution Plans
• pg_hint_plan extension – Specify a “hint” to modify how the planner works by using PostgreSQL's
pg_hint_plan extension. To install and learn more about how to use the pg_hint_plan extension,
see the pg_hint_plan documentation.
• GUC variables – Override one or more cost model parameters or other optimizer parameters, such as
the from_collapse_limit or GEQO_threshold.
When you use one of these techniques to force the query optimizer to use a plan, you can also use query
plan management to capture and enforce use of the new plan.
You can use the pg_hint_plan extension to change the join order, the join methods, or the access paths
for a SQL statement. You use a SQL comment with special pg_hint_plan syntax to modify how the
optimizer creates a plan. For example, assume the problem SQL statement has a two-way join.
SELECT *
FROM t1, t2
WHERE t1.id = t2.id;
Then suppose that the optimizer chooses the join order (t1, t2), but we know that the join order (t2, t1)
is faster. The following hint forces the optimizer to use the faster join order, (t2, t1). Include EXPLAIN so
that the optimizer generates a plan for the SQL statement but does not run the statement. (Output not
shown.)
To modify the optimizer's generated plan and capture the plan using pg_hint_plan
After this runs, the optimizer captures the plan in the apg_plan_mgmt.dba_plans view. The
captured plan doesn't include the special pg_hint_plan comment syntax because query plan
management normalizes the statement by removing leading comments.
3. View the managed plans by using the apg_plan_mgmt.dba_plans view.
4. Set the status of the plan to Preferred. Doing so makes sure that the optimizer chooses to run
it, instead of selecting from the set of approved plans, when the minimum-cost plan isn't already
Approved or Preferred.
5. Turn off manual plan capture and enforce the use of managed plans.
888
Amazon Aurora User Guide for Aurora
Maintaining Execution Plans
Now, when the original SQL statement runs, the optimizer chooses either an Approved or
Preferred plan. If the minimum-cost plan isn't Approved or Preferred, then the optimizer
chooses the Preferred plan.
Deleting Plans
Delete plans that have not been used for a long time or that are no longer relevant. Each plan has a
last_used date that the optimizer updates each time it executes a plan or picks it as the minimum-cost
plan for a statement. Use the last_used date to determine if a plan has been used recently and is still
relevant.
For example, you can use the apg_plan_mgmt.delete_plan function as follows. Doing this deletes
all plans that haven't been chosen as the minimum-cost plan or haven't run in at least 31 days. However,
this example doesn't delete plans that have been explicitly rejected.
To delete any plan that is no longer valid and that you expect not to become valid again, use the
apg_plan_mgmt.validate_plans function. For more information, see Validating Plans (p. 887).
You can implement your own policy for deleting plans. Plans are automatically deleted when the
current date last_used is greater than the value of the apg_plan_mgmt.plan_retention_period
parameter, which defaults to 32 days. You can specify a longer interval, or you can implement your own
plan retention policy by calling the delete_plan function directly.
Important
If you don't clean up plans, you might eventually run out of shared memory that is set aside
for query plan management. To control how much memory is available for managed plans,
use the apg_plan_mgmt.max_plans parameter. Set this parameter in your DB instance-level
parameter group and restart your DB instance for changes to take effect. For more information,
see the apg_plan_mgmt.max_plans (p. 891) parameter.
An authorized user can copy any subset of the apg_plan_mgmt.plans table to another table, and then
save it using the pg_dump command. The following is an example.
1. Copy the .tar file of the exported managed plans to the system where the plans are to be restored.
889
Amazon Aurora User Guide for Aurora
Parameter Reference for Query Plan Management
2. Use the pg_restore command to copy the tar file into a new table.
3. Merge the plans_copy table with the apg_plan_mgmt.plans table, as shown in the following
example.
Note
In some cases, you might dump from one version of the apg_plan_mgmt extension and
restore into a different version. In these cases, the columns in the plans table might be
different. If so, name the columns explicitly instead of using SELECT *.
4. Reload the managed plans into shared memory and remove the temporary plans table.
Parameters
• apg_plan_mgmt.capture_plan_baselines (p. 891)
• apg_plan_mgmt.max_databases (p. 891)
• apg_plan_mgmt.max_plans (p. 891)
• apg_plan_mgmt.pgss_min_calls (p. 891)
• apg_plan_mgmt.pgss_min_mean_time_ms (p. 892)
• apg_plan_mgmt.pgss_min_stddev_time_ms (p. 892)
• apg_plan_mgmt.pgss_min_total_time_ms (p. 892)
• apg_plan_mgmt.plan_retention_period (p. 893)
• apg_plan_mgmt.unapproved_plan_execution_threshold (p. 893)
• apg_plan_mgmt.use_plan_baselines (p. 893)
890
Amazon Aurora User Guide for Aurora
Parameter Reference for Query Plan Management
• Set at the cluster-level to provide the same settings for all DB instances. For more information, see
Modifying Parameters in a DB Cluster Parameter Group (p. 213).
• Set at the DB instance level to isolate the settings to an individual DB instance. For more information,
see Modifying Parameters in a DB Parameter Group (p. 210).
• Set in a specific client session such as in psql, to isolate the values to only that session.
apg_plan_mgmt.capture_plan_baselines
Enable execution plan capture for SQL statements.
Value Description
automatic Enable plan capture for subsequent SQL statements that satisfy the eligibility criteria.
apg_plan_mgmt.max_databases
Sets the maximum number of database objects that might use query plan management. A database
object is what gets created with the CREATE DATABASE SQL statement.
Important
Set apg_plan_mgmt.max_databases at the cluster or DB instance level. It requires a DB
instance restart for a new value to take effect.
apg_plan_mgmt.max_plans
Sets the maximum number of plans that might be captured in the apg_plan_mgmt.dba_plans view.
Important
Set apg_plan_mgmt.max_plans at the cluster or DB instance level. It requires a DB instance
restart for a new value to take effect.
apg_plan_mgmt.pgss_min_calls
This parameter has been deprecated.
891
Amazon Aurora User Guide for Aurora
Parameter Reference for Query Plan Management
Sets the minimum number of pg_stat_statements calls that are eligible for plan capture.
Usage Notes
Requires installation of the pg_stat_statements extension. For more information, see the PostgreSQL
pg_stats_statements documentation.
apg_plan_mgmt.pgss_min_mean_time_ms
This parameter has been deprecated.
Usage Notes
Requires installation of the pg_stat_statements extension. For more information, see the
PostgreSQL pg_stats_statements documentation.
apg_plan_mgmt.pgss_min_stddev_time_ms
This parameter has been deprecated.
Usage Notes
Requires installation of the pg_stat_statements extension. For more information, see the PostgreSQL
pg_stats_statements documentation.
apg_plan_mgmt.pgss_min_total_time_ms
This parameter has been deprecated.
892
Amazon Aurora User Guide for Aurora
Parameter Reference for Query Plan Management
Usage Notes
Requires installation of the pg_stat_statements extension. For more information, see the PostgreSQL
pg_stats_statements documentation.
apg_plan_mgmt.plan_retention_period
The number of days plans are kept in the apg_plan_mgmt.dba_plans view before being automatically
deleted. A plan is deleted when the current date is this many days since the plan's last_used date.
Positive integer 32 A positive integer value greater or equal to 32, representing days.
apg_plan_mgmt.unapproved_plan_execution_threshold
An estimated total plan cost threshold, below which the optimizer runs an unapproved plan. By default,
the optimizer does not run unapproved plans. However, you can set an execution threshold for your
fastest unapproved plans. With this setting, the optimizer bypasses the overhead of enforcing only
approved plans.
With the following example, the optimizer runs an unapproved plan if the estimated cost is less than
550, even if use_plan_baselines is true.
apg_plan_mgmt.use_plan_baselines
Enforce the optimizer to use managed plans for managed statements.
893
Amazon Aurora User Guide for Aurora
Function Reference for Query Plan Management
Value Description
true Enforce the use of managed plans. When a SQL statement runs and it is a managed
statement in the apg_plan_mgmt.dba_plans view, the optimizer chooses a managed
plan in the following order.
false (Default) Do not use managed plans. The optimizer uses its generated minimum-cost
plan.
Usage Notes
When use_plan_baselines is true, then the optimizer makes the following execution decisions:
Functions
• apg_plan_mgmt.delete_plan (p. 894)
• apg_plan_mgmt.evolve_plan_baselines (p. 895)
• apg_plan_mgmt.plan_last_used (p. 896)
• apg_plan_mgmt.reload (p. 897)
• apg_plan_mgmt.set_plan_enabled (p. 897)
• apg_plan_mgmt.set_plan_status (p. 897)
• apg_plan_mgmt.validate_plans (p. 898)
apg_plan_mgmt.delete_plan
Delete a managed plan.
Syntax
apg_plan_mgmt.delete_plan(
sql_hash,
plan_hash
)
894
Amazon Aurora User Guide for Aurora
Function Reference for Query Plan Management
Return Value
Parameters
Parameter Description
apg_plan_mgmt.evolve_plan_baselines
Verifies whether an already approved plan is faster or whether a plan identified by the query optimizer
as a minimum cost plan is faster.
Syntax
apg_plan_mgmt.evolve_plan_baselines(
sql_hash,
plan_hash,
min_speedup_factor,
action
)
Return Value
The number of plans that were not faster than the best approved plan.
Parameters
Parameter Description
plan_hash The managed plan's plan_hash ID. Use NULL to mean all plans that have
the same sql_hash ID value.
min_speedup_factor The minimum speedup factor can be the number of times faster that a
plan must be than the best of the already approved plans to approve it.
Alternatively, this factor can be the number of times slower that a plan must
be to reject or disable it.
action The action the function is to perform. Valid values include the following.
Case does not matter.
• 'disable' – Disable each matching plan that does not meet the
minimum speedup factor.
• 'approve' – Enable each matching plan that meets the minimum
speedup factor and set its status to approved.
• 'reject' – For each matching plan that does not meet the minimum
speedup factor, set its status to rejected.
895
Amazon Aurora User Guide for Aurora
Function Reference for Query Plan Management
Parameter Description
• NULL – The function simply returns the number of plans that have no
performance benefit because they do not meet the minimum speedup
factor.
Usage Notes
Set specified plans to approved, rejected, or disabled based on whether the planning plus execution time
is faster than the best approved plan by a factor that you can set. The action parameter might be set to
'approve' or 'reject' to automatically approve or reject a plan that meets the performance criteria.
Alternatively, it might be set to '' (empty string) to do the performance experiment and produce a report,
but take no action.
Conduct a performance experiment to compare the planning plus execution time of each plan relative
to the other plans in the baseline. In some cases, there is only one plan for a statement and the plan
is approved. In such a case, compare the planning plus execution time of the plan to the planning plus
execution time of using no plan.
The incremental benefit (or disadvantage) of each plan is recorded in the apg_plan_mgmt.dba_plans
view in the total_time_benefit_ms column. When this value is positive, there is a measurable
performance advantage to including this plan in the baseline.
In addition to collecting the planning and execution time of each candidate plan, the last_verified
column of the apg_plan_mgmt.dba_plans view is updated with the current_timestamp. The
last_verified timestamp might be used to avoid running this function again on a plan that recently
had its performance verified.
apg_plan_mgmt.plan_last_used
Returns the last_used date of the specified plan from shared memory.
Syntax
apg_plan_mgmt.plan_last_used(
sql_hash,
plan_hash
)
Return Value
Parameters
Parameter Description
896
Amazon Aurora User Guide for Aurora
Function Reference for Query Plan Management
apg_plan_mgmt.reload
Reload plans into shared memory from the apg_plan_mgmt.dba_plans view.
Syntax
apg_plan_mgmt.reload()
Return Value
None.
Parameters
None.
Usage Notes
• Use it to refresh the shared memory of a read-only replica immediately, rather than wait for new plans
to propagate to the replica.
• Use it after importing managed plans.
apg_plan_mgmt.set_plan_enabled
Enable or disable a managed plan.
Syntax
apg_plan_mgmt.set_plan_enabled(
sql_hash,
plan_hash,
[true | false]
)
Return Value
Parameters
Parameter Description
apg_plan_mgmt.set_plan_status
Set a managed plan's status to Approved, Unapproved, Rejected, or Preferred.
Syntax
897
Amazon Aurora User Guide for Aurora
Function Reference for Query Plan Management
apg_plan_mgmt.set_plan_status(
sql_hash,
plan_hash,
status
)
Return Value
Parameters
Parameter Description
• Approved
• Unapproved
• Rejected
• Preferred
The case you use does not matter, however the status value is set to initial uppercase
in the apg_plan_mgmt.dba_plans view. For more information about these values,
see status in Reference for the apg_plan_mgmt.dba_plans View (p. 879).
apg_plan_mgmt.validate_plans
Validate that the optimizer can still recreate plans. The optimizer validates Approved, Unapproved,
and Preferred plans, whether the plan is enabled or disabled. Rejected plans are not validated.
Optionally, you can use the apg_plan_mgmt.validate_plans function to delete or disable invalid
plans.
Syntax
apg_plan_mgmt.validate_plans(
sql_hash,
plan_hash,
action)
apg_plan_mgmt.validate_plans(
action)
Return Value
Parameters
Parameter Description
898
Amazon Aurora User Guide for Aurora
Publishing Aurora PostgreSQL Logs to CloudWatch Logs
Parameter Description
plan_hash The managed plan's plan_hash ID. Use NULL to mean all plans for the same
sql_hash ID value.
action The action the function is to perform for invalid plans. Valid string values include the
following. Case does not matter.
Usage Notes
Use the form validate_plans(action) to validate all the managed plans for all the managed
statements in the entire apg_plan_mgmt.dba_plans view.
Use the form validate_plans(sql_hash, NULL, action) to validate all the managed plans for
the managed statement specified with sql_hash.
• Aurora PostgreSQL supports publishing logs to CloudWatch Logs for versions 9.6.12 and
above and versions 10.7 and above.
• From Aurora PostgreSQL, only postgresql logs can be published. Publishing upgrade logs isn't
supported.
• You can't publish logs to CloudWatch Logs for the China (Ningxia) region.
• If exporting log data is disabled, Aurora doesn't delete existing log groups or log streams.
If exporting log data is disabled, existing log data remains available in CloudWatch Logs,
depending on log retention, and you still incur charges for stored audit log data. You can
delete log streams and log groups using the CloudWatch Logs console, the AWS CLI, or the
CloudWatch Logs API.
• If you don't want to export audit logs to CloudWatch Logs, make sure that all methods of
exporting audit logs are disabled. These methods are the AWS Management Console, the AWS
CLI, and the RDS API.
899
Amazon Aurora User Guide for Aurora
Publishing Aurora PostgreSQL Logs to CloudWatch Logs
Console
You can publish Aurora PostgreSQL logs to CloudWatch Logs with the console.
AWS CLI
You can publish Aurora PostgreSQL logs with the AWS CLI. You can run the modify-db-cluster AWS CLI
command with the following options:
You can also publish Aurora PostgreSQL logs by running one of the following AWS CLI commands:
• create-db-cluster
• restore-db-cluster-from-s3
• restore-db-cluster-from-snapshot
• restore-db-cluster-to-point-in-time
Run one of these AWS CLI commands with the following options:
Other options might be required depending on the AWS CLI command that you run.
Example
The following command creates an Aurora PostgreSQL DB cluster to publish log files to CloudWatch
Logs.
For Windows:
900
Amazon Aurora User Guide for Aurora
Publishing Aurora PostgreSQL Logs to CloudWatch Logs
Example
The following command modifies an existing Aurora PostgreSQL DB cluster 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 postgresql.
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 Aurora PostgreSQL DB cluster to disable publishing 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 postgresql.
For Windows:
Note
When using the Windows command prompt, you must escape double quotes (") in JSON code by
prefixing them with a backslash (\).
RDS API
You can publish Aurora PostgreSQL logs with the RDS API. You can run the ModifyDBCluster action with
the following options:
901
Amazon Aurora User Guide for Aurora
Monitoring Log Events in Amazon CloudWatch
You can also publish Aurora PostgreSQL logs with the RDS API by running one of the following RDS API
actions:
• CreateDBCluster
• RestoreDBClusterFromS3
• RestoreDBClusterFromSnapshot
• RestoreDBClusterToPointInTime
Other parameters might be required depending on the AWS CLI command that you run.
A new log group is automatically created for the Aurora DB cluster under the following prefix, in which
cluster-name represents the DB cluster name, and log_type represents the log type.
/aws/rds/cluster/cluster-name/log_type
For example, if you configure the export function to include the postgresql log for a DB cluster named
my-db-cluster, PostgreSQL log data is stored in the /aws/rds/cluster/my-db-cluster/
postgresql log group.
All of the events from all of the DB instances in a DB cluster are pushed to a log group using different log
streams.
If a log group with the specified name exists, Aurora uses that log group to export log data for the
Aurora DB cluster. You can use automated configuration, such as AWS CloudFormation, to create log
groups with predefined log retention periods, metric filters, and customer access. Otherwise, a new log
group is automatically created using the default log retention period, Never Expire, in CloudWatch Logs.
You can use the CloudWatch Logs console, the AWS CLI, or the CloudWatch Logs API to change the log
retention period. For more information about changing log retention periods in CloudWatch Logs, see
Change Log Data Retention in CloudWatch Logs.
You can use the CloudWatch Logs console, the AWS CLI, or the CloudWatch Logs API to search for
information within the log events for a DB cluster. For more information about searching and filtering
log data, see Searching and Filtering Log Data.
902
Amazon Aurora User Guide for Aurora
Enabling Aurora Machine Learning
between the Aurora database and the AWS machine learning (ML) services Amazon SageMaker and
Amazon Comprehend.
• You can add ML-based predictions to your existing database applications. You don't need to build
custom integrations or learn separate tools. You can embed machine learning processing directly into
your SQL query as calls to functions.
• The ML integration is a fast way to enable ML services to work with transactional data. You don't have
to move the data out of the database to perform the machine learning operations. You don't have
to convert or reimport the results of the machine learning operations to use them in your database
application.
• You can use your existing governance policies to control who has access to the underlying data and to
the generated insights.
AWS machine learning services are managed services that you set up and run in their own production
environments. Currently, Aurora Machine Learning integrates with Amazon Comprehend for sentiment
analysis and Amazon SageMaker for a wide variety of ML algorithms.
For general information about Amazon Comprehend, see Amazon Comprehend. For details about using
Aurora and Amazon Comprehend together, see Using Amazon Comprehend for Natural Language
Processing (p. 906).
For general information about Amazon SageMaker, see Amazon SageMaker. For details about
using Aurora and Amazon SageMaker together, see Using Amazon SageMaker to Run Your Own ML
Models (p. 907).
Note
Aurora machine learning for PostgreSQL connects an Aurora cluster to Amazon SageMaker or
Amazon Comprehend services only within the same AWS Region.
Topics
• Enabling Aurora Machine Learning (p. 903)
• Using Amazon Comprehend for Natural Language Processing (p. 906)
• Exporting Data to Amazon S3 for Amazon SageMaker Model Training (p. 907)
• Using Amazon SageMaker to Run Your Own ML Models (p. 907)
• Best Practices with Aurora Machine Learning (p. 910)
• Monitoring Aurora Machine Learning (p. 914)
• PostgreSQL Function Reference for Aurora Machine Learning (p. 916)
• Manually Setting up IAM Roles for Amazon SageMaker and Amazon Comprehend Using the AWS
CLI (p. 917)
• Version 2.4 of Aurora with PostgreSQL compatibility running the PostgreSQL engine version 10.11.
• Version 3.1 and higher of Aurora with PostgreSQL compatibility running the PostgreSQL engine
version 11.6 and higher
For information about upgrading an older Aurora cluster, see Upgrading the PostgreSQL DB Engine for
Aurora PostgreSQL (p. 925).
903
Amazon Aurora User Guide for Aurora
Enabling Aurora Machine Learning
Topics
• Setting Up IAM Access to AWS Machine Learning Services (p. 904)
• Installing the aws_ml Extension for Model Inference (p. 905)
You can do IAM setup automatically by using the AWS Management Console as shown here. To use the
AWS CLI to set up IAM access, see Manually Setting up IAM Roles for Amazon SageMaker and Amazon
Comprehend Using the AWS CLI (p. 917).
For Aurora machine learning, you use Amazon S3 only for training Amazon SageMaker models. You only
need to use Amazon S3 with Aurora machine learning if you don't already have a trained model available
and the training is your responsibility.
To connect a DB cluster to these services requires that you set up an AWS Identity and Access
Management (IAM) role for each Amazon service. The IAM role enables users of your DB cluster to
authenticate with the corresponding service.
To generate the IAM roles for Amazon SageMaker, Amazon Comprehend, or Amazon S3, repeat the
following steps for each service that you need.
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 Aurora PostgreSQL DB cluster that
you want to use.
3. Choose the Connectivity & security tab.
4. Choose Select a service to connect to this cluster in the Manage IAM roles section.
5. Choose the service that you want to connect to from the list:
• Amazon S3
• Amazon Comprehend
• Amazon SageMaker
6. Choose Connect service.
7. Enter the required information for the specific service on the Connect cluster window:
• For Amazon SageMaker, enter the Amazon Resource Name (ARN) of an Amazon SageMaker
endpoint.
From the navigation pane of the Amazon SageMaker console, choose Endpoints and copy the ARN
of the endpoint you want to use. For details about what the endpoint represents, see Deploy a
Model on Amazon SageMaker Hosting Services.
904
Amazon Aurora User Guide for Aurora
Enabling Aurora Machine Learning
For more about an Amazon S3 bucket ARN, see Specifying Resources in a Policy in the Amazon
Simple Storage Service Developer Guide. For more about using an Amazon S3 bucket with Amazon
SageMaker, see Step 1: Create an Amazon S3 Bucket in the Amazon SageMaker Developer Guide.
8. Choose Connect service.
9. Aurora creates a new IAM role and adds it to the DB cluster's list of Current IAM roles for this
cluster. The IAM role's status is initially In progress. The IAM role name is autogenerated with the
following pattern for each connected service:
Aurora also creates a new IAM policy and attaches it to the role. The policy name follows a similar
naming convention and also has a timestamp.
To install these functions in a specific database, enter the following SQL command at a psql prompt.
If you create the aws_ml extension in the template1 default database, then the functions are available
in each new database that you create.
psql>\dx
If you set up an IAM role for Amazon Comprehend, you can verify the setup as follows.
When you install the aws_ml extension, the aws_ml administrative role is created and granted to the
rds_superuser role. Separate schemas are also created for the aws_sagemaker service and for the
aws_comprehend service. The rds_superuser role is made the OWNER of both of these schemas.
905
Amazon Aurora User Guide for Aurora
Using Amazon Comprehend for
Natural Language Processing
For users or roles to obtain access to the functions in the aws_ml extension, grant EXECUTE privilege
on those functions. You can subsequently REVOKE execution privileges, if needed. EXECUTE privileges
are revoked from PUBLIC on the functions of these schemas by default. In a multi-tenant database
configuration, to prevent tenants from accessing the functions use REVOKE USAGE on one or more of
the ML service schemas.
For a reference to the installed functions of the aws_ml extension, see PostgreSQL Function Reference
for Aurora Machine Learning (p. 916).
Aurora machine learning uses Amazon Comprehend for sentiment analysis of text that is stored in your
database. A sentiment is an opinion expressed in text. Sentiment analysis identifies and categorizes
sentiments to determine if the attitude towards something (such as a topic or product) is positive,
negative, or neutral.
Note
Amazon Comprehend is currently available only in some AWS Regions. To check in which AWS
Regions you can use Amazon Comprehend, see the AWS Region Table page on the AWS site.
For example, using Amazon Comprehend you can analyze contact center call-in documents to detect
caller sentiment and better understand caller-agent dynamics. You can find a further description in the
post Analyzing contact center calls on the AWS Machine Learning blog.
You can also combine sentiment analysis with the analysis of other information in your database using
a single query. For example, you can detect the average sentiment of call-in center documents for issues
that combine the following:
Using Amazon Comprehend from Aurora Machine Learning is as easy as calling a SQL function. When
you installed the aws_ml extension (Installing the aws_ml Extension for Model Inference (p. 905)),
it provides the aws_comprehend.detect_sentiment (p. 916) function to perform sentiment analysis
through Amazon Comprehend.
For each text fragment that you analyze, this function helps you determine the sentiment and the
confidence level. A typical Amazon Comprehend query looks for table rows where the sentiment has a
certain value (POSITIVE or NEGATIVE), with a confidence level greater than a certain percent.
For example, the following query shows how to determine the average sentiment of documents in a
database table, myTable.document. The query considers only documents where the confidence of the
assessment is at least 80 percent. In the following example, English (en) is the language of the sentiment
text.
906
Amazon Aurora User Guide for Aurora
Exporting Data to Amazon S3 for
Amazon SageMaker Model Training
To avoid your being charged for sentiment analysis more than once per table row, you can materialize
the results of the analysis once per row. Do this on the rows of interest. In the following example, French
(fr) is the language of the sentiment text.
For more information on optimizing your function calls, see Best Practices with Aurora Machine
Learning (p. 910).
For information about parameters and return types for the sentiment detection function, see
aws_comprehend.detect_sentiment (p. 916).
To train Amazon SageMaker models, you export data to an Amazon S3 bucket. The Amazon S3 bucket
is used by Amazon SageMaker to train your model before it is deployed. You can query data from an
Aurora PostgreSQL DB cluster and save it directly into text files stored in an Amazon S3 bucket. Then
Amazon SageMaker consumes the data from the Amazon S3 bucket for training. For more about Amazon
SageMaker model training, see Train a Model with Amazon SageMaker.
Note
When you create an S3 bucket for Amazon SageMaker model training or batch scoring, always
include the text sagemaker in the S3 bucket name. For more information about creating an S3
bucket for Amazon SageMaker, see Step 1: Create an Amazon S3 Bucket.
For more information about exporting your data, see Exporting Data from an Aurora PostgreSQL DB
Cluster to Amazon S3 (p. 864).
Amazon SageMaker provides access to your data sources so that you can perform exploration and
analysis without managing the hardware infrastructure for servers. Amazon SageMaker also provides
common machine learning algorithms that are optimized to run efficiently against extremely large
907
Amazon Aurora User Guide for Aurora
Using Amazon SageMaker to Run Your Own ML Models
Be sure to deploy the model you are using in the same AWS Region as your Aurora PostgreSQL cluster.
Aurora machine learning always invokes Amazon SageMaker endpoints in the same AWS Region as your
Aurora cluster.
When you install the aws_ml extension (as described in Installing the aws_ml Extension for Model
Inference (p. 905)), it provides the aws_sagemaker.invoke_endpoint (p. 916) function. You use this
function to invoke your Amazon SageMaker model and perform model inference directly from within
your SQL database application.
Topics
• Creating a User-Defined Function to Invoke an Amazon SageMaker Model (p. 908)
• Passing an Array as Input to an Amazon SageMaker Model (p. 909)
• Specifying Batch Size When Invoking an Amazon SageMaker Model (p. 909)
• Invoking an Amazon SageMaker Model that has Multiple Outputs (p. 910)
• You can give your ML model its own name instead of only calling
aws_sagemaker.invoke_endpoint for all of your ML models.
• You can specify the model endpoint URL in just one place in your SQL application code.
• You can control EXECUTE privileges to each ML function independently.
• You can declare the model input and output types using SQL types. SQL enforces the number and type
of arguments passed to your ML model and performs type conversion if necessary. Using SQL types
will also translate SQL NULL to the appropriate default value expected by your ML model.
• You can reduce the maximum batch size if you want to return the first few rows a little faster.
To specify a user-defined function, use the SQL data definition language (DDL) statement CREATE
FUNCTION. When you define the function, you specify the following:
The user-defined function returns the inference computed by the Amazon SageMaker endpoint after
executing the model on the input parameters. The following example creates a user-defined function for
an Amazon SageMaker model with two input parameters.
908
Amazon Aurora User Guide for Aurora
Using Amazon SageMaker to Run Your Own ML Models
CREATE FUNCTION classify_event (IN arg1 INT, IN arg2 DATE, OUT category INT)
AS $$
SELECT aws_sagemaker.invoke_endpoint (
'sagemaker_model_endpoint_name', NULL,
arg1, arg2 -- model inputs are separate arguments
)::INT -- cast the output to INT
$$ LANGUAGE SQL PARALLEL SAFE COST 5000;
• The aws_sagemaker.invoke_endpoint function input can be one or more parameters of any data
type.
For more details about parameters, see the aws_sagemaker.invoke_endpoint (p. 916) function
reference.
• This example uses an INT output type. If you cast the output from a varchar type to a different type,
then it must be cast to a PostgreSQL builtin scalar type such as INTEGER, REAL, FLOAT, or NUMERIC.
For more information about these types, see Data Types in the PostgreSQL documentation.
• Specify PARALLEL SAFE to enable parallel query execution. For more information, see Exploiting
Parallel Query Processing (p. 913).
• Specify COST 5000 to estimate execution cost for the function. Use a positive number giving the
estimated execution cost for the function, in units of cpu_operator_cost.
The following example creates a user-defined function that passes an array as input to the Amazon
SageMaker regression model.
909
Amazon Aurora User Guide for Aurora
Best Practices with Aurora Machine Learning
• Use the optional max_rows_per_batch parameter to provide control of the number of rows for a
batch-mode function invocation. If you use a value of NULL, then the query optimizer automatically
chooses the maximum batch size. For more information, see Optimizing Batch-Mode Execution for
Aurora Machine Learning Function Calls (p. 911).
• By default, passing NULL as a parameter's value is translated to an empty string before passing to
Amazon SageMaker. For this example the inputs have different types.
• If you have a non-text input, or text input that needs to default to some value other than an empty
string, use the COALESCE statement. Use COALESCE to translate NULL to the desired null replacement
value in the call to aws_sagemaker.invoke_endpoint. For the amount parameter in this example,
a NULL value is converted to 0.0.
This user-defined function returns values from a model that returns multiple outputs by using a
composite type for the outputs.
For the composite type, use fields in the same order as they appear in the model output and cast the
output of aws_sagemaker.invoke_endpoint to your composite type. The caller can extract the
individual fields either by name or with PostgreSQL ".*" notation.
910
Amazon Aurora User Guide for Aurora
Best Practices with Aurora Machine Learning
• The number of virtual CPUs of the database instance, which determines the maximum degree of
parallelism that the database might use when executing your ML functions.
• the PostgreSQL parameters that control parallel query execution.
Topics
• Optimizing Batch-Mode Execution for Aurora Machine Learning Function Calls (p. 911)
• Exploiting Parallel Query Processing (p. 913)
• Using Materialized Views and Materialized Columns (p. 914)
Aurora automatically uses batch mode if the function is referenced from the SELECT list, a WHERE clause,
or a HAVING clause. Note that top-level simple CASE expressions are eligible for batch-mode execution.
Top-level searched CASE expressions are also eligible for batch-mode execution provided that the first
WHEN clause is a simple predicate with a batch-mode function call.
Your user-defined function must be a LANGUAGE SQL function and should specify PARALLEL SAFE and
COST 5000.
Topics
• Function Migration from the SELECT Statement to the FROM Clause (p. 911)
• Using the max_rows_per_batch Parameter (p. 912)
• Verifying Batch-Mode Execution (p. 912)
The migration of eligible batch-mode functions to the FROM clause can be examined manually on a per-
query level. To do this, you use EXPLAIN statements (and ANALYZE and VERBOSE) and find the "Batch
Processing" information below each batch-mode Function Scan. You can also use EXPLAIN (with
VERBOSE) without running the query. You then observe whether the calls to the function appear as a
Function Scan under a nested loop join that was not specified in the original statement.
In the following example, the presence of the nested loop join operator in the plan shows that Aurora
migrated the anomaly_score function. It migrated this function from the SELECT list to the FROM
clause, where it's eligible for batch-mode execution.
911
Amazon Aurora User Guide for Aurora
Best Practices with Aurora Machine Learning
Batch-mode functions improve efficiency by building batches of rows that spread the cost of the
Aurora Machine Learning function calls over a large number of rows. However, if a SELECT statement
finishes early due to a LIMIT clause, then the batch can be constructed over more rows than the
query uses. This approach can result in additional charges to your AWS account. To gain the benefits
of batch-mode execution but avoid building batches that are too large, use a smaller value for the
max_rows_per_batch parameter in your function calls.
If you do an EXPLAIN (VERBOSE, ANALYZE) of a query that uses batch-mode execution, you see a
FunctionScan operator that is below a nested loop join. The number of loops reported by EXPLAIN
tells you the number of times a row was fetched from the FunctionScan operator. If a statement
uses a LIMIT clause, the number of fetches is consistent. To optimize the size of the batch, set the
max_rows_per_batch parameter to this value. However, if the batch-mode function is referenced in a
predicate in the WHERE clause or HAVING clause, then you probably can't know the number of fetches in
advance. In this case, use the loops as a guideline and experiment with max_rows_per_batch to find a
setting that optimizes performance.
In this example, there was 1 batch that contained 3,333 rows, which took 146.273 ms to process. The
"Batch Processing" section shows the following:
• How many batches there were for this function scan operation
• The batch size average, minimum, and maximum
912
Amazon Aurora User Guide for Aurora
Best Practices with Aurora Machine Learning
Typically the final batch is smaller than the rest, which often results in a minimum batch size that is
much smaller than the average.
To return the first few rows more quickly, set the max_rows_per_batch parameter to a smaller value.
To reduce the number of batch mode calls to the ML service when you use a LIMIT in your user-defined
function, set the max_rows_per_batch parameter to a smaller value.
Parallel query processing occurs both within the database and within the ML service. The number of
cores in the instance class of the database limits the degree of parallelism that can be used during query
execution. The database server can construct a parallel query execution plan that partitions the task
among a set of parallel workers. Then each of these workers can build batched requests containing tens
of thousands of rows (or as many as are allowed by each service).
The batched requests from all of the parallel workers are sent to the endpoint for the AWS service
(Amazon SageMaker, for example). Thus, the number and type of instances behind the AWS service
endpoint also limits the degree of parallelism that can be usefully exploited. Even a two-core instance
class can benefit significantly from parallel query processing. However, to fully exploit parallelism at
higher K degrees, you need a database instance class that has at least K cores. You also need to configure
the AWS service so that it can process K batched requests in parallel. For Amazon SageMaker, you need
to configure the SageMaker endpoint for your ML model to have K initial instances of a sufficiently high-
performing instance class.
To exploit parallel query processing, you can set the parallel_workers storage parameter of the table
that contains the data that you plan to pass. You set parallel_workers to a batch-mode function
such as aws_comprehend.detect_sentiment. If the optimizer chooses a parallel query plan, the AWS
ML services can be called both in batch and in parallel. You can use the following parameters with the
aws_comprehend.detect_sentiment function to get a plan with four-way parallelism.
-- If you change either of the following two parameters, you must restart
-- the database instance for the changes to take effect.
--
-- SET max_worker_processes to 8; -- default value is 8
-- SET max_parallel_workers to 8; -- not greater than max_worker_processes
--
SET max_parallel_workers_per_gather to 4; -- not greater than max_parallel_workers
-- You can set the parallel_workers storage parameter on the table that the data
-- for the ML function is coming from in order to manually override the degree of
-- parallelism that would otherwise be chosen by the query optimizer
--
ALTER TABLE yourTable SET (parallel_workers = 4);
-- Example query to exploit both batch mode execution and parallel query
--
EXPLAIN (verbose, analyze, buffers, hashes)
913
Amazon Aurora User Guide for Aurora
Monitoring Aurora Machine Learning
For more about controlling parallel query, see Parallel Plans in the PostgreSQL documentation.
The latency of an ordinary single-row INSERT statement is typically much less than the latency
of calling a batch-mode function. Thus, you might not be able to meet the latency requirements
of your application if you invoke the batch-mode function for every single-row INSERT that your
application performs. To materialize the result of calling an AWS service into a materialized column,
high-performance applications generally need to populate the materialized columns. To do this, they
periodically issue an UPDATE statement that operates on a large batch of rows at the same time.
UPDATE takes a row-level lock that can impact a running application. So you might need to use
SELECT ... FOR UPDATE SKIP LOCKED, or use MATERIALIZED VIEW.
Analytics queries that operate on a large number of rows in real time can combine batch-mode
materialization with real-time processing. To do this, these queries assemble a UNION ALL of the pre-
materialized results with a query over the rows that don't yet have materialized results. In some cases,
such a UNION ALL is needed in multiple places, or the query is generated by a third-party application.
If so, you can create a VIEW to encapsulate the UNION ALL operation so this detail isn't exposed to the
rest of the SQL application.
You can use a materialized view to materialize the results of an arbitrary SELECT statement at a
snapshot in time. You can also use it to refresh the materialized view at any time in the future. Currently
PostgreSQL doesn't support incremental refresh, so each time the materialized view is refreshed the
materialized view is fully recomputed.
You can refresh materialized views with the CONCURRENTLY option, which updates the contents of the
materialized view without taking an exclusive lock. Doing this allows a SQL application to read from the
materialized view while it's being refreshed.
For information about monitoring the performance of the Amazon SageMaker operations called from
Aurora Machine Learning functions, see Monitor Amazon SageMaker.
• all – Track C language functions and SQL language functions that aren't placed inline. To track the
aws_ml functions, use all because these functions are implemented in C.
914
Amazon Aurora User Guide for Aurora
Monitoring Aurora Machine Learning
To find the names of your SQL functions that call the aws_sagemaker.invoke_endpoint function,
query the source code of the functions in the PostgreSQL pg_proc catalog table.
For more about query plan management, see Managing Query Execution Plans for Aurora
PostgreSQL (p. 873).
To find calls to the aws_sagemaker.invoke_endpoint function that don't use batch mode, use the
following statement.
\dx apg_plan_mgmt
The example preceding searches all statements in your workload that call SQL functions that in turn call
the aws_sagemaker.invoke_endpoint function.
To obtain detailed runtime statistics for each of these statements, call the
apg_plan_mgmt.get_explain_stmt function.
915
Amazon Aurora User Guide for Aurora
Function Reference
aws_comprehend.detect_sentiment
Performs sentiment analysis using Amazon Comprehend. For more about usage, see Using Amazon
Comprehend for Natural Language Processing (p. 906).
Syntax
aws_comprehend.detect_sentiment (
IN input_text varchar,
IN language_code varchar,
IN max_rows_per_batch int,
OUT sentiment varchar,
OUT confidence real)
)
Input Parameters
input_text
The language of the input_text. For valid values, see Languages Supported in Amazon
Comprehend.
max_rows_per_batch
The maximum number of rows per batch for batch-mode processing. For more information, see
Optimizing Batch-Mode Execution for Aurora Machine Learning Function Calls (p. 911).
Output Parameters
sentiment
The sentiment of the text. Valid values are POSITIVE, NEGATIVE, NEUTRAL, or MIXED.
confidence
The degree of confidence in the sentiment value. Values range between 1.0 for 100% to 0.0 for
0%.
aws_sagemaker.invoke_endpoint
After you train a model and deploy it into production using Amazon SageMaker services, your client
applications use the aws_sagemaker.invoke_endpoint function to get inferences from the
model. The model must be hosted at the specified endpoint and must be in the same AWS Region
as the database instance. For more about usage, see Using Amazon SageMaker to Run Your Own ML
Models (p. 907).
916
Amazon Aurora User Guide for Aurora
Manually Setting up IAM Roles Using the AWS CLI
Syntax
aws_sagemaker.invoke_endpoint(
IN endpoint_name varchar,
IN max_rows_per_batch int,
VARIADIC model_input "any",
OUT model_output varchar
)
Input Parameters
endpoint_name
The maximum number of rows per batch for batch-mode processing. For more information, see
Optimizing Batch-Mode Execution for Aurora Machine Learning Function Calls (p. 911).
model_input
One or more input parameters for the ML model. These can be any data type.
PostgreSQL allows you to specify up to 100 input parameters for a function. Array data types must
be one-dimensional, but can contain as many elements as are expected by the Amazon SageMaker
model. The number of inputs to an Amazon SageMaker model is bounded only by the Amazon
SageMaker 5 MB message size limit.
Output Parameters
model_output
Usage Notes
The aws_sagemaker.invoke_endpoint function connects only to a model endpoint in the same AWS
Region. If your database instance has replicas in multiple AWS Regions, always deploy each Amazon
SageMaker model to all of those AWS Regions.
Calls to aws_sagemaker.invoke_endpoint are authenticated using the Amazon SageMaker IAM role
for the database instance.
Amazon SageMaker model endpoints are scoped to an individual account and are not public. The
endpoint_name URL doesn't contain the account ID. Amazon SageMaker determines the account ID
from the authentication token that is supplied by the Amazon SageMaker IAM role of the database
instance.
917
Amazon Aurora User Guide for Aurora
Manually Setting up IAM Roles Using the AWS CLI
Setting up the IAM roles for Amazon SageMaker or Amazon Comprehend using the AWS CLI or the RDS
API consists of the following steps:
1. Create an IAM policy to specify which Amazon SageMaker endpoints can be invoked by your Aurora
PostgreSQL cluster or to enable access to Amazon Comprehend.
2. Create an IAM role to permit your Aurora PostgreSQL database cluster to access AWS ML services. Also
attach the IAM policy created preceding to the IAM role created here.
3. Associate the IAM role that you created preceding to the Aurora PostgreSQL database cluster to
permit access to AWS ML services.
Topics
• Creating an IAM Policy to Access Amazon SageMaker using the AWS CLI (p. 918)
• Creating an IAM Policy to Access Amazon Comprehend using the AWS CLI (p. 919)
• Creating an IAM Role to Access Amazon SageMaker and Amazon Comprehend (p. 919)
• Associating an IAM Role with an Aurora PostgreSQL DB Cluster Using the AWS CLI (p. 920)
The following policy adds the permissions required by Aurora PostgreSQL to invoke an Amazon
SageMaker function on your behalf. You can specify all of your Amazon SageMaker endpoints that you
need your database applications to access from your Aurora PostgreSQL cluster in a single policy.
Note
This policy enables you to specify the AWS Region for an Amazon SageMaker endpoint.
However, an Aurora PostgreSQL cluster can only invoke Amazon SageMaker models deployed in
the same AWS Region as the cluster.
The following AWS CLI command creates an IAM policy with these options.
For the next step, see Creating an IAM Role to Access Amazon SageMaker and Amazon
Comprehend (p. 919).
918
Amazon Aurora User Guide for Aurora
Manually Setting up IAM Roles Using the AWS CLI
The following policy adds the permissions required by Aurora PostgreSQL to invoke AWS Amazon
Comprehend on your behalf.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAuroraToInvokeComprehendDetectSentiment",
"Effect": "Allow",
"Action": [
"comprehend:DetectSentiment",
"comprehend:BatchDetectSentiment"
],
"Resource": "*"
}
]
}
For the net step, see Creating an IAM Role to Access Amazon SageMaker and Amazon
Comprehend (p. 919).
After you create the IAM policies, create an IAM role that the Aurora PostgreSQL DB cluster can assume
for your database users to access ML services. To create an IAM role, follow the steps described in
Creating a Role to Delegate Permissions to an IAM User.
Attach the preceding policies to the IAM role you create. For more information, see Attaching an IAM
Policy to an IAM User or Role (p. 1040).
919
Amazon Aurora User Guide for Aurora
Manually Setting up IAM Roles Using the AWS CLI
For more information about IAM roles, see IAM Roles in the AWS Identity and Access Management User
Guide.
For the next step, see Associating an IAM Role with an Aurora PostgreSQL DB Cluster Using the AWS
CLI (p. 920).
The last process in setting up IAM access is to associate the IAM role and its IAM policy with your Aurora
PostgreSQL DB cluster. Do the following:
To associate the role with your DB cluster, use the AWS Management Console or the add-role-to-db-
cluster AWS CLI command.
• To add an IAM role for a PostgreSQL DB cluster 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 the PostgreSQL DB cluster name to display its details.
3. On the Connectivity & security tab, in the Manage IAM roles section, choose the role to add
under Add IAM roles to this cluster .
4. Under Feature, choose SageMaker or Comprehend.
5. Choose Add role.
• To add an IAM role for a PostgreSQL DB cluster using the CLI
Use the following command to add the role to the PostgreSQL DB cluster named my-db-cluster.
Replace your-role-arn with the role ARN that you noted in a previous step. For the value of the
--feature-name option, use SageMaker, Comprehend, or s3Export depending on which service
you want to use.
Example
For Windows:
2. Set the cluster-level parameter for each AWS ML service to the ARN for the associated IAM role.
920
Amazon Aurora User Guide for Aurora
Fast Recovery after Failover
Cluster-level parameters are grouped into DB cluster parameter groups. To set the preceding cluster
parameters, use an existing custom DB cluster group or create a new one. To create a new DB cluster
parameter group, call the create-db-cluster-parameter-group command from the AWS CLI, for
example:
Set the appropriate cluster-level parameter or parameters and the related IAM role ARN values in your
DB cluster parameter group. Do the following.
Modify the DB cluster to use the new DB cluster parameter group. Then, reboot the cluster. The
following shows how.
When the instance has rebooted, your IAM roles are associated with your DB cluster.
In a typical failover situation, you might see a temporary but large performance degradation after
failover. This degradation occurs because when the failover DB instance starts, the buffer cache is empty.
An empty cache is also known as a cold cache. A cold cache degrades performance because the DB
instance has to read from the slower disk, instead of taking advantage of values stored in the buffer
cache.
With cluster cache management, you set a specific reader DB instance as the failover target. Cluster
cache management ensures that the data in the designated reader's cache is kept synchronized with
the data in the writer DB instance's cache. The designated reader's cache with prefilled values is known
921
Amazon Aurora User Guide for Aurora
Configuring Cluster Cache Management
as a warm cache. If a failover occurs, the designated reader uses values in its warm cache immediately
when it's promoted to the new writer DB instance. This approach provides your application much better
recovery performance.
Topics
• Configuring Cluster Cache Management (p. 922)
• Monitoring the Buffer Cache (p. 925)
Configuration Steps
• Enable Cluster Cache Management (p. 922)
• Set the Promotion Tier Priority for the Writer DB Instance (p. 923)
• Set the Promotion Tier Priority for a Reader DB Instance (p. 924)
Note
Allow at least 1 minute after completing these steps for cluster cache management to be fully
operational.
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. In the list, choose the parameter group for your Aurora PostgreSQL DB cluster.
The DB cluster must use a parameter group other than the default, because you can't change values
in a default parameter group.
4. For Parameter group actions, choose Edit.
5. Set the value of the apg_ccm_enabled cluster parameter to 1.
6. Choose Save changes.
AWS CLI
To enable cluster cache management for an Aurora PostgreSQL DB cluster, use the AWS CLI modify-
db-cluster-parameter-group command with the following required parameters:
• --db-cluster-parameter-group-name
• --parameters
922
Amazon Aurora User Guide for Aurora
Configuring Cluster Cache Management
Example
For Windows:
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 Writer DB instance of the Aurora PostgreSQL DB cluster.
4. Choose Modify. The Modify DB Instance page appears.
5. On the Failover panel, choose tier-0 for the Priority.
6. Choose Continue and check the summary of modifications.
7. To apply the changes immediately after you save them, choose Apply immediately.
8. Choose Modify DB Instance to save your changes.
AWS CLI
To set the promotion tier priority to 0 for the writer DB instance using the AWS CLI, call the modify-db-
instance command with the following required parameters:
• --db-instance-identifier
• --promotion-tier
• --apply-immediately
Example
923
Amazon Aurora User Guide for Aurora
Configuring Cluster Cache Management
--promotion-tier 0 \
--apply-immediately
For Windows:
The promotion tier priority is a value that specifies the order in which an Aurora reader is promoted to
the writer DB instance after a failure. Valid values are 0–15, where 0 is the first priority and 15 is the last
priority.
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 a Reader DB instance of the Aurora PostgreSQL DB cluster that is the same instance class as
the writer DB instance.
4. Choose Modify. The Modify DB Instance page appears.
5. On the Failover panel, choose tier-0 for the Priority.
6. Choose Continue and check the summary of modifications.
7. To apply the changes immediately after you save them, choose Apply immediately.
8. Choose Modify DB Instance to save your changes.
AWS CLI
To set the promotion tier priority to 0 for the reader DB instance using the AWS CLI, call the modify-db-
instance command with the following required parameters:
• --db-instance-identifier
• --promotion-tier
• --apply-immediately
Example
924
Amazon Aurora User Guide for Aurora
Monitoring the Buffer Cache
For Windows:
Cluster cache management also provides the aurora_ccm_status function. Use the
aurora_ccm_status function on the writer DB instance to get the following information about the
progress of cache warming on the designated reader:
• buffers_sent_last_minute – How many buffers have been sent to the designated reader in the
last minute.
• buffers_sent_last_scan – How many buffers have been sent to the designated reader during the
last complete scan of the buffer cache.
• buffers_found_last_scan – How many buffers have been identified as frequently accessed and
needed to be sent during the last complete scan of the buffer cache. Buffers already cached on the
designated reader aren't sent.
• buffers_sent_current_scan – How many buffers have been sent so far during the current scan.
• buffers_found_current_scan – How many buffers have been identified as frequently accessed in
the current scan.
• current_scan_progress – How many buffers have been visited so far during the current scan.
The following example shows how to use the aurora_ccm_status function to convert some of its
output into a warm rate and warm percentage.
Major version upgrades can contain database changes that are not backward-compatible with existing
applications. As a result, you must manually perform major version upgrades of your DB instances. You
can initiate a major version upgrade by modifying your DB cluster. However, before you perform a major
925
Amazon Aurora User Guide for Aurora
Overview of Upgrading
version upgrade, we recommend that you follow the steps described in How to Prepare for and Perform
a Major Version Upgrade (p. 927).
In contrast, minor version upgrades include only changes that are backward-compatible with existing
applications. You can initiate a minor version upgrade manually by modifying your DB cluster. Or you
can enable the Auto minor version upgrade option when creating or modifying a DB cluster. Doing so
means that your DB cluster is automatically upgraded after Aurora PostgreSQL tests and approves the
new version. For more details, see Automatic Minor Version Upgrades for PostgreSQL (p. 930). For
information about manually performing a minor version upgrade, see Manually Upgrading the Aurora
PostgreSQL Engine (p. 929).
Note
• Currently, you can do a major version upgrade from Aurora PostgreSQL 9.6 minor versions
9.6.9 and greater to Aurora PostgreSQL 10 minor versions 10.11 or greater.
• Aurora DB clusters that are configured as logical replication publishers or subscribers can't
undergo a major version upgrade. For more information, see Using PostgreSQL Logical
Replication with Aurora (p. 860).
Topics
• Overview of Upgrading Aurora PostgreSQL (p. 926)
• Identifying the Version of a PostgreSQL DB Cluster (p. 927)
• Determining Which Engine Version to Upgrade to (p. 927)
• How to Prepare for and Perform a Major Version Upgrade (p. 927)
• Manually Upgrading the Aurora PostgreSQL Engine (p. 929)
• Automatic Minor Version Upgrades for PostgreSQL (p. 930)
• Upgrading PostgreSQL Extensions (p. 931)
To safely upgrade your DB instances, Aurora PostgreSQL uses the pg_upgrade utility described in the
PostgreSQL documentation. After the writer upgrade completes, each reader instance experiences a brief
outage while it's upgraded to the new major version automatically.
Aurora PostgreSQL takes a DB cluster snapshot before the upgrade begins. If you want to return to a
previous version after an upgrade is complete, you can restore the DB cluster from this snapshot created
before the upgrade, or you can restore the DB cluster to a specific point in time before the upgrade
started. For more information, see Restoring from a DB Cluster Snapshot (p. 292) or Restoring a DB
Cluster to a Specified Time (p. 325).
During the major version upgrade process, a cloned volume is allocated. If the upgrade fails for some
reason, such as due to a schema incompatibility, Aurora PostgreSQL uses this clone to roll back the
upgrade. Note, when more than 15 clones of a source volume are allocated, subsequent clones become
full copies and will take longer. This can cause the upgrade process to take longer as well. If Aurora
PostgreSQL rolls back the upgrade, be aware of the following:
• You may see billing entries and metrics for both the original volume and the cloned volume allocated
during the upgrade. Aurora PostgreSQL will clean up the extra volume after the cluster backup
retention window is beyond the time of the upgrade.
926
Amazon Aurora User Guide for Aurora
Identifying the PostgreSQL Versions
• The next cross region snapshot copy from this cluster will be a full copy instead of an incremental
copy.
The version numbering sequence for the PostgreSQL database engine is as follows:
• For PostgreSQL versions 10 and later, the engine version number is in the form major.minor. The major
version number is the integer part of the version number. The minor version number is the fractional
part of the version number.
A major version upgrade increases the integer part of the version number, such as upgrading from
10.minor to 11.minor.
• For PostgreSQL versions earlier than 10, the engine version number is in the form major.major.minor.
The major engine version number is both the integer and the first fractional part of the version
number. For example, 9.6 is a major version. The minor version number is the third part of the version
number. For example, for version 9.6.12, the 12 is the minor version number.
A major version upgrade increases the major part of the version number. For example, an upgrade
from 9.6.12 to 10.7 is a major version upgrade, where 9.6 and 10 are the major version numbers.
Example
For Windows:
Before applying an upgrade to your production DB clusters, make sure that you thoroughly test any
upgrade to verify that your applications work correctly.
927
Amazon Aurora User Guide for Aurora
Major Version Upgrades
1. Have a version-compatible parameter group ready – If you are using a custom DB instance or DB
cluster parameter group, you have two options:
• You can specify the default DB instance and/or DB cluster parameter group for the new DB engine
version.
• Or you can create your own custom parameter group for the new DB engine version.
If you associate a new DB instance or DB cluster parameter group as a part of the upgrade request,
you must reboot the database after the upgrade completes to apply the parameters. If an instance
needs to be rebooted to apply the parameter group changes, the instance's parameter group status
shows pending-reboot. You can view an instance's parameter group status in the console or by
using a CLI command such as describe-db-instances or describe-db-clusters.
2. Check for unsupported usage:
• Prepared transactions – Commit or roll back all open prepared transactions before attempting an
upgrade. You can use the following query to verify that there are no open prepared transactions on
your instance.
• Reg* data types – Remove all uses of the reg* data types before attempting an upgrade. Except for
regtype and regclass, you can't upgrade the reg* data types. The pg_upgrade utility can''t persist
this data type, which is used by Amazon Aurora to do the upgrade. For more information about the
pg_upgrade utility, see the PostgreSQL documentation.
To verify that there are no uses of unsupported reg* data types, use the following query for each
database.
3. Perform a backup – The upgrade process creates a DB cluster snapshot of your DB cluster during
upgrading. If you also want to do a manual backup before the upgrade process, see Creating a DB
Cluster Snapshot (p. 290) for more information.
4. Drop unknown data types – Drop unknown data types depending on the target version.
PostgreSQL version 10 stopped supporting the unknown data type. If a version 9.6 database uses the
unknown data type, an upgrade to a version 10 shows an error message such as the following:
To find the unknown data type in your database so you can remove the offending column or change it
to a supported data type, use the following SQL:
928
Amazon Aurora User Guide for Aurora
Manually Upgrading the Aurora PostgreSQL Engine
5. Perform a dry run upgrade – We highly recommend testing a major version upgrade on a duplicate
of your production database before trying the upgrade on your production database. To create a
duplicate test instance, you can either restore your database from a recent snapshot or clone your
database. For more information, see Restoring from a Snapshot (p. 292) or Cloning Databases in an
Aurora DB Cluster (p. 254).
To perform the dry-run upgrade, see Manually Upgrading the Aurora PostgreSQL Engine (p. 929) for
more information.
6. Upgrade your production instance – When the dry-run major version upgrade is successful, you
should be able to upgrade your production database with confidence. For more information, see
Manually Upgrading the Aurora PostgreSQL Engine (p. 929).
Note
During the upgrade process, you can't do a point-in-time restore of your cluster. Aurora
PostgreSQL takes a DB cluster snapshot during the upgrade process if your backup retention
period is greater than 0. You can perform a point-in-time restore to times before the upgrade
began and after the automatic snapshot of your instance has completed.
For information about an upgrade in progress, you can use Amazon RDS to view two
logs that the pg_upgrade utility produces. These are pg_upgrade_internal.log and
pg_upgrade_server.log. Amazon Aurora appends a timestamp to the file name for these logs. You
can view these logs as you can any other log. For more information, see Amazon Aurora Database Log
Files (p. 489).
7. Upgrade PostgreSQL extensions – The PostgreSQL upgrade process doesn't upgrade any PostgreSQL
extensions. For more information, see Upgrading PostgreSQL Extensions (p. 931).
8. After completing a major version upgrade – After the major version upgrade is complete, we
recommend the following:
• Run the ANALYZE operation to refresh the pg_statistic table.
• Consider testing your application on the upgraded database with a similar workload to verify that
everything works as expected. After the upgrade is verified, you can delete this test instance.
Console
To upgrade the engine version of a DB cluster 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 cluster that you want to upgrade.
3. Choose Modify. The Modify DB cluster page appears.
4. For DB engine version, choose the new version.
5. Choose Continue and check the summary of modifications.
6. 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 Aurora DB Cluster (p. 232).
7. On the confirmation page, review your changes. If they are correct, choose Modify Cluster to save
your changes.
929
Amazon Aurora User Guide for Aurora
Automatic Minor Version Upgrades
AWS CLI
To upgrade the engine version of a DB cluster, use the CLI modify-db-cluster command. Specify the
following parameters:
Example
For Windows:
RDS API
To upgrade the engine version of a DB cluster, use the ModifyDBCluster operation. Specify the following
parameters:
930
Amazon Aurora User Guide for Aurora
Upgrading PostgreSQL Extensions
For each PostgreSQL major version, one minor version is designated by Amazon Aurora as the automatic
upgrade version. After a minor version has been tested and approved by Amazon Aurora, the minor
version upgrade occurs automatically during your maintenance window. Aurora doesn't automatically
set newer released minor versions as the automatic upgrade version. Before Aurora designates a newer
automatic upgrade version, several criteria are considered, such as the following:
You can use the following AWS CLI command and script to determine the current automatic upgrade
minor versions.
A PostgreSQL DB instance is automatically upgraded during your maintenance window if the following
criteria are met:
• The DB cluster has the Auto minor version upgrade option enabled.
• The DB cluster is running a minor DB engine version that is less than the current automatic upgrade
minor version.
To list your currently installed extensions, use the PostgreSQL pg_extension catalog in the following
command.
To view a list of the specific extension versions that are available for your installation, use the
PostgreSQL pg_available_extension_versions view in the following command.
931
Amazon Aurora User Guide for Aurora
Fast Failover
• Aggressively set TCP keepalives to ensure that longer running queries that are waiting for a server
response will be killed before the read timeout expires in the event of a failure.
• Set the Java DNS caching timeouts aggressively to ensure the Aurora Read-Only Endpoint can properly
cycle through read-only nodes on subsequent connection attempts.
• Set the timeout variables used in the JDBC connection string as low as possible. Use separate
connection objects for short and long running queries.
• Use the provided read and write Aurora endpoints to establish a connection to the cluster.
• Use RDS APIs to test application response on server side failures and use a packet dropping tool to test
application response for client-side failures.
Enabling TCP keepalive parameters and setting them aggressively ensures that if your client is no longer
able to connect to the database, then any active connections are quickly closed. This action allows the
application to react appropriately, such as by picking a new host to connect to.
• tcp_keepalive_time controls the time, in seconds, after which a keepalive packet is sent when no
data has been sent by the socket (ACKs are not considered data). We recommend the following setting:
tcp_keepalive_time = 1
• tcp_keepalive_intvl controls the time, in seconds, between sending subsequent keepalive packets
after the initial packet is sent (set using the tcp_keepalive_time parameter). We recommend the
following setting:
tcp_keepalive_intvl = 1
• tcp_keepalive_probes is the number of unacknowledged keepalive probes that occur before the
application is notified. We recommend the following setting:
tcp_keepalive_probes = 5
These settings should notify the application within five seconds when the database stops responding.
A higher tcp_keepalive_probes value can be set if keepalive packets are often dropped within the
application's network. This subsequently increases the time it takes to detect an actual failure, but allows
for more buffer in less reliable networks.
1. When testing how to configure the TCP keepalive parameters, we recommend doing so via the
command line with the following commands: This suggested configuration is system wide, meaning
that it affects all other applications that create sockets with the SO_KEEPALIVE option on.
932
Amazon Aurora User Guide for Aurora
Fast Failover
2. Once you've found a configuration that works for your application, these settings must be persisted
by adding the following lines (including any changes you made) to /etc/sysctl.conf:
tcp_keepalive_time = 1
tcp_keepalive_intvl = 1
tcp_keepalive_probes = 5
For information on setting TCP keepalive parameters on Windows, see Things You May Want to Know
About TCP Keepalive.
jdbc:postgresql://myauroracluster.cluster-c9bfei4hjlrd.us-east-1-
beta.rds.amazonaws.com:5432,
myauroracluster.cluster-ro-c9bfei4hjlrd.us-east-1-beta.rds.amazonaws.com:5432
/postgres?user=<masteruser>&password=<masterpw>&loginTimeout=2
&connectTimeout=2&cancelSignalTimeout=2&socketTimeout=60
&tcpKeepAlive=true&targetServerType=master&loadBalanceHosts=true
For best availability and to avoid a dependency on the RDS API, the best option for connecting is to
maintain a file with a host string that your application reads from when you establish a connection to
the database. This host string would have all the Aurora endpoints available for the cluster. For more
information about Aurora endpoints, see Amazon Aurora Connection Management (p. 12). For example,
you could store the endpoints in a file locally like the following:
myauroracluster.cluster-c9bfei4hjlrd.us-east-1-beta.rds.amazonaws.com:5432,
myauroracluster.cluster-ro-c9bfei4hjlrd.us-east-1-beta.rds.amazonaws.com:5432
Your application would read from this file to populate the host section of the JDBC connection string.
Renaming the DB Cluster causes these endpoints to change; ensure that your application handles that
event should it occur.
933
Amazon Aurora User Guide for Aurora
Fast Failover
my-node1.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432,
my-node2.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432,
my-node3.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432,
my-node4.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432
The benefit of this approach is that the PostgreSQL JDBC connection driver will loop through all nodes
on this list to find a valid connection, whereas when using the Aurora endpoints only two nodes will
be tried per connection attempt. The downside of using DB instance nodes is that if you add or remove
nodes from your cluster and the list of instance endpoints becomes stale, the connection driver may
never find the correct host to connect to.
Setting the following parameters aggressively helps ensure that your application doesn't wait too long to
connect to any one host.
• loginTimeout - Controls how long your application waits to login to the database after a socket
connection has been established.
• connectTimeout - Controls how long the socket waits to establish a connection to the database.
Other application parameters can be modified to speed up the connection process, depending on how
aggressive you want your application to be.
• cancelSignalTimeout - In some applications, you may want to send a "best effort" cancel signal on
a query that has timed out. If this cancel signal is in your failover path, you should consider setting it
aggressively to avoid sending this signal to a dead host.
• socketTimeout - This parameter controls how long the socket waits for read operations. This
parameter can be used as a global "query timeout" to ensure no query waits longer than this value. A
good practice is to have one connection handler that runs short lived queries and sets this value lower,
and to have another connection handler for long running queries with this value set much higher.
Then, you can rely on TCP keepalive parameters to kill long running queries if the server goes down.
• tcpKeepAlive - Enable this parameter to ensure the TCP keepalive parameters that you set are
respected.
• targetServerType- This parameter can be used to control whether the driver connects to a read
(slave) or write (master) node. Possible values are: any, master, slave and preferSlave. The
preferSlave value attempts to establish a connection to a reader first but falls back and connects to
the writer if no reader connection can be established.
• loadBalanceHosts - When set to true, this parameter has the application connect to a random host
chosen from a list of candidate hosts.
Your application can connect to any DB instance in the DB Cluster and query the
aurora_replica_status function to determine who the writer of the cluster is, or to find any other
reader nodes in the cluster. You can use this function to reduce the amount of time it takes to find a host
to connect to, though in certain scenarios the aurora_replica_status function may show out of date
or incomplete information in certain network failure scenarios.
A good way to ensure your application can find a node to connect to is to attempt to connect to
the cluster writerendpoint and then the cluster readerendpoint until you can establish a readable
connection. These endpoints do not change unless you rename your DB Cluster, and thus can generally
be left as static members of your application or stored in a resource file that your application reads from.
934
Amazon Aurora User Guide for Aurora
Fast Failover
Once you establish a connection using one of these endpoints, you can call the
aurora_replica_status function to get information about the rest of the cluster. For example, the
following command retrieves information with the aurora_replica_status function.
So for example, the hosts section of your connection string could start with both the writer and reader
cluster endpoints:
myauroracluster.cluster-c9bfei4hjlrd.us-east-1-beta.rds.amazonaws.com:5432,
myauroracluster.cluster-ro-c9bfei4hjlrd.us-east-1-beta.rds.amazonaws.com:5432
In this scenario, your application would attempt to establish a connection to any node type, master or
slave. Once connected, a good practice is to first examine the read-write status of the node by querying
for the result of the command SHOW transaction_read_only.
If the return value of the query is OFF, then you've successfully connected to the master
node. If the return value is ON, and your application requires a read-write connection, you
can then call the aurora_replica_status function to determine the server_id that has
session_id='MASTER_SESSION_ID'. This function gives you the name of the master node. You can
use this in conjunction with the 'endpointPostfix' described below.
One thing to watch out for is when you connect to a replica that has data that has become stale. When
this happens, the aurora_replica_status function may show out-of-date information. A threshold
for staleness can be set at the application level and examined by looking at the difference between the
server time and the last_update_time. In general, your application should be sure to avoid flip-flopping
between two hosts due to conflicting information returned by the aurora_replica_status function. That
is, your application should err on the side of trying all known hosts first instead of blindly following the
data returned by the aurora_replica_status function.
RDS API
You can programmatically find the list of instances by using the AWS Java SDK, specifically the
DescribeDbClusters API. Here's a small example of how you might do this in java 8:
935
Amazon Aurora User Guide for Aurora
Fast Failover
String pgJDBCEndpointStr =
singleClusterResult.getDBClusterMembers().stream()
.sorted(Comparator.comparing(DBClusterMember::getIsClusterWriter)
.reversed()) // This puts the writer at the front of the list
.map(m -> m.getDBInstanceIdentifier() + endpointPostfix + ":" +
singleClusterResult.getPort()))
.collect(Collectors.joining(","));
my-node1.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432,
my-node2.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com:5432
The variable 'endpointPostfix' can be a constant that your application sets, or can be obtained by
querying the DescribeDBInstances API for a single instance in your cluster. This value remains constant
within a region and for an individual customer, so it would save an API call to simply keep this constant in
a resource file that your application reads from. In the example above, it would be set to:
.cksc6xlmwcyw.us-east-1-beta.rds.amazonaws.com
For availability purposes, a good practice would be to default to using the Aurora Endpoints of your DB
Cluster if the API is not responding, or taking too long to respond. The endpoints are guaranteed to be
up to date within the time it takes to update the DNS record (typically less than 30 seconds). This again
can be stored in a resource file that your application consumes.
Testing Failover
In all cases you must have a DB Cluster with >= 2 DB instances in it.
From the server side, certain APIs can cause an outage that can be used to test how your applications
responds:
rdsClient.failoverDBCluster(request);
}
• RebootDBInstance - Failover is not guaranteed in this API. It will shutdown the database on the
writer, though, and can be used to test how your application responds to connections dropping (note
that the ForceFailover parameter is not applicable for Aurora engines and instead should use the
FailoverDBCluster API)
• ModifyDBCluster - Modifying the Port will cause an outage when the nodes in the cluster begin
listening on a new port. In general your application can respond to this failure by ensuring that only
your application controls port changes and can appropriately update the endpoints it depends on,
by having someone manually update the port when they make modifications at the API level, or by
querying the RDS API in your application to determine if the port has changed.
• ModifyDBInstance - Modifying the DBInstanceClass will cause an outage
936
Amazon Aurora User Guide for Aurora
Fast Failover
• DeleteDBInstance - Deleting the master/writer will cause a new DB Instance to be promoted to writer
in your DB Cluster
From the application/client side, if using Linux, you can test how the application responds to sudden
packet drops based on port, host, or if tcp keepalive packets are not sent or received by using iptables.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.joda.time.Duration;
public FastFailoverDriverManager() {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
/*
* RO endpoint has a TTL of 1s, we should honor that here. Setting this
aggressively makes sure that when
* the PG JDBC driver creates a new connection, it will resolve a new different RO
endpoint on subsequent attempts
* (assuming there is > 1 read node in your cluster)
*/
java.security.Security.setProperty("networkaddress.cache.ttl" , "1");
// If the lookup fails, default to something like small to retry
java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "3");
}
/*
937
Amazon Aurora User Guide for Aurora
Troubleshooting storage issues
* A good practice is to set socket and statement timeout to be the same thing
since both
* the client AND server will kill the query at the same time, leaving no running
queries
* on the backend
*/
Statement st = conn.createStatement();
st.execute("set statement_timeout to " + queryTimeout.getMillis());
st.close();
return conn;
}
return newEndpointList;
}
938
Amazon Aurora User Guide for Aurora
Using Kerberos Authentication
same storage space it uses for storing error and message logs. If your sorts or index creation functions
exceed memory available, you could develop a local storage shortage. If you experience issues with
Aurora PostgreSQL running out of storage space, you can either reconfigure your data sorts to use more
memory, or reduce the data retention period for your PostgreSQL log files. For more information about
changing the log retention period see, PostgreSQL Database Log Files (p. 498).
Keeping all of your credentials in the same directory can save you time and effort. You have a centralized
place for storing and managing credentials for multiple DB clusters. Using a directory can also improve
your overall security profile.
Kerberos provides a different authentication method than AWS Identity and Access Management (IAM).
A database can use either Kerberos or IAM authentication but not both. For more information about IAM
authentication, see IAM Database Authentication (p. 1035).
Amazon Aurora supports Kerberos authentication for PostgreSQL DB clusters in the following AWS
Regions:
• US East (Ohio)
• US East (N. Virginia)
• US West (N. California)
• US West (Oregon)
• Asia Pacific (Mumbai)
• Asia Pacific (Seoul)
• Asia Pacific (Singapore)
• Asia Pacific (Sydney)
• Asia Pacific (Tokyo)
• Canada (Central)
• Europe (Frankfurt)
• Europe (Ireland)
• Europe (London)
• Europe (Stockholm)
• South America (São Paulo)
Topics
• Overview of Kerberos Authentication for PostgreSQL DB Clusters (p. 940)
• Setting Up Kerberos Authentication for PostgreSQL DB Clusters (p. 940)
• Managing a DB Cluster in a Domain (p. 948)
• Connecting to PostgreSQL with Kerberos Authentication (p. 949)
939
Amazon Aurora User Guide for Aurora
Overview of Kerberos Authentication
1. Use AWS Managed Microsoft AD to create an AWS Managed Microsoft AD directory. You can use the
AWS Management Console, the AWS CLI, or the AWS Directory Service API to create the directory.
2. Create a role that provides Amazon Aurora access to make calls to your AWS Managed Microsoft AD
directory. To do so, create an AWS Identity and Access Management (IAM) role that uses the managed
IAM policy AmazonRDSDirectoryServiceAccess.
For the IAM role to allow access, the AWS Security Token Service (AWS STS) endpoint must be
activated in the correct AWS Region for your AWS account. AWS STS endpoints are active by default
in all AWS Regions, and you can use them without any further actions. For more information, see
Activating and Deactivating AWS STS in an AWS Region in the IAM User Guide.
3. Create and configure users in the AWS Managed Microsoft AD directory using the Microsoft Active
Directory tools. For more information about creating users in your Active Directory, see Manage Users
and Groups in AWS Managed Microsoft AD in the AWS Directory Service Administration Guide.
4. If you plan to locate the directory and the DB instance in different virtual private clouds (VPCs),
configure VPC peering. For more information, see What Is VPC Peering? in the Amazon VPC Peering
Guide.
5. Create or modify a PostgreSQL DB cluster either from the console, CLI, or RDS API using one of the
following methods:
• Creating a DB Cluster and Connecting to a Database on an Aurora PostgreSQL DB Cluster (p. 88)
• Modifying an Amazon Aurora DB Cluster (p. 232)
• Restoring from a DB Cluster Snapshot (p. 292)
• Restoring a DB Cluster to a Specified Time (p. 325)
When you create or modify the DB cluster , provide the domain identifier (d-* identifier) that was
generated when you created your directory. Also provide the name of the IAM role that you created.
You can locate the DB cluster in the same VPC as the directory or in a different VPC.
6. Use the RDS master user credentials to connect to the PostgreSQL DB cluster. Create the user in
PostgreSQL to be identified externally. Externally identified users can log in to the PostgreSQL DB
cluster using Kerberos authentication.
Topics
• Step 1: Create a Directory Using AWS Managed Microsoft AD (p. 941)
• Step 2: Create an IAM Role for Amazon Aurora to Access the AWS Directory Service (p. 944)
• Step 3: Create and Configure Users (p. 945)
• Step 4: Configure VPC Peering (p. 945)
• Step 5: Create or Modify a PostgreSQL DB cluster (p. 946)
• Step 6: Create Kerberos Authentication PostgreSQL Logins (p. 947)
940
Amazon Aurora User Guide for Aurora
Setting Up
When you create an AWS Managed Microsoft AD directory, AWS Directory Service performs the following
tasks on your behalf:
When you launch AWS Directory Service for Microsoft Active Directory, AWS creates an Organizational
Unit (OU) that contains all of your directory's objects. This OU, which has the NetBIOS name that you
entered when you created your directory, is located in the domain root. The domain root is owned and
managed by AWS.
The Admin account that was created with your AWS Managed Microsoft AD directory has permissions for
the most common administrative activities for your OU:
The Admin account also has rights to perform the following domain-wide activities:
• Manage DNS configurations (add, remove, or update records, zones, and forwarders)
• View DNS event logs
• View security event logs
1. In the AWS Directory Service console navigation pane, choose Directories, and then choose Set up
directory.
2. Choose AWS Managed Microsoft AD. AWS Managed Microsoft AD is the only option currently
supported for use with Amazon Aurora.
3. Choose Next.
4. On the Enter directory information page, provide the following information:
941
Amazon Aurora User Guide for Aurora
Setting Up
Edition
The password for the directory administrator. The directory creation process creates an
administrator account with the user name Admin and this password.
The directory administrator password can't include the word "admin." The password is case-
sensitive and must be 8–64 characters in length. It must also contain at least one character from
three of the following four categories:
• Lowercase letters (a–z)
• Uppercase letters (A–Z)
• Numbers (0–9)
• Nonalphanumeric characters (~!@#$%^&*_-+=`|\(){}[]:;"'<>,.?/)
Confirm password
VPC
Choose the VPC for the directory. You can create the PostgreSQL DB cluster in this same VPC or
in a different VPC.
Subnets
Choose the subnets for the directory servers. The two subnets must be in different Availability
Zones.
7. Choose Next.
8. Review the directory information. If changes are needed, choose Previous and make the changes.
When the information is correct, choose Create directory.
942
Amazon Aurora User Guide for Aurora
Setting Up
It takes several minutes for the directory to be created. When it has been successfully created, the Status
value changes to Active.
To see information about your directory, choose the directory ID in the directory listing. Make a note of
the Directory ID value. You need this value when you create or modify your PostgreSQL DB instance.
943
Amazon Aurora User Guide for Aurora
Setting Up
When a DB instance is created using the AWS Management Console and the console user has the
iam:CreateRole permission, the console creates this role automatically. In this case, the role name
is rds-directoryservice-kerberos-access-role. Otherwise, you must create the IAM role
manually. When you create this IAM role, choose Directory Service, and attach the AWS managed
policy AmazonRDSDirectoryServiceAccess to it.
For more information about creating IAM roles for a service, see Creating a Role to Delegate Permissions
to an AWS Service in the IAM User Guide.
Note
The IAM role used for Windows Authentication for RDS for Microsoft SQL Server can't be used
for Amazon Aurora.
944
Amazon Aurora User Guide for Aurora
Setting Up
Optionally, you can create policies with the required permissions instead of using the managed IAM
policy AmazonRDSDirectoryServiceAccess. In this case, the IAM role must have the following IAM
trust policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": [
"directoryservice.rds.amazonaws.com",
"rds.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
The role must also have the following IAM role policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ds:DescribeDirectories",
"ds:AuthorizeApplication",
"ds:UnauthorizeApplication",
"ds:GetAuthorizedApplicationDetails"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
To create users in an AWS Directory Service directory, you must be connected to a Windows-based
Amazon EC2 instance. Also, this EC2 instance must be a member of the AWS Directory Service directory.
At the same time, you must be logged in as a user that has privileges to create users. For more
information, see Create a User in the AWS Directory Service Administration Guide.
If the same AWS account owns both VPCs, follow the instructions in What Is VPC Peering? in the Amazon
VPC Peering Guide. Specifically, complete the following steps:
1. Set up appropriate VPC routing rules to make sure that the network traffic can flow both ways.
945
Amazon Aurora User Guide for Aurora
Setting Up
2. Ensure the DB instance's security group can receive ingress traffic from this security group.
3. Ensure that there is no network access control list (ACL) rule to block traffic.
If different AWS accounts own the VPCs, complete the following steps:
1. Configure VPC peering by following the instructions in What Is VPC Peering? Specifically, complete the
following steps:
a. Set up appropriate VPC routing rules to make sure that the network traffic can flow both ways.
b. Make sure that there is no ACL rule to block traffic.
2. Start sharing the directory with the AWS account where you plan to create the DB cluster. To do this,
follow the instructions in Tutorial: Sharing Your AWS Managed Microsoft AD Directory for Seamless
EC2 Domain-Join in the AWS Directory Service Administration Guide.
3. Sign in to the AWS Directory Service console using the account for the DB cluster, and make sure that
the domain has the SHARED status before proceeding.
4. While logged into the AWS Directory Service console using the account for the DB cluster, make a note
of the Directory ID value for the directory.
• Create a new PostgreSQL DB cluster using the console, the create-db-cluster CLI command, or the
CreateDBCluster RDS API operation. For instructions, see Creating a DB Cluster and Connecting to a
Database on an Aurora PostgreSQL DB Cluster (p. 88).
• Modify an existing PostgreSQL DB cluster using the console, the modify-db-cluster CLI command,
or the ModifyDBCluster RDS API operation. For instructions, see Modifying an Amazon Aurora DB
Cluster (p. 232).
• Restore a PostgreSQL DB cluster from a DB snapshot using the console, the restore-db-cluster-
from-db-snapshot CLI command, or the RestoreDBClusterFromDBSnapshot RDS API operation. For
instructions, see Restoring from a DB Cluster Snapshot (p. 292).
• Restore a PostgreSQL DB cluster to a point-in-time using the console, the restore-db-instance-
to-point-in-time CLI command, or the RestoreDBClusterToPointInTime RDS API operation. For
instructions, see Restoring a DB Cluster to a Specified Time (p. 325).
Kerberos authentication is only supported for PostgreSQL DB clustersin a VPC. The DB cluster can be in
the same VPC as the directory, or in a different VPC. The DB cluster must use a security group that allows
egress within the directory's VPC so the DB cluster can communicate with the directory.
When you use the console to create a DB cluster , choose Password and Kerberos authentication in the
Database authentication section. Choose Browse Directory and then select the directory, or choose
Create a new directory.
946
Amazon Aurora User Guide for Aurora
Setting Up
When you use the console to modify or restore a DB cluster , choose the directory in the Kerberos
authentication section, or choose Create a new directory.
When you use the AWS CLI, the following parameters are required for the DB cluster to be able to use
the directory that you created:
• For the --domain parameter, use the domain identifier ("d-*" identifier) generated when you created
the directory.
• For the --domain-iam-role-name parameter, use the role you created that uses the managed IAM
policy AmazonRDSDirectoryServiceAccess.
For example, the following CLI command modifies a DB cluster to use a directory.
Important
If you modify a DB cluster to enable Kerberos authentication, reboot the DB cluster after making
the change.
947
Amazon Aurora User Guide for Aurora
Managing a DB Cluster in a Domain
To allow an Active Directory user to authenticate with PostgreSQL, use the RDS master user credentials.
You use these credentials to connect to the PostgreSQL DB cluster as you do with any other DB cluster .
After you're logged in, create an externally authenticated user in PostgreSQL and grant the rds_ad role
to this user.
Replace username with the user name and include the domain name in uppercase. Users (both humans
and applications) from your domain can now connect to the RDS PostgreSQL cluster from a domain-
joined client machine using Kerberos authentication.
• To reattempt enabling Kerberos authentication for a failed membership, use the modify-db-cluster CLI
command. Specify the current membership's directory ID for the --domain option.
• To disable Kerberos authentication on a DB instance, use the modify-db-cluster CLI command. Specify
none for the --domain option.
• To move a DB instance from one domain to another, use the modify-db-cluster CLI command. Specify
the domain identifier of the new domain for the --domain option.
948
Amazon Aurora User Guide for Aurora
Connecting with Kerberos Authentication
A request to enable Kerberos authentication can fail because of a network connectivity issue or an
incorrect IAM role. In some cases, the attempt to enable Kerberos authentication might fail when you
create or modify a DB cluster. If so, make sure that you are using the correct IAM role, then modify the
DB cluster to join the domain.
pgAdmin
To use pgAdmin to connect to PostgreSQL with Kerberos authentication, take the following steps:
psql
To use psql to connect to PostgreSQL with Kerberos authentication, take the following steps:
kinit username
Replace username with the user name. At the prompt, enter the password stored in the Microsoft
Active Directory for the user.
949
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Reference
2. If the PostgreSQL DB cluster is using a publicly accessible VPC, put a private IP address for your DB
cluster endpoint in your /etc/hosts file on the EC2 client. For example, the following commands
obtain the private IP address and then put it in the /etc/hosts file.
3. Use the following psql command to log in to a PostgreSQL DB cluster that is integrated with Microsoft
Active Directory.
Cluster-level parameters are managed in DB cluster parameter groups. Instance-level parameters are
managed in DB parameter groups. Although each DB instance in an Aurora PostgreSQL DB cluster is
compatible with the PostgreSQL database engine, some of the PostgreSQL database engine parameters
must be applied at the cluster level, and are managed using DB cluster parameter groups. Cluster-level
parameters are not found in the DB parameter group for a DB instance in an Aurora PostgreSQL DB
cluster and are listed later in this topic.
You can view both cluster-level and instance-level parameters in the Amazon RDS console, or by using
the AWS CLI or Amazon RDS API. For example, to view cluster-level parameters in a DB cluster parameter
group, use the describe-db-cluster-parameters AWS CLI command. To view instance-level parameters
in a DB parameter group for a DB instance in a DB cluster, use the describe-db-parameters AWS CLI
command.
You can manage both cluster-level and instance-level parameters using the Amazon RDS console, the
AWS CLI, or the Amazon RDS API. There are separate commands for managing cluster-level parameters
and instance-level parameters. For example:
950
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
For more information about parameter groups, see Working with DB Parameter Groups and DB Cluster
Parameter Groups (p. 205).
ansi_constraint_trigger_ordering Yes
ansi_force_foreign_key_checks Yes
ansi_qualified_update_set_target Yes
apg_ccm_enabled Yes
archive_command No
archive_timeout No
array_nulls Yes
autovacuum Yes
autovacuum_analyze_scale_factor Yes
autovacuum_analyze_threshold Yes
autovacuum_freeze_max_age Yes
autovacuum_max_workers Yes
autovacuum_multixact_freeze_max_age Yes
autovacuum_naptime Yes
autovacuum_vacuum_cost_delay Yes
autovacuum_vacuum_cost_limit Yes
autovacuum_vacuum_scale_factor Yes
autovacuum_vacuum_threshold Yes
autovacuum_work_mem Yes
backslash_quote Yes
client_encoding Yes
data_directory No
datestyle Yes
default_tablespace Yes
default_with_oids Yes
extra_float_digits Yes
huge_pages No
951
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
intervalstyle Yes
lc_monetary Yes
lc_numeric Yes
lc_time Yes
log_autovacuum_min_duration Yes
max_prepared_transactions Yes
password_encryption No
port No
rds.enable_plan_management Yes
rds.extensions No
rds.force_autovacuum_logging_level Yes
rds.force_ssl Yes
rds.logical_replication Yes
rds.restrict_password_commands Yes
server_encoding No
ssl Yes
synchronous_commit Yes
timezone Yes
track_commit_timestamp Yes
vacuum_cost_delay Yes
vacuum_cost_limit Yes
vacuum_cost_page_hit Yes
vacuum_cost_page_miss Yes
vacuum_defer_cleanup_age Yes
vacuum_freeze_min_age Yes
vacuum_freeze_table_age Yes
vacuum_multixact_freeze_min_age Yes
vacuum_multixact_freeze_table_age Yes
wal_buffers Yes
952
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
apg_enable_not_in_transform Yes
apg_enable_remove_redundant_inner_joins Yes
apg_enable_semijoin_push_down Yes
apg_plan_mgmt.capture_plan_baselines Yes
apg_plan_mgmt.max_databases Yes
apg_plan_mgmt.max_plans Yes
apg_plan_mgmt.plan_retention_period Yes
apg_plan_mgmt.unapproved_plan_execution_threshold Yes
apg_plan_mgmt.use_plan_baselines Yes
application_name Yes
authentication_timeout Yes
auto_explain.log_analyze Yes
auto_explain.log_buffers Yes
auto_explain.log_format Yes
auto_explain.log_min_duration Yes
auto_explain.log_nested_statements Yes
auto_explain.log_timing Yes
auto_explain.log_triggers Yes
auto_explain.log_verbose Yes
auto_explain.sample_rate Yes
backend_flush_after Yes
bgwriter_flush_after Yes
bytea_output Yes
check_function_bodies Yes
953
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
checkpoint_flush_after Yes
checkpoint_timeout No
client_min_messages Yes
config_file No
constraint_exclusion Yes
cpu_index_tuple_cost Yes
cpu_operator_cost Yes
cpu_tuple_cost Yes
cursor_tuple_fraction Yes
db_user_namespace No
deadlock_timeout Yes
debug_pretty_print Yes
debug_print_parse Yes
debug_print_plan Yes
debug_print_rewritten Yes
default_statistics_target Yes
default_transaction_deferrable Yes
default_transaction_isolation Yes
default_transaction_read_only Yes
effective_cache_size Yes
effective_io_concurrency Yes
enable_bitmapscan Yes
enable_hashagg Yes
enable_hashjoin Yes
enable_indexonlyscan Yes
enable_indexscan Yes
enable_material Yes
enable_mergejoin Yes
enable_nestloop Yes
enable_seqscan Yes
enable_sort Yes
954
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
enable_tidscan Yes
escape_string_warning Yes
exit_on_error No
force_parallel_mode Yes
from_collapse_limit Yes
geqo Yes
geqo_effort Yes
geqo_generations Yes
geqo_pool_size Yes
geqo_seed Yes
geqo_selection_bias Yes
geqo_threshold Yes
gin_fuzzy_search_limit Yes
gin_pending_list_limit Yes
hba_file No
hot_standby_feedback No
ident_file No
idle_in_transaction_session_timeout Yes
join_collapse_limit Yes
lc_messages Yes
listen_addresses No
lo_compat_privileges No
log_connections Yes
log_destination Yes
log_directory No
log_disconnections Yes
log_duration Yes
log_error_verbosity Yes
log_executor_stats Yes
log_file_mode No
log_filename Yes
955
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
log_hostname Yes
log_line_prefix No
log_lock_waits Yes
log_min_duration_statement Yes
log_min_error_statement Yes
log_min_messages Yes
log_parser_stats Yes
log_planner_stats Yes
log_replication_commands Yes
log_rotation_age Yes
log_rotation_size Yes
log_statement Yes
log_statement_stats Yes
log_temp_files Yes
log_timezone No
log_truncate_on_rotation No
logging_collector No
maintenance_work_mem Yes
max_connections Yes
max_files_per_process Yes
max_locks_per_transaction Yes
max_replication_slots Yes
max_stack_depth Yes
max_standby_archive_delay No
max_standby_streaming_delay No
max_wal_senders Yes
max_worker_processes Yes
min_parallel_relation_size Yes
old_snapshot_threshold Yes
operator_precedence_warning Yes
parallel_setup_cost Yes
956
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
parallel_tuple_cost Yes
pg_hint_plan.debug_print Yes
pg_hint_plan.enable_hint Yes
pg_hint_plan.enable_hint_table Yes
pg_hint_plan.message_level Yes
pg_hint_plan.parse_messages Yes
pg_stat_statements.max Yes
pg_stat_statements.save Yes
pg_stat_statements.track Yes
pg_stat_statements.track_utility Yes
pgaudit.log Yes
pgaudit.log_catalog Yes
pgaudit.log_level Yes
pgaudit.log_parameter Yes
pgaudit.log_relation Yes
pgaudit.log_statement_once Yes
pgaudit.role Yes
postgis.gdal_enabled_drivers Yes
quote_all_identifiers Yes
random_page_cost Yes
rds.force_admin_logging_level Yes
rds.log_retention_period Yes
rds.rds_superuser_reserved_connections Yes
rds.superuser_variables No
replacement_sort_tuples Yes
restart_after_crash No
row_security Yes
search_path Yes
seq_page_cost Yes
session_replication_role Yes
shared_buffers Yes
957
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Parameters
shared_preload_libraries Yes
sql_inheritance Yes
ssl_ca_file No
ssl_cert_file No
ssl_ciphers No
ssl_key_file No
standard_conforming_strings Yes
statement_timeout Yes
stats_temp_directory No
superuser_reserved_connections No
synchronize_seqscans Yes
syslog_facility No
tcp_keepalives_count Yes
tcp_keepalives_idle Yes
tcp_keepalives_interval Yes
temp_buffers Yes
temp_tablespaces Yes
track_activities Yes
track_activity_query_size Yes
track_counts Yes
track_functions Yes
track_io_timing Yes
transaction_deferrable Yes
transaction_read_only Yes
transform_null_equals Yes
unix_socket_directories No
unix_socket_group No
unix_socket_permissions No
update_process_title Yes
wal_receiver_status_interval Yes
wal_receiver_timeout Yes
958
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Events
wal_sender_timeout Yes
work_mem Yes
xmlbinary Yes
xmloption Yes
BufferPin:BufferPin
In this wait event, a session is waiting to access a data buffer during a period when no other session
can examine that buffer. Buffer pin waits can be protracted if another process holds an open cursor
which last read data from the buffer in question.
Client:ClientRead
In this wait event, a session is receiving data from an application client. This wait might be prevalent
during bulk data loads using the COPY statement, or for applications that pass data to Aurora using
many round trips between the client and the database. A high number of client read waits per
transaction may indicate excessive round trips, such as parameter passing. You should compare this
against the expected number of statements per transaction.
IO:DataFilePrefetch
In this wait event, a session is waiting for an asynchronous prefetch from Aurora Storage.
IO:DataFileRead
In this wait event, a session is reading data from Aurora Storage. This may be a typical wait event
for I/O intensive workloads. SQL statements showing a comparatively large proportion of this
wait event compared to other SQL statements may be using an inefficient query plan that requires
reading large amounts of data.
IO:XactSync
In this wait event, a session is issuing a COMMIT or ROLLBACK, requiring the current transaction’s
changes to be persisted. Aurora is waiting for Aurora storage to acknowledge persistence.
This wait most often arises when there is a very high rate of commit activity on the system. You
can sometimes alleviate this wait by modifying applications to commit transactions in batches. You
might see this wait at the same time as CPU waits in a case where the DB load exceeds the number
of virtual CPUs (vCPUs) for the DB instance. In this case, the storage persistence might be competing
for CPU with CPU-intensive database workloads. To alleviate this scenario, you can try reducing
those workloads, or scaling up to a DB instance with more vCPUs.
Lock:transactionid
In this wait event, a session is trying to modify data that has been modified by another session, and
is waiting for the other session’s transaction to be committed or rolled back. You can investigate
blocking and waiting sessions in the pg_locks view.
LWLock:buffer_content
In this wait event, a session is waiting to read or write a data page in memory while another session
has that page locked for writing. Heavy write contention for a single page (hot page), due to
959
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL Updates
frequent updates of the same piece of data by many sessions, could lead to prevalence of this wait
event. Excessive use of foreign key constraints could increase lock duration, leading to increased
contention. You should investigate workloads experiencing high buffer_content waits for usage
of foreign key constraints to determine if the constraints are necessary. Alternatively, decreasing
the fillfactor on the parent table will spread the keys across more of the block and can reduce
contention on the page.
LWLock:SubtransControlLock
In this wait event, a session is looking up or manipulating the parent/child relationship between
a transaction and a subtransaction. The two most common causes of subtransaction use are
savepoints and PL/pgSQL exception blocks. The wait event might occur if there is heavy concurrent
querying of data that's simultaneously being updated from within subtransactions. You should
investigate whether it is possible to reduce the use of savepoints and exception blocks, or to
decrease concurrent queries on the rows being updated.
For a complete list of PostgreSQL wait events, see PostgreSQL wait-event table.
Topics
• Identifying Your Version of Amazon Aurora PostgreSQL (p. 960)
• Upgrading the Amazon Aurora PostgreSQL Engine Version (p. 961)
• Engine Versions for Amazon Aurora PostgreSQL (p. 961)
• Extension Versions for Amazon Aurora PostgreSQL (p. 984)
An Aurora database has two version numbers; the Aurora version number and the database engine
version number.
• To get the Aurora version number, see Identifying Your Amazon Aurora Version (p. 352).
• You can get the database engine version number for an Aurora PostgreSQL DB instance by querying
for the SERVER_VERSION runtime parameter. To get the database engine version number, use the
following query.
SHOW SERVER_VERSION;
960
Amazon Aurora User Guide for Aurora
Upgrading
The following table shows the version of each Aurora PostgreSQL release and the PostgreSQL version
that it is compatible with.
Version 3.1
This version of Aurora PostgreSQL is compatible with PostgreSQL 11.6. For more information about the
improvements in release 11.6, see PostgreSQL Release 11.6.
This release contains multiple critical stability enhancements. Amazon highly recommends upgrading
your Aurora PostgreSQL clusters that use older PostgreSQL 11 engines to this release.
961
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Patch Versions
• Version 3.1.2 (p. 962)
• Version 3.1.1 (p. 962)
• Version 3.1.0 (p. 963)
Version 3.1.2
This release contains a critical stability enhancement. Amazon highly recommends updating your older
Aurora PostgreSQL 11-compatible clusters to this release.
1. Fixed a bug whereby a reader DB instance might temporarily use stale data. This could lead to
wrong results such as too few or too many rows. This error is not persisted on storage, and will
clear when the database page containing the row has been evicted from cache. This can happen
when the primary DB instance enters a transaction snapshot overflow due to having more than 64
subtransactions in a single transaction. Applications susceptible to this bug include those that use
SQL savepoints or PostgreSQL exception handlers with more than 64 subtransactions in the top
transaction.
1. Fixed a bug that may cause a reader DB instance to crash causing unavailability while attempting to
the join the DB cluster. This can happen in some cases when the primary DB instance has a transaction
snapshot overflow due to a high number of subtransactions. In this situation the reader DB instance
will be unable to join until the snapshot overflow has cleared.
1. Fixed a bug that prevented Performance Insights from determining the query ID of a running
statement.
Version 3.1.1
You can find the following improvements in this engine update.
1. Fixed a bug whereby the DB instance might be briefly unavailable due to the self-healing function of
the underlying storage.
1. Fixed a bug whereby the database engine might crash causing unavailability. This occurred while
scanning an included, non-key column of a B-Tree index. This only applies to PostgreSQL 11 "included
column" indexes.
2. Fixed a bug that might cause the database engine to crash causing unavailability. This occurred if
a newly established database connection encountered a resource exhaustion-related error during
initialization after successful authentication.
962
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
1. Provided a fix for the pg_hint_plan extension that could lead the database engine to crash causing
unavailability. The open source issue can be tracked at https://github.com/ossc-db/pg_hint_plan/
pull/45.
2. Fixed a bug where SQL of the form ALTER FUNCTION ... OWNER TO ... would incorrectly report
ERROR: improper qualified name (too many dotted names).
3. Improved the performance of GIN index vacuum via prefetching.
4. Fixed a bug in open source PostgreSQL that could lead to a database engine crash causing
unavailability. This occurred during parallel B-Tree index scans. This issue has been reported to the
PostgreSQL community.
5. Improved the performance of in-memory B-Tree index scans.
Version 3.1.0
You can find the following new features and improvements in this engine version.
New Features
1. Support for exporting data to Amazon S3. For more information, see Exporting Data from an Aurora
PostgreSQL DB Cluster to Amazon S3 (p. 864).
2. Support for Amazon Aurora Machine Learning. For more information, see Using Machine Learning
(ML) with Aurora PostgreSQL (p. 902).
3. SQL processing enhancements include:
• Optimizations for NOT IN with the apg_enable_not_in_transform parameter.
• Semi-join filter pushdown enhancements for hash joins with the
apg_enable_semijoin_push_down parameter.
• Optimizations for redundant inner join removal with the
apg_enable_remove_redundant_inner_joins parameter.
• Improved ANSI compatibility options with the ansi_constraint_trigger_ordering,
ansi_force_foreign_key_checks and ansi_qualified_update_set_target parameters.
For more information, see Amazon Aurora PostgreSQL Parameters (p. 950).
4. New and updated PostgreSQL extensions include:
• The new aws_ml extension. For more information, see Using Machine Learning (ML) with Aurora
PostgreSQL (p. 902).
• The new aws_s3 extension. For more information, see Exporting Data from an Aurora PostgreSQL
DB Cluster to Amazon S3 (p. 864).
• Updates to the apg_plan_mgmt extension. For more information, see Managing Query Execution
Plans for Aurora PostgreSQL (p. 873)
1. Fixed a bug related to creating B-tree indexes on temporary tables that in rare cases may result in
longer recovery time, and impact availability.
2. Fixed a bug related to replication when Aurora PostgreSQL is acting as a physical replica of an RDS
PostgreSQL instance. In rare cases, this bug causes a log write failure that may result in longer
recovery time, and impact availability.
3. Fixed a bug related to handling of reads with high I/O latency that in rare cases may result in longer
recovery time, and impact availability.
963
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
1. Corrected a memory leak in the log-apply process on read nodes. To see this memory leak, use
Enhancement Monitoring and observe the "% of memory usage" for the "wal replay" process.
2. Fixed a bug related to logical replication whereby wal segments are not properly removed from
storage. This can result in storage bloat. To monitor this, view the TransactionLogDiskUsage
parameter.
3. Fixed multiple bugs, which cause Aurora to crash during prefetch operations on Btree indexes.
4. Fixed a bug whereby an Aurora restart may timeout when logical replication is used.
5. Enhanced the validation checks performed on data blocks in the buffer cache. This improves Aurora's
detection of inconsistency.
1. The query plan management extension apg_plan_mgmt has an improved algorithm for managing
plan generation for highly partitioned tables.
2. Reduced startup time on instances with large caches via improvements in the buffer cache recovery
algorithm.
3. Improved the performance of the read-node-apply process under high transaction rate workloads by
using changes to PostgreSQL LWLock prioritization. These changes prevent starvation of the read-
node-apply process while the PostgreSQL ProcArray is under heavy contention.
4. Improved handling of batch reads during vacuum, table scans, and index scans. This results in greater
throughput and lower CPU consumption.
5. Fixed a bug whereby a read node may crash during the replay of a PostgreSQL SLRU-truncate
operation.
6. Fixed a bug where in rare cases, database writes may stall following an error returned by one of the six
copies of an Aurora log record.
7. Fixed a bug related to logical replication where an individual transaction larger than 1 Gb in size may
result in an engine crash.
8. Fixed a memory leak on read nodes when cluster cache management is enabled.
9. Fixed a bug whereby importing an RDS PostgreSQL snapshot may hang if the source snapshot
contains a large number of unlogged relations.
10.Fixed a bug whereby the Aurora storage daemon may crash under heavy I/O load.
11.Fixed a bug related to hot_standby_feedback for read nodes whereby the read node may report
the wrong transaction id epoch to the write node. This can cause the write node to ignore the
hot_standby_feedback and invalidate snapshots on the read node.
12.Fixed a bug whereby storage errors that occur during CREATE DATABASE statements are not properly
handled. The bug would leave the resulting database inaccessible. The correct behavior is to fail the
database creation and return the appropriate error to the user.
13.Improved handling of PostgreSQL snapshot overflow when a read node attempts to connect to a write
node. Prior to this change, if the write node was in a snapshot overflow state, the read node would be
unable to join. A message would appear in the PostgreSQL log file in the form, DEBUG: recovery
snapshot waiting for non-overflowed snapshot or until oldest active xid on
standby is at least xxxxxxx (now yyyyyyy). A snapshot overflow occurs when an individual
transaction has created over 64 subtransactions.
14.Fixed a bug related to common table expressions whereby an error is incorrectly raised when a NOT IN
class exists in a CTE. The error is CTE with NOT IN fails with ERROR: could not find CTE
CTE-Name.
15.Fixed a bug related to an incorrect last_error_timestamp value in the aurora_replica_status
table.
16.Fixed a bug to avoid populating shared buffers with blocks belonging to temporary objects. These
blocks correctly reside in backend local buffers.
964
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 3.0
This version of Aurora PostgreSQL is compatible with PostgreSQL 11.4. For more information about the
improvements in release 11.4, see PostgreSQL Release 11.4.
Note
For the initial release, the supported AWS Regions are us-east-1, us-east-2, us-west-2, eu-
west-1, ap-northeast-1, and ap-northeast-2. For the complete list of AWS Regions, see Aurora
PostgreSQL Region Availability (p. 7).
Improvements
1. This release contains all fixes, features, and improvements present in Version 2.3.5 (p. 969).
2. Partitioning – Partitioning improvements include support for hash partitioning, enabling creation of a
default partition, and dynamic row movement to another partition based on the key column update.
3. Performance – Performance improvements include parallelism while creating indexes, materialized
views, hash joins, and sequential scans to make the operations perform better.
4. Stored procedures – SQL stored procedures now added support for embedded transactions.
5. Autovacuum improvements – To provide valuable logging, the parameter
rds.force_autovacuum_logging is ON by default in conjunction with the
log_autovacuum_min_duration parameter set to 10 seconds. To increase
autovacuum effectiveness, the values for the autovacuum_max_workers and
autovacuum_vacuum_cost_limit parameters are computed based on host memory capacity to
provide larger default values.
6. Improved transaction timeout – The parameter idle_in_transaction_session_timeout is set to
12 hours. Any session that has been idle more than 12 hours is terminated.
7. The tsearch2 module is no longer supported – If your application uses tsearch2 functions, update
it to use the equivalent functions provided by the core PostgreSQL engine. For more information
about the tsearch2 module, see PostgreSQL tsearch2.
8. The chkpass module is no longer supported – For more information about the chkpass module, see
PostgreSQL chkpass.
9. Updated the following extensions:
• address_standardizer to version 2.5.1
• address_standardizer_data_us to version 2.5.1
• btree_gin to version 1.3
• citext to version 1.5
• cube to version 1.4
• hstore to version 1.5
• ip4r to version 2.2
• isn to version 1.2
• orafce to version 3.7
• pg_hint_plan to version 1.3.4
• pg_prewarm to version 1.2
965
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 2.4
This version of Aurora PostgreSQL is compatible with PostgreSQL 10.11. For more information about the
improvements in release 10.11, see PostgreSQL Release 10.11.
This release contains multiple critical stability enhancements. Amazon highly recommends upgrading
your Aurora PostgreSQL clusters that use older PostgreSQL 10 engines to this release.
Patch Versions
• Version 2.4.2 (p. 966)
• Version 2.4.1 (p. 967)
• Version 2.4.0 (p. 967)
Version 2.4.2
You can find the following improvements in this engine update.
1. Fixed a bug whereby a reader DB instance might temporarily use stale data. This could lead to
wrong results such as too few or too many rows. This error is not persisted on storage, and will
clear when the database page containing the row has been evicted from cache. This can happen
when the primary DB instance enters a transaction snapshot overflow due to having more than 64
subtransactions in a single transaction. Applications susceptible to this bug include those that use
SQL savepoints or PostgreSQL exception handlers with more than 64 subtransactions in the top
transaction.
1. Fixed a bug that may cause a reader DB instance to crash causing unavailability while attempting to
the join the DB cluster. This can happen in some cases when the primary DB instance has a transaction
snapshot overflow due to a high number of subtransactions. In this situation the reader DB instance
will be unable to join until the snapshot overflow has cleared.
1. Fixed a bug that prevented Performance Insights from determining the query ID of a running
statement.
966
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 2.4.1
You can find the following improvements in this engine update.
1. Fixed a bug whereby the DB instance might be briefly unavailable due to the self-healing function of
the underlying storage.
1. Fixed a bug that might cause the database engine to crash causing unavailability. This occurred if
a newly established database connection encountered a resource exhaustion-related error during
initialization after successful authentication.
1. Provided a fix for the pg_hint_plan extension that could lead the database engine to crash causing
unavailability. The open source issue can be tracked at https://github.com/ossc-db/pg_hint_plan/
pull/45.
2. Fixed a bug where SQL of the form ALTER FUNCTION ... OWNER TO ... would incorrectly report
ERROR: improper qualified name (too many dotted names).
3. Improved the performance of GIN index vacuum via prefetching.
4. Fixed a bug in open source PostgreSQL that could lead to a database engine crash causing
unavailability. This occurred during parallel B-Tree index scans. This issue has been reported to the
PostgreSQL community.
5. Improved the performance of in-memory B-Tree index scans.
6. Additional general improvements to the stability and availability of Aurora PostgreSQL.
Version 2.4.0
You can find the following new features and improvements in this engine version.
New Features
1. Support for exporting data to Amazon S3. For more information, see Exporting Data from an Aurora
PostgreSQL DB Cluster to Amazon S3 (p. 864).
2. Support for Amazon Aurora Machine Learning. For more information, see Using Machine Learning
(ML) with Aurora PostgreSQL (p. 902).
3. SQL processing enhancements include:
• Optimizations for NOT IN with the apg_enable_not_in_transform parameter.
• Semi-join filter pushdown enhancements for hash joins with the
apg_enable_semijoin_push_down parameter.
• Optimizations for redundant inner join removal with the
apg_enable_remove_redundant_inner_joins parameter.
• Improved ANSI compatibility options with the ansi_constraint_trigger_ordering,
ansi_force_foreign_key_checks and ansi_qualified_update_set_target parameters.
For more information, see Amazon Aurora PostgreSQL Parameters (p. 950).
4. New and updated PostgreSQL extensions include:
• The new aws_ml extension. For more information, see Using Machine Learning (ML) with Aurora
PostgreSQL (p. 902).
967
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
• The new aws_s3 extension. For more information, see Exporting Data from an Aurora PostgreSQL
DB Cluster to Amazon S3 (p. 864).
• Updates to the apg_plan_mgmt extension. For more information, see Managing Query Execution
Plans for Aurora PostgreSQL (p. 873)
1. Fixed a bug related to creating B-tree indexes on temporary tables that in rare cases may result in
longer recovery time, and impact availability.
2. Fixed a bug related to replication when Aurora PostgreSQL is acting as a physical replica of an RDS
PostgreSQL instance. In rare cases, this bug causes a log write failure that may result in longer
recovery time, and impact availability.
3. Fixed a bug related to handling of reads with high I/O latency that in rare cases may result in longer
recovery time, and impact availability.
1. Corrected a memory leak in the log-apply process on read nodes. To see this memory leak, use
Enhancement Monitoring and observe the "% of memory usage" for the "wal replay" process.
2. Fixed a bug related to logical replication whereby wal segments are not properly removed from
storage. This can result in storage bloat. To monitor this, view the TransactionLogDiskUsage
parameter.
3. Fixed multiple bugs, which cause Aurora to crash during prefetch operations on Btree indexes.
4. Fixed a bug whereby an Aurora restart may timeout when logical replication is used.
5. Enhanced the validation checks performed on data blocks in the buffer cache. This improves Aurora's
detection of inconsistency.
1. The query plan management extension apg_plan_mgmt has an improved algorithm for managing
plan generation for highly partitioned tables.
2. Reduced startup time on instances with large caches via improvements in the buffer cache recovery
algorithm.
3. Improved the performance of the read-node-apply process under high transaction rate workloads by
using changes to PostgreSQL LWLock prioritization. These changes prevent starvation of the read-
node-apply process while the PostgreSQL ProcArray is under heavy contention.
4. Improved handling of batch reads during vacuum, table scans, and index scans. This results in greater
throughput and lower CPU consumption.
5. Fixed a bug whereby a read node may crash during the replay of a PostgreSQL SLRU-truncate
operation.
6. Fixed a bug where in rare cases, database writes may stall following an error returned by one of the six
copies of an Aurora log record.
7. Fixed a bug related to logical replication where an individual transaction larger than 1 Gb in size may
result in an engine crash.
8. Fixed a memory leak on read nodes when cluster cache management is enabled.
9. Fixed a bug whereby importing an RDS PostgreSQL snapshot may hang if the source snapshot
contains a large number of unlogged relations.
10.Fixed a bug whereby the Aurora storage daemon may crash under heavy I/O load.
11.Fixed a bug related to hot_standby_feedback for read nodes whereby the read node may report
the wrong transaction id epoch to the write node. This can cause the write node to ignore the
hot_standby_feedback and invalidate snapshots on the read node.
968
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
12.Fixed a bug whereby storage errors that occur during CREATE DATABASE statements are not properly
handled. The bug would leave the resulting database inaccessible. The correct behavior is to fail the
database creation and return the appropriate error to the user.
13.Improved handling of PostgreSQL snapshot overflow when a read node attempts to connect to a write
node. Prior to this change, if the write node was in a snapshot overflow state, the read node would be
unable to join. A message would appear in the PostgreSQL log file in the form, DEBUG: recovery
snapshot waiting for non-overflowed snapshot or until oldest active xid on
standby is at least xxxxxxx (now yyyyyyy). A snapshot overflow occurs when an individual
transaction has created over 64 subtransactions.
14.Fixed a bug related to common table expressions whereby an error is incorrectly raised when a NOT IN
class exists in a CTE. The error is CTE with NOT IN fails with ERROR: could not find CTE
CTE-Name.
15.Fixed a bug related to an incorrect last_error_timestamp value in the aurora_replica_status
table.
16.Fixed a bug to avoid populating shared buffers with blocks belonging to temporary objects. These
blocks correctly reside in backend local buffers.
17.Improved the performance of vacuum cleanup on GIN indexes.
18.Fixed a bug where in rare cases Aurora may exhibit 100% CPU utilization while acting as a replica of
an RDS PostgreSQL instance even when the replication stream is idle.
19.Backported a change from PostgreSQL 11 which improves the cleanup of orphaned temporary
tables. Without this change, it is possible that in rare cases orphaned temporary tables can to lead to
transaction ID wraparound. For more information, see this PostgreSQL community commit.
20.Fixed a bug where a Writer instance may accept replication registration requests from Reader
instances while having an uninitialized startup process.
21.Changed the following extensions:
• Updated pg_hint_plan to version 1.3.3.
• Added plprofiler version 4.1.
Version 2.3
This version of Aurora PostgreSQL is compatible with PostgreSQL 10.7. For more information about the
improvements in release 10.7, see PostgreSQL Release 10.7.
Patch Versions
• Version 2.3.5 (p. 969)
• Version 2.3.3 (p. 970)
• Version 2.3.1 (p. 970)
• Version 2.3.0 (p. 970)
Version 2.3.5
You can find the following improvements in this engine update.
Improvements
969
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 2.3.3
You can find the following improvements in this engine update.
Improvements
Version 2.3.1
You can find the following improvements in this engine update.
Improvements
1. Fixed multiple bugs related to I/O prefetching that caused engine crashes.
Version 2.3.0
You can find the following improvements in this engine update.
New Features
1. Aurora PostgreSQL now performs I/O prefetching while scanning B-tree indexes. This results in
significantly improved performance for B-tree scans over uncached data.
Improvements
1. Fixed a bug whereby read nodes may fail with the error "too many LWLocks taken".
2. Addressed numerous issues that caused read nodes to fail to startup while the cluster is under heavy
write workload.
970
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
3. Fixed a bug whereby usage of the aurora_stat_memctx_usage() function could lead to a crash.
4. Improved the cache replacement strategy used by table scans to minimize thrashing of the buffer
cache.
Version 2.2
This version of Aurora PostgreSQL is compatible with PostgreSQL 10.6. For more information about the
improvements in release 10.6, see PostgreSQL Release 10.6.
Patch Versions
• Version 2.2.1 (p. 971)
• Version 2.2.0 (p. 971)
Version 2.2.1
You can find the following improvements in this engine update.
Improvements
Version 2.2.0
You can find the following improvements in this engine update.
New features
1. Added the restricted password management feature. Restricted password management enables you
to restrict who can manage user passwords and password expiration changes by using the parameter
rds.restrict_password_commands and the role rds_password. For more information, see
Restricting Password Management (p. 824).
Version 2.1
This version of Aurora PostgreSQL is compatible with PostgreSQL 10.5. For more information about the
improvements in release 10.5, see PostgreSQL Release 10.5.
971
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Patch Versions
• Version 2.1.1 (p. 972)
• Version 2.1.0 (p. 972)
Version 2.1.1
You can find the following improvements in this engine update.
Improvements
1. Fixed a bug which could cause an error running queries. The message reported would be of the form
"CLOG segment 123 does not exist: No such file or directory".
2. Increased the supported size of IAM passwords to 8KB.
3. Improved consistency of performance under high throughput write workloads.
4. Fixed a bug which could cause a read replica to crash during a restart.
5. Fixed a bug which could cause an error running queries. The message reported would be of the form
"SQL ERROR: Attempting to read past EOF of relation".
6. Fixed a bug which could cause an increase in memory usage after a restart.
7. Fixed a bug which could cause a transaction with a large number of subtransactions to fail.
8. Merged a patch from community PostgreSQL which addresses potential failures when
using GIN indexes. For more information see https://git.postgresql.org/gitweb/?
p=postgresql.git;a=commit;h=f9e66f2fbbb49a493045c8d8086a9b15d95b8f18.
9. Fixed a bug which could cause a snapshot import from RDS for PostgreSQL to fail.
Version 2.1.0
You can find the following improvements in this engine update.
New features
1. General availability of Aurora Query Plan Management, which enables customers to track and manage
any or all query plans used by their applications, to control query optimizer plan selection, and to
ensure high and stable applicationperformance. For more information, see Managing Query Execution
Plans for Aurora PostgreSQL (p. 873).
2. Updated the libprotobuf extension to version 1.3.0. This is used by the PostGIS extension.
3. Updated the pg_similarity extension to version 1.0.
4. Updated the log_fdw extension to version 1.1.
5. Updated the pg_hint_plan extension to version 1.3.1.
Improvements
1. Network traffic between the writer and reader nodes is now compressed to reduce network utilization.
This reduces the chance of read node unavailability due to network saturation.
2. Implemented a high performance, scalable subsystem for PostgreSQL subtransactions. This improves
the performance of applications which make extensive use of savepoints and PL/pgSQL exception
handlers.
3. The rds_superuser role can now set the following parameters on a per-session, database, or role
level:
• log_duration
972
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
• log_error_verbosity
• log_executor_stats
• log_lock_waits
• log_min_duration_statement
• log_min_error_statement
• log_min_messages
• log_parser_stats
• log_planner_stats
• log_replication_commands
• log_statement_stats
• log_temp_files
4. Fixed a bug whereby the SQL command "ALTER FUNCTION ... OWNER TO ..." might fail with error
"improper qualified name (too many dotted names)".
5. Fixed a bug whereby a crash could occur while committing a transaction with more than two million
subtransactions.
6. Fixed a bug in community PostgreSQL code related to GIN indexes which can cause the Aurora Storage
volume to become unavailable.
7. Fixed a bug whereby an Aurora PostgreSQL replica of an RDS for PostgreSQL instance might fail to
start, reporting error: "PANIC: could not locate a valid checkpoint record".
8. Fixed a bug whereby passing an invalid parameter to the aurora_stat_backend_waits function
could cause a crash.
Known issues
Version 2.0
This version of Aurora PostgreSQL is compatible with PostgreSQL 10.4. For more information about the
improvements in release 10.4, see PostgreSQL Release 10.4.
Patch Versions
• Version 2.0.1 (p. 973)
• Version 2.0.0 (p. 974)
Version 2.0.1
You can find the following improvements in this engine update.
Improvements
1. Fixed a bug which could cause an error running queries. The message reported would be of the form
"CLOG segment 123 does not exist: No such file or directory".
2. Increased the supported size of IAM passwords to 8KB.
3. Improved consistency of performance under high throughput write workloads.
4. Fixed a bug which could cause a read replica to crash during a restart.
5. Fixed a bug which could cause an error running queries. The message reported would be of the form
"SQL ERROR: Attempting to read past EOF of relation".
973
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
6. Fixed a bug which could cause an increase in memory usage after a restart.
7. Fixed a bug which could cause a transaction with a large number of subtransactions to fail.
8. Merged a patch from community PostgreSQL which addresses potential failures when
using GIN indexes. For more information see https://git.postgresql.org/gitweb/?
p=postgresql.git;a=commit;h=f9e66f2fbbb49a493045c8d8086a9b15d95b8f18.
9. Fixed a bug which could cause a snapshot import from RDS for PostgreSQL to fail.
Version 2.0.0
You can find the following improvements in this engine update.
Improvements
1. This release contains all fixes, features, and improvements present in Version 1.3 (p. 978).
2. The temporary file size limitation is user-configurable. You require the rds_superuser role to modify
the temp_file_limit parameter.
3. Updated the GDAL library, which is used by the PostGIS extension.
4. Updated the ip4r extension to version 2.1.1.
5. Updated the pg_repack extension to version 1.4.3.
6. Updated the plv8 extension to version 2.1.2.
7. Parallel queries – When you create a new Aurora PostgreSQL version 2.0 instance, parallel
queries are enabled for the default.postgres10 parameter group. The parameter
max_parallel_workers_per_gather is set to 2 by default, but you can modify it to support your
specific workload requirements.
8. Fixed a bug whereby read nodes may crash following a specific type of free space change from the
write node.
Version 1.6
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.16. For more information about
the improvements in release 9.6.16, see PostgreSQL Release 9.6.16.
This release contains multiple critical stability enhancements. Amazon highly recommends upgrading
your Aurora PostgreSQL clusters that use older PostgreSQL 9.6 engines to this release.
Patch Versions
• Version 1.6.2 (p. 974)
• Version 1.6.1 (p. 975)
• Version 1.6.0 (p. 975)
Version 1.6.2
You can find the following improvements in this engine update.
1. Fixed a bug whereby a reader DB instance might temporarily use stale data. This could lead to
wrong results such as too few or too many rows. This error is not persisted on storage, and will
clear when the database page containing the row has been evicted from cache. This can happen
when the primary DB instance enters a transaction snapshot overflow due to having more than 64
974
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
subtransactions in a single transaction. Applications susceptible to this bug include those that use
SQL savepoints or PostgreSQL exception handlers with more than 64 subtransactions in the top
transaction.
1. Fixed a bug that may cause a reader DB instance to crash causing unavailability while attempting to
the join the DB cluster. This can happen in some cases when the primary DB instance has a transaction
snapshot overflow due to a high number of subtransactions. In this situation the reader DB instance
will be unable to join until the snapshot overflow has cleared.
1. Fixed a bug that prevented Performance Insights from determining the query ID of a running
statement.
Version 1.6.1
You can find the following improvements in this engine update.
1. None
1. Fixed a bug that might cause the database engine to crash causing unavailability. This occurred if
a newly established database connection encountered a resource exhaustion-related error during
initialization after successful authentication.
Version 1.6.0
You can find the following new features and improvements in this engine version.
New Features
1. Updates to the apg_plan_mgmt extension. For more information, see Managing Query Execution
Plans for Aurora PostgreSQL (p. 873)
1. Fixed a bug related to creating B-tree indexes on temporary tables that in rare cases may result in
longer recovery time, and impact availability.
2. Fixed a bug related to replication when Aurora PostgreSQL is acting as a physical replica of an RDS
PostgreSQL instance. In rare cases, this bug causes a log write failure that may result in longer
recovery time, and impact availability.
3. Fixed a bug related to handling of reads with high I/O latency that in rare cases may result in longer
recovery time, and impact availability.
975
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
1. Corrected a memory leak in the log-apply process on read nodes. To see this memory leak, use
Enhancement Monitoring and observe the "% of memory usage" for the "wal replay" process.
2. Fixed multiple bugs, which cause Aurora to crash during prefetch operations on Btree indexes.
3. Enhanced the validation checks performed on data blocks in the buffer cache. This improves Aurora's
detection of inconsistency.
1. The query plan management extension apg_plan_mgmt has an improved algorithm for managing
plan generation for highly partitioned tables.
2. Reduced startup time on instances with large caches via improvements in the buffer cache recovery
algorithm.
3. Improved the performance of the read-node-apply process under high transaction rate workloads by
using changes to PostgreSQL LWLock prioritization. These changes prevent starvation of the read-
node-apply process while the PostgreSQL ProcArray is under heavy contention.
4. Fixed a bug whereby a read node may crash during the replay of a PostgreSQL SLRU-truncate
operation.
5. Fixed a bug where in rare cases, database writes may stall following an error returned by one of the six
copies of an Aurora log record.
6. Fixed a memory leak on read nodes when cluster cache management is enabled.
7. Fixed a bug whereby importing an RDS PostgreSQL snapshot may hang if the source snapshot
contains a large number of unlogged relations.
8. Fixed a bug related to hot_standby_feedback for read nodes whereby the read node may report
the wrong transaction id epoch to the write node. This can cause the write node to ignore the
hot_standby_feedback and invalidate snapshots on the read node.
9. Fixed a bug whereby storage errors that occur during CREATE DATABASE statements are not properly
handled. The bug would leave the resulting database inaccessible. The correct behavior is to fail the
database creation and return the appropriate error to the user.
10.Improved handling of PostgreSQL snapshot overflow when a read node attempts to connect to a write
node. Prior to this change, if the write node was in a snapshot overflow state, the read node would be
unable to join. A message would appear in the PostgreSQL log file in the form, DEBUG: recovery
snapshot waiting for non-overflowed snapshot or until oldest active xid on
standby is at least xxxxxxx (now yyyyyyy). A snapshot overflow occurs when an individual
transaction has created over 64 subtransactions.
11.Fixed a bug related to common table expressions whereby an error is incorrectly raised when a NOT IN
class exists in a CTE. The error is CTE with NOT IN fails with ERROR: could not find CTE
CTE-Name.
12.Fixed a bug related to an incorrect last_error_timestamp value in the aurora_replica_status
table.
13.Fixed a bug to avoid populating shared buffers with blocks belonging to temporary objects. These
blocks correctly reside in backend local buffers.
14.Fixed a bug where in rare cases Aurora may exhibit 100% CPU utilization while acting as a replica of
an RDS PostgreSQL instance even when the replication stream is idle.
15.Backported a change from PostgreSQL 11 which improves the cleanup of orphaned temporary
tables. Without this change, it is possible that in rare cases orphaned temporary tables can to lead to
transaction ID wraparound. For more information, see this PostgreSQL community commit.
16.Fixed a bug where a Writer instance may accept replication registration requests from Reader
instances while having an uninitialized startup process.
17.Changed the following extensions:
• Updated pg_hint_plan to version 1.2.5.
976
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 1.5
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.12. For more information about
the improvements in release 9.6.12, see PostgreSQL Release 9.6.12.
Patch Versions
• Version 1.5.3 (p. 977)
• Version 1.5.2 (p. 977)
• Version 1.5.1 (p. 977)
• Version 1.5.0 (p. 978)
Version 1.5.3
You can find the following improvements in this engine update.
Improvements
Version 1.5.2
You can find the following improvements in this engine update.
Improvements
Version 1.5.1
You can find the following improvements in this engine update.
Improvements
1. Fixed multiple bugs related to I/O prefetching, which caused engine crashes.
977
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 1.5.0
You can find the following improvements in this engine update.
New features
1. Aurora PostgreSQL now performs I/O prefetching while scanning B-tree indexes. This results in
significantly improved performance for B-tree scans over uncached data.
Improvements
1. Addressed numerous issues that caused read nodes to fail to startup while the cluster is under heavy
write workload.
2. Fixed a bug whereby usage of the aurora_stat_memctx_usage() function could lead to a crash.
3. Improved the cache replacement strategy used by table scans to minimize thrashing of the buffer
cache.
Version 1.4
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.11. For more information about
the improvements in release 9.6.11, see PostgreSQL Release 9.6.11.
New features
Improvements
1. This release contains all fixes, features, and improvements present in Version 1.3 (p. 978).
2. Network traffic between the writer and reader nodes is now compressed to reduce network utilization.
This reduces the chance of read node unavailability due to network saturation.
3. Performance of subtransactions has improved under high concurrency workloads.
4. An update for the pg_hint_plan extension to version 1.2.3.
5. Fixed an issue where on a busy system, a commit with millions of subtransactions (and sometimes
with commit timestamps enabled) can cause Aurora to crash.
6. Fixed an issue where an INSERT statement with VALUES could fail with the message "Attempting to
read past EOF of relation".
7. An upgrade of the apg_plan_mgmt extension to version 1.0.1. For details, see The apg_plan_mgmt
Extension Version 1.0.1 (p. 985).
The apg_plan_mgmt extension is used with query plan management. For more about how to install,
upgrade, and use the apg_plan_mgmt extension, see Managing Query Execution Plans for Aurora
PostgreSQL (p. 873).
Version 1.3
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.9. For more information about the
improvements in version 9.6.9, see PostgreSQL Release 9.6.9.
Patch Versions
978
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 1.3.2
You can find the following improvements in this engine update.
New features
Improvements
1. Fixed a bug which could cause an error running queries. The message reported would be of the form
"CLOG segment 123 does not exist: No such file or directory".
2. Increased the supported size of IAM passwords to 8KB.
3. Improved consistency of performance under high throughput write workloads.
4. Fixed a bug which could cause a read replica to crash during a restart.
5. Fixed a bug which could cause an error running queries. The message reported would be of the form
"SQL ERROR: Attempting to read past EOF of relation".
6. Fixed a bug which could cause an increase in memory usage after a restart.
7. Fixed a bug which could cause a transaction with a large number of subtransactions to fail.
8. Merged a patch from community PostgreSQL which addresses potential failures when
using GIN indexes. For more information see https://git.postgresql.org/gitweb/?
p=postgresql.git;a=commit;h=f9e66f2fbbb49a493045c8d8086a9b15d95b8f18.
9. Fixed a bug which could cause a snapshot import from RDS for PostgreSQL to fail.
Version 1.3.0
You can find the following improvements in this engine update.
Improvements
1. This release contains all fixes, features, and improvements present in Version 1.2 (p. 980).
2. Updated the GDAL library, which is used by the PostGIS extension.
3. Updated the following PostgreSQL extensions:
• ip4r updated to version 2.1.1.
• pgaudit updated to version 1.1.1.
• pg_repack updated to version 1.4.3.
• plv8 updated to version 2.1.2.
4. Fixed an issue in the monitoring system that could incorrectly cause a failover when local disk usage is
high.
5. Fixed a bug whereby Aurora PostgreSQL can repeatedly crash, reporting:
PANIC: new_record_total_len (8201) must be less than BLCKSZ (8192), rmid (6),
info (32)
6. Fixed a bug whereby an Aurora PostgreSQL read node might be unable to rejoin a cluster due to
recovery of a large buffer cache. This issue is unlikely to occur on instances other than r4.16xlarge.
7. Fixed a bug whereby inserting into an empty GIN index leaf page imported from pre-9.4 engine
versions can cause the Aurora storage volume to become unavailable.
979
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
8. Fixed a bug whereby, in rare circumstances, a crash during transaction commit could result in the loss
of CommitTs data for the committing transaction. The actual durability of the transaction was not
impacted by this bug.
9. Fixed a bug in the PostGIS extension whereby PostGIS can crash in the function
gserialized_gist_picksplit_2d().
10.Improved the stability of read-only nodes during heavy write traffic on instances smaller than r4.8xl.
This specifically addresses a situation where the network bandwidth between the writer and the
reader is constrained.
11.Fixed a bug whereby an Aurora PostgreSQL instance acting as a replication target of an RDS for
PostgreSQL instance crashed with the following error:
Version 1.2
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.8. For more information about the
improvements in version 9.6.8, see PostgreSQL Release 9.6.8.
Patch Versions
• Version 1.2.2 (p. 980)
• Version 1.2.0 (p. 981)
Version 1.2.2
You can find the following improvements in this engine update.
New features
Improvements
1. Fixed a bug which could cause an error running queries. The message reported would be of the form
"CLOG segment 123 does not exist: No such file or directory".
2. Increased the supported size of IAM passwords to 8KB.
3. Improved consistency of performance under high throughput write workloads.
4. Fixed a bug which could cause a read replica to crash during a restart.
5. Fixed a bug which could cause an error running queries. The message reported would be of the form
"SQL ERROR: Attempting to read past EOF of relation".
6. Fixed a bug which could cause an increase in memory usage after a restart.
980
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
7. Fixed a bug which could cause a transaction with a large number of subtransactions to fail.
8. Merged a patch from community PostgreSQL which addresses potential failures when
using GIN indexes. For more information see https://git.postgresql.org/gitweb/?
p=postgresql.git;a=commit;h=f9e66f2fbbb49a493045c8d8086a9b15d95b8f18.
9. Fixed a bug which could cause a snapshot import from RDS for PostgreSQL to fail.
Version 1.2.0
You can find the following improvements in this engine update.
New features
Improvements
1. This release contains all fixes, features, and improvements present in Version 1.1 (p. 982).
2. Updates the following PostgreSQL extensions:
• pg_hint_plan updated to version 1.2.2
• plv8 updated to version 2.1.0
3. Improves efficiency of traffic between writer and reader nodes.
4. Improves connection establishment performance.
5. Improve the diagnostic data provided in the PostgreSQL error log when an out-of-memory error is
encountered.
6. Multiple fixes to improve the reliability and performance of snapshot import from Amazon RDS for
PostgreSQL to Aurora with PostgreSQL compatibility.
7. Multiple fixes to improve the reliability and performance of Aurora PostgreSQL read nodes.
8. Fixes a bug in which an otherwise idle instance can generate unnecessary read traffic on an Aurora
storage volume.
9. Fixes a bug in which duplicate sequence values can be encountered during insert. The problem only
occurs when migrating a snapshot from RDS for PostgreSQL to Aurora PostgreSQL. The fix prevents
the problem from being introduced when performing the migration. Instances migrated before this
release can still encounter duplicate key errors.
10.Fixes a bug in which an RDS for PostgreSQL instance migrated to Aurora PostgreSQL using replication
can run out of memory doing insert/update of GIST indexes, or cause other issues with GIST indexes.
11.Fixes a bug in which vacuum can fail to update the corresponding pg_database.datfrozenxid
value for a database.
12.Fixes a bug in which a crash while creating a new MultiXact (contended row level lock) can cause
Aurora PostgreSQL to hang indefinitely on the first access to the same relation after the engine
restarts.
13.Fixes a bug in which a PostgreSQL backend can't be terminated or canceled while invoking an fdw call.
14.Fixes a bug in which one vCPU is fully utilized at all times by the Aurora storage daemon. This issue is
especially noticeable on smaller instance classes, such as r4.large, where it can lead to 25–50 percent
CPU usage when idle.
15.Fixes a bug in which an Aurora PostgreSQL writer node can fail over spuriously.
16.Fixes a bug in which, in a rare scenario, an Aurora PostgreSQL read node can report:
981
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
17.Fixes a bug in which stale relcache entries can halt vacuuming of relations and push the system close
to transaction ID wraparound. The fix is a port of a PostgreSQL community patch scheduled to be
released in a future minor version.
18.Fixes a bug in which a failure while extending a relation can cause Aurora to crash while scanning the
partially extended relation.
Version 1.1
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.6. For more information about the
improvements in version 9.6.6 see, PostgreSQL Release 9.6.6.
New features
Improvements
1. This release contains all fixes, features, and improvements present in Version 1.0.11 (p. 983)
2. Updates for the following PostgreSQL extensions:
• postgis extension updated to version 2.3.4
• geos library updated to version 3.6.2
• pg_repack updated to version 1.4.2
3. Access to the pg_statistic relation enabled.
4. Disabled the 'effective_io_concurrency' guc parameter, as it does not apply to Aurora storage.
5. Changed the 'hot_standby_feedback' guc parameter to not-modifiable and set the value to '1'.
6. Improved heap page read performance during a vacuum operation.
7. Improved performance of snapshot conflict resolution on read nodes.
8. Improved performance of transaction snapshot acquisition on read nodes.
9. Improved write performance for GIN meta page updates.
10.Improved buffer cache recovery performance during startup.
11.Fixes a bug that caused a database engine crash at startup while recovering prepared transactions.
12.Fixes a bug that could result in the inability to start a read node when there are a large number of
prepared transactions.
13.Fixes a bug that could cause a read node to report:
982
Amazon Aurora User Guide for Aurora
Engine Versions for Aurora PostgreSQL
Version 1.0
This version of Aurora PostgreSQL is compatible with PostgreSQL 9.6.3. For more information about the
improvements in version 9.6.3 see, PostgreSQL Release 9.6.3.
Patch Versions
• Version 1.0.11 (p. 983)
• Version 1.0.10 (p. 983)
• Version 1.0.9 (p. 984)
• Version 1.0.8 (p. 984)
• Version 1.0.7 (p. 984)
Version 1.0.11
You can find the following improvements in this engine update:
1. Fixes an issue with parallel query execution that can lead to incorrect results.
2. Fixes an issue with visibility map handling during replication from Amazon RDS for PostgreSQL that
can cause the Aurora storage volume to become unavailable.
3. Corrects the pg-repack extension.
4. Implements improvements to maintain fresh nodes.
5. Fixes issues that can lead to an engine crash.
Version 1.0.10
This update includes a new feature. You can now replicate an Amazon RDS PostgreSQL DB instance to
Aurora PostgreSQL. For more information, see Replication with Amazon Aurora PostgreSQL (p. 859).
1. Adds error logging when a cache exists and a parameter change results in a mismatched buffer cache,
storage format, or size.
2. Fixes an issue that causes an engine reboot if there is an incompatible parameter value for huge
pages.
3. Improves handling of multiple truncate table statements during a replay of a write ahead log (WAL)
on a read node.
4. Reduces static memory overhead to reduce out-of-memory errors.
5. Fixes an issue that can lead to out-of-memory errors while performing an insert with a GiST index.
983
Amazon Aurora User Guide for Aurora
Extension Versions for Aurora PostgreSQL
6. Improves snapshot import from RDS PostgreSQL, removing the requirement that a vacuum be
performed on uninitialized pages.
7. Fixes an issue that causes prepared transactions to return to the previous state following an engine
crash.
8. Implements improvements to prevent read nodes from becoming stale.
9. Implements improvements to reduce downtime with an engine restart.
10.Fixes issues that can cause an engine crash.
Version 1.0.9
In this engine update, we fix an issue that can cause the Aurora storage volume to become unavailable
when importing a snapshot from RDS PostgreSQL that contained uninitialized pages.
Version 1.0.8
You can find the following improvements in this engine update:
1. Fixes an issue that prevented the engine from starting if the shared_preload_libraries instance
parameter contained pg_hint_plan.
2. Fixes the error "Attempt to fetch heap block XXX is beyond end of heap (YYY blocks)," which can occur
during parallel scans.
3. Improves the effectiveness of prefetching on reads for a vacuum.
4. Fixes issues with snapshot import from RDS PostgreSQL, which can fail if there are incompatible
pg_internal.init files in the source snapshot.
5. Fixes an issue that can cause a read node to crash with the message "aurora wal replay process (PID
XXX) was terminated by signal 11: Segmentation fault". This issue occurs when the reader applied a
visibility map change for an uncached visibility map page.
Version 1.0.7
This is the first generally available release of Amazon Aurora with PostgreSQL compatibility.
The apg_plan_mgmt extension changes for version 2.0 include the following:
1. You can now manage all queries inside SQL functions, whether they have parameters or not.
2. You can now manage all queries inside PL/pgSQL functions, whether they have parameters or not.
984
Amazon Aurora User Guide for Aurora
Extension Versions for Aurora PostgreSQL
3. You can now manage queries in generic plans, whether they have parameters or not. To learn
more about generic plans versus custom plans, See the PREPARE statement in the PostgreSQL
documentation.
4. You can now use query plan management to enforce the use of specific types of aggregate methods in
query plans.
Extension Improvements
1. You can now save planswith a size up to 8KB times the setting of the max_worker_processes
parameter. Previously the maximum plan size was 8KB.
2. Fixed bugs for unnamed prepared statements such as those from JDBC.
3. Previously, when you tried to do CREATE EXTENSION apg_plan_mgmt when it is not loaded in the
shared_preload_libraries, the backend connection would be dropped. Now, an error message
prints and the connection is not dropped.
4. The default value of the cardinality_error in the apg_plan_mgmt.plans table is NULL, but it
can be set to -1 during the apg_plan_mgmt.evolve_plan_baselines function. NULL is now used
consistently.
5. Plans are now saved for queries that refer to temporary tables.
6. The default maximum number of plans is increased from 1000 to 10000.
7. The following pgss parameters are deprecated because the automatic plan capture mode should be
used instead of those parameters.
• apg_plan_mgmt.pgss_min_calls
• apg_plan_mgmt.pgss_min_mean_time_ms
• apg_plan_mgmt.pgss_min_stddev_time_ms
• apg_plan_mgmt.pgss_min_total_time_ms
1. A new update_plan_hash parameter is available for the validate_plans function. This parameter
updates the plan_hash for plans that can't be reproduced exactly. The update_plan_hash
parameter also enables you to fix a plan by rewriting the SQL. You can then register the good plan as
an Approved plan for the original SQL. Following is an example of using update_plan_hash.
The parameter explain_options can be any comma-separated list of valid EXPLAIN options, as
shown following.
analyze,verbose,buffers,hashes,format json
985
Amazon Aurora User Guide for Aurora
Extension Versions for Aurora PostgreSQL
To create an EXPLAIN script for your workload or a portion of it, use the \a , \t, and \o options to
redirect the output to a file. For example, you can create an EXPLAIN script for the top-ranked (top-
K) statements by using the PostgreSQL pg_stat_statements view sorted by total_time in DESC
order.
3. The precise location of the Gather parallel query operator is determined by costing, and may
change slightly over time. To prevent these differences from invalidating the entire plan, query plan
management now computes the same plan_hash even if the Gather operators move to different
places in the plan tree.
4. Support is added for nonparameterized statements inside pl/pgsql functions.
5. Overhead is reduced when the apg_plan_mgmt extension is installed on multiple databases in the
same cluster while two or more databases are being accessed concurrently. Also, this release fixed a
bug in this area that caused plans to not be stored in shared memory.
Extension Improvements
986
Amazon Aurora User Guide for Aurora
Amazon Aurora Basic Operational Guidelines
Some of the best practices for Amazon Aurora are specific to a particular database engine. For more
information about Aurora best practices specific to a database engine, see the following:
Amazon Aurora MySQL See Best Practices with Amazon Aurora MySQL (p. 701)
Amazon Aurora PostgreSQL See Best Practices with Amazon Aurora PostgreSQL (p. 931)
Note
For common recommendations for Aurora, see Using Amazon Aurora
Recommendations (p. 442).
Topics
• Amazon Aurora Basic Operational Guidelines (p. 987)
• DB Instance RAM Recommendations (p. 987)
• Monitoring Amazon Aurora (p. 988)
• Working with DB Parameter Groups and DB Cluster Parameter Groups (p. 988)
• Amazon Aurora Best Practices Presentation Video (p. 988)
• 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.
• 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. Aurora DB clusters
with multiple read replicas can experience connection failures also when connections use the reader
endpoint and one of the read replica instances is in maintenance or is deleted.
• Test failover for your DB cluster to understand how long the process takes for your use case and to
ensure that the application that accesses your DB cluster can automatically connect to the new DB
cluster after failover.
987
Amazon Aurora User Guide for Aurora
Monitoring Amazon Aurora
• VolumeReadIOPS – This measures the average number of read I/O operations from a cluster volume,
reported at 5-minute intervals. The value of VolumeReadIOPS should be small and stable. If you
find your read IO is spiking or is higher than usual, you should investigate the DB instances in your DB
cluster to see which DB instances are causing the increased IO.
• BufferCacheHitRatio – This metric measures the percentage of requests that are served by the
buffer cache of a DB instance in your DB cluster. This metric gives you an insight into the amount of
data that is being served from memory. If the hit ratio is low, it is a good indication that your queries
on this DB instance are going to disk more often than not. In this case, you should investigate your
workload to see which queries are causing this behavior.
If, after investigating your workload, you find that you need more memory, scaling up the DB instance
class to a class with more RAM could be beneficial. After doing so, you can investigate the metrics
above and continue to scale up as necessary. For more information about monitoring a DB cluster, see
Monitoring Amazon Aurora DB Cluster Metrics (p. 377).
Always exercise caution when modifying DB engine parameters and back up your DB cluster before
modifying a DB parameter group. For information about backing up your DB cluster, see Backing Up and
Restoring an Amazon Aurora DB Cluster (p. 286).
988
Amazon Aurora User Guide for Aurora
Overview of an Aurora Proof of Concept
In this topic, you can find an overview and a step-by-step outline of the high-level procedures and
decisions involved in running a proof of concept, listed following. For detailed instructions, you can
follow links to the full documentation for specific subjects.
The following advice about best practices can help you avoid common mistakes that cause problems
during benchmarking. However, this topic doesn't cover the step-by-step process of performing
benchmarks and doing performance tuning. Those procedures vary depending on your workload and
the Aurora features that you use. For detailed information, consult performance-related documentation
such as Managing Performance and Scaling for Aurora DB Clusters (p. 252), Amazon Aurora MySQL
Performance Enhancements (p. 505), Managing Amazon Aurora PostgreSQL (p. 854), and Using Amazon
RDS Performance Insights (p. 398).
The information in this topic applies mainly to applications where your organization writes the code
and designs the schema and that support the MySQL and PostgreSQL open-source database engines. If
you're testing a commercial application or code generated by an application framework, you might not
have the flexibility to apply all of the guidelines. In such cases, check with your AWS representative to
see if there are Aurora best practices or case studies for your type of application.
You must ensure that all of the functionality of your application is compatible with Aurora. Because
Aurora is wire-compatible with MySQL 5.6 and MySQL 5.7 and also PostgreSQL 9.6 and PostgreSQL 10.4,
most applications developed for those engines are also compatible with Aurora. However, you must still
validate compatibility on a per-application basis.
For example, some of the configuration choices that you make when you set up an Aurora cluster
influence whether you can or should use particular database features. You might start with the most
989
Amazon Aurora User Guide for Aurora
2. Understand Your Workload Characteristics
general-purpose kind of Aurora cluster, known as provisioned. You might then decide if a specialized
configuration such as serverless or parallel query offers benefits for your workload.
Use the following questions to help identify and quantify your objectives:
Take some time to build knowledge about Aurora database engines and platform capabilities, and
review the service documentation. Take note of all the features that can help you achieve your desired
outcomes. One of these might be workload consolidation, described in the AWS Database Blog post
How to plan and optimize Amazon Aurora with MySQL compatibility for consolidated workloads.
Another might be demand-based scaling, described in Using Amazon Aurora Auto Scaling with Aurora
Replicas (p. 270) in the Amazon Aurora User Guide. Others might be performance gains or simplified
database operations.
One of the key factors affecting your database choices is the velocity of the data. High velocity involves
data being inserted and updated very frequently. Such a system might have thousands of connections
and hundreds of thousands of simultaneous queries reading from and writing to a database. Queries
in high-velocity systems usually affect a relatively small number of rows, and typically access multiple
columns in the same row.
Aurora is designed to handle high-velocity data. Depending on the workload, an Aurora cluster with a
single r4.16xlarge DB instance can process more than 600,000 SELECT statements per second. Again
depending on workload, such a cluster can process 200,000 INSERT, UPDATE, and DELETE statements
per second. Aurora is a row store database and is ideally suited for high-volume, high-throughput, and
highly parallelized OLTP workloads.
Aurora can also run reporting queries on the same cluster that handles the OLTP workload. Aurora
supports up to 15 replicas (p. 60), each of which is on average within 10–20 milliseconds of the primary
instance. Analysts can query OLTP data in real time without copying the data to a separate data
990
Amazon Aurora User Guide for Aurora
3. Practice with the Console or CLI
warehouse cluster. With Aurora clusters using the parallel query feature, you can offload much of the
processing, filtering, and aggregation work to the massively distributed Aurora storage subsystem.
Use this planning phase to familiarize yourself with the capabilities of Aurora, other AWS services, the
AWS Management Console, and the AWS CLI. Also, check how these work with the other tooling that you
plan to use in the proof of concept.
By taking advantage of the Aurora shared storage model and features such as replication and snapshots,
you can treat entire database clusters as another kind of object that you freely manipulate. You can set
up, tear down, and change the capacity of Aurora clusters frequently during the proof of concept. You
aren't locked into early choices about capacity, database settings, and physical data layout.
To get started, set up an empty Aurora cluster. Choose the provisioned capacity type and regional
location for your initial experiments.
Connect to that cluster using a client program such as a SQL command-line application. Initially, you
connect using the cluster endpoint. You connect to that endpoint to perform any write operations, such
as data definition language (DDL) statements and extract, transform, load (ETL) processes. Later in the
proof of concept, you connect query-intensive sessions using the reader endpoint, which distributes the
query workload among multiple DB instances in the cluster.
Scale the cluster out by adding more Aurora Replicas. For those procedures, see Replication with Amazon
Aurora (p. 60). Scale the DB instances up or down by changing the AWS instance class. Understand
how Aurora simplifies these kinds of operations, so that if your initial estimates for system capacity are
inaccurate, you can adjust later without starting over.
Examine cluster metrics to see activity over time, and how the metrics apply to the DB instances in the
cluster.
It's useful to become familiar with how to do these things through the AWS Management Console in the
beginning. After you understand what you can do with Aurora, you can progress to automating those
operations using the AWS CLI. In the following sections, you can find more details about the procedures
and best practices for these activities during the proof-of-concept period.
991
Amazon Aurora User Guide for Aurora
4. Create Your Aurora Cluster
Aurora typically involves groups of DB instances arranged in clusters. Thus, many operations involve
determining which DB instances are associated with a cluster and then performing administrative
operations in a loop for all the instances.
For example, you might automate steps such as creating Aurora clusters, then scaling them up with
larger instance classes or scaling them out with additional DB instances. Doing so helps you to repeat any
stages in your proof of concept and explore what-if scenarios with different kinds or configurations of
Aurora clusters.
Learn the capabilities and limitations of infrastructure deployment tools such as AWS CloudFormation.
You might find activities that you do in a proof-of-concept context aren't suitable for production use.
For example, the AWS CloudFormation behavior for modification is to create a new instance and delete
the current one, including its data. For more details on this behavior, see Update Behaviors of Stack
Resources in the AWS CloudFormation User Guide.
Where practical, start with a cluster using the following settings. Skip this step only if you have certain
specific use cases in mind. For example, you might skip this step if your use case requires a specialized
kind of Aurora cluster. Or you might skip it if you need a particular combination of database engine and
version.
• Amazon Aurora.
• MySQL 5.6 compatibility. This combination of database engine and version has the widest
compatibility with other Aurora features.
• Turn off quick create. For the proof of concept, we recommend that you be aware of all the settings
you choose so that you can create identical or slightly different clusters later.
• Regional. The Global setting is for specific high availability scenarios. You can try it out later after your
initial functional and performance experiments.
• One writer, multiple readers. This is the most widely used, general purpose kind of cluster. This setting
persists for the life of the cluster. Thus, if you later do experiments with other kinds of clusters such as
serverless or parallel query, you create other clusters and compare and contrast the results on each.
• Choose the Dev/Test template. This choice isn't significant for your proof-of-concept activities.
• For Instance Size, choose Memory Optimized and one of the xlarge instance classes. You can adjust
the instance class up or down later.
• Under Multi-AZ Deployment, choose Create Replica in Different Zone. Many of the most useful
aspects of Aurora involve clusters of multiple DB instances. It makes sense to always start with at least
two DB instances in any new cluster. Using a different Availability Zone for the second DB instance
helps to test different high availability scenarios.
• When you pick names for the DB instances, use a generic naming convention. Don't refer to any cluster
DB instance as the "master" or "writer," because different DB instances assume those roles as needed.
We recommend using something like clustername-az-serialnumber, for example myprodappdb-
a-01. These pieces uniquely identify the DB instance and its placement.
• Set the backup retention high for the Aurora cluster. With a long retention period, you can do point-
in-time recovery (PITR) for a period up to 35 days. You can reset your database to a known state after
running tests involving DDL and data manipulation language (DML) statements. You can also recover if
you delete or change data by mistake.
992
Amazon Aurora User Guide for Aurora
5. Set Up Your Schema
• Enable additional recovery, logging, and monitoring features at cluster creation. Turn on all the choices
under Backtrack, Performance Insights, Monitoring, and Log exports. With these features enabled,
you can test the suitability of features such as backtracking, Enhanced Monitoring, or Performance
Insights for your workload. You can also easily investigate performance and perform troubleshooting
during the proof of concept.
To issue SQL statements on your cluster, find its cluster endpoint and supply that value as the
connection parameter to your client application. You can find the cluster endpoint on the Connectivity
tab of the detail page of your cluster. The cluster endpoint is the one labeled Writer. The other endpoint,
labeled Reader, represents a read-only connection that you can supply to end users who run reports or
other read-only queries. For help with any issues around connecting to your cluster, see Connecting to an
Amazon Aurora DB Cluster (p. 169).
If you're porting your schema and data from a different database system, expect to make some schema
changes at this point. These schema changes are to match the SQL syntax and capabilities available in
Aurora. You might leave out certain columns, constraints, triggers, or other schema objects at this point.
Doing so can be useful particularly if these objects require rework for Aurora compatibility and aren't
significant for your objectives with the proof of concept.
If you're migrating from a database system with a different underlying engine than Aurora's, consider
using the AWS Schema Conversion Tool (AWS SCT) to simplify the process. For details, see the AWS
Schema Conversion Tool User Guide. For general details about migration and porting activities, see the
AWS whitepaper Aurora Migration Handbook.
During this stage, you can evaluate whether there are inefficiencies in your schema setup, for example
in your indexing strategy or other table structures such as partitioned tables. Such inefficiencies can
be amplified when you deploy your application on a cluster with multiple DB instances and a heavy
workload. Consider whether you can fine-tune such performance aspects now, or during later activities
such as a full benchmark test.
You can use several techniques to import either physical or logical backup data to Aurora. For details,
see Migrating Data to an Amazon Aurora MySQL DB Cluster (p. 514) or Migrating Data to Amazon Aurora
with PostgreSQL Compatibility (p. 831) depending on the database engine you're using in the proof of
concept.
Experiment with the ETL tools and technologies that you're considering. See which one best meets
your needs. Consider both throughput and flexibility. For example, some ETL tools perform a one-time
transfer, and others involve ongoing replication from the old system to Aurora.
993
Amazon Aurora User Guide for Aurora
7. Port Your SQL Code
If you're migrating from a MySQL-compatible system to Aurora MySQL, you can use the native data
transfer tools. The same applies if you're migrating from a PostgreSQL-compatible system to Aurora
PostgreSQL. If you're migrating from a database system that uses a different underlying engine than
Aurora does, you can experiment with the AWS Database Migration Service (AWS DMS). For details about
AWS DMS, see the AWS Database Migration Service User Guide.
For details about migration and porting activities, see the AWS whitepaper Aurora Migration Handbook.
• If you're moving from RDS MySQL or PostgreSQL, the SQL changes are small enough that you can try
the original SQL code with Aurora and manually incorporate needed changes.
• Similarly, if you move from an on-premises database compatible with MySQL or PostgreSQL, you can
try the original SQL code and manually incorporate changes.
• If you're coming from a different commercial database, the required SQL changes are more extensive.
In this case, consider using the AWS SCT.
During this stage, you can evaluate whether there are inefficiencies in your schema setup, for example
in your indexing strategy or other table structures such as partitioned tables. Consider whether you can
fine-tune such performance aspects now, or during later activities such as a full benchmark test.
You can verify the database connection logic in your application. To take advantage of Aurora distributed
processing, you might need to use separate connections for read and write operations, and use
relatively short sessions for query operations. For information about connections, see 9. Connect to
Aurora (p. 995).
Consider if you had to make compromises and tradeoffs to work around issues in your production
database. Build time into the proof-of-concept schedule to make improvements to your schema design
and queries. To judge if you can achieve easy wins in performance, operating cost, and scalability, try the
original and modified applications side by side on different Aurora clusters.
For details about migration and porting activities, see the AWS whitepaper Aurora Migration Handbook.
Aurora makes it easy to reuse the optimal configuration settings for a particular application or use case.
Instead of editing a separate configuration file for each DB instance, you manage sets of parameters that
you assign to entire clusters or specific DB instances. For example, the time zone setting applies to all DB
instances in the cluster, and you can adjust the page cache size setting for each DB instance.
994
Amazon Aurora User Guide for Aurora
9. Connect to Aurora
You start with one of the default parameter sets, and apply changes to only the parameters that you
need to fine-tune. For details about working with parameter groups, see Amazon Aurora DB Cluster and
DB Instance Parameters (p. 207). For the configuration settings that are or aren't applicable to Aurora
clusters, see Aurora MySQL Parameters (p. 711) or Amazon Aurora PostgreSQL Parameters (p. 950)
depending on your database engine.
9. Connect to Aurora
As you find when doing your initial schema and data setup and running sample queries, you can connect
to different endpoints in an Aurora cluster. The endpoint to use depends on whether the operation is a
read such as SELECT statement, or a write such as a CREATE or INSERT statement. As you increase the
workload on an Aurora cluster and experiment with Aurora features, it's important for your application to
assign each operation to the appropriate endpoint.
By using the cluster endpoint for write operations, you always connect to a DB instance in the cluster
that has read-write capability. By default, only one DB instance in an Aurora cluster has read-write
capability. This DB instance is called the primary instance. If the original primary instance becomes
unavailable, Aurora activates a failover mechanism and a different DB instance takes over as the primary.
Similarly, by directing SELECT statements to the reader endpoint, you spread the work of processing
queries among the DB instances in the cluster. Each reader connection is assigned to a different DB
instance using round-robin DNS resolution. Doing most of the query work on the read-only DB Aurora
Replicas reduces the load on the primary instance, freeing it to handle DDL and DML statements.
Using these endpoints reduces the dependency on hard-coded hostnames, and helps your application to
recover more quickly from DB instance failures.
Note
Aurora also has custom endpoints that you create. Those endpoints usually aren't needed during
a proof of concept.
The Aurora Replicas are subject to a replica lag, even though that lag is usually 10 to 20 milliseconds.
You can monitor the replication lag and decide whether it is within the range of your data consistency
requirements. In some cases, your read queries might require strong read consistency (read-after-write
consistency). In these cases, you can continue using the cluster endpoint for them and not the reader
endpoint.
To take full advantage of Aurora capabilities for distributed parallel execution, you might need to change
the connection logic. Your objective is to avoid sending all read requests to the primary instance. The
read-only Aurora Replicas are standing by, with all the same data, ready to handle SELECT statements.
Code your application logic to use the appropriate endpoint for each kind of operation. Follow these
general guidelines:
• Avoid using a single hard-coded connection string for all database sessions.
• If practical, enclose write operations such as DDL and DML statements in functions in your client
application code. That way, you can make different kinds of operations use specific connections.
• Make separate functions for query operations. Aurora assigns each new connection to the reader
endpoint to a different Aurora Replica to balance the load for read-intensive applications.
• For operations involving sets of queries, close and reopen the connection to the reader endpoint
when each set of related queries is finished. Use connection pooling if that feature is available in your
software stack. Directing queries to different connections helps Aurora to distribute the read workload
among the DB instances in the cluster.
For general information about connection management and endpoints for Aurora, see Connecting to
an Amazon Aurora DB Cluster (p. 169). For a deep dive on this subject, see Aurora MySQL Database
Administrator’s Handbook – Connection Management.
995
Amazon Aurora User Guide for Aurora
10. Run Your Workload
As much as practical, replicate the actual conditions under which the application will run. For example,
you typically run your application code on Amazon EC2 instances in the same AWS Region and the same
virtual private cloud (VPC) as the Aurora cluster. If your production application runs on multiple EC2
instances spanning multiple Availability Zones, set up your proof-of-concept environment in the same
way. For more information on AWS Regions, see Regions and Availability Zones in the Amazon RDS User
Guide. To learn more about the Amazon VPC service, see What Is Amazon VPC? in the Amazon VPC User
Guide.
After you've verified that the basic features of your application work and you can access the data
through Aurora, you can exercise aspects of the Aurora cluster. Some features you might want to try are
concurrent connections with load balancing, concurrent transactions, and automatic replication.
By this point, the data transfer mechanisms should be familiar, and so you can run tests with a larger
proportion of sample data.
This stage is when you can see the effects of changing configuration settings such as memory limits and
connection limits. Revisit the procedures that you explored in 8. Specify Configuration Settings (p. 994).
You can also experiment with mechanisms such as creating and restoring snapshots. For example, you
can create clusters with different AWS instance classes, numbers of AWS Replicas, and so on. Then
on each cluster, you can restore the same snapshot containing your schema and all your data. For
the details of that cycle, see Creating a DB Cluster Snapshot (p. 290) and Restoring from a DB Cluster
Snapshot (p. 292).
You can always see the current state of your cluster, or examine trends over time, by examining the
Monitoring tab. This tab is available from the console detail page for each Aurora cluster or DB instance.
It displays metrics from the Amazon CloudWatch monitoring service in the form of charts. You can filter
the metrics by name, by DB instance, and by time period.
To have more choices on the Monitoring tab, enable Enhanced Monitoring and Performance Insights in
the cluster settings. You can also enable those choices later if you didn't choose them when setting up
the cluster.
To measure performance, you rely mostly on the charts showing activity for the whole Aurora cluster.
You can verify whether the Aurora Replicas have similar load and response times. You can also see how
the work is split up between the read-write primary instance and the read-only Aurora Replicas. If there
is some imbalance between the DB instances or an issue affecting only one DB instance, you can examine
the Monitoring tab for that specific instance.
After the environment and the actual workload are set up to emulate your production application, you
can measure how well Aurora performs. The most important questions to answer are as follows:
996
Amazon Aurora User Guide for Aurora
11. Measure Performance
• How many queries per second is Aurora processing? You can examine the Throughput metrics to see
the figures for various kinds of operations.
• How long does it take, on average for Aurora to process a given query? You can examine the Latency
metrics to see the figures for various kinds of operations.
To do so, look at the Monitoring tab for a given Aurora cluster in the RDS console as illustrated
following.
If you can, establish baseline values for these metrics in your current environment. If that's not practical,
construct a baseline on the Aurora cluster by executing a workload equivalent to your production
application. For example, run your Aurora workload with a similar number of simultaneous users and
queries. Then observe how the values change as you experiment with different instance classes, cluster
size, configuration settings, and so on.
If the throughput numbers are lower than you expect, investigate further the factors affecting database
performance for your workload. Similarly, if the latency numbers are higher than you expect, further
investigate. To do so, monitor the secondary metrics for the DB server (CPU, memory, and so on). You
can see whether the DB instances are close to their limits. You can also see how much extra capacity your
DB instances have to handle more concurrent queries, queries against larger tables, and so on.
Tip
To detect metric values that fall outside the expected ranges, set up CloudWatch alarms.
When evaluating the ideal Aurora cluster size and capacity, you can find the configuration that achieves
peak application performance without over-provisioning resources. One important factor is finding
the appropriate size for the DB instances in the Aurora cluster. Start by selecting an instance size that
has similar CPU and memory capacity to your current production environment. Collect throughput and
latency numbers for the workload at that instance size. Then, scale the instance up to the next larger
997
Amazon Aurora User Guide for Aurora
12. Exercise Aurora High Availability
size. See if the throughput and latency numbers improve. Also scale the instance size down, and see if
the latency and throughput numbers remain the same. Your goal is to get the highest throughput, with
the lowest latency, on the smallest instance possible.
Tip
Size your Aurora clusters and associated DB instances with enough existing capacity to handle
sudden, unpredictable traffic spikes. For mission-critical databases, leave at least 20 percent
spare CPU and memory capacity.
Run performance tests long enough to measure database performance in a warm, steady state. You
might need to run the workload for many minutes or even a few hours before reaching this steady state.
It's normal at the beginning of a run to have some variance. This variance happens because each Aurora
Replica warms up its caches based on the SELECT queries that it handles.
Aurora performs best with transactional workloads involving multiple concurrent users and queries.
To ensure that you're driving enough load for optimal performance, run benchmarks that use
multithreading, or run multiple instances of the performance tests concurrently. Measure performance
with hundreds or even thousands of concurrent client threads. Simulate the number of concurrent
threads that you expect in your production environment. You might also perform additional stress tests
with more threads to measure Aurora scalability.
To evaluate these features requires a certain mindset. In earlier activities, such as performance
measurement, you observe how the system performs when everything works correctly. Testing high
availability requires you to think through worst-case behavior. You must consider various kinds of
failures, even if such conditions are rare. You might intentionally introduce problems to make sure that
the system recovers correctly and quickly.
Tip
For a proof of concept, set up all the DB instances in an Aurora cluster with the same AWS
instance class. Doing so makes it possible to try out Aurora availability features without major
changes to performance and scalability as you take DB instances offline to simulate failures.
We recommend using at least two instances in each Aurora cluster. The DB instances in an Aurora cluster
can span up to three Availability Zones (AZs). Locate each of the first two or three DB instances in a
different AZ. When you begin using larger clusters, spread your DB instances across all of the AZs in
your AWS Region. Doing so increases fault tolerance capability. Even if a problem affects an entire AZ,
Aurora can fail over to a DB instance in a different AZ. If you run a cluster with more than three instances,
distribute the DB instances as evenly as you can over all three AZs.
Tip
The storage for an Aurora cluster is independent from the DB instances. The storage for each
Aurora cluster always spans three AZs.
When you test high availability features, always use DB instances with identical capacity in your
test cluster. Doing so avoids unpredictable changes in performance, latency, and so on whenever
one DB instance takes over for another.
To learn how to simulate failure conditions to test high availability features, see Testing Amazon Aurora
Using Fault Injection Queries (p. 565).
As part of your proof-of-concept exercise, one objective is to find the ideal number of DB instances and
the optimal instance class for those DB instances. Doing so requires balancing the requirements of high
availability and performance.
998
Amazon Aurora User Guide for Aurora
13. What to Do Next
For Aurora, the more DB instances that you have in a cluster, the greater the benefits for high availability.
Having more DB instances also improves scalability of read-intensive applications. Aurora can distribute
multiple connections for SELECT queries among the read-only Aurora Replicas.
On the other hand, limiting the number of DB instances reduces the replication traffic from the
primary node. The replication traffic consumes network bandwidth, which is another aspect of overall
performance and scalability. Thus, for write-intensive OLTP applications, prefer to have a smaller number
of large DB instances rather than many small DB instances.
In a typical Aurora cluster, one DB instance (the primary instance) handles all the DDL and DML
statements. The other DB instances (the Aurora Replicas) handle only SELECT statements. Although the
DB instances don't do exactly the same amount of work, we recommend using the same instance class
for all the DB instances in the cluster. That way, if a failure happens and Aurora promotes one of the
read-only DB instances to be the new primary instance, the primary instance has the same capacity as
before.
If you need to use DB instances of different capacities in the same cluster, set up failover tiers for the
DB instances. These tiers determine the order in which Aurora Replicas are promoted by the failover
mechanism. Put DB instances that are a lot larger or smaller than the others into a lower failover tier.
Doing so ensures that they are chosen last for promotion.
Exercise the data recovery features of Aurora, such as automatic point-in-time restore, manual snapshots
and restore, and cluster backtracking. If appropriate, copy snapshots to other AWS Regions and restore
into other AWS Regions to mimic DR scenarios.
Investigate your organization's requirements for restore time objective (RTO), restore point objective
(RPO), and geographic redundancy. Most organizations group these items under the broad category of
disaster recovery. Evaluate the Aurora high availability features described in this section in the context of
your disaster recovery process to ensure that your RTO and RPO requirements are met.
After you get your database environment up and running with Aurora, you can move on to more detailed
evaluation steps, leading to your final migration and production deployment. Depending on your
situation, these other steps might or might not be included in the proof-of-concept process. For details
about migration and porting activities, see the AWS whitepaper Aurora Migration Handbook.
In another next step, consider the security configurations relevant for your workload and designed
to meet your security requirements in a production environment. Plan what controls to put in place
to protect access to the Aurora cluster master user credentials. Define the roles and responsibilities
of database users to control access to data stored in the Aurora cluster. Take into account database
access requirements for applications, scripts, and third-party tools or services. Explore AWS services and
features such as AWS Secrets Manager and AWS Identity and Access Management (IAM) authentication.
At this point, you should understand the procedures and best practices for running benchmark tests
with Aurora. You might find you need to do additional performance tuning. For details, see Managing
Performance and Scaling for Aurora DB Clusters (p. 252), Amazon Aurora MySQL Performance
Enhancements (p. 505), Managing Amazon Aurora PostgreSQL (p. 854), and Using Amazon RDS
Performance Insights (p. 398). If you do additional tuning, make sure that you're familiar with the metrics
that you gathered during the proof of concept. For a next step, you might create new clusters with
different choices for configuration settings, database engine, and database version. Or you might create
specialized kinds of Aurora clusters to match the needs of specific use cases.
999
Amazon Aurora User Guide for Aurora
13. What to Do Next
For example, you can explore Aurora parallel query clusters for hybrid transaction/analytical processing
(HTAP) applications. If wide geographic distribution is crucial for disaster recovery or to minimize latency,
you can explore Aurora global databases. If your workload is intermittent or you're using Aurora in a
development/test scenario, you can explore Aurora Serverless clusters.
Your production clusters might also need to handle high volumes of incoming connections. To learn
those techniques, see the AWS whitepaper Aurora MySQL Database Administrator’s Handbook –
Connection Management.
If, after the proof of concept, you decide that your use case is not suited for Aurora, consider these other
AWS services:
• For purely analytic use cases, workloads benefit from a columnar storage format and other features
more suitable to OLAP workloads. AWS services that address such use cases include the following:
• Amazon Redshift
• Amazon EMR
• Amazon Athena
• Many workloads benefit from a combination of Aurora with one or more of these services. You can
move data between these services by using these:
• AWS Glue
• AWS DMS
• Importing from Amazon S3, as described in the Amazon Aurora User Guide
• Exporting to Amazon S3, as described in the Amazon Aurora User Guide
• Many other popular ETL tools
1000
Amazon Aurora User Guide for Aurora
Security is a shared responsibility between AWS and you. The shared responsibility model describes this
as security of the cloud and security in the cloud:
• Security of the cloud – AWS is responsible for protecting the infrastructure that runs AWS services in
the AWS Cloud. AWS also provides you with services that you can use securely. Third-party auditors
regularly test and verify the effectiveness of our security as part of the AWS compliance programs.
To learn about the compliance programs that apply to Amazon Aurora (Aurora), see AWS Services in
Scope by Compliance Program.
• Security in the cloud – Your responsibility is determined by the AWS service that you use. You are also
responsible for other factors including the sensitivity of your data, your organization’s requirements,
and applicable laws and regulations.
This documentation helps you understand how to apply the shared responsibility model when using
Amazon Aurora. The following topics show you how to configure Amazon Aurora to meet your security
and compliance objectives. You also learn how to use other AWS services that help you monitor and
secure your Amazon Aurora resources.
You can manage access to your Amazon Aurora resources and your databases on a DB cluster. The
method you use to manage access depends on what type of task the user needs to perform with Amazon
Aurora:
• Run your DB cluster in a virtual private cloud (VPC) based on the Amazon VPC service for the greatest
possible network access control. For more information about creating a DB cluster in a VPC, see
Amazon Virtual Private Cloud VPCs and Amazon Aurora (p. 1067).
• Use AWS Identity and Access Management (IAM) policies to assign permissions that determine who
is allowed to manage Amazon Aurora resources. For example, you can use IAM to determine who is
allowed to create, describe, modify, and delete DB clusters, tag resources, or modify security groups.
For information on setting up an IAM user, see Create an IAM User (p. 74).
• Use security groups to control what IP addresses or Amazon EC2 instances can connect to your
databases on a DB cluster. When you first create a DB cluster, its firewall prevents any database access
except through rules specified by an associated security group.
• Use Secure Socket Layer (SSL) or Transport Layer Security (TLS) connections with DB clusters running
the Aurora MySQL or Aurora PostgreSQL. For more information on using SSL/TLS with a DB cluster,
see Using SSL/TLS to Encrypt a Connection to a DB Cluster (p. 1005).
• Use Amazon Aurora encryption to secure your DB clusters and snapshots at rest. Amazon Aurora
encryption uses the industry standard AES-256 encryption algorithm to encrypt your data on
the server that hosts your DB cluster. For more information, see Encrypting Amazon Aurora
Resources (p. 1003).
• Use the security features of your DB engine to control who can log in to the databases on a DB cluster.
These features work just as if the database was on your local network.
For information about security with Aurora MySQL, see Security with Amazon Aurora MySQL (p. 508).
For information about security with Aurora PostgreSQL, see Security with Amazon Aurora
PostgreSQL (p. 823).
1001
Amazon Aurora User Guide for Aurora
Data Protection
Aurora is part of the managed database service Amazon Relational Database Service (Amazon RDS).
Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in
the cloud. If you are not already familiar with Amazon RDS, see the Amazon RDS User Guide.
For both Amazon RDS and Aurora, you can access the RDS API programmatically, and you can use the
AWS CLI to access the RDS API interactively. Some RDS API operations and AWS CLI commands apply
to both Amazon RDS and Aurora, while others apply to either Amazon RDS or Aurora. For information
about RDS API operations, see Amazon RDS API Reference. For more information about the AWS CLI, see
AWS Command Line Interface Reference for Amazon RDS.
Note
You only have to configure security for your use cases. You don't have to configure security
access for processes that Amazon Aurora manages. These include creating backups, replicating
data between a master and a read replica, and other processes.
For more information on managing access to Amazon Aurora resources and your databases on a DB
cluster, see the following topics.
Topics
• Data Protection in Amazon Aurora (p. 1002)
• Identity and Access Management in Amazon Aurora (p. 1019)
• Kerberos Authentication (p. 1053)
• Logging and Monitoring in Amazon Aurora (p. 1053)
• Compliance Validation for Amazon Aurora (p. 1056)
• Resilience in Amazon Aurora (p. 1057)
• Infrastructure Security in Amazon Aurora (p. 1059)
• Security Best Practices for Amazon Aurora (p. 1059)
• Controlling Access with Security Groups (p. 1060)
• Master User Account Privileges (p. 1062)
• Using Service-Linked Roles for Amazon Aurora (p. 1063)
• Amazon Virtual Private Cloud VPCs and Amazon Aurora (p. 1067)
For data protection, we recommend that you protect AWS account credentials and set up principals
with AWS Identity and Access Management (IAM). Doing this means that each user is given only the
permissions necessary to fulfill their job duties. We also recommend that you secure your data in the
following ways:
1002
Amazon Aurora User Guide for Aurora
Data Encryption
We strongly recommend that you never put sensitive identifying information, such as your customers'
account numbers, into free-form fields such as a Name field. This recommendation includes when you
work with Amazon Aurora or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any
data that you enter into Amazon Aurora or other services might get picked up for inclusion in diagnostic
logs. When you provide a URL to an external server, don't include credentials information in the URL to
validate your request to that server.
For more information about data protection, see the AWS Shared Responsibility Model and GDPR blog
post on the AWS Security Blog.
Topics
• Protecting Data Using Encryption (p. 1003)
• Internetwork Traffic Privacy (p. 1018)
Topics
• Encrypting Amazon Aurora Resources (p. 1003)
• Key Management (p. 1005)
• Using SSL/TLS to Encrypt a Connection to a DB Cluster (p. 1005)
• Rotating Your SSL/TLS Certificate (p. 1007)
Amazon Aurora encrypted DB clusters use the industry standard AES-256 encryption algorithm to
encrypt your data on the server that hosts your Amazon Aurora DB clusters. After your data is encrypted,
Amazon Aurora handles authentication of access and decryption of your data transparently with a
minimal impact on performance. You don't need to modify your database client applications to use
encryption.
Note
For encrypted and unencrypted DB clusters, data that is in transit between the source and the
read replicas is encrypted, even when replicating across AWS Regions.
Topics
• Overview of Encrypting Amazon Aurora Resources (p. 1004)
• Enabling Encryption for an Amazon Aurora DB Cluster (p. 1004)
• Availability of Amazon Aurora Encryption (p. 1004)
1003
Amazon Aurora User Guide for Aurora
Data Encryption
To manage the keys used for encrypting and decrypting your Amazon Aurora resources, you use the
AWS Key Management Service (AWS KMS). AWS KMS combines secure, highly available hardware and
software to provide a key management system scaled for the cloud. Using AWS KMS, you can create
encryption keys and define the policies that control how these keys can be used. AWS KMS supports
CloudTrail, so you can audit key usage to verify that keys are being used appropriately. You can use your
AWS KMS keys with Amazon Aurora and supported AWS services such as and supported AWS services
such as Amazon S3, Amazon EBS, and Amazon Redshift. For a list of services that support AWS KMS, see
Supported Services in the AWS Key Management Service Developer Guide.
For an Amazon Aurora encrypted DB cluster, all logs, backups, and snapshots are encrypted. You can
also encrypt a read replica of an Amazon Aurora encrypted cluster. The encryption for the read replica is
protected by the AWS Region's KMS master key.
If you use the create-db-cluster AWS CLI command to create an encrypted DB cluster, set the --
storage-encrypted parameter to true. If you use the CreateDBCluster API operation, set the
StorageEncrypted parameter to true.
When you create an encrypted DB cluster, you can also supply the AWS KMS key identifier for your
encryption key. If you don't specify an AWS KMS key identifier, then Amazon Aurora uses your default
encryption key for your new DB cluster. AWS KMS creates your default encryption key for Amazon Aurora
for your AWS account. Your AWS account has a different default encryption key for each AWS Region.
Once you have created an encrypted DB cluster, you can't change the type of encryption key used by that
DB cluster. Therefore, be sure to determine your encryption key requirements before you create your
encrypted DB cluster.
If you use the AWS CLI create-db-cluster command to create an encrypted DB cluster, set the --
kms-key-id parameter to the Amazon Resource Name (ARN) for the KMS key for the DB cluster. If you
use the RDS API CreateDBCluster action, set the KmsKeyId parameter to the ARN for your KMS key
for the DB cluster.
You can use the ARN of a key from another account to encrypt a DB cluster. Or you might create a DB
cluster with the same AWS account that owns the KMS encryption key used to encrypt that new DB
cluster. In this case, the KMS key ID that you pass can be the KMS key alias instead of the key's ARN.
Important
In some cases, Amazon Aurora can lose access to the encryption key for a DB cluster. For
example, Aurora loses access when RDS access to a key is revoked. In these cases, the encrypted
DB cluster goes into a terminal state and you can only restore the DB cluster from a backup. We
strongly recommend that you always enable backups for encrypted DB clusters to guard against
the loss of encrypted data in your databases.
1004
Amazon Aurora User Guide for Aurora
Data Encryption
Note
Amazon Aurora encryption is not available for the db.t2.micro DB instance class.
The source snapshot remains encrypted throughout the copy process. AWS Key Management Service
uses envelope encryption to protect data during the copy process. For more information about
envelope encryption, see Envelope Encryption.
Key Management
You can manage keys used for Amazon Aurora encrypted DB clusters using the AWS Key Management
Service (AWS KMS) in the AWS KMS console. If you want full control over a key, then you must create a
customer-managed key.
You can't delete, revoke, or rotate default keys provisioned by AWS KMS. You can't share a snapshot
that has been encrypted using the default AWS KMS encryption key of the AWS account that shared the
snapshot.
You can view audit logs of every action taken with a customer-managed key by using AWS CloudTrail.
Important
When Aurora encounters a DB cluster encrypted by a key that Aurora doesn't have access
to, Aurora puts the DB cluster into a terminal state. In this state, the DB cluster is no longer
available and the current state of the database can't be recovered. To restore the DB cluster, you
must re-enable access to the encryption key for Aurora, and then restore the DB cluster from a
backup.
Important
For information about rotating your certificate, see Rotating Your SSL/TLS Certificate (p. 1007).
Note
All certificates are only available for download using SSL/TLS connections.
To get a root certificate that works for all AWS Regions, download from one of these locations:
1005
Amazon Aurora User Guide for Aurora
Data Encryption
• https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem (CA-2019)
• https://s3.amazonaws.com/rds-downloads/rds-ca-2015-root.pem (CA-2015)
This root certificate is a trusted root entity and should work in most cases but might fail if your
application doesn't accept certificate chains. If your application doesn't accept certificate chains,
download the AWS Region–specific certificate from the list of intermediate certificates found later in this
section.
To get a certificate bundle that contains both the intermediate and root certificates, download from
https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem.
If your application is on Microsoft Windows and requires a PKCS7 file, you can download the PKCS7
certificate bundle. This bundle contains both the intermediate and root certificates at https://
s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.p7b.
Note
Amazon RDS Proxy and Aurora Serverless use certificates from the AWS Certificate Manager
(ACM). If you are using RDS Proxy, you don't need to download Amazon RDS certificates or
update applications that use RDS Proxy connections. For more information about using TLS/SSL
with RDS Proxy, see Using TLS/SSL with RDS Proxy (p. 177).
If you are Aurora Serverless, downloading Amazon RDS certificates isn't required. For more
information about using TLS/SSL with Aurora Serverless, see Using TLS/SSL with Aurora
Serverless (p. 119).
Intermediate Certificates
You might need to use an intermediate certificate to connect to your AWS Region. For example, you
must use an intermediate certificate to connect to the AWS GovCloud (US-West) Region using SSL/TLS.
If you need an intermediate certificate for a particular AWS Region, download the certificate from the
following table.
1006
Amazon Aurora User Guide for Aurora
Data Encryption
You can download the intermediate certificate for an AWS GovCloud (US) Region from the following list:
To get a certificate bundle that contains both the intermediate and root certificates for the AWS
GovCloud (US) Regions, download from https://s3.us-gov-west-1.amazonaws.com/rds-downloads/rds-
combined-ca-us-gov-bundle.pem.
The current CA certificates expire on March 5, 2020. New application connections using SSL/TLS with
certificate verification will fail after March 5, 2020.
Before you update your DB instances to use the new CA certificate, make sure that you update your
clients or applications connecting to your RDS databases.
Amazon RDS provides new CA certificates as an AWS security best practice. For information about the
new certificates and the supported AWS Regions, see Using SSL/TLS to Encrypt a Connection to a DB
Cluster (p. 1005).
Note
Amazon RDS Proxy and Aurora Serverless use certificates from the AWS Certificate Manager
(ACM). If you are using RDS Proxy, when you rotate your SSL/TLS certificate, you don't need to
1007
Amazon Aurora User Guide for Aurora
Data Encryption
update applications that use RDS Proxy connections. For more information about using TLS/SSL
with RDS Proxy, see Using TLS/SSL with RDS Proxy (p. 177).
If you are Aurora Serverless, rotating your SSL/TLS certificate isn't required. For more
information about using TLS/SSL with Aurora Serverless, see Using TLS/SSL with Aurora
Serverless (p. 119).
Topics
• Updating Your CA Certificate by Modifying Your DB Instance (p. 1008)
• Updating Your CA Certificate by Applying DB Instance Maintenance (p. 1010)
• Sample Script for Importing Certificates Into Your Trust Store (p. 1014)
• Reverting an Update of a CA Certificate (p. 1015)
• Overriding the Default CA Certificate for New DB Instances (p. 1017)
1. Download the new SSL/TLS certificate as described in Using SSL/TLS to Encrypt a Connection to a
DB Cluster (p. 1005).
2. Update your applications to use the new SSL/TLS certificate.
The methods for updating applications for new SSL/TLS certificates depend on your specific
applications. Work with your application developers to update the SSL/TLS certificates for your
applications.
For information about checking for SSL/TLS connections and updating applications for each DB
engine, see the following topics:
For a sample script that updates a trust store for a Linux operating system, see Sample Script for
Importing Certificates Into Your Trust Store (p. 1014).
Note
The certificate bundle contains certificates for both the old and new CA, so you can upgrade
your application safely and maintain connectivity during the transition period. If you
are using the AWS Database Migration Service to migrate a database to a DB cluster, we
recommend using the certificate bundle to ensure connectivity during the migration.
3. Modify the DB instance to change the CA from rds-ca-2015 to rds-ca-2019.
Important
By default, this operation restarts your DB instance. If you don't want to restart your DB
instance during this operation, you can use the modify-db-instance CLI command and
specify the --no-certificate-rotation-restart option.
This option will not rotate the certificate until the next time the database restarts, either for
planned or unplanned maintenance. This option is only recommended if you don't use SSL/
TLS.
If you are experiencing connectivity issues after certificate expiry, use the apply immediately
option by specifying Apply immediately in the console or by specifying the --apply-
immediately option using the AWS CLI. By default, this operation is scheduled to run
during your next maintenance window.
1008
Amazon Aurora User Guide for Aurora
Data Encryption
You can use the AWS Management Console or the AWS CLI to change the CA certificate from rds-
ca-2015 to rds-ca-2019 for a DB instance.
Console
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases, and then choose the DB instance that you want to
modify.
3. Choose Modify.
1009
Amazon Aurora User Guide for Aurora
Data Encryption
Important
Choosing this option restarts your database immediately.
7. On the confirmation page, review your changes. If they are correct, choose Modify DB Instance to
save your changes.
Important
When you schedule this operation, make sure that you have updated your client-side trust
store beforehand.
AWS CLI
To use the AWS CLI to change the CA from rds-ca-2015 to rds-ca-2019 for a DB instance, call the
modify-db-instance command. Specify the DB instance identifier and the --ca-certificate-
identifier option.
Important
When you schedule this operation, make sure that you have updated your client-side trust store
beforehand.
Example
The following code modifies mydbinstance by setting the CA certificate to rds-ca-2019. The changes
are applied during the next maintenance window by using --no-apply-immediately. Use --apply-
immediately to apply the changes immediately.
Important
By default, this operation reboots your DB instance. If you don't want to reboot your DB instance
during this operation, you can use the modify-db-instance CLI command and specify the --
no-certificate-rotation-restart option.
This option will not rotate the certificate until the next time the database restarts, either for
planned or unplanned maintenance. This option is only recommended if you do not use SSL/
TLS.
Use --apply-immediately to apply the update immediately. By default, this operation is
scheduled to run during your next maintenance window.
For Windows:
1. Download the new SSL/TLS certificate as described in Using SSL/TLS to Encrypt a Connection to a
DB Cluster (p. 1005).
1010
Amazon Aurora User Guide for Aurora
Data Encryption
2.
Update your database applications to use the new SSL/TLS certificate.
The methods for updating applications for new SSL/TLS certificates depend on your specific
applications. Work with your application developers to update the SSL/TLS certificates for your
applications.
For information about checking for SSL/TLS connections and updating applications for each DB
engine, see the following topics:
For a sample script that updates a trust store for a Linux operating system, see Sample Script for
Importing Certificates Into Your Trust Store (p. 1014).
Note
The certificate bundle contains certificates for both the old and new CA, so you can upgrade
your application safely and maintain connectivity during the transition period.
3. Apply DB instance maintenance to change the CA from rds-ca-2015 to rds-ca-2019.
Important
You can choose to apply the change immediately. By default, this operation is scheduled to
run during your next maintenance window.
You can use the AWS Management Console to apply DB instance maintenance to change the CA
certificate from rds-ca-2015 to rds-ca-2019 for multiple DB instances.
Use the AWS Management Console to change the CA certificate for multiple DB instances.
1. Sign in to the AWS Management Console and open the Amazon RDS console at https://
console.aws.amazon.com/rds/.
2. In the navigation pane, choose Databases.
If you have at least one DB instance that is using the old CA certificate, the following banner appears
at the top of the page.
In the navigation pane, there is a Certificate update option that shows the total number of affected
DB instances.
1011
Amazon Aurora User Guide for Aurora
Data Encryption
Either choose View pending maintenance actions in the banner, or choose Certificate update in the
navigation pane.
1012
Amazon Aurora User Guide for Aurora
Data Encryption
Note
This page only shows the DB instances for the current AWS Region. If you have DB instances
in more than one AWS Region, check this page in each AWS Region to see all DB instances
with old SSL/TLS certificates.
3. Choose the DB instance you want to update.
You can schedule the certificate rotation for your next maintenance window by choosing Update at
the next maintenance window. Apply the rotation immediately by choosing Update now.
Important
When your CA certificate is rotated, the operation restarts your DB instance.
If you experience connectivity issues after certificate expiry, use the Update now option.
4. If you choose Update at the next maintenance window or Update now, you are prompted to
confirm the CA certificate rotation.
Important
Before scheduling the CA certificate rotation on your database, update any client
applications that use SSL/TLS and the server certificate to connect. These updates are
specific to your DB engine. To determine whether your applications use SSL/TLS and the
server certificate to connect, see Step 2: Update Your Database Applications to Use the New
SSL/TLS Certificate (p. 1011). After you have updated these client applications, you can
confirm the CA certificate rotation.
1013
Amazon Aurora User Guide for Aurora
Data Encryption
Topics
• Sample Script for Importing Certificates on Linux (p. 1014)
• Sample Script for Importing Certificates on macOS (p. 1014)
The following is a sample shell script that imports the certificate bundle into a trust store on a Linux
operating system.
mydir=tmp/certs
if [ ! -e "${mydir}" ]
then
mkdir -p "${mydir}"
fi
truststore=${mydir}/rds-truststore.jks
storepassword=changeit
rm ${mydir}/rds-combined-ca-bundle.pem
The following is a sample shell script that imports the certificate bundle into a trust store on macOS.
mydir=tmp/certs
if [ ! -e "${mydir}" ]
then
mkdir -p "${mydir}"
fi
1014
Amazon Aurora User Guide for Aurora
Data Encryption
truststore=${mydir}/rds-truststore.jks
storepassword=changeit
rm ${mydir}/rds-combined-ca-bundle.pem
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.
1015
Amazon Aurora User Guide for Aurora
Data Encryption
1016
Amazon Aurora User Guide for Aurora
Data Encryption
AWS CLI
To revert to a previous CA certificate for a DB instance, call the modify-db-instance command. Specify
the DB instance identifier and the --ca-certificate-identifier option.
Important
When you schedule this operation, make sure that you have updated your client-side trust store
beforehand.
Example
The following code example modifies mydbinstance by setting the CA certificate to rds-ca-2015. The
changes are applied during the next maintenance window by using --no-apply-immediately. Use --
apply-immediately to apply the changes immediately.
Important
When the --certificate-rotation-restart option is specified, using the --apply-
immediately option causes an outage. The --certificate-rotation-restart option, the
default, specifies that the DB instance is restarted when the certificate is rotated.
The --no-certificate-rotation-restart option, specifies that the DB instance is not
restarted when the certificate is rotated. Use the --no-certificate-rotation-restart
option only if you are not using SSL/TLS to connect to the DB instance.
For Windows:
To override the system-default CA certificate for new DB instances temporarily, or to remove the
override, use the modify-certificates command.
By using this command, you can specify an RDS-approved SSL/TLS certificate for new DB instances that
is different from the default certificate provided by RDS. You can also use this operation to remove the
override, so that new DB instances use the default certificate provided by RDS.
You might need to override the default certificate in the following situations:
• You already migrated your applications to support the latest CA certificate, but the new CA certificate
is not yet the RDS default CA certificate for the specified AWS Region.
• RDS has already moved to a new default CA certificate for the specified AWS Region, but you're still in
the process of supporting the new CA certificate. In this case, you temporarily need additional time to
finish your application changes.
1017
Amazon Aurora User Guide for Aurora
Internetwork Traffic Privacy
Note
You can't use the RDS console to override the default CA certificate, or to remove the override.
Example
The following code example sets the default CA certificate to rds-ca-2019. The changes are applied
immediately.
• An AWS Site-to-Site VPN connection. For more information, see What is AWS Site-to-Site VPN?
• An AWS Direct Connect connection. For more information, see What is AWS Direct Connect?
You get access to Amazon Aurora through the network by using AWS-published API operations. Clients
must support Transport Layer Security (TLS) 1.0. We recommend TLS 1.2. Clients must also support
cipher suites with Perfect Forward Secrecy (PFS), such as Ephemeral Diffie-Hellman (DHE) or Elliptic
Curve Diffie-Hellman Ephemeral (ECDHE). Most modern systems such as Java 7 and later support these
modes. Additionally, you must sign requests using an access key ID and a secret access key that are
associated with an IAM principal. Or you can use the AWS Security Token Service (STS) to generate
temporary security credentials to sign requests.
1018
Amazon Aurora User Guide for Aurora
Identity and Access Management
Topics
• Audience (p. 1019)
• Authenticating With Identities (p. 1019)
• Managing Access Using Policies (p. 1021)
• How Amazon Aurora Works with IAM (p. 1023)
• Amazon Aurora Identity-Based Policy Examples (p. 1025)
• IAM Database Authentication (p. 1035)
• Troubleshooting Amazon Aurora Identity and Access (p. 1051)
Audience
How you use AWS Identity and Access Management (IAM) differs, depending on the work you do in
Aurora.
Service user – If you use the Aurora service to do your job, then your administrator provides you with
the credentials and permissions that you need. As you use more Aurora features to do your work, you
might need additional permissions. Understanding how access is managed can help you request the
right permissions from your administrator. If you cannot access a feature in Aurora, see Troubleshooting
Amazon Aurora Identity and Access (p. 1051).
Service administrator – If you're in charge of Aurora resources at your company, you probably have
full access to Aurora. It's your job to determine which Aurora features and resources your employees
should access. You must then submit requests to your IAM administrator to change the permissions of
your service users. Review the information on this page to understand the basic concepts of IAM. To
learn more about how your company can use IAM with Aurora, see How Amazon Aurora Works with
IAM (p. 1023).
IAM administrator – If you're an IAM administrator, you might want to learn details about how you can
write policies to manage access to Aurora. To view example Aurora identity-based policies that you can
use in IAM, see Amazon Aurora Identity-Based Policy Examples (p. 1025).
You must be authenticated (signed in to AWS) as the AWS account root user, an IAM user, or by assuming
an IAM role. You can also use your company's single sign-on authentication, or even sign in using Google
or Facebook. In these cases, your administrator previously set up identity federation using IAM roles.
When you access AWS using credentials from another company, you are assuming a role indirectly.
To sign in directly to the AWS Management Console, use your password with your root user email or your
IAM user name. You can access AWS programmatically using your root user or IAM user access keys. AWS
1019
Amazon Aurora User Guide for Aurora
Authenticating With Identities
provides SDK and command line tools to cryptographically sign your request using your credentials. If
you don’t use AWS tools, you must sign the request yourself. Do this using Signature Version 4, a protocol
for authenticating inbound API requests. For more information about authenticating requests, see
Signature Version 4 Signing Process in the AWS General Reference.
Regardless of the authentication method that you use, you might also be required to provide additional
security information. For example, AWS recommends that you use multi-factor authentication (MFA) to
increase the security of your account. To learn more, see Using Multi-Factor Authentication (MFA) in AWS
in the IAM User Guide.
An IAM group is an identity that specifies a collection of IAM users. You can't sign in as a group. You
can use groups to specify permissions for multiple users at a time. Groups make permissions easier to
manage for large sets of users. For example, you could have a group named IAMAdmins and give that
group permissions to administer IAM resources.
Users are different from roles. A user is uniquely associated with one person or application, but a role
is intended to be assumable by anyone who needs it. Users have permanent long-term credentials, but
roles provide temporary credentials. To learn more, see When to Create an IAM User (Instead of a Role) in
the IAM User Guide.
IAM database authentication works with Aurora. For more information about authenticating to your DB
cluster using IAM, see IAM Database Authentication (p. 1035).
IAM Roles
An IAM role is an identity within your AWS account that has specific permissions. It is similar to an IAM
user, but is not associated with a specific person. You can temporarily assume an IAM role in the AWS
Management Console by switching roles. You can assume a role by calling an AWS CLI or AWS API
operation or by using a custom URL. For more information about methods for using roles, see Using IAM
Roles in the IAM User Guide.
IAM roles with temporary credentials are useful in the following situations:
• Temporary IAM user permissions – An IAM user can assume an IAM role to temporarily take on
different permissions for a specific task.
• Federated user access – Instead of creating an IAM user, you can use existing identities from AWS
Directory Service, your enterprise user directory, or a web identity provider. These are known as
1020
Amazon Aurora User Guide for Aurora
Managing Access Using Policies
federated users. AWS assigns a role to a federated user when access is requested through an identity
provider. For more information about federated users, see Federated Users and Roles in the IAM User
Guide.
• Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different
account to access resources in your account. Roles are the primary way to grant cross-account access.
However, with some AWS services, you can attach a policy directly to a resource (instead of using a role
as a proxy). To learn the difference between roles and resource-based policies for cross-account access,
see How IAM Roles Differ from Resource-based Policies in the IAM User Guide.
• AWS service access – A service role is an IAM role that a service assumes to perform actions in your
account on your behalf. When you set up some AWS service environments, you must define a role
for the service to assume. This service role must include all the permissions that are required for the
service to access the AWS resources that it needs. Service roles vary from service to service, but many
allow you to choose your permissions as long as you meet the documented requirements for that
service. Service roles provide access only within your account and cannot be used to grant access
to services in other accounts. You can create, modify, and delete a service role from within IAM. For
example, you can create a role that allows Amazon Redshift to access an Amazon S3 bucket on your
behalf and then load data from that bucket into an Amazon Redshift cluster. For more information, see
Creating a Role to Delegate Permissions to an AWS Service in the IAM User Guide.
• Applications running on Amazon EC2 – You can use an IAM role to manage temporary credentials
for applications that are running on an EC2 instance and making AWS CLI or AWS API requests.
This is preferable to storing access keys within the EC2 instance. To assign an AWS role to an EC2
instance and make it available to all of its applications, you create an instance profile that is attached
to the instance. An instance profile contains the role and enables programs that are running on the
EC2 instance to get temporary credentials. For more information, see Using an IAM Role to Grant
Permissions to Applications Running on Amazon EC2 Instances in the IAM User Guide.
To learn whether to use IAM roles, see When to Create an IAM Role (Instead of a User) in the IAM User
Guide.
An IAM administrator can use policies to specify who has access to AWS resources, and what actions
they can perform on those resources. Every IAM entity (user or role) starts with no permissions. In other
words, by default, users can do nothing, not even change their own password. To give a user permission
to do something, an administrator must attach a permissions policy to a user. Or the administrator can
add the user to a group that has the intended permissions. When an administrator gives permissions to a
group, all users in that group are granted those permissions.
IAM policies define permissions for an action regardless of the method that you use to perform the
operation. For example, suppose that you have a policy that allows the iam:GetRole action. A user with
that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API.
Identity-Based Policies
Identity-based policies are JSON permissions policy documents that you can attach to an identity, such
as an IAM user, role, or group. These policies control what actions that identity can perform, on which
resources, and under what conditions. To learn how to create an identity-based policy, see Creating IAM
Policies in the IAM User Guide.
1021
Amazon Aurora User Guide for Aurora
Managing Access Using Policies
Identity-based policies can be further categorized as inline policies or managed policies. Inline policies
are embedded directly into a single user, group, or role. Managed policies are standalone policies that
you can attach to multiple users, groups, and roles in your AWS account. Managed policies include AWS
managed policies and customer managed policies. To learn how to choose between a managed policy or
an inline policy, see Choosing Between Managed Policies and Inline Policies in the IAM User Guide.
The following AWS managed policies, which you can attach to users in your account, are specific to
Amazon Aurora:
• AmazonRDSReadOnlyAccess – Grants read-only access to all Amazon Aurora resources for the AWS
account specified.
• AmazonRDSFullAccess – Grants full access to all Amazon Aurora resources for the AWS account
specified.
• Permissions boundaries – A permissions boundary is an advanced feature in which you set the
maximum permissions that an identity-based policy can grant to an IAM entity (IAM user or role).
You can set a permissions boundary for an entity. The resulting permissions are the intersection of
entity's identity-based policies and its permissions boundaries. Resource-based policies that specify
the user or role in the Principal field are not limited by the permissions boundary. An explicit deny
in any of these policies overrides the allow. For more information about permissions boundaries, see
Permissions Boundaries for IAM Entities in the IAM User Guide.
• Service control policies (SCPs) – SCPs are JSON policies that specify the maximum permissions for
an organization or organizational unit (OU) in AWS Organizations. AWS Organizations is a service for
grouping and centrally managing multiple AWS accounts that your business owns. If you enable all
features in an organization, then you can apply service control policies (SCPs) to any or all of your
accounts. The SCP limits permissions for entities in member accounts, including each AWS account
root user. For more information about Organizations and SCPs, see How SCPs Work in the AWS
Organizations User Guide.
• Session policies – Session policies are advanced policies that you pass as a parameter when you
programmatically create a temporary session for a role or federated user. The resulting session's
permissions are the intersection of the user or role's identity-based policies and the session policies.
Permissions can also come from a resource-based policy. An explicit deny in any of these policies
overrides the allow. For more information, see Session Policies in the IAM User Guide.
For more information about identity and access management for Aurora, continue to the following
pages:
1022
Amazon Aurora User Guide for Aurora
How Amazon Aurora Works with IAM
Topics
• Aurora Identity-Based Policies (p. 1023)
• Aurora Resource-Based Policies (p. 1025)
• Authorization Based on Aurora Tags (p. 1025)
• Aurora IAM Roles (p. 1025)
Actions
The Action element of an IAM identity-based policy describes the specific action or actions that will be
allowed or denied by the policy. Policy actions usually have the same name as the associated AWS API
operation. The action is used in a policy to grant permissions to perform the associated operation.
Policy actions in Aurora use the following prefix before the action: rds:. For example, to grant someone
permission to describe DB instances with the Amazon RDS DescribeDBInstances API operation, you
include the rds:DescribeDBInstances action in their policy. Policy statements must include either
an Action or NotAction element. Aurora defines its own set of actions that describe tasks that you can
perform with this service.
To specify multiple actions in a single statement, separate them with commas as follows:
"Action": [
"rds:action1",
"rds:action2"
You can specify multiple actions using wildcards (*). For example, to specify all actions that begin with
the word Describe, include the following action:
"Action": "rds:Describe*"
To see a list of Aurora actions, see Actions Defined by Amazon RDS in the IAM User Guide.
Resources
The Resource element specifies the object or objects to which the action applies. Statements must
include either a Resource or a NotResource element. You specify a resource using an ARN or using the
wildcard (*) to indicate that the statement applies to all resources.
arn:${Partition}:rds:${Region}:${Account}:{ResourceType}/${Resource}
1023
Amazon Aurora User Guide for Aurora
How Amazon Aurora Works with IAM
For more information about the format of ARNs, see Amazon Resource Names (ARNs) and AWS Service
Namespaces.
For example, to specify the dbtest DB instance in your statement, use the following ARN:
"Resource": "arn:aws:rds:us-west-2:123456789012:db:dbtest"
To specify all DB instances that belong to a specific account, use the wildcard (*):
"Resource": "arn:aws:rds:us-east-1:123456789012:db:*"
Some RDS API operations, such as those for creating resources, cannot be performed on a specific
resource. In those cases, you must use the wildcard (*).
"Resource": "*"
Many Amazon RDS API operations involve multiple resources. For example, CreateDBInstance creates
a DB instance. You can specify that an IAM user must use a specific security group and parameter group
when creating a DB instance. To specify multiple resources in a single statement, separate the ARNs with
commas.
"Resource": [
"resource1",
"resource2"
To see a list of Aurora resource types and their ARNs, see Resources Defined by Amazon RDS in the IAM
User Guide. To learn with which actions you can specify the ARN of each resource, see Actions Defined by
Amazon RDS.
Condition Keys
The Condition element (or Condition block) lets you specify conditions in which a statement is in
effect. The Condition element is optional. You can build conditional expressions that use condition
operators, such as equals or less than, to match the condition in the policy with values in the request.
If you specify multiple Condition elements in a statement, or multiple keys in a single Condition
element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single
condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be
met before the statement's permissions are granted.
You can also use placeholder variables when you specify conditions. For example, you can grant an IAM
user permission to access a resource only if it is tagged with their IAM user name. For more information,
see IAM Policy Elements: Variables and Tags in the IAM User Guide.
Aurora defines its own set of condition keys and also supports using some global condition keys. To see
all AWS global condition keys, see AWS Global Condition Context Keys in the IAM User Guide.
To see a list of Aurora condition keys, see Condition Keys for Amazon RDS in the IAM User Guide. To learn
with which actions and resources you can use a condition key, see Actions Defined by Amazon RDS.
Examples
To view examples of Aurora identity-based policies, see Amazon Aurora Identity-Based Policy
Examples (p. 1025).
1024
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
To view an example identity-based policy for limiting access to a resource based on the tags on that
resource, see Grant Permission for Actions on a Resource with a Specific Tag with Two Different
Values (p. 1029).
Service-Linked Roles
Service-linked roles allow AWS services to access resources in other services to complete an action on
your behalf. Service-linked roles appear in the Roles list in the IAM Management Console and are owned
by the service. An IAM administrator can view but not edit the permissions for service-linked roles.
Aurora supports service-linked roles. For details about creating or managing Aurora service-linked roles,
see Using Service-Linked Roles for Amazon Aurora (p. 1063).
Service Roles
This feature allows a service to assume a service role on your behalf. This role allows the service to access
resources in other services to complete an action on your behalf. Service roles appear in the Roles list in
the IAM Management Console and are owned by your account. This means that an IAM administrator can
change the permissions for this role. However, doing so might break the functionality of the service.
To learn how to create an IAM identity-based policy using these example JSON policy documents, see
Creating Policies on the JSON Tab in the IAM User Guide.
Topics
1025
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
• Get Started Using AWS Managed Policies – To start using Aurora quickly, use AWS managed policies
to give your employees the permissions they need. These policies are already available in your account
and are maintained and updated by AWS. For more information, see Get Started Using Permissions
With AWS Managed Policies in the IAM User Guide.
• Grant Least Privilege – When you create custom policies, grant only the permissions required
to perform a task. Start with a minimum set of permissions and grant additional permissions as
necessary. Doing so is more secure than starting with permissions that are too lenient and then trying
to tighten them later. For more information, see Grant Least Privilege in the IAM User Guide.
• Enable MFA for Sensitive Operations – For extra security, require IAM users to use multi-factor
authentication (MFA) to access sensitive resources or API operations. For more information, see Using
Multi-Factor Authentication (MFA) in AWS in the IAM User Guide.
• Use Policy Conditions for Extra Security – To the extent that it's practical, define the conditions under
which your identity-based policies allow access to a resource. For example, you can write conditions to
specify a range of allowable IP addresses that a request must come from. You can also write conditions
to allow requests only within a specified date or time range, or to require the use of SSL or MFA. For
more information, see IAM JSON Policy Elements: Condition in the IAM User Guide.
To ensure that those entities can still use the Aurora console, also attach the following AWS managed
policy to the entities. For more information, see Adding Permissions to a User in the IAM User Guide.
AmazonRDSReadOnlyAccess
You don't need to allow minimum console permissions for users that are making calls only to the AWS
CLI or the AWS API. Instead, allow access to only the actions that match the API operation that you're
trying to perform.
1026
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ViewOwnUserInfo",
"Effect": "Allow",
"Action": [
"iam:GetUserPolicy",
"iam:ListGroupsForUser",
"iam:ListAttachedUserPolicies",
"iam:ListUserPolicies",
"iam:GetUser"
],
"Resource": [
"arn:aws:iam::*:user/${aws:username}"
]
},
{
"Sid": "NavigateInConsole",
"Effect": "Allow",
"Action": [
"iam:GetGroupPolicy",
"iam:GetPolicyVersion",
"iam:GetPolicy",
"iam:ListAttachedGroupPolicies",
"iam:ListGroupPolicies",
"iam:ListPolicyVersions",
"iam:ListPolicies",
"iam:ListUsers"
],
"Resource": "*"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCreateDBInstanceOnly",
"Effect": "Allow",
"Action": [
"rds:CreateDBInstance"
],
"Resource": [
"arn:aws:rds:*:123456789012:db:test*",
"arn:aws:rds:*:123456789012:og:default*",
1027
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
"arn:aws:rds:*:123456789012:pg:default*",
"arn:aws:rds:*:123456789012:subgrp:default"
],
"Condition": {
"StringEquals": {
"rds:DatabaseEngine": "mysql",
"rds:DatabaseClass": "db.t2.micro"
}
}
}
]
}
The policy includes a single statement that specifies the following permissions for the IAM user:
• The policy allows the IAM user to create a DB instance using the CreateDBInstance API operation (this
also applies to the create-db-instance AWS CLI command and the AWS Management Console).
• The Resource element specifies that the user can perform actions on or with resources. You specify
resources using an Amazon Resources Name (ARN). This ARN includes the name of the service that
the resource belongs to (rds), the AWS Region (* indicates any region in this example), the user
account number (123456789012 is the user ID in this example), and the type of resource. For more
information about creating ARNs, see Working with Amazon Resource Names (ARNs) in Amazon
RDS (p. 345).
The Resource element in the example specifies the following policy constraints on resources for the
user:
• The DB instance identifier for the new DB instance must begin with test (for example,
testCustomerData1, test-region2-data).
• The option group for the new DB instance must begin with default.
• The DB parameter group for the new DB instance must begin with default.
• The subnet group for the new DB instance must be the default subnet group.
• The Condition element specifies that the DB engine must be MySQL and the DB instance class
must be db.t2.micro. The Condition element specifies the conditions when a policy should
take effect. You can add additional permissions or restrictions by using the Condition element.
For more information about specifying conditions, see Condition Keys (p. 1024). This example
specifies the rds:DatabaseEngine and rds:DatabaseClass conditions. For information about
the valid condition values for rds:DatabaseEngine, see the list under the Engine parameter in
CreateDBInstance. For information about the valid condition values for rds:DatabaseClass, see
Hardware Specifications for All Available DB Instance Classes for Aurora (p. 34).
The policy doesn't specify the Principal element because in an identity-based policy you don't specify
the principal who gets the permission. When you attach policy to a user, the user is the implicit principal.
When you attach a permission policy to an IAM role, the principal identified in the role's trust policy gets
the permissions.
To see a list of Aurora actions, see Actions Defined by Amazon RDS in the IAM User Guide.
If you create an IAM policy that is more restrictive than the minimum required permissions, the console
doesn't function as intended for users with that IAM policy. To ensure that those users can still use the
console, also attach the AmazonRDSReadOnlyAccess managed policy to the user, as described in
Managing Access Using Policies (p. 1021).
1028
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
You don't need to allow minimum console permissions for users that are making calls only to the AWS
CLI or the Amazon RDS API.
The following policy grants full access to all Amazon Aurora resources for the root AWS account:
AmazonRDSFullAccess
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowRDSDescribe",
"Effect":"Allow",
"Action":"rds:Describe*",
"Resource":"*"
}
]
}
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowMySQLProductionCreate",
"Effect":"Allow",
"Action":"rds:CreateDBInstance",
"Resource":[
"arn:aws:rds:us-west-2:123456789012:pg:mysql-production",
"arn:aws:rds:us-west-2:123456789012:secgrp:db-production"
]
}
]
}
1029
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowDevTestCreate",
"Effect":"Allow",
"Action":[
"rds:ModifyDBInstance",
"rds:CreateDBSnapshot"
],
"Resource":"*",
"Condition":{
"StringEquals":{
"rds:db-tag/stage":[
"development",
"test"
]
}
}
}
]
}
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyDelete1",
"Effect":"Deny",
"Action":"rds:DeleteDBInstance",
"Resource":"arn:aws:rds:us-west-2:123456789012:db:my-mysql-instance"
}
]
}
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowMySQLCreate",
"Effect":"Allow",
1030
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
"Action":"rds:CreateDBInstance",
"Resource":"*",
"Condition":{
"StringEquals":{
"rds:DatabaseEngine":"mysql"
},
"Bool":{
"rds:MultiAz": false
}
}
}
]
}
Explicitly denying permission supersedes any other permissions granted. This ensures that identities to
not accidentally get permission that you never want to grant.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyLargeCreate",
"Effect":"Deny",
"Action":"rds:CreateDBInstance",
"Resource":"*",
"Condition":{
"StringEquals":{
"rds:DatabaseClass":[
"db.r3.8xlarge",
"db.m4.10xlarge"
]
}
}
},
{
"Sid":"DenyPIOPSCreate",
"Effect":"Deny",
"Action":"rds:CreateDBInstance",
"Resource":"*",
"Condition":{
"NumericNotEquals":{
"rds:Piops":"0"
}
}
}
]
}
Example 3: Limit the Set of Tag Keys and Values That Can Be Used to Tag a
Resource
The following policy uses an RDS condition key and allows the addition of a tag with the key stage to be
added to a resource with the values test, qa, and production.
1031
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
{
"Version" : "2012-10-17",
"Statement" : [{
"Effect" : "Allow",
"Action" : [ "rds:AddTagsToResource", "rds:RemoveTagsFromResource"
],
"Resource" : "*",
"Condition" : { "streq" : { "rds:req-tag/stage" : [ "test", "qa",
"production" ] } }
}
]
}
}
For example, suppose that you add a tag named environment to your DB instances with values such as
beta, staging, production, and so on. If you do, you can create a policy that restricts certain users to
DB instances based on the environment tag value.
Note
Custom tag identifiers are case-sensitive.
The following table lists the RDS tag identifiers that you can use in a Condition element.
snapshot-tag DB snapshots
cluster-tag DB clusters
"Condition":{"StringEquals":{"rds:rds-tag-identifier/tag-name": ["value"]} }
For example, the following Condition element applies to DB instances with a tag named environment
and a tag value of production.
1032
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
"Condition":{"StringEquals":{"rds:db-tag/environment": ["production"]} }
For information about creating tags, see Tagging Amazon RDS Resources (p. 340).
Important
If you manage access to your RDS resources using tagging, we recommend that you secure
access to the tags for your RDS resources. You can manage access to tags by creating policies
for the AddTagsToResource and RemoveTagsFromResource actions. For example, the
following policy denies users the ability to add or remove tags for all resources. You can then
create policies to allow specific users to add or remove tags.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyTagUpdates",
"Effect":"Deny",
"Action":[
"rds:AddTagsToResource",
"rds:RemoveTagsFromResource"
],
"Resource":"*"
}
]
}
To see a list of Aurora actions, see Actions Defined by Amazon RDS in the IAM User Guide.
Example 1: Grant Permission for Actions on a Resource with a Specific Tag with Two Different
Values
The following policy allows permission to perform the ModifyDBInstance and CreateDBSnapshot
APIs on DB instances with either the stage tag set to development or test.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowDevTestCreate",
"Effect":"Allow",
"Action":[
"rds:ModifyDBInstance",
"rds:CreateDBSnapshot"
],
"Resource":"*",
"Condition":{
"StringEquals":{
"rds:db-tag/stage":[
"development",
"test"
]
}
}
}
1033
Amazon Aurora User Guide for Aurora
Identity-Based Policy Examples
]
}
Example 2: Explicitly Deny Permission to Create a DB Instance that Uses Specified DB Parameter
Groups
The following policy explicitly denies permission to create a DB instance that uses DB parameter groups
with specific tag values. You might apply this policy if you require that a specific customer-created DB
parameter group always be used when creating DB instances. Policies that use Deny are most often used
to restrict access that was granted by a broader policy.
Explicitly denying permission supersedes any other permissions granted. This ensures that identities to
not accidentally get permission that you never want to grant.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyProductionCreate",
"Effect":"Deny",
"Action":"rds:CreateDBInstance",
"Resource":"*",
"Condition":{
"StringEquals":{
"rds:pg-tag/usage":"prod"
}
}
}
]
}
Example 3: Grant Permission for Actions on a DB Instance with an Instance Name that is Prefixed
with a User Name
The following policy allows permission to call any API (except to AddTagsToResource or
RemoveTagsFromResource) on a DB instance that has a DB instance name that is prefixed with the
user's name and that has a tag called stage equal to devo or that has no tag called stage.
The Resource line in the policy identifies a resource by its Amazon Resource Name (ARN). For more
information about using ARNs with Amazon Aurora resources, see Working with Amazon Resource
Names (ARNs) in Amazon RDS (p. 345).
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowFullDevAccessNoTags",
"Effect":"Allow",
"NotAction":[
"rds:AddTagsToResource",
"rds:RemoveTagsFromResource"
],
"Resource":"arn:aws:rds:*:123456789012:db:${aws:username}*",
"Condition":{
"StringEqualsIfExists":{
"rds:db-tag/stage":"devo"
}
}
}
]
}
1034
Amazon Aurora User Guide for Aurora
IAM Database Authentication
An authentication token is a unique string of characters that Amazon Aurora generates on request.
Authentication tokens are generated using AWS Signature Version 4. Each token has a lifetime of 15
minutes. You don't need to store user credentials in the database, because authentication is managed
externally using IAM. You can also still use standard database authentication.
• Network traffic to and from the database is encrypted using Secure Sockets Layer (SSL).
• You can use IAM to centrally manage access to your database resources, instead of managing access
individually on each DB cluster.
• For applications running on Amazon EC2, you can use profile credentials specific to your EC2 instance
to access your database instead of a password, for greater security.
Topics
• Availability for IAM Database Authentication (p. 1035)
• MySQL Limitations for IAM Database Authentication (p. 1035)
• PostgreSQL Limitations for IAM Database Authentication (p. 1036)
• Enabling and Disabling IAM Database Authentication (p. 1036)
• Creating and Using an IAM Policy for IAM Database Access (p. 1037)
• Creating a Database Account Using IAM Authentication (p. 1040)
• Connecting to Your DB Cluster Using IAM Authentication (p. 1041)
• Aurora with MySQL compatibility version 1.10 or higher. All DB instance classes are supported, except
for db.t2.small and db.t3.small.
• Aurora with PostgreSQL compatibility, PostgreSQL versions 9.6.9 and 10.4 or higher.
The database engines that work with Amazon Aurora don't impose any limits on authentication attempts
per second. However, when you use IAM database authentication, your application must generate
an authentication token. Your application then uses that token to connect to the DB cluster. If you
exceed the limit of maximum new connections per second, then the extra overhead of IAM database
authentication can cause connection throttling. The extra overhead can cause even existing connections
to drop. For information about the maximum total connections for Aurora MySQL, see Maximum
Connections to an Aurora MySQL DB Instance (p. 550).
Currently, Aurora MySQL parallel query doesn't support IAM database authentication.
1035
Amazon Aurora User Guide for Aurora
IAM Database Authentication
• Use IAM database authentication as a mechanism for temporary, personal access to databases.
• Use IAM database authentication only for workloads that can be easily retried.
• Don't use IAM database authentication if your application requires more than 200 new connections per
second.
• The maximum number of connections per second for your database cluster may be limited depending
on the cluster type and your workload.
Console
To create a new DB cluster with IAM authentication by using the console, see Creating an Amazon Aurora
DB Cluster (p. 101).
Each creation workflow has a Configure Advanced Settings page, where you can enable IAM DB
authentication. In that page's Database Options section, choose Yes for Enable IAM DB Authentication.
To restore a DB cluster
1036
Amazon Aurora User Guide for Aurora
IAM Database Authentication
AWS CLI
To create a new DB cluster with IAM authentication by using the AWS CLI, use the create-db-cluster
command. Specify the --enable-iam-database-authentication option.
To update an existing DB cluster to have or not have IAM authentication, use the AWS CLI command
modify-db-cluster. Specify either the --enable-iam-database-authentication or --no-
enable-iam-database-authentication option, as appropriate.
Note
Make sure that all affected DB instances are compatible with IAM authentication. Check the
compatibility requirements in Availability for IAM Database Authentication (p. 1035). For an
Aurora DB cluster, you can only enable IAM authentication if all DB instances in the cluster are
compatible with IAM.
By default, Aurora performs the modification during the next maintenance window. If you want to
override this and enable IAM DB authentication as soon as possible, use the --apply-immediately
parameter.
If you are restoring a DB cluster, use one of the following AWS CLI commands:
• restore-db-cluster-to-point-in-time
• restore-db-cluster-from-db-snapshot
The IAM database authentication setting defaults to that of the source snapshot. To change this
setting, set the --enable-iam-database-authentication or --no-enable-iam-database-
authentication option, as appropriate.
RDS API
To create a new DB instance with IAM authentication by using the API, use the API operation
CreateDBCluster. Set the EnableIAMDatabaseAuthentication parameter to true.
To update an existing DB cluster to have IAM authentication, use the API operation ModifyDBCluster.
Set the EnableIAMDatabaseAuthentication parameter to true to enable IAM authentication, or
false to disable it.
Note
Make sure that all affected DB instances are compatible with IAM authentication. Check the
compatibility requirements in Availability for IAM Database Authentication (p. 1035). For an
Aurora DB cluster, you can only enable IAM authentication if all DB instances in the cluster are
compatible with IAM.
If you are restoring a DB cluster, use one of the following API operations:
• RestoreDBClusterToPointInTime
• RestoreDBClusterFromSnapshot
The IAM database authentication setting defaults to that of the source snapshot. To change this setting,
set the EnableIAMDatabaseAuthentication parameter to true to enable IAM authentication, or
false to disable it.
1037
Amazon Aurora User Guide for Aurora
IAM Database Authentication
The following example policy allows an IAM user to connect to a DB cluster using IAM database
authentication.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:us-east-2:1234567890:dbuser:cluster-ABCDEFGHIJKL01234/db_user"
]
}
]
}
Important
An IAM administrator user can access DB clusters without explicit permissions in an IAM policy.
The example in Create an IAM User (p. 74) creates an IAM administrator user. If you want to
restrict administrator access to DB clusters, you can create an IAM role with the appropriate,
lesser privileged permissions and assign it to the administrator.
Note
Don't confuse the rds-db: prefix with other RDS API operation prefixes that begin with
rds:. You use the rds-db: prefix and the rds-db:connect action only for IAM database
authentication. They aren't valid in any other context.
Currently, the IAM console displays an error for policies with the rds-db:connect action. You
can ignore this error.
The example policy includes a single statement with the following elements:
• Effect – Specify Allow to grant access to the DB cluster. If you don't explicitly allow access, then
access is denied by default.
• Action – Specify rds-db:connect to allow connections to the DB cluster.
• Resource – Specify an Amazon Resource Name (ARN) that describes one database account in one DB
cluster. The ARN format is as follows.
arn:aws:rds-db:region:account-id:dbuser:DbClusterResourceId/db-user-name
To find a DB cluster resource ID in the AWS Management Console for Amazon Aurora, choose the
DB cluster to see its details. Then choose the Configuration tab. The Resource ID is shown in the
Configuration section.
Alternatively, you can use the AWS CLI command to list the identifiers and resource IDs for all of
your DB cluster in the current AWS Region, as shown following.
1038
Amazon Aurora User Guide for Aurora
IAM Database Authentication
• db-user-name is the name of the database account to associate with IAM authentication. In the
example policy, the database account is db_user.
You can construct other ARNs to support various access patterns. The following policy allows access to
two different database accounts in a DB cluster.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:us-east-2:123456789012:dbuser:cluster-ABCDEFGHIJKL01234/
jane_doe",
"arn:aws:rds-db:us-east-2:123456789012:dbuser:cluster-ABCDEFGHIJKL01234/
mary_roe"
]
}
]
}
The following policy uses the "*" character to match all DB clusters and database accounts for a
particular AWS account and AWS Region.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:us-east-2:1234567890:dbuser:*/*"
]
}
]
}
The following policy matches all of the DB clusters for a particular AWS account and AWS Region.
However, the policy only grants access to DB clusters that have a jane_doe database account.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
1039
Amazon Aurora User Guide for Aurora
IAM Database Authentication
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:us-east-2:123456789012:dbuser:*/jane_doe"
]
}
]
}
The IAM user or role has access to only those databases that the database user does. For example,
suppose that your DB cluster has a database named dev, and another database named test. If the
database user jane_doe has access only to dev, any IAM users or roles that access that DB cluster with
the jane_doe user also have access only to dev. This access restriction is also true for other database
objects, such as tables, views, and so on.
As you work through the tutorial, you can use one of the policy examples shown in this section as
a starting point and tailor it to your needs. At the end of the tutorial, you have an IAM user with an
attached policy that can make use of the rds-db:connect action.
Note
You can map multiple IAM users or roles to the same database user account. For example,
suppose that your IAM policy specified the following resource ARN.
arn:aws:rds-db:us-east-2:123456789012:dbuser:cluster-12ABC34DEFG5HIJ6KLMNOP78QR/
jane_doe
If you attach the policy to IAM users Jane, Bob, and Diego, then each of those users can connect
to the specified DB cluster using the jane_doe database account.
1040
Amazon Aurora User Guide for Aurora
IAM Database Authentication
The IDENTIFIED WITH clause allows MySQL to use the AWSAuthenticationPlugin to authenticate
the database account (jane_doe). The AS 'RDS' clause refers to the authentication method, and the
specified database account should have the same name as the IAM user or role. In this example, both the
database account and the IAM user or role are named jane_doe.
Note
If you see the following message, it means that the AWS-provided plugin is not available for the
current DB cluster.
ERROR 1524 (HY000): Plugin 'AWSAuthenticationPlugin' is not loaded
To troubleshoot this error, verify that you are using a supported configuration and that
you have enabled IAM database authentication on your DB cluster. For more information,
see Availability for IAM Database Authentication (p. 1035) and Enabling and Disabling IAM
Database Authentication (p. 1036).
After you create an account using AWSAuthenticationPlugin, you manage it in the same way as
other database accounts. For example, you can modify account privileges with GRANT and REVOKE
statements, or modify various account attributes with the ALTER USER statement.
Every authentication token must be accompanied by a valid signature, using AWS signature version 4.
(For more information, see Signature Version 4 Signing Process in the AWS General Reference.) The AWS
CLI and the AWS SDK for Java can automatically sign each token you create.
You can use an authentication token when you connect to Amazon Aurora from another AWS service,
such as AWS Lambda. By using a token, you can avoid placing a password in your code. Alternatively, you
can use the AWS SDK for Java to programmatically create and programmatically sign an authentication
token.
After you have a signed IAM authentication token, you can connect to an Aurora DB cluster. Following,
you can find out how to do this using either a command line tool or the AWS SDK for Java.
For more information, see Use IAM authentication to connect with SQL Workbench/J to Amazon Aurora
MySQL or Amazon RDS for MySQL.
Topics
• Connecting to Your DB Cluster Using IAM Authentication from the Command Line: AWS CLI and
mysql Client (p. 1041)
• Connecting to Your DB Cluster Using IAM Authentication from the Command Line: AWS CLI and psql
Client (p. 1043)
• Connecting to Your DB Cluster Using IAM Authentication and the AWS SDK for Java (p. 1044)
1041
Amazon Aurora User Guide for Aurora
IAM Database Authentication
Topics
• Generating an IAM Authentication Token (p. 1042)
• Connecting to a DB Cluster (p. 1042)
The following example shows how to get a signed authentication token using the AWS CLI.
• --hostname – The host name of the DB cluster that you want to access.
• --port – The port number used for connecting to your DB cluster.
• --region – The AWS Region where the DB cluster is running.
• --username – The database account that you want to access.
The first several characters of the token look like the following.
rdsmysql.cdgmuqiadpid.us-west-2.rds.amazonaws.com:3306/?Action=connect&DBUser=jane_doe&X-
Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900...
Connecting to a DB Cluster
• --host – The host name of the DB cluster that you want to access.
• --port – The port number used for connecting to your DB cluster.
• --ssl-ca – The SSL certificate file that contains the public key. For more information, see Using SSL/
TLS to Encrypt a Connection to a DB Cluster (p. 1005).
• --enable-cleartext-plugin – A value that specifies that AWSAuthenticationPlugin must be
used for this connection.
• --user – The database account that you want to access.
• --password – A signed IAM authentication token.
The authentication token consists of several hundred characters. It can be unwieldy on the command
line. One way to work around this is to save the token to an environment variable, and then use that
variable when you connect. The following example shows one way to perform this workaround.
RDSHOST="rdsmysql.cdgmuqiadpid.us-west-2.rds.amazonaws.com"
TOKEN="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 3306 --region us-west-2
--username jane_doe )"
1042
Amazon Aurora User Guide for Aurora
IAM Database Authentication
When you connect using AWSAuthenticationPlugin, the connection is secured using SSL. To verify
this, type the following at the mysql> command prompt.
+---------------+-------------+
| Variable_name | Value
|
+---------------+-------------+
| ... | ...
| Ssl_cipher | AES256-SHA
|
| ... | ...
| Ssl_version | TLSv1.1
|
| ... | ...
+-----------------------------+
Topics
• Generating an IAM Authentication Token (p. 1043)
• Connecting to an Aurora PostgreSQL Cluster (p. 1044)
export RDSHOST="mypostgres-cluster.cluster-cdgmuqiadpid.us-west-2.rds.amazonaws.com"
export PGPASSWORD="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 5432 --
region us-west-2 --username jane_doe )"
• --hostname – The host name of the DB cluster (cluster endpoint) that you want to access.
• --port – The port number used for connecting to your DB cluster.
• --region – The AWS Region where the DB cluster is running.
• --username – The database account that you want to access.
The first several characters of the generated token look like the following.
1043
Amazon Aurora User Guide for Aurora
IAM Database Authentication
mypostgres-cluster.cluster-cdgmuqiadpid.us-west-2.rds.amazonaws.com:5432/?
Action=connect&DBUser=jane_doe&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900...
• host – The host name of the DB cluster (cluster endpoint) that you want to access.
• port – The port number used for connecting to your DB cluster.
• sslmode – The SSL mode to use. When you use sslmode=verify-full, the SSL connection verifies
the DB cluster endpoint against the endpoint in the SSL certificate.
• sslrootcert – The SSL certificate file that contains the public key. For more information, see Using
SSL with a PostgreSQL DB Instance.
• dbname – The database that you want to access.
• user – The database account that you want to access.
The following example shows using psql to connect. In the example psql uses the environment variable
PGPASSWORD that was set when the token was generated in the previous section.
Connecting to Your DB Cluster Using IAM Authentication and the AWS SDK for
Java
You can connect from the command line to an Aurora MySQL or Aurora PostgreSQL DB cluster with the
AWS SDK for Java as described following.
Topics
• Generating an IAM Authentication Token (p. 1044)
• Manually Constructing an IAM Authentication Token (p. 1045)
• Connecting to a DB Cluster (p. 1048)
After you create an instance of RdsIamAuthTokenGenerator, you can call the getAuthToken
method to obtain a signed token. Provide the AWS Region, host name, port number, and user name. The
following code example illustrates how to do this.
package com.amazonaws.codesamples;
1044
Amazon Aurora User Guide for Aurora
IAM Database Authentication
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.services.rds.auth.GetIamAuthTokenRequest;
import com.amazonaws.services.rds.auth.RdsIamAuthTokenGenerator;
return authToken;
}
However, you can also construct and sign an authentication token manually, as shown in the following
code example.
package com.amazonaws.codesamples;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.auth.SigningAlgorithm;
import com.amazonaws.util.BinaryUtils;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.SortedMap;
import java.util.TreeMap;
1045
Amazon Aurora User Guide for Aurora
IAM Database Authentication
//Step 1: Create a canonical request date should be in format YYYYMMDD and dateTime
should be in format YYYYMMDDTHHMMSSZ
public static String createCanonicalString(String user, String accessKey, String date,
String dateTime, String region, String expiryPeriod, String hostName, String port) throws
Exception {
canonicalQueryParameters.put("Action", action);
canonicalQueryParameters.put("DBUser", user);
canonicalQueryParameters.put("X-Amz-Algorithm", "AWS4-HMAC-SHA256");
canonicalQueryParameters.put("X-Amz-Credential", accessKey + "%2F" + date + "%2F" +
region + "%2F" + serviceName + "%2Faws4_request");
canonicalQueryParameters.put("X-Amz-Date", dateTime);
canonicalQueryParameters.put("X-Amz-Expires", expiryPeriod);
canonicalQueryParameters.put("X-Amz-SignedHeaders", signedHeader);
1046
Amazon Aurora User Guide for Aurora
IAM Database Authentication
1047
Amazon Aurora User Guide for Aurora
IAM Database Authentication
Connecting to a DB Cluster
The following code example shows how to generate an authentication token, and then use it to connect
to a cluster running MySQL.
To run this code example, you need the AWS SDK for Java, found on the AWS site. In addition, you need
the following:
To download a certificate for your AWS Region, see Intermediate Certificates (p. 1006). Place the
SSL certificate in the same directory as this Java program file, so that the class loader can find the
certificate at runtime.
This code example obtains AWS credentials from the default credential provider chain.
package com.amazonaws.samples;
1048
Amazon Aurora User Guide for Aurora
IAM Database Authentication
import com.amazonaws.services.rds.auth.RdsIamAuthTokenGenerator;
import com.amazonaws.services.rds.auth.GetIamAuthTokenRequest;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.net.URL;
//Configuration parameters for the generation of the IAM Database Authentication token
private static final String RDS_INSTANCE_HOSTNAME = "rdsmysql.cdgmuqiadpid.us-
west-2.rds.amazonaws.com";
private static final int RDS_INSTANCE_PORT = 3306;
private static final String REGION_NAME = "us-west-2";
private static final String DB_USER = "jane_doe";
private static final String JDBC_URL = "jdbc:mysql://" + RDS_INSTANCE_HOSTNAME + ":" +
RDS_INSTANCE_PORT;
clearSslProperties();
1049
Amazon Aurora User Guide for Aurora
IAM Database Authentication
/**
* This method returns a connection to the db instance authenticated using IAM Database
Authentication
* @return
* @throws Exception
*/
private static Connection getDBConnectionUsingIam() throws Exception {
setSslProperties();
return DriverManager.getConnection(JDBC_URL, setMySqlConnectionProperties());
}
/**
* This method sets the mysql connection properties which includes the IAM Database
Authentication token
* as the password. It also specifies that SSL verification is required.
* @return
*/
private static Properties setMySqlConnectionProperties() {
Properties mysqlConnectionProperties = new Properties();
mysqlConnectionProperties.setProperty("verifyServerCertificate","true");
mysqlConnectionProperties.setProperty("useSSL", "true");
mysqlConnectionProperties.setProperty("user",DB_USER);
mysqlConnectionProperties.setProperty("password",generateAuthToken());
return mysqlConnectionProperties;
}
/**
* This method generates the IAM Auth Token.
* An example IAM Auth Token would look like follows:
* btusi123.cmz7kenwo2ye.rds.cn-north-1.amazonaws.com.cn:3306/?
Action=connect&DBUser=iamtestuser&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-
Date=20171003T010726Z&X-Amz-SignedHeaders=host&X-Amz-Expires=899&X-Amz-
Credential=AKIAPFXHGVDI5RNFO4AQ%2F20171003%2Fcn-north-1%2Frds-db%2Faws4_request&X-Amz-
Signature=f9f45ef96c1f770cdad11a53e33ffa4c3730bc03fdee820cfdf1322eed15483b
* @return
*/
private static String generateAuthToken() {
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(AWS_ACCESS_KEY,
AWS_SECRET_KEY);
.hostname(RDS_INSTANCE_HOSTNAME).port(RDS_INSTANCE_PORT).userName(DB_USER).build());
}
/**
* This method sets the SSL properties which specify the key store file, its type and
password:
* @throws Exception
*/
private static void setSslProperties() throws Exception {
System.setProperty("javax.net.ssl.trustStore", createKeyStoreFile());
System.setProperty("javax.net.ssl.trustStoreType", KEY_STORE_TYPE);
System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_KEY_STORE_PASSWORD);
}
/**
* This method returns the path of the Key Store File needed for the SSL verification
during the IAM Database Authentication to
* the db instance.
* @return
1050
Amazon Aurora User Guide for Aurora
Troubleshooting
* @throws Exception
*/
private static String createKeyStoreFile() throws Exception {
return createKeyStoreFile(createCertificate()).getPath();
}
/**
* This method generates the SSL certificate
* @return
* @throws Exception
*/
private static X509Certificate createCertificate() throws Exception {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
URL url = new File(SSL_CERTIFICATE).toURI().toURL();
if (url == null) {
throw new Exception();
}
try (InputStream certInputStream = url.openStream()) {
return (X509Certificate) certFactory.generateCertificate(certInputStream);
}
}
/**
* This method creates the Key Store File
* @param rootX509Certificate - the SSL certificate to be stored in the KeyStore
* @return
* @throws Exception
*/
private static File createKeyStoreFile(X509Certificate rootX509Certificate) throws
Exception {
File keyStoreFile = File.createTempFile(KEY_STORE_FILE_PREFIX,
KEY_STORE_FILE_SUFFIX);
try (FileOutputStream fos = new FileOutputStream(keyStoreFile.getPath())) {
KeyStore ks = KeyStore.getInstance(KEY_STORE_TYPE, KEY_STORE_PROVIDER);
ks.load(null);
ks.setCertificateEntry("rootCaCertificate", rootX509Certificate);
ks.store(fos, DEFAULT_KEY_STORE_PASSWORD.toCharArray());
}
return keyStoreFile;
}
/**
* This method clears the SSL properties.
* @throws Exception
*/
private static void clearSslProperties() throws Exception {
System.clearProperty("javax.net.ssl.trustStore");
System.clearProperty("javax.net.ssl.trustStoreType");
System.clearProperty("javax.net.ssl.trustStorePassword");
}
Topics
• I Am Not Authorized to Perform an Action in Aurora (p. 1052)
• I Am Not Authorized to Perform iam:PassRole (p. 1052)
• I Want to View My Access Keys (p. 1052)
1051
Amazon Aurora User Guide for Aurora
Troubleshooting
• I'm an Administrator and Want to Allow Others to Access Aurora (p. 1053)
• I Want to Allow People Outside of My AWS Account to Access My Aurora Resources (p. 1053)
The following example error occurs when the mateojackson IAM user tries to use the console to view
details about a widget but does not have rds:GetWidget permissions.
In this case, Mateo asks his administrator to update his policies to allow him to access the my-example-
widget resource using the rds:GetWidget action.
Some AWS services allow you to pass an existing role to that service, instead of creating a new service
role or service-linked role. To do this, you must have permissions to pass the role to the service.
The following example error occurs when an IAM user named marymajor tries to use the console to
perform an action in Aurora. However, the action requires the service to have permissions granted by a
service role. Mary does not have permissions to pass the role to the service.
In this case, Mary asks her administrator to update her policies to allow her to perform the
iam:PassRole action.
Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE) and a secret
access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY). Like a user name and
password, you must use both the access key ID and secret access key together to authenticate your
requests. Manage your access keys as securely as you do your user name and password.
Important
Do not provide your access keys to a third party, even to help find your canonical user ID. By
doing this, you might give someone permanent access to your account.
When you create an access key pair, you are prompted to save the access key ID and secret access key in
a secure location. The secret access key is available only at the time you create it. If you lose your secret
access key, you must add new access keys to your IAM user. You can have a maximum of two access keys.
If you already have two, you must delete one key pair before creating a new one. To view instructions,
see Managing Access Keys in the IAM User Guide.
1052
Amazon Aurora User Guide for Aurora
Kerberos Authentication
To get started right away, see Creating Your First IAM Delegated User and Group in the IAM User Guide.
• To learn whether Aurora supports these features, see How Amazon Aurora Works with IAM (p. 1023).
• To learn how to provide access to your resources across AWS accounts that you own, see Providing
Access to an IAM User in Another AWS Account That You Own in the IAM User Guide.
• To learn how to provide access to your resources to third-party AWS accounts, see Providing Access to
AWS Accounts Owned by Third Parties in the IAM User Guide.
• To learn how to provide access through identity federation, see Providing Access to Externally
Authenticated Users (Identity Federation) in the IAM User Guide.
• To learn the difference between using roles and resource-based policies for cross-account access, see
How IAM Roles Differ from Resource-based Policies in the IAM User Guide.
Kerberos Authentication
Amazon Aurora supports 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.
Amazon Aurora support for Kerberos and Active Directory provides the benefits of single sign-on and
centralized authentication of database users. You can keep your user credentials in Active Directory.
Active Directory provides a centralized place for storing and managing credentials for multiple DB
instances.
You can enable your database users to authenticate against DB instances in two ways. They can use
credentials stored either in AWS Directory Service for Microsoft Active Directory or in your on-premises
Active Directory.
Currently, Aurora supports Kerberos authentication for PostgreSQL DB clusters. For more information,
see Using Kerberos Authentication with Aurora PostgreSQL (p. 939).
1053
Amazon Aurora User Guide for Aurora
Logging and Monitoring
solution so that you can more easily debug a multi-point failure if one occurs. AWS provides several tools
for monitoring your Amazon Aurora resources and responding to potential incidents:
Using Amazon CloudWatch alarms, you watch a single metric over a time period that you specify.
If the metric exceeds a given threshold, a notification is sent to an Amazon SNS topic or AWS Auto
Scaling policy. CloudWatch alarms do not invoke actions because they are in a particular state.
Rather the state must have changed and been maintained for a specified number of periods. For
more information, see Monitoring with Amazon CloudWatch (p. 356).
AWS CloudTrail Logs
CloudTrail provides a record of actions taken by a user, role, or an AWS service in Amazon Aurora.
CloudTrail captures all API calls for Amazon Aurora as events, including calls from the console and
from code calls to Amazon RDS API operations. Using the information collected by CloudTrail, you
can determine the request that was made to Amazon Aurora, the IP address from which the request
was made, who made the request, when it was made, and additional details. For more information,
see Logging Amazon RDS API Calls with AWS CloudTrail (p. 501).
Enhanced Monitoring
Amazon Aurora provides metrics in real time for the operating system (OS) that your DB cluster
runs on. You can view the metrics for your DB cluster using the console, or consume the Enhanced
Monitoring JSON output from Amazon CloudWatch Logs in a monitoring system of your choice. For
more information, see Enhanced Monitoring (p. 390).
Amazon RDS Performance Insights
Performance Insights expands on existing Amazon Aurora monitoring features to illustrate your
database's performance and help you analyze any issues that affect it. With the Performance
Insights dashboard, you can visualize the database load and filter the load by waits, SQL statements,
hosts, or users. For more information, see Using Amazon RDS Performance Insights (p. 398).
Database Logs
You can view, download, and watch database logs using the AWS Management Console, AWS CLI, or
RDS API. For more information, see Amazon Aurora Database Log Files (p. 489).
Amazon Aurora Recommendations
Amazon Aurora uses the Amazon Simple Notification Service (Amazon SNS) to provide notification
when an Amazon Aurora 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.
For more information, see Using Amazon RDS Event Notification (p. 465).
AWS Trusted Advisor
Trusted Advisor draws upon best practices learned from serving hundreds of thousands of AWS
customers. Trusted Advisor inspects your AWS environment and then makes recommendations
when opportunities exist to save money, improve system availability and performance, or help
close security gaps. All AWS customers have access to five Trusted Advisor checks. Customers with a
Business or Enterprise support plan can view all Trusted Advisor checks.
1054
Amazon Aurora User Guide for Aurora
Logging and Monitoring
For more information on these checks, see Trusted Advisor Best Practices (Checks).
Database Activity Streams
For Aurora PostgreSQL, database activity streams can protect your databases from internal threats
by controlling DBA access to the database activity streams. Thus, the collection, transmission,
storage, and subsequent processing of the database activity stream is beyond the access of the DBAs
that manage the database. Database activity streams can provide safeguards for your database and
meet compliance and regulatory requirements. For more information, see Using Database Activity
Streams with Aurora PostgreSQL (p. 447).
For more information about monitoring Aurora see Monitoring an Amazon Aurora DB Cluster (p. 353).
1055
Amazon Aurora User Guide for Aurora
Compliance Validation
For a list of AWS services in scope of specific compliance programs, see AWS Services in Scope by
Compliance Program. For general information, see AWS Compliance Programs.
You can download third-party audit reports using AWS Artifact. For more information, see Downloading
Reports in AWS Artifact.
Your compliance responsibility when using Amazon Aurora is determined by the sensitivity of your
data, your organization’s compliance objectives, and applicable laws and regulations. AWS provides the
following resources to help with compliance:
• Security and Compliance Quick Start Guides – These deployment guides discuss architectural
considerations and provide steps for deploying security- and compliance-focused baseline
environments on AWS.
• Architecting for HIPAA Security and Compliance Whitepaper – This whitepaper describes how
companies can use AWS to create HIPAA-compliant applications.
• AWS Compliance Resources – This collection of workbooks and guides that might apply to your
industry and location.
• AWS Config – This AWS service assesses how well your resource configurations comply with internal
practices, industry guidelines, and regulations.
• AWS Security Hub – This AWS service provides a comprehensive view of your security state within AWS
that helps you check your compliance with security industry standards and best practices.
1056
Amazon Aurora User Guide for Aurora
Resilience
For more information about AWS Regions and Availability Zones, see AWS Global Infrastructure.
In addition to the AWS global infrastructure, Aurora offers features to help support your data resiliency
and backup needs.
If you want to retain a backup beyond the backup retention period, you can also take a snapshot of the
data in your cluster volume. Aurora retains incremental restore data for the entire backup retention
period. Thus, you need to create a snapshot only for data that you want to retain beyond the backup
retention period. You can create a new DB cluster from the snapshot.
You can recover your data by creating a new Aurora DB cluster from the backup data that Aurora
retains, or from a DB cluster snapshot that you have saved. You can quickly create a new copy of a DB
cluster from backup data to any point in time during your backup retention period. The continuous and
incremental nature of Aurora backups during the backup retention period means you don't need to take
frequent snapshots of your data to improve restore times.
For more information, see Backing Up and Restoring an Amazon Aurora DB Cluster (p. 286).
Replication
Aurora Replicas are independent endpoints in an Aurora DB cluster, best used for scaling read operations
and increasing availability. Up to 15 Aurora Replicas can be distributed across the Availability Zones that
a DB cluster spans within an AWS Region. The DB cluster volume is made up of multiple copies of the
data for the DB cluster. However, the data in the cluster volume is represented as a single, logical volume
to the primary DB instance and to Aurora Replicas in the DB cluster. If the primary DB instance fails, an
Aurora Replica is promoted to be the primary DB instance.
Aurora also supports replication options that are specific to Aurora MySQL and Aurora PostgreSQL.
For more information, see Replication with Amazon Aurora (p. 60).
Failover
Aurora stores copies of the data in a DB cluster across multiple Availability Zones in a single AWS Region.
This storage occurs regardless of whether the DB instances in the DB cluster span multiple Availability
Zones. When you create Aurora Replicas across Availability Zones, Aurora automatically provisions and
maintains them synchronously. The primary DB instance is synchronously replicated across Availability
Zones to Aurora Replicas to provide data redundancy, eliminate I/O freezes, and minimize latency spikes
during system backups. Running a DB cluster with high availability can enhance availability during
1057
Amazon Aurora User Guide for Aurora
Failover
planned system maintenance, and help protect your databases against failure and Availability Zone
disruption.
For more information, see High Availability for Aurora (p. 40).
1058
Amazon Aurora User Guide for Aurora
Infrastructure Security
You use AWS published API calls to access Amazon Aurora through the network. Clients must support
Transport Layer Security (TLS) 1.0. We recommend TLS 1.2 or later. Clients must also support cipher
suites with perfect forward secrecy (PFS) such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve
Ephemeral Diffie-Hellman (ECDHE). Most modern systems such as Java 7 and later support these modes.
Additionally, requests must be signed by using an access key ID and a secret access key that is associated
with an IAM principal. Or you can use the AWS Security Token Service (AWS STS) to generate temporary
security credentials to sign requests.
Security Groups
Security groups control the access that traffic has in and out of a DB instance. By default, network access
is turned off to a DB instance. You can specify rules in a security group that allow access from an IP
address range, port, or security group. After ingress rules are configured, the same rules apply to all DB
instances that are associated with that security group.
For more information, see Controlling Access with Security Groups (p. 1060).
Public Accessibility
When you launch a DB instance inside a virtual private cloud (VPC) based on the Amazon VPC service,
you can turn on or off public accessibility for that instance. To designate whether the DB instance
that you create has a DNS name that resolves to a public IP address, you use the Public accessibility
parameter. By using this parameter, you can designate whether there is public access to the DB instance.
You can modify a DB instance to turn on or off public accessibility by modifying the Public accessibility
parameter.
For more information, see Hiding a DB Instance in a VPC from the Internet (p. 1079).
• Create an individual IAM user for each person who manages Amazon Aurora resources, including
yourself. Don't use AWS root credentials to manage Amazon Aurora resources.
• Grant each user the minimum set of permissions required to perform his or her duties.
• Use IAM groups to effectively manage permissions for multiple users.
• Rotate your IAM credentials regularly.
• Configure AWS Secrets Manager to automatically rotate the secrets for Amazon Aurora. For more
information, see Rotating Your AWS Secrets Manager Secrets in the AWS Secrets Manager User Guide.
For more information about IAM, see AWS Identity and Access Management. For information on IAM best
practices, see IAM Best Practices.
1059
Amazon Aurora User Guide for Aurora
Controlling Access with Security Groups
Use the AWS Management Console, the AWS CLI, or the RDS API to change the password for your master
user. If you use another tool, such as a SQL client, to change the master user password, it might result in
privileges being revoked for the user unintentionally.
When you create rules for your VPC security group that allow access to the instances in your VPC, you
must specify a port for each range of addresses that the rule allows access for. For example, if you want
to enable SSH access to instances in the VPC, then you create a rule allowing access to TCP port 22 for
the specified range of addresses.
You can configure multiple VPC security groups that allow access to different ports for different
instances in your VPC. For example, you can create a VPC security group that allows access to TCP port
80 for web servers in your VPC. You can then create another VPC security group that allows access to TCP
port 3306 for Aurora MySQL DB instances in your VPC.
Note
In an Aurora DB cluster, the VPC security group associated with the DB cluster is also associated
with all of the DB instances in the DB cluster. If you change the VPC security group for the DB
cluster or for a DB instance, the change is applied automatically to all of the DB instances in the
DB cluster.
For more information on VPC security groups, see Security Groups in the Amazon Virtual Private Cloud
User Guide.
1. Create a VPC security group (for example, sg-appsrv1) and define inbound rules that use the IP
addresses of the client application as the source. This security group allows your client application to
connect to EC2 instances in a VPC that uses this security group.
2. Create an EC2 instance for the application and add the EC2 instance to the VPC security group (sg-
appsrv1) that you created in the previous step. The EC2 instance in the VPC shares the VPC security
group with the DB instance.
3. Create a second VPC security group (for example, sg-dbsrv1) and create a new rule by specifying the
VPC security group that you created in step 1 (sg-appsrv1) as the source.
1060
Amazon Aurora User Guide for Aurora
Creating a VPC Security Group
4. Create a new DB instance and add the DB instance to the VPC security group (sg-dbsrv1) that you
created in the previous step. When you create the DB instance, use the same port number as the one
specified for the VPC security group (sg-dbsrv1) rule that you created in step 3.
For more information about using a VPC, see Amazon Virtual Private Cloud VPCs and Amazon
Aurora (p. 1067).
For information about modifying a DB cluster, see Modifying an Amazon Aurora DB Cluster (p. 232).
1061
Amazon Aurora User Guide for Aurora
Master User Account Privileges
1062
Amazon Aurora User Guide for Aurora
Service-Linked Roles
A service-linked role makes using Amazon Aurora easier because you don’t have to manually add the
necessary permissions. Amazon Aurora defines the permissions of its service-linked roles, and unless
defined otherwise, only Amazon Aurora can assume its roles. The defined permissions include the trust
policy and the permissions policy, and that permissions policy cannot be attached to any other IAM
entity.
You can delete the roles only after first deleting their related resources. This protects your Amazon
Aurora resources because you can't inadvertently remove permission to access the resources.
For information about other services that support service-linked roles, see AWS Services That Work with
IAM and look for the services that have Yes in the Service-Linked Role column. Choose a Yes with a link
to view the service-linked role documentation for that service.
The AWSServiceRoleForRDS service-linked role trusts the following services to assume the role:
• rds.amazonaws.com
The role permissions policy allows Amazon Aurora to complete the following actions on the specified
resources:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CreateNetworkInterface",
"ec2:CreateSecurityGroup",
"ec2:DeleteNetworkInterface",
"ec2:DeleteSecurityGroup",
"ec2:DescribeAvailabilityZones",
"ec2:DescribeInternetGateways",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeVpcAttribute",
"ec2:DescribeVpcs",
"ec2:ModifyNetworkInterfaceAttribute",
"ec2:ModifyVpcEndpoint",
"ec2:RevokeSecurityGroupIngress",
"ec2:CreateVpcEndpoint",
"ec2:DescribeVpcEndpoints",
"ec2:DeleteVpcEndpoints",
"ec2:AssignPrivateIpAddresses",
"ec2:UnassignPrivateIpAddresses"
],
"Resource": "*"
1063
Amazon Aurora User Guide for Aurora
Service-Linked Role Permissions for Amazon Aurora
},
{
"Effect": "Allow",
"Action": [
"sns:Publish"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup"
],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/rds/*",
"arn:aws:logs:*:*:log-group:/aws/docdb/*",
"arn:aws:logs:*:*:log-group:/aws/neptune/*"
]
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/rds/*:log-stream:*",
"arn:aws:logs:*:*:log-group:/aws/docdb/*:log-stream:*",
"arn:aws:logs:*:*:log-group:/aws/neptune/*:log-stream:*"
]
},
{
"Effect": "Allow",
"Action": [
"kinesis:CreateStream",
"kinesis:PutRecord",
"kinesis:PutRecords",
"kinesis:DescribeStream",
"kinesis:SplitShard",
"kinesis:MergeShards",
"kinesis:DeleteStream",
"kinesis:UpdateShardCount"
],
"Resource": [
"arn:aws:kinesis:*:*:stream/aws-rds-das-*"
]
}
]
}
Note
You must configure permissions to allow an IAM entity (such as a user, group, or role) to create,
edit, or delete a service-linked role. If you encounter the following error message:
Unable to create the resource. Verify that you have permission to create service linked role.
Otherwise wait and try again later.
Make sure you have the following permissions enabled:
{
"Action": "iam:CreateServiceLinkedRole",
"Effect": "Allow",
"Resource": "arn:aws:iam::*:role/aws-service-role/rds.amazonaws.com/
AWSServiceRoleForRDS",
1064
Amazon Aurora User Guide for Aurora
Creating a Service-Linked Role for Amazon Aurora
"Condition": {
"StringLike": {
"iam:AWSServiceName":"rds.amazonaws.com"
}
}
}
For more information, see Service-Linked Role Permissions in the IAM User Guide.
If you delete this service-linked role, and then need to create it again, you can use the same process to
recreate the role in your account. When you create a DB cluster, Amazon Aurora creates the service-
linked role for you again.
To check whether the service-linked role has an active session in the IAM console
1. Sign in to the AWS Management Console and open the IAM console at https://
console.aws.amazon.com/iam/.
2. In the navigation pane of the IAM console, choose Roles. Then choose the name (not the check box)
of the AWSServiceRoleForRDS role.
3. On the Summary page for the chosen role, choose the Access Advisor tab.
4. On the Access Advisor tab, review recent activity for the service-linked role.
Note
If you are unsure whether Amazon Aurora is using the AWSServiceRoleForRDS role, you can
try to delete the role. If the service is using the role, then the deletion fails and you can view
the AWS Regions where the role is being used. If the role is being used, then you must wait
1065
Amazon Aurora User Guide for Aurora
Deleting a Service-Linked Role for Amazon Aurora
for the session to end before you can delete the role. You cannot revoke the session for a
service-linked role.
If you want to remove the AWSServiceRoleForRDS role, you must first delete all of your DB clusters.
You can use the IAM console, the IAM CLI, or the IAM API to delete the AWSServiceRoleForRDS service-
linked role. For more information, see Deleting a Service-Linked Role in the IAM User Guide.
1066
Amazon Aurora User Guide for Aurora
Using Amazon Aurora with Amazon VPC
When you use an Amazon 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. There is
no additional cost to run your DB instance in an Amazon VPC.
Accounts that support only the EC2-VPC platform have a default VPC. All new DB instances are created
in the default VPC unless you specify otherwise. If you are a new Amazon Aurora customer, if you have
never created a DB instance before, or if you are creating a DB instance in an AWS Region you have not
used before, you are most likely on the EC2-VPC platform and have a default VPC.
Topics
• How to Create a VPC for Use with Amazon Aurora (p. 1067)
• Scenarios for Accessing a DB Instance in a VPC (p. 1073)
• Working with a DB Instance in a VPC (p. 1077)
• Tutorial: Create an Amazon VPC for Use with a DB Instance (p. 1083)
This documentation only discusses VPC functionality relevant to Amazon Aurora DB clusters. For more
information about Amazon VPC, see Amazon VPC Getting Started Guide and Amazon VPC User Guide.
For information about using a network address translation (NAT) gateway, see NAT Gateways in the
Amazon Virtual Private Cloud User Guide.
1067
Amazon Aurora User Guide for Aurora
Creating a VPC for Aurora
in the default VPC for your AWS account, or you can create a user-defined VPC. For information, see
Amazon Virtual Private Cloud VPCs and Amazon Aurora (p. 1067).
Amazon Aurora optionally can create a VPC and subnet group for you to use with your DB cluster. Doing
this can be helpful if you have never created a VPC, or if you would like to create a new VPC that is
separate from your other VPCs. If you want Amazon Aurora to create a VPC and subnet group for you,
then skip this procedure and see Create an Aurora MySQL DB Cluster (p. 79).
Note
All VPC and EC2 resources that you use with your Aurora DB cluster must be in one of the
regions listed in Regions and Availability Zones (p. 5).
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 to create your VPC
in. This example uses the US East (Ohio) Region.
3. In the upper-left corner, choose VPC Dashboard. Choose Start VPC Wizard to begin creating a VPC.
4. In the Create VPC wizard, choose VPC with a Single Public Subnet. Choose Select.
1068
Amazon Aurora User Guide for Aurora
Creating a VPC for Aurora
1. To add the second subnet to your VPC, in the VPC Dashboard choose Subnets, and then choose Create
Subnet. An Amazon Aurora DB cluster requires at least two VPC subnets.
2. Set the following values in the Create Subnet panel:
• Name tag: gs-subnet2
• VPC: Choose the VPC that you created in the previous step, for example: vpc-a464d1c1
(10.0.0.0/16) | gs-cluster-vpc.
• Availability Zone: us-east-1c
• CIDR block: 10.0.1.0/24
1069
Amazon Aurora User Guide for Aurora
Creating a VPC for Aurora
The last step in creating a VPC for use with your Amazon Aurora DB cluster is to create a VPC security
group, which identifies which network addresses and protocols are allowed to access DB instances in your
VPC.
1. In the VPC Dashboard, choose Security Groups, and then choose Create Security Group.
2. Set the following values in the Create Security Group panel:
1070
Amazon Aurora User Guide for Aurora
Creating a VPC for Aurora
To connect to your Aurora DB cluster, you need to add an inbound rule to your VPC security group that
allows inbound traffic to connect.
1. Determine the IP address to use to connect to the Aurora cluster. You can use the service at https://
checkip.amazonaws.com to determine your public IP address. If you are connecting through an ISP or
from behind your firewall without a static IP address, you need to find out the range of IP addresses
used by client computers.
Warning
If you use 0.0.0.0/0, you enable all IP addresses to access your DB cluster. This
is acceptable for a short time in a test environment, but it's unsafe for production
environments. In production, you'll authorize only a specific IP address or range of addresses
to access your DB cluster.
2. In the VPC Dashboard, choose Security Groups, and then choose the gs-securitygroup1 security
group that you created in the previous procedure.
3. Choose the Inbound tab, and then choose the Edit button.
4. Set the following values for your new inbound rule:
• Type: All Traffic
• Source: The IP address or range from the previous step, for example 203.0.113.25/32.
1071
Amazon Aurora User Guide for Aurora
Creating a VPC for Aurora
1072
Amazon Aurora User Guide for Aurora
Scenarios for Accessing a DB Instance in a VPC
1073
Amazon Aurora User Guide for Aurora
Scenarios for Accessing a DB Instance in a VPC
The simplest way to manage access between EC2 instances and DB instances in the same VPC is to do the
following:
• Create a VPC security group for your DB instances to be in. This security group can be used to restrict
access to the DB instances. For example, you can create a custom rule for this security group that
allows TCP access using the port you assigned to the DB instance when you created it and an IP
address you use to access the DB instance for development or other purposes.
• Create a VPC security group for your EC2 instances (web servers and clients) to be in. This security
group can, if needed, allow access to the EC2 instance from the Internet via the VPC's routing table. For
example, you can set rules on this security group to allow TCP access to the EC2 instance over port 22.
• Create custom rules in the security group for your DB instances that allow connections from the
security group you created for your EC2 instances. This would allow any member of the security group
to access the DB instances.
For a tutorial that shows you how to create a VPC with both public and private subnets for this scenario,
see Tutorial: Create an Amazon VPC for Use with a DB Instance (p. 1083).
1074
Amazon Aurora User Guide for Aurora
Scenarios for Accessing a DB Instance in a VPC
To create a rule in a VPC security group that allows connections from another security group,
do the following:
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc.
2. In the navigation pane, choose Security Groups.
3. Choose or create a security group for which you want to allow access to members of another
security group. In the scenario preceding, this is the security group that you use for your DB
instances. Choose the Inbound Rules tab, and then choose Edit rule.
4. On the Edit inbound rules page, choose Add Rule.
5. From Type, choose one of the All ICMP options. In the Source box, start typing the ID of the security
group; this provides you with a list of security groups. Choose the security group with members that
you want to have access to the resources protected by this security group. In the scenario preceding,
this is the security group that you use for your EC2 instance.
6. Repeat the steps for the TCP protocol by creating a rule with All TCP as the Type and your security
group in the Source box. If you intend to use the UDP protocol, create a rule with All UDP as the
Type and your security group in the Source box.
7. Create a custom TCP rule that permits access via the port you used when you created your DB
instance, such as port 3306 for MySQL. Enter your security group or an IP address to use in the
Source box.
8. Choose Save when you are done.
1075
Amazon Aurora User Guide for Aurora
Scenarios for Accessing a DB Instance in a VPC
A VPC peering connection is a networking connection between two VPCs that enables you to route traffic
between them using private IP addresses. Instances in either VPC can communicate with each other as
if they are within the same network. You can create a VPC peering connection between your own VPCs,
with a VPC in another AWS account, or with a VPC in a different AWS Region. To learn more about VPC
peering, see VPC Peering in the Amazon Virtual Private Cloud User Guide.
Using ClassicLink, you can connect an EC2 instance to a logically isolated database where you define the
IP address range and control the access control lists (ACLs) to manage network traffic. You don't have to
use public IP addresses or tunneling to communicate with the DB instance in the VPC. This arrangement
provides you with higher throughput and lower latency connectivity for inter-instance communications.
To enable ClassicLink between a DB instance in a VPC and an EC2 instance not in a VPC
1. Sign in to the AWS Management Console and open the Amazon VPC console at https://
console.aws.amazon.com/vpc.
2. In the navigation pane, choose Your VPCs.
3. Choose the VPC used by the DB instance.
4. In Actions, choose Enable ClassicLink. In the confirmation dialog box, choose Yes, Enable.
5. On the EC2 console, choose the EC2 instance you want to connect to the DB instance in the VPC.
6. In Actions, choose ClassicLink, and then choose Link to VPC.
7. On the Link to VPC page, choose the security group you want to use, and then choose Link to VPC.
Note
The ClassicLink features are only visible in the consoles for accounts and regions that support
EC2-Classic. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux
Instances.
1076
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
• A VPC of size /16 (for example CIDR: 10.0.0.0/16). This size provides 65,536 private IP addresses.
• A subnet of size /24 (for example CIDR: 10.0.0.0/24). This size provides 256 private IP addresses.
• An Amazon Aurora DB instance that is associated with the VPC and the subnet. Amazon RDS assigns an
IP address within the subnet to your DB instance.
• An Internet gateway which connects the VPC to the Internet and to other AWS products.
• A security group associated with the DB instance. The security group's inbound rules allow your client
application to access to your DB instance.
For information about creating a DB instance in a VPC, see Creating a DB Instance in a VPC (p. 1079).
Your default VPC has three subnets you can use to isolate resources inside the VPC. The default VPC also
has an Internet Gateway that can be used to provide access to resources inside the VPC from outside the
VPC.
For a list of scenarios involving Amazon Aurora DB instances in a VPC , see Scenarios for Accessing a DB
Instance in a VPC (p. 1073).
For a tutorial that shows you how to create a VPC that you can use with a common Amazon Aurora
scenario, see Tutorial: Create an Amazon VPC for Use with a DB Instance (p. 1083).
To learn how to work with DB instances inside a VPC, see the following:
Topics
• Working with a DB Instance in a VPC (p. 1078)
1077
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
• Your VPC must have at least two subnets. These subnets must be in two different Availability Zones
in the AWS Region where you want to deploy your DB instance. A subnet is a segment of a VPC's
IP address range that you can specify and that lets you group instances based on your security and
operational needs.
• If you want your DB instance in the VPC to be publicly accessible, you must enable the VPC attributes
DNS hostnames and DNS resolution.
• Your VPC must have a DB subnet group that you create (for more information, see the next section).
You create a DB subnet group by specifying the subnets you created. Amazon Aurora uses that DB
subnet group and your preferred Availability Zone to choose a subnet and an IP address within that
subnet to assign to your DB instance.
• Your VPC must have a VPC security group that allows access to the DB instance.
• The CIDR blocks in each of your subnets must be large enough to accommodate spare IP addresses for
Amazon Aurora to use during maintenance activities, including failover and compute scaling.
• A VPC can have an instance tenancy attribute of either default or dedicated. All default VPCs have the
instance tenancy attribute set to default, and a default VPC can support any DB instance class.
If you choose to have your DB instance in a dedicated VPC where the instance tenancy attribute is
set to dedicated, the DB instance class of your DB instance must be one of the approved Amazon EC2
dedicated instance types. For example, the m3.medium EC2 dedicated instance corresponds to the
db.m3.medium DB instance class. For information about instance tenancy in a VPC, go to Using EC2
Dedicated Instances in the Amazon Virtual Private Cloud User Guide.
For more information about the instance types that can be in a dedicated instance, see Amazon EC2
Dedicated Instances on the EC2 pricing page.
Each DB subnet group should have subnets in at least two Availability Zones in a given AWS Region.
When creating a DB instance in a VPC, you must choose a DB subnet group. Amazon Aurora uses that
DB subnet group and your preferred Availability Zone to choose a subnet and an IP address within that
subnet to associate with your DB instance. If the primary DB instance of a Multi-AZ deployment fails,
Amazon Aurora can promote the corresponding standby and subsequently create a new standby using an
IP address of the subnet in one of the other Availability Zones.
When Amazon Aurora creates a DB instance in a VPC, it assigns a network interface to your DB instance
by using an IP address from your DB subnet group. However, we strongly recommend that you use the
DNS name to connect to your DB instance because the underlying IP address changes during failover.
Note
For each DB instance that you run in a VPC, you should reserve at least one address in each
subnet in the DB subnet group for use by Amazon Aurora for recovery actions.
1078
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
When you launch a DB instance inside a VPC, the DB instance has a private IP address for traffic inside
the VPC. This private IP address isn't publicly accessible. You can use the Public accessibility option to
designate whether the DB instance also has a public IP address in addition to the private IP address. If
the DB instance is designated as publicly accessible, its DNS endpoint resolves to the private IP address
from within the DB instance's VPC, and to the public IP address from outside of the DB instance's VPC.
Access to the DB instance is ultimately controlled by the security group it uses, and that public access is
not permitted if the security group assigned to the DB instance doesn't permit it.
You can modify a DB instance to turn on or off public accessibility by modifying the Public accessibility
option. This parameter is modified just like any other DB instance parameter. For more information, see
the modifying section for your DB engine.
The following illustration shows the Public accessibility option in the Network & Security section.
For information about modifying a DB instance to set the Public accessibility option, see Modify a DB
Instance in a DB Cluster (p. 233).
1079
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
For instructions on how to create subnets in a VPC, see Create a VPC with Private and Public
Subnets (p. 1083).
When you create a DB instance in a VPC, you must choose a DB subnet group. Amazon Aurora then uses
that DB subnet group and your preferred Availability Zone to choose a subnet and an IP address within
that subnet. Amazon Aurora creates and associates an Elastic Network Interface to your DB instance
with that IP address. For Multi-AZ deployments, defining a subnet for two or more Availability Zones in
an AWS Region allows Amazon Aurora to create a new standby in another Availability Zone should the
need arise. You need to do this even for Single-AZ deployments, just in case you want to convert them to
Multi-AZ deployments at some point.
In this step, you create a DB subnet group and add the subnets you created for your VPC.
Console
1080
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
8. Choose Create.
Your new DB subnet group appears in the DB subnet groups list on the RDS console. You can choose
the DB subnet group to see details, including all of the subnets associated with the group, in the
details pane at the bottom of the window.
1081
Amazon Aurora User Guide for Aurora
Working with a DB Instance in a VPC
Note
If you want your DB instance in the VPC to be publicly accessible, you must enable the
VPC attributes DNS hostnames and DNS resolution. For information on updating the DNS
information for a VPC instance, see Updating DNS Support for Your VPC.
For details on how to create a DB instance, see Creating an Amazon Aurora DB Cluster (p. 101) .
When prompted in the Network & Security section, enter the VPC name, the DB subnet group, and the
VPC security group you created in the previous steps.
Note
Updating VPCs is not currently supported for Aurora clusters.
1082
Amazon Aurora User Guide for Aurora
Tutorial: Create an Amazon VPC for Use with a DB Instance
The following diagram shows this scenario. For information about other scenarios, see Scenarios for
Accessing a DB Instance in a VPC (p. 1073).
Because your DB instance only needs to be available to your web server, and not to the public Internet,
you create a VPC with both public and private subnets. The web server is hosted in the public subnet,
so that it can reach the public Internet. The DB instance is hosted in a private subnet. The web server is
able to connect to the DB instance because it is hosted within the same VPC, but the DB instance is not
available to the public Internet, providing greater security.
1083
Amazon Aurora User Guide for Aurora
Tutorial: Create an Amazon VPC for Use with a DB Instance
9. If the current route table is not the same as the route table for the first private subnet, choose Edit
route table association. For Route Table ID, choose the route table that you noted earlier—for
example: rtb-98b613fd. Next, to save your selection, choose Save.
Note the security group ID because you need it later in this tutorial.
1. Determine the IP address to use to connect to instances in your VPC. To determine your public IP
address, you can use the service at https://checkip.amazonaws.com. An example of an IP address is
203.0.113.25/32.
If you are connecting through an Internet service provider (ISP) or from behind your firewall without
a static IP address, you need to find out the range of IP addresses used by client computers.
Warning
If you use 0.0.0.0/0, you enable all IP addresses to access your public instances. This
approach is acceptable for a short time in a test environment, but it's unsafe for production
environments. In production, you'll authorize only a specific IP address or range of
addresses to access your instances.
2. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
3. Choose VPC Dashboard, choose Security Groups, and then choose the tutorial-securitygroup
security group that you created in the previous procedure.
4. Under the list of security groups, choose the Inbound Rules tab, and then choose Edit rules.
5. On the Edit inbound rules page, choose Add Rule.
6. Set the following values for your new inbound rule to allow Secure Shell (SSH) access to your EC2
instance. If you do this, you can connect to your EC2 instance to install the web server and other
utilities, and to upload content for your web server.
• Type: SSH
• Source: The IP address or range from Step 1, for example: 203.0.113.25/32.
7. Choose Add rule.
8. Set the following values for your new inbound rule to allow HTTP access to your web server.
• Type: HTTP
• Source: 0.0.0.0/0.
1085
Amazon Aurora User Guide for Aurora
Tutorial: Create an Amazon VPC for Use with a DB Instance
9. To save your settings, choose Save rules. Next, choose Close on the confirmation page.
• Type: MySQL/Aurora
• Source: The identifier of the tutorial-securitygroup security group that you created
previously in this tutorial, for example: sg-9edd5cfb.
6. To save your settings, choose Save rules. Next, choose Close on the confirmation page.
• Name: tutorial-db-subnet-group
• Description: Tutorial DB Subnet Group
• VPC: tutorial-vpc (vpc-identifier)
1086
Amazon Aurora User Guide for Aurora
Tutorial: Create an Amazon VPC for Use with a DB Instance
5. In the Add subnets section, choose Add all the subnets related to this VPC.
6. Choose Create.
Your new DB subnet group appears in the DB subnet groups list on the RDS console. You can click
the DB subnet group to see details, including all of the subnets associated with the group, in the
details pane at the bottom of the window.
1087
Amazon Aurora User Guide for Aurora
Quotas in Amazon Aurora
Topics
• Quotas in Amazon Aurora (p. 1088)
• Naming Constraints in Amazon Aurora (p. 1089)
• Amazon Aurora File Size Limits (p. 1090)
The following table lists the resources and their quotas per AWS Region.
DB clusters 40
DB instances 40
DB subnet groups 50
Event subscriptions 20
Parameter groups 50
Reserved DB instances 40
1088
Amazon Aurora User Guide for Aurora
Naming Constraints in Amazon Aurora
Note
By default, you can have up to a total of 40 DB instances. RDS DB instances, Aurora DB
instances, Amazon Neptune instances, and Amazon DocumentDB instances apply to this quota.
If your application requires more DB instances, you can request additional DB instances by
opening the Service Quotas console. In the navigation pane, choose AWS services. Choose
Amazon Relational Database Service (Amazon RDS), choose a quota, and follow the directions
to request a quota increase. For more information, see Requesting a Quota Increase in the
Service Quotas User Guide.
Initial database name Database name constraints differ between Aurora MySQL
and PostgreSQL. For more information, see the available
settings when creating each DB cluster.
Master user name Master user name constraints differ for each database
engine. For more information, see the available settings
when creating each DB cluster.
Master password The password for the master database user can include any
printable ASCII character except /, ", @, or a space. Master
password length constraints differ for each database engine.
For more information, see the available settings when
creating each DB cluster.
1089
Amazon Aurora User Guide for Aurora
Amazon Aurora File Size Limits
1090
Amazon Aurora User Guide for Aurora
Can't Connect to DB Instance
Topics
• Can't Connect to Amazon RDS DB Instance (p. 1091)
• Amazon RDS Security Issues (p. 1092)
• Resetting the DB Instance Owner Role Password (p. 1093)
• Amazon RDS DB Instance Outage or Reboot (p. 1093)
• Amazon RDS DB Parameter Changes Not Taking Effect (p. 1093)
• Amazon Aurora MySQL Out of Memory Issues (p. 1094)
• Amazon Aurora MySQL Replication Issues (p. 1094)
• No Space Left on Device (p. 1097)
For information about debugging problems using the Amazon RDS API, see Troubleshooting Applications
on Aurora (p. 1099).
• Inbound rules – The access rules enforced by your local firewall and the IP addresses authorized to
access your DB instance might not match. The problem is most likely the inbound rules in your security
group.
By default, DB instances don't allow access. Access is granted through a security group associated with
the VPC that allows traffic into and out of the DB instance. If necessary, add inbound and outbound
rules for your particular situation to the security group. You can specify an IP address, a range of IP
addresses, or another VPC security group.
Note
When adding a new inbound rule, you can choose My IP for Source to allow access to the DB
instance from the IP address detected in your browser.
For more information about setting up security groups, see Provide Access to the DB Cluster in the VPC
by Creating a Security Group (p. 77).
Note
Client connections from IP addresses within the range 169.254.0.0/16 aren't permitted. This is
the Automatic Private IP Addressing Range (APIPA), which is used for local-link addressing.
• Public accessibility – To connect to your DB instance from outside of the VPC, such as by using a client
application, the instance must have a public IP address assigned to it.
To make the instance publicly accessible, modify it and choose Yes under Public accessibility. For
more information, see Hiding a DB Instance in a VPC from the Internet (p. 1079).
• Port – The port that you specified when you created the DB instance can't be used to send or receive
communications due to your local firewall restrictions. To determine if your network allows the
specified port to be used for inbound and outbound communication, check with your network
administrator.
1091
Amazon Aurora User Guide for Aurora
Testing the DB Instance Connection
• Availability – For a newly created DB instance, 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 size of your DB instance, it can take up to 20 minutes before an instance is available.
From a Linux or Unix terminal, you can test the connection by entering the following (replace DB-
instance-endpoint with the endpoint and port with the port of your DB instance).
For example, the following shows a sample command and the return value.
Windows users can use Telnet to test the connection to a DB instance. Telnet actions aren't supported
other than for testing the connection. If a connection is successful, the action returns no message. If a
connection isn't successful, you receive an error message such as the following.
For more information on creating IAM users, see Create an IAM User (p. 74).
1092
Amazon Aurora User Guide for Aurora
Resetting the DB Instance Owner Role Password
account to be ready. If this is an existing account, you might lack permissions in your access policies to
perform certain actions such as creating a DB instance. To fix the issue, your IAM administrator needs to
provide the necessary roles to your account. For more information, see the IAM documentation.
For example, if you lock yourself out of the db_owner role on your SQL Server database, you can reset
the db_owner role password by modifying the DB instance master password. By changing the DB
instance password, you can regain access to the DB instance. By changing the DB instance password,
you can also access databases using the modified password for db_owner, and restore privileges
for the db_owner role that might have been accidentally revoked. You can change the DB instance
password by using the Amazon RDS console, the AWS CLI command modify-db-instance, or by using the
ModifyDBInstance API operation.
A DB instance reboot occurs when you change a setting that requires a reboot, or when you manually
cause a reboot. A reboot can occur immediately if you change a setting and request that the change take
effect immediately or it can occur during the DB instance's maintenance window.
• You change the backup retention period for a DB instance from 0 to a nonzero value or from a nonzero
value to 0 and set Apply Immediately to true.
• You change the DB instance class, and Apply Immediately is set to true.
A DB instance reboot occurs during the maintenance window when one of the following occurs:
• You change the backup retention period for a DB instance from 0 to a nonzero value or from a nonzero
value to 0, and Apply Immediately is set to false.
• You change the DB instance class, and Apply Immediately is set to false.
When you change a static parameter in a DB parameter group, the change doesn't take effect until the
DB instance associated with the parameter group is rebooted. The change requires a manual reboot. The
DB instance isn't automatically rebooted during the maintenance window.
1093
Amazon Aurora User Guide for Aurora
Aurora MySQL Out of Memory Issues
static parameter, the change doesn't take effect until you reboot the DB instance associated with the
parameter group.
You can reboot a DB instance using the RDS console or explicitly calling the RebootDBInstance API
operation (without failover, if the DB instance is in a Multi-AZ deployment). 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. An example of this might be calling ModifyDBInstance to
change the DB instance class. For more information, see Modifying Parameters in a DB Parameter
Group (p. 210).
For the db.t2.small DB instance class, the aurora_oom_response parameter is set to print, tune by
default. For all other DB instance classes, the parameter value is empty by default (disabled).
Topics
• Diagnosing and Resolving Lag Between Read Replicas (p. 1094)
• Diagnosing and Resolving a MySQL Read Replication Failure (p. 1096)
• Slave Down or Disabled Error (p. 1097)
1094
Amazon Aurora User Guide for Aurora
Diagnosing and Resolving Lag Between Read Replicas
The AuroraBinlogReplicaLag metric returns -1 during a network outage or when a patch is applied
during the maintenance window. In this case, wait for network connectivity to be restored or for the
maintenance window to end before you check the AuroraBinlogReplicaLag metric again.
The MySQL read replication technology is asynchronous. Thus, you can expect occasional increases for
the BinLogDiskUsage metric on the source DB instance and for the AuroraBinlogReplicaLag
metric on the read replica. For example, consider a situation where a high volume of write operations
to the source DB instance occur in parallel. At the same time, write operations to the read replica are
serialized using a single I/O thread. Such a situation can lead to a lag between the source instance and
read replica.
For more information about read replicas and MySQL, see Replication Implementation Details in the
MySQL documentation.
You can reduce the lag between updates to a source DB instance and the subsequent updates to the read
replica by doing the following:
• Set the DB instance class of the read replica to have a storage size comparable to that of the source DB
instance.
• Make sure that parameter settings in the DB parameter groups used by the source DB instance and
the read replica are compatible. For more information and an example, see the discussion of the
max_allowed_packet parameter in the next section.
• Disable the query cache. For tables that are modified often, using the query cache can increase replica
lag because the cache is locked and refreshed often. If this is the case, you might see less replica lag
if you disable the query cache. You can disable the query cache by setting the query_cache_type
parameter to 0 in the DB parameter group for the DB instance. For more information on the query
cache, see Query Cache Configuration.
• Warm the buffer pool on the read replica for InnoDB for MySQL. For example, suppose that you have a
small set of tables that are being updated often and you're using the InnoDB or XtraDB table schema.
In this case, dump those tables on the read replica. Doing this causes the database engine to scan
through the rows of those tables from the disk and then cache them in the buffer pool. This approach
can reduce replica lag. The following shows an example.
PROMPT> mysqldump \
-h <endpoint> \
--port=<port> \
-u=<username> \
-p <password> \
database_name table1 table2 > /dev/null
For Windows:
PROMPT> mysqldump ^
-h <endpoint> ^
--port=<port> ^
-u=<username> ^
-p <password> ^
database_name table1 table2 > /dev/null
1095
Amazon Aurora User Guide for Aurora
Diagnosing and Resolving a
MySQL Read Replication Failure
Common situations that can cause replication errors include the following:
• The value for the max_allowed_packet parameter for a read replica is less than the
max_allowed_packet parameter for the source DB instance.
The max_allowed_packet parameter is a custom parameter that you can set in a DB parameter
group. The max_allowed_packet parameter is used to specify the maximum size of data
manipulation language (DML) that can be run on the database. If the max_allowed_packet value
for the source DB instance is smaller than the max_allowed_packet value for the read replica,
the replication process can throw an error and stop replication. The most common error is packet
bigger than 'max_allowed_packet' bytes. You can fix the error by having the source and read
replica use DB parameter groups with the same max_allowed_packet parameter values.
• Writing to tables on a read replica. If you're creating indexes on a read replica, you need to have the
read_only parameter set to 0 to create the indexes. If you're writing to tables on the read replica, it
can break replication.
• Using a nontransactional storage engine such as MyISAM. Read replicas require a transactional storage
engine. Replication is only supported for the following storage engines: InnoDB for MySQL, InnoDB for
MariaDB 10.2 or higher, or XtraDB for MariaDB 10.1 or lower.
You can convert a MyISAM table to InnoDB with the following command:
• If you encounter a logical error and you can safely skip the error, follow the steps described in Skipping
the Current Replication Error. Your Aurora MySQL DB instance must be running a version that includes
the mysql_rds_skip_repl_error procedure. For more information, see mysql_rds_skip_repl_error.
• If you encounter a binary log (binlog) position issue, you can change the replica replay position with
the mysql_rds_next_master_log command. Your Aurora MySQL DB instance must be running a
version that supports the mysql_rds_next_master_log command to change the replica replay
position. For version information, see mysql_rds_next_master_log.
• If you encounter a temporary performance issue due to high DML load, you can set the
innodb_flush_log_at_trx_commit parameter to 2 in the DB parameter group on the read replica.
Doing this can help the read replica catch up, though it temporarily reduces atomicity, consistency,
isolation, and durability (ACID).
• You can delete the read replica and create an instance using the same DB instance identifier so that the
endpoint remains the same as that of your old read replica.
If a replication error is fixed, the Replication State changes to replicating. For more information, see
Troubleshooting a MySQL Read Replica Problem.
1096
Amazon Aurora User Guide for Aurora
Slave Down or Disabled Error
This error message appears because replication is stopped and can't be restarted.
If you need to skip a large number of errors, the replication lag can increase beyond the default retention
period for binary log files. In this case, you might encounter a fatal error due to binary log files being
purged before they have been replayed on the replica. This purge causes replication to stop, and you can
no longer call the mysql.rds_skip_repl_error command to skip replication errors.
You can mitigate this issue by increasing the number of hours that binary log files are retained on your
replication master. After you have increased the binlog retention time, you can restart replication and
call the mysql.rds_skip_repl_error command as needed.
To set the binlog retention time, use the mysql_rds_set_configuration procedure. Specify a configuration
parameter of 'binlog retention hours' along with the number of hours to retain binlog files on the DB
cluster, up to 720 (30 days). The following example sets the retention period for binlog files to 48 hours.
ERROR: could not write block XXXXXXXX of temporary file: No space left on device.
Each DB instance in an Amazon Aurora DB cluster uses local solid state drive (SSD) storage to store
temporary tables for a session. This local storage for temporary tables doesn't automatically grow like
the Aurora cluster volume. Instead, the amount of local storage is limited. The limit is based on the DB
instance class for DB instances in your DB cluster.
To show the amount of storage available for temporary tables and logs, you can use the CloudWatch
metric FreeLocalStorage. This metric is for per-instance temporary volumes, not the cluster volume.
For more information on available metrics, see Monitoring Amazon Aurora DB Cluster Metrics (p. 377).
In some cases, you can't modify your workload to reduce the amount temporary storage required.
If so, modify your DB instances to use a DB instance class that has more local SSD storage. For more
information, see DB Instance Classes (p. 33).
For more troubleshooting information, see What is stored in Aurora for MySQL local storage, and how
can I troubleshoot local storage issues? or What is stored in Amazon Aurora for PostgreSQL storage, and
how can I troubleshoot storage issues?.
1097
Amazon Aurora User Guide for Aurora
Using the Query API
For more information about the AWS CLI, see AWS Command Line Interface Reference for Amazon RDS.
Topics
• Using the Query API (p. 1098)
• Troubleshooting Applications on Aurora (p. 1099)
Query Parameters
HTTP Query-based requests are HTTP requests that use the HTTP verb GET or POST and a Query
parameter named Action.
Each Query request must include some common parameters to handle authentication and selection of
an action.
Some operations take lists of parameters. These lists are specified using the param.n notation. Values of
n are integers starting from 1.
For information about Amazon RDS regions and endpoints, go to Amazon Relational Database Service
(RDS) in the Regions and Endpoints section of the Amazon Web Services General Reference.
1098
Amazon Aurora User Guide for Aurora
Troubleshooting Applications
Topics
• Retrieving Errors (p. 1099)
• Troubleshooting Tips (p. 1099)
For information about troubleshooting for Amazon RDS DB instances, see Troubleshooting for
Aurora (p. 1091).
Retrieving Errors
Typically, you want your application to check whether a request generated an error before you spend any
time processing results. The easiest way to find out if an error occurred is to look for an Error node in
the response from the Amazon RDS API.
XPath syntax provides a simple way to search for the presence of an Error node, as well as an easy way
to retrieve the error code and message. The following code snippet uses Perl and the XML::XPath module
to determine if an error occurred during a request. If an error occurred, the code prints the first error
code and message in the response.
use XML::XPath;
my $xp = XML::XPath->new(xml =>$response);
if ( $xp->find("//Error") )
{print "There was an error processing your request:\n", " Error code: ",
$xp->findvalue("//Error[1]/Code"), "\n", " ",
$xp->findvalue("//Error[1]/Message"), "\n\n"; }
Troubleshooting Tips
We recommend the following processes to diagnose and resolve problems with the Amazon RDS API.
• Verify that Amazon RDS is operating normally in the AWS Region you are targeting by visiting http://
status.aws.amazon.com.
• Check the structure of your request
Each Amazon RDS operation has a reference page in the Amazon RDS API Reference. Double-check that
you are using parameters correctly. In order to give you ideas regarding what might be wrong, look at
the sample requests or user scenarios to see if those examples are doing similar operations.
• Check the forum
Amazon RDS has a development community forum where you can search for solutions to problems
others have experienced along the way. To view the forum, go to
https://forums.aws.amazon.com/
1099
Amazon Aurora User Guide for Aurora
Document History
Current API version: 2014-10-31
The following table describes important changes to the Amazon Aurora User Guide. For notification
about updates to this documentation, you can subscribe to an RSS feed. For information about Amazon
Relational Database Service (Amazon RDS), see the Amazon Relational Database Service User Guide.
Note
Before August 31, 2018, Amazon Aurora was documented in the Amazon Relational Database
Service User Guide. For earlier Aurora document history, see Document History in the Amazon
Relational Database Service User Guide.
Amazon Aurora available Aurora is now available in the April 22, 2020
in the Africa (Cape Town) Africa (Cape Town) Region. For
Region (p. 1100) more information, see Regions
and Availability Zones.
Aurora PostgreSQL versions New patch versions of Amazon April 17, 2020
3.1.2, 2.4.2, and 1.6.2 (p. 1100) Aurora with PostgreSQL
compatibility include version
3.1.2 (compatible with
PostgreSQL 11.6), version 2.4.2
(compatible with PostgreSQL
10.11), and version 1.6.2
(compatible with PostgreSQL
9.6.16). For more information,
see Database Engine Versions for
Amazon Aurora PostgreSQL.
Aurora MySQL version Aurora MySQL version 2.07.2 is April 17, 2020
2.07.2 (p. 737) available.
Aurora PostgreSQL versions New patch versions of Amazon April 16, 2020
3.1.1, 2.4.1, and 1.6.1 (p. 1100) Aurora with PostgreSQL
compatibility include version
3.1.1 (compatible with
PostgreSQL 11.6), version 2.4.1
(compatible with PostgreSQL
10.11), and version 1.6.1
(compatible with PostgreSQL
9.6.16). For more information,
see Database Engine Versions for
Amazon Aurora PostgreSQL.
Aurora PostgreSQL now You can now create Aurora April 8, 2020
supports db.r5.16xlarge and PostgreSQL DB clusters running
db.r5.8xlarge DB instance PostgreSQL that use the
classes (p. 1100) db.r5.16xlarge and db.r5.8xlarge
DB instance classes. For more
information, see Hardware
Specifications for All Available
DB Instance Classes for Aurora.
1100
Amazon Aurora User Guide for Aurora
Amazon RDS Proxy for Amazon RDS Proxy is now April 8, 2020
PostgreSQL (p. 1100) available for PostgreSQL. You
can use RDS Proxy to reduce
the overhead of connection
management on your cluster
and also the chance of "too
many connections" errors. The
RDS Proxy is currently in public
preview for PostgreSQL. For
more information, see Managing
Connections with Amazon RDS
Proxy (Preview).
Aurora Global Database You can now create Aurora March 10, 2020
now supports Aurora global databases for the
PostgreSQL (p. 1100) PostgreSQL database engine.
An Aurora global database
spans multiple AWS Regions,
enabling low latency global
reads and disaster recovery from
region-wide outages. For more
information, see Working with
Amazon Aurora Global Database.
Aurora PostgreSQL You can now use Kerberos February 28, 2020
supports Kerberos authentication to authenticate
authentication (p. 1100) users when they connect to your
Aurora PostgreSQL DB clusters.
For more information, see Using
Kerberos Authentication with
Aurora PostgreSQL.
1101
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL versions 3.1, New versions of Amazon February 11, 2020
2.4, and 1.6 (p. 1100) Aurora with PostgreSQL
compatibility include version 3.1
(compatible with PostgreSQL
11.6), version 2.4 (compatible
with PostgreSQL 10.11), and
version 1.6 (compatible with
PostgreSQL 9.6.16). For more
information, see Database
Engine Versions for Amazon
Aurora PostgreSQL.
The Data API supports AWS The Data API now supports February 6, 2020
PrivateLink (p. 1100) creating Amazon VPC endpoints
for Data API calls to keep
traffic between applications
and the Data API in the AWS
network. For more information,
see Creating an Amazon VPC
Endpoint (AWS PrivateLink) for
the Data API.
Aurora machine learning support The aws_ml Aurora PostgreSQL February 5, 2020
in Aurora PostgreSQL (p. 1100) extension provides functions
you use in your database queries
to call Amazon Comprehend
for sentiment analysis and
Amazon SageMaker to run your
own machine learning models.
For more information, see
Using Machine Learning (ML)
Capabilities with Aurora.
Aurora PostgreSQL supports You can query data from February 5, 2020
exporting data to Amazon an Aurora with PostgreSQL
S3 (p. 1100) compatibility DB cluster and
export it directly into files stored
in an Amazon S3 bucket. For
more information, see Exporting
Data from an Aurora PostgreSQL
DB Cluster to Amazon S3.
Aurora MySQL version Aurora MySQL version 2.07.1 is December 23, 2019
2.07.1 (p. 738) available.
Aurora MySQL version Aurora MySQL version 1.22.1 is December 23, 2019
1.22.1 (p. 772) available.
1102
Amazon Aurora User Guide for Aurora
Aurora MySQL release notes in This section now includes history December 13, 2019
Document History (p. 1100) entries for Aurora with MySQL
compatibility release notes for
versions released after August
31, 2018. For the full release
notes for a specific version,
choose the link in the first
column of the history entry.
Amazon RDS Proxy (p. 1100) You can reduce the overhead December 3, 2019
of connection management
on your cluster, and reduce
the chance of "too many
connections" errors, by using
the Amazon RDS Proxy. You
associate each proxy with an
RDS DB instance or Aurora DB
cluster. Then you use the proxy
endpoint in the connection
string for your application. The
Amazon RDS Proxy is currently
in a public preview state. It
supports the Aurora MySQL
database engine. For more
information, see Managing
Connections with Amazon RDS
Proxy (Preview).
Data API for Aurora Serverless You can now use a hint to November 26, 2019
supports data type mapping instruct the Data API for
hints (p. 1100) Aurora Serverless to send a
String value to the database
as a different type. For more
information, see Calling the Data
API.
Data API for Aurora Serverless You can download and use a November 26, 2019
supports a Java client library Java client library for Data API. It
(Preview) (p. 1100) enables you to map your client-
side classes to requests and
responses of the Data API. For
more information, see Using the
Java Client Library for Data API.
1103
Amazon Aurora User Guide for Aurora
READ COMMITTED isolation You can now enable the READ November 25, 2019
level enabled for Amazon Aurora COMMITTED isolation level
MySQL Replicas (p. 1100) on Aurora MySQL Replicas.
Doing so requires enabling the
aurora_read_replica_read_committed_isolation_enabled
configuration setting at the
instance level. Using the READ
COMMITTED isolation level
for long-running queries on
OLTP clusters can help address
issues with history list length.
Before enabling this setting,
be sure to understand how the
isolation behavior on Aurora
Replicas differs from the usual
MySQL implementation of
READ COMMITTED. For more
information, see Aurora MySQL
Isolation Levels.
Performance Insights supports You can now analyze statistics November 25, 2019
analyzing statistics of of running queries with
running Aurora PostgreSQL Performance Insights for Aurora
queries (p. 1100) PostgreSQL DB instances. For
more information, see Analyzing
Statistics of Running Queries.
More clusters in an Aurora global You can now add multiple November 25, 2019
database (p. 1100) secondary regions to an Aurora
global database. You can take
advantage of low latency global
reads and disaster recovery
across a wider geographic area.
For more information about
Aurora Global Database, see
Working with Amazon Aurora
Global Database.
Aurora machine learning support In Aurora MySQL 2.07 and November 25, 2019
in Aurora MySQL (p. 1100) higher, you can call Amazon
Comprehend for sentiment
analysis and Amazon SageMaker
for a wide variety of machine
learning algorithms. You use the
results directly in your database
application by embedding calls
to stored functions in your
queries. For more information,
see Using Machine Learning (ML)
Capabilities with Aurora.
1104
Amazon Aurora User Guide for Aurora
Aurora MySQL version Aurora MySQL version 2.07.0 is November 25, 2019
2.07.0 (p. 739) available.
Aurora MySQL version Aurora MySQL version 1.22.0 is November 25, 2019
1.22.0 (p. 773) available.
Aurora MySQL version Aurora MySQL version 1.21.0 is November 25, 2019
1.21.0 (p. 776) available.
Aurora Global Database no You no longer need to specify November 25, 2019
longer requires engine mode --engine-mode=global
setting (p. 1100) when creating a cluster that
is intended to be part of an
Aurora global database. All
Aurora clusters that meet the
compatibility requirements
are eligible to be part of a
global database. For example,
the cluster currently must use
Aurora MySQL version 1 with
MySQL 5.6 compatibility. For
information about Aurora Global
Database, see Working with
Amazon Aurora Global Database.
Aurora Global Database is Starting in Aurora MySQL 2.07, November 25, 2019
available for Aurora MySQL you can create an Aurora Global
version 2 (p. 1100) Database with MySQL 5.7
compatibility. You don't need to
specify the global engine mode
for the primary or secondary
clusters. You can add any new
provisioned cluster with Aurora
MySQL 2.07 or higher to an
Aurora Global Database. For
information about Aurora Global
Database, see Working with
Amazon Aurora Global Database.
Aurora MySQL version Aurora MySQL version 2.06.0 is November 22, 2019
2.06.0 (p. 741) available.
Aurora MySQL version Aurora MySQL version 2.04.8 is November 20, 2019
2.04.8 (p. 746) available.
Aurora MySQL hot row The hot row contention November 19, 2019
contention optimization optimization is now generally
available without lab available for Aurora MySQL and
mode (p. 1100) does not require the Aurora lab
mode setting to be ON. This
feature substantially improves
throughput for workloads with
many transactions contending
for rows on the same page. The
improvement involves changing
the lock release algorithm used
by Aurora MySQL.
1105
Amazon Aurora User Guide for Aurora
Aurora MySQL hash joins The hash join feature is now November 19, 2019
available without lab generally available for Aurora
mode (p. 1100) MySQL and does not require the
Aurora lab mode setting to be
ON. This feature can improve
query performance when you
need to join a large amount of
data by using an equi-join. For
more information about using
this feature, see Working with
Hash Joins in Aurora MySQL.
Aurora MySQL 2.* support Aurora MySQL clusters now November 19, 2019
for more db.r5 instance support the instance types
classes (p. 1100) db.r5.8xlarge, db.r5.16xlarge,
and db.r5.24xlarge. For more
information about instance
types for Aurora MySQL clusters,
see Choosing the DB Instance
Class.
Aurora MySQL 2.* support for Aurora MySQL 2.* versions now November 19, 2019
backtracking (p. 1100) offer a quick way to recover from
user errors, such as dropping
the wrong table or deleting the
wrong row. Backtrack allows you
to move your database to a prior
point in time without needing
to restore from a backup, and it
completes within seconds, even
for large databases. Read the
AWS blog for an overview, and
refer to Backtracking an Aurora
DB Cluster. for more details.
Aurora MySQL version Aurora MySQL version 2.04.7 is November 14, 2019
2.04.7 (p. 747) available.
Aurora MySQL version Aurora MySQL version 2.05.0 is November 11, 2019
2.05.0 (p. 744) available.
Aurora MySQL version Aurora MySQL version 1.20.0 is November 11, 2019
1.20.0 (p. 778) available.
1106
Amazon Aurora User Guide for Aurora
Billing tag support for You can now use tags to keep October 23, 2019
Aurora (p. 1100) track of cost allocation for
resources such as Aurora
clusters, DB instances within
Aurora clusters, I/O, backups,
snapshots, and so on. You can
see costs associated with each
tag using AWS Cost Explorer.
For more information about
using tags with Aurora, see
Tagging Amazon RDS Resources.
For general information about
tags and ways to use them
for cost analysis, see Using
Cost Allocation Tags and User-
Defined Cost Allocation Tags
Data API for Aurora Aurora PostgreSQL now September 23, 2019
PostgreSQL (p. 1100) supports using the Data API with
Amazon Aurora Serverless DB
clusters. For more information,
see Using the Data API for
Aurora Serverless.
Aurora MySQL version Aurora MySQL version 2.04.6 is September 19, 2019
2.04.6 (p. 749) available.
Aurora MySQL version Aurora MySQL version 1.19.5 is September 19, 2019
1.19.5 (p. 779) available.
Aurora PostgreSQL supports You can configure your Aurora August 9, 2019
uploading database logs to PostgreSQL DB cluster to
CloudWatch logs (p. 1100) publish log data to a log group
in Amazon CloudWatch Logs.
With CloudWatch Logs, you can
perform real-time analysis of the
log data, and use CloudWatch to
create alarms and view metrics.
You can use CloudWatch Logs
to store your log records in
highly durable storage. For more
information, see Publishing
Aurora PostgreSQL Logs to
Amazon CloudWatch Logs.
Multi-master clusters for Aurora You can set up Aurora MySQL August 8, 2019
MySQL (p. 1100) multi-master clusters. In these
clusters, each DB instance has
read-write capability. For more
information, see Working with
Aurora Multi-Master Clusters.
1107
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL supports You can now use Amazon July 9, 2019
Aurora Serverless (p. 1100) Aurora Serverless with
Aurora PostgreSQL. An
Aurora Serverless DB cluster
automatically starts up, shuts
down, and scales up or down its
compute capacity based on your
application's needs. For more
information, see Using Amazon
Aurora Serverless.
Cross-account cloning for Aurora You can now clone the cluster July 2, 2019
MySQL (p. 1100) volume for an Aurora MySQL DB
cluster between AWS accounts.
You authorize the sharing
through AWS Resource Access
Manager (AWS RAM). The cloned
cluster volume uses a copy-on-
write mechanism, which only
requires additional storage for
new or changed data. For more
information about cloning for
Aurora, see Cloning Databases in
an Aurora DB Cluster.
Aurora PostgreSQL You can now create Aurora June 20, 2019
supports db.t3 DB instance PostgreSQL DB clusters that use
classes (p. 1100) the db.t3 DB instance classes.
For more information, see DB
Instance Class.
1108
Amazon Aurora User Guide for Aurora
Support for importing data You can now import data from June 19, 2019
from Amazon S3 for Aurora an Amazon S3 file into a table
PostgreSQL (p. 1100) in an Aurora PostgreSQL DB
cluster. For more information,
see Importing Amazon S3 Data
into an Aurora PostgreSQL DB
Cluster.
Data API for Aurora Serverless You can access Aurora Serverless May 30, 2019
generally available (p. 1100) clusters with web services–based
applications using the Data
API. For more information, see
Using the Data API for Aurora
Serverless.
Aurora PostgreSQL version Version 2.3 of Amazon Aurora May 30, 2019
2.3 (p. 1100) with PostgreSQL compatibility
is available and compatible
with PostgreSQL 10.7. For more
information, see Version 2.3.
Aurora MySQL version Aurora MySQL version 2.04.4 is May 29, 2019
2.04.4 (p. 752) available.
1109
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL versions The following patch versions for May 21, 2019
1.2.2, 1.3.2, 2.0.1, 2.1.1, Amazon Aurora with PostgreSQL
2.2.1 (p. 1100) compatibility are now available
and include versions 1.2.2, 1.3.2,
2.0.1, 2.1.1, and 2.2.1. For more
information, see Database
Engine Versions for Amazon
Aurora PostgreSQL.
Performance Insights You can now use Performance May 13, 2019
support for Aurora Global Insights with Aurora Global
Database (p. 1100) Database. For information
about Performance Insights
for Aurora, see Using Amazon
RDS Performance Insights. For
information about Aurora global
databases, see Working with
Aurora Global Database.
Aurora global databases You can now create Aurora April 30, 2019
available in more AWS global databases in most
Regions (p. 1100) AWS Regions where Aurora is
available. For information about
Aurora global databases, see
Working with Amazon Aurora
Global Databases.
1110
Amazon Aurora User Guide for Aurora
Minimum Capacity of 1 for The minimum capacity setting April 29, 2019
Aurora Serverless (p. 1100) you can use for an Aurora
Serverless cluster is 1. Formerly,
the minimum was 2. For
information about specifying
Aurora Serverless capacity
values, see Setting the Capacity
of an Aurora Serverless DB
Cluster.
Aurora Serverless timeout You can now specify the April 29, 2019
action (p. 1100) action to take when an Aurora
Serverless capacity change times
out. For more information, see
Timeout Action for Capacity
Changes.
Per-second billing (p. 1100) Amazon RDS is now billed in 1- April 25, 2019
second increments in all AWS
Regions except AWS GovCloud
(US) for on-demand instances.
For more information, see DB
Instance Billing for Aurora.
Restore MySQL 5.7 backups You can now create a backup April 17, 2019
from Amazon S3 (p. 1100) of your MySQL version 5.7
database, store it on Amazon S3,
and then restore the backup file
onto a new Aurora MySQL DB
cluster. For more information,
see Migrating Data from an
External MySQL Database to an
Aurora MySQL DB Cluster.
1111
Amazon Aurora User Guide for Aurora
Aurora proof-of-concept You can learn how to perform April 16, 2019
tutorial (p. 1100) a proof of concept to try your
application and workload with
Aurora. For the full tutorial, see
Performing an Aurora Proof of
Concept.
Aurora Serverless supports You can now import backups April 16, 2019
restoring from an Amazon S3 from Amazon S3 to an Aurora
backup (p. 1100) Serverless cluster. For details
about that procedure, see
Migrating Data from MySQL by
Using an Amazon S3 Bucket.
New modifiable parameters for You can now modify the April 4, 2019
Aurora Serverless (p. 1100) following DB parameters for
an Aurora Serverless cluster:
innodb_file_format,
innodb_file_per_table,
innodb_large_prefix,
innodb_lock_wait_timeout,
innodb_monitor_disable,
innodb_monitor_enable,
innodb_monitor_reset,
innodb_monitor_reset_all,
innodb_print_all_deadlocks,
log_warnings,
net_read_timeout,
net_retry_count,
net_write_timeout,
sql_mode, and tx_isolation.
For more information about
configuration parameters for
Aurora Serverless clusters, see
Aurora Serverless and Parameter
Groups.
Aurora PostgreSQL logical You can now use PostgreSQL March 28, 2019
replication (p. 1100) logical replication to replicate
parts of a database for an Aurora
PostgreSQL DB cluster. For
more information, see Using
PostgreSQL Logical Replication.
1112
Amazon Aurora User Guide for Aurora
GTID support for Aurora MySQL You can now use replication with March 25, 2019
2.04 (p. 1100) the global transaction ID (GTID)
feature of MySQL 5.7. This
feature simplifies performing
binary log (binlog) replication
between Aurora MySQL and an
external MySQL 5.7-compatible
database. The replication can
use the Aurora MySQL cluster
as the source or the destination.
This feature is available for
Aurora MySQL 2.04 and higher.
For more information about
GTID-based replication and
Aurora MySQL, see Using GTID-
Based Replication for Aurora
MySQL.
Aurora MySQL version Aurora MySQL version 2.04.1 is March 25, 2019
2.04.1 (p. 756) available.
Aurora MySQL version Aurora MySQL version 2.04 is March 25, 2019
2.04 (p. 757) available.
Uploading Aurora You can now have Aurora upload February 25, 2019
Serverless logs to Amazon database logs to CloudWatch for
CloudWatch (p. 1100) an Aurora Serverless cluster. For
more information, see Viewing
Aurora Serverless DB Clusters.
As part of this enhancement,
you can now define values for
instance-level parameters in a
DB cluster parameter group,
and those values apply to all DB
instances in the cluster unless
you override them in the DB
parameter group. For more
information, see Working with
DB Parameter Groups and DB
Cluster Parameter Groups.
Aurora MySQL supports db.t3 You can now create Aurora February 25, 2019
DB instance classes (p. 1100) MySQL DB clusters that use
the db.t3 DB instance classes.
For more information, see DB
Instance Class.
Aurora MySQL supports db.r5 You can now create Aurora February 25, 2019
DB instance classes (p. 1100) MySQL DB clusters that use
the db.r5 DB instance classes.
For more information, see DB
Instance Class.
1113
Amazon Aurora User Guide for Aurora
Performance Insights counters You can now add performance February 19, 2019
for Aurora MySQL (p. 1100) counters to your Performance
Insights charts for Aurora
MySQL DB instances. For more
information, see Performance
Insights Dashboard Components.
Aurora PostgreSQL version Version 2.2.0 of Aurora with February 13, 2019
2.2.0 (p. 1100) PostgreSQL compatibility is
available and compatible with
PostgreSQL 10.6. For more
information, see Version 2.2.0.
Aurora MySQL version Aurora MySQL version 2.03.3 is January 18, 2019
2.03.3 (p. 758) available.
Aurora MySQL version Aurora MySQL version 1.17.8 is January 17, 2019
1.17.8 (p. 784) available.
1114
Amazon Aurora User Guide for Aurora
Aurora backup billing (p. 1100) You can use the Amazon January 3, 2019
CloudWatch metrics
TotalBackupStorageBilled,
SnapshotStorageUsed, and
BackupRetentionPeriodStorageUsed
to monitor the space usage
of your Aurora backups. For
more information about how
to use CloudWatch metrics, see
Overview of Monitoring. For
more information about how
to manage storage for backup
data, see Understanding Aurora
Backup Storage Usage.
Performance Insights counters You can now add performance December 6, 2018
(p. 1100) counters to your Performance
Insights charts. For more
information, see Performance
Insights Dashboard Components.
Aurora Global You can now create Aurora November 28, 2018
Database (p. 1100) global databases. An Aurora
global database spans multiple
AWS Regions, enabling low
latency global reads and disaster
recovery from region-wide
outages. For more information,
see Working with Amazon
Aurora Global Database.
Query editor for Aurora You can run SQL statements November 20, 2018
Serverless (beta) (p. 1100) in the Amazon RDS console on
Aurora Serverless clusters. For
more information, see Using
the Query Editor for Aurora
Serverless.
Data API for Aurora Serverless You can access Aurora Serverless November 20, 2018
(beta) (p. 1100) clusters with web services–based
applications using the Data
API. For more information, see
Using the Data API for Aurora
Serverless.
1115
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL version 2.1 Aurora with PostgreSQL November 20, 2018
(p. 1100) compatibility version 2.1 is
available and compatible with
PostgreSQL 10.5. For more
information, see Version 2.1.
TLS support for Aurora Aurora Serverless clusters November 19, 2018
Serverless (p. 1100) support TLS/SSL encryption. For
more information, see TLS/SSL
for Aurora Serverless.
Custom endpoints (p. 1100) You can now create endpoints November 12, 2018
that are associated with an
arbitrary set of DB instances.
This feature helps with load
balancing and high availability
for Aurora clusters where some
DB instances have different
capacity or configuration than
others. You can use custom
endpoints instead of connecting
to a specific DB instance through
its instance endpoint. For more
information, see Amazon Aurora
Connection Management.
Aurora MySQL version Aurora MySQL version 2.03.1 is October 24, 2018
2.03.1 (p. 760) available.
Custom parameter groups You can now specify a custom October 15, 2018
for restore and point in time parameter group when you
recovery (p. 1100) restore a snapshot or perform a
point in time recovery operation.
For more information, see
Restoring from a DB Cluster
Snapshot and Restoring a DB
Cluster to a Specified Time.
Aurora MySQL version Aurora MySQL version 2.03 is October 11, 2018
2.03 (p. 760) available.
Deletion protection for Aurora When you enable deletion September 26, 2018
DB clusters (p. 1100) protection for a DB cluster, the
database cannot be deleted by
any user. For more information,
see Deleting a DB Instance in a
DB Cluster.
1116
Amazon Aurora User Guide for Aurora
Aurora PostgreSQL version 2.0 Aurora with PostgreSQL September 25, 2018
(p. 1100) compatibility version 2.0 is
available and compatible with
PostgreSQL 10.4. For more
information, see Version 2.0.
Stop/Start feature You can now stop or start an September 24, 2018
Aurora (p. 1100) entire Aurora cluster with a
single operation. For more
information, see Stopping and
Starting an Aurora Cluster.
Aurora MySQL version Aurora MySQL version 2.02.4 is September 21, 2018
2.02.4 (p. 761) available.
Parallel Query feature for Aurora Aurora MySQL now offers an September 20, 2018
MySQL (p. 1100) option to parallelize I/O work
for queries across the Aurora
storage infrastructure. This
feature speeds up data-intensive
analytic queries, which are
often the most time-consuming
operations in a workload. For
more information, see Working
with Parallel Query for Aurora
MySQL.
Aurora MySQL version Aurora MySQL version 1.18.0 is September 20, 2018
1.18.0 (p. 783) available.
Aurora PostgreSQL version 1.3 Aurora PostgreSQL version 1.3 is September 11, 2018
(p. 1100) now available and is compatible
with PostgreSQL 9.6.9. For more
information, see Version 1.3.
New guide (p. 1100) This is the first release of the August 31, 2018
Amazon Aurora User Guide.
1117
Amazon Aurora User Guide for Aurora
AWS Glossary
For the latest AWS terminology, see the AWS Glossary in the AWS General Reference.
1118