OReilly Database Ebook
OReilly Database Ebook
OReilly Database Ebook
m
pl
im
en
ts
of
An
Introduction
to Cloud
Databases
A Guide for Administrators
REPORT
Break free from
old guard databases
AWS provides the broadest selection of
purpose-built databases allowing you to
save, grow, and innovate faster
978-1-492-04482-6
[LSI]
Table of Contents
4. Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
iii
CHAPTER 1
Database Options in the Cloud
1
The report does not cover arguments for or against moving to the
cloud, because there are other resources to support this decision and
because the decision is tied in so tightly with the particular traits of
your databases and how you use them. Furthermore, we don’t
review or recommend particular cloud offerings, although we refer
to the offerings of the currently dominant cloud vendors: Amazon
Web Services (AWS), Microsoft Azure, and Google Cloud Platform.
This chapter includes the following:
Many criteria for choosing a provider are general, not database spe‐
cific: pricing, the ecosystem of third-party developers around each
offering, stability, support for legal compliance regimes, added value
in high-end tools for artificial intelligence, and more.
As you evaluate cloud offerings, think about future directions for
your organization. For instance, will streaming and real-time data
processing be a bigger part of your future? Which cloud offerings
will support you a couple of years from now?
Most exciting, you’ll have more time to look at the business context
for the database and think of ways to improve the value of the data
you manage for your organization. We go into more detail about
these topics in Chapter 2.
As you can tell from this list, the DBA’s job has typically revolved
around database operations, disaster management, user manage‐
ment, and performance tuning. Monitoring and troubleshooting
have mostly been manual, and usually reactive instead of planned.
11
Not much time has been left for performing tasks that are higher
along the value chain, such as designing databases and optimizing
the applications that rely on the databases.
The lack of automation and a reactive approach to problems has left
DBAs struggling to keep up with the various databases under their
watch. Most of their workdays have devolved into a triage model in
which they always need to attend to the most urgent tasks.
As cloud computing profoundly changes job roles and the ways
organizations run their businesses, it is restructuring the traditional
work of a DBA. In the cloud, many of the traditional tasks of a DBA
simply vanish or are significantly reduced. The cloud provider, of
course, handles all of the infrastructure work, such as racking and
stacking the servers, networking, and storage. Backups and security
are also farmed off, mostly to the cloud provider’s domain. So what
do DBAs do in the cloud?
If you’re running your own databases in the cloud, you still will be
doing a lot of the traditional DBA tasks such as installing and patch‐
ing software, backing up the databases, and so on. This report focu‐
ses on managed databases, as defined in “Self-Managed Versus
Managed Databases” on page 5, because they offer several extra ben‐
efits over self-managed databases as well as more substantial
changes in the DBA’s role. This chapter also focuses on relational
databases, which typically require a greater variety of management
tasks.
When you use a managed database in the cloud, you can spend
more time on data architecture and the applications that the data‐
base supports. Anticipating needs and making enhancements to the
database now become the primary concerns of the DBA. You’ll be in
a far better situation to derive more value from the organization’s
data assets, by helping teams deliver new features faster and proac‐
tively tuning application performance.
Other tasks include helping set up batch and real-time data pipe‐
lines to ingest and transform batch and streaming data. Building,
maintaining, and tuning highly distributed data pipelines is an
important function of administrators working with cloud-based
databases. You can also devote more time to strengthening database
security and assuring adherence to compliance requirements
imposed by governments and industry bodies.
Provisioning
Managed database services such as Amazon RDS offer a wide range
of instance types for your database servers. Instead of ordering a
hardware system with particular memory and CPU requirements
for your datacenter, you choose one or more instance types that
offer the memory and CPU power that meet your requirements.
Matching the instance type to your workloads can help reduce the
possibility of paying for resources that you won’t use.
Scaling is another provisioning task. Autoscaling, which you can do
at the level of VMs and at the level of databases, lets the system add
an instance when the loads become high and shut down an instance
so as not to waste excess capacity when the loads diminish.
Although autoscaling is an extremely valuable form of automation,
you can fall victim to a DoS attack or configuration error that spins
up a huge number of instances and jacks up your costs.
You can also choose regions near your database users for optimal
response time. Using the offerings of a global cloud provider wisely
is a key aspect of provisioning in the cloud.
As we have discussed, traditional databases, especially the online
transaction processing (OLTP) databases, are notoriously difficult to
scale. As the number of users, the size of the datasets, and the com‐
plexity of database operations increase, query response times grow
longer. Business growth can be reflected in all those factors, as well
as the growth of applications that place more of a burden on the
Access
In the cloud, you are responsible for everything unique to your data
and users: handing out accounts, forming groups or roles to com‐
bine user accounts, and designating access to various parts of your
databases. We cover this topic more in “Security for Data and Appli‐
cations in the Cloud” on page 19.
Logs
DBAs need database logs for troubleshooting, compliance, and
auditability; this is still true in the cloud. Figure 2-2 shows how you
can easily view logs for a database instance through the AWS con‐
sole. When you have many databases that you must monitor and
manage, the usefulness of this feature becomes clear.
Performance optimization
Tuning database performance is one of the key tasks of a traditional
DBA; it separates the good DBAs from run-of-the-mill administra‐
tors. Good performance tuning requires an in-depth understanding
of storage, network, memory, and application code. Placing the
databases in the cloud doesn’t relieve the DBA from complete
responsibility for the database. Performance tuning, both reactive
and proactive, is still going to be primarily the DBA’s responsibility.
However, cloud vendors provide some easy ways to obtain informa‐
tion, such as AWS’s RDS Performance Insights.
In the cloud, you won’t be spending a lot of time worrying about
typical server- and storage-related performance issues, because you
can easily scale up or scale out your databases based on your work‐
loads. You’re more likely to spend your time analyzing database
waits, so as to improve database response times.
Network Isolation
Some common cloud features to protect your systems on the net‐
work are VPCs, firewalls, and network access control lists (ACLs).
As we discuss in “High-Level Effects of Moving to the Cloud” on
page 2, a VPC is a private network within the cloud for communica‐
tion between your servers. Within a VPC, you can isolate database
instances by specifying the IP range that is allowed access to each
database. The organization that creates a VPC has full control over
its virtual networking environment and can select its own IP address
ranges, create subnets, and configure its own route tables and net‐
work gateways.
Direct Connections
Instead of a VPN, you can connect systems outside the
cloud to systems within the cloud through Direct Con‐
nect in AWS or ExpressRoute in Azure. They exploit
private network links provided by telecommunications
carriers to create a direct connection. End-to-end
encryption is still recommended, and is generally done
through standard Secure Sockets Layer (SSL)/Trans‐
port Layer Security (TLS).
Data Encryption
In the cloud, it’s easy to encrypt your data to provide additional pro‐
tection to data at rest. For example, when you enable encryption in
an Amazon RDS cluster, the database stores all data in the tables that
you create in an encrypted format. The encryption also applies to
the database backups. Encryption is also easy to set up when you
transmit data to and from the cloud.
Encryption is particularly necessary for organizations that must
meet industry compliance requirements such as Health Insurance
Portability and Accountability Act (HIPAA) compliance for health
care, the Sarbanes-Oxley Act (SOX) for financial reporting, and the
Payment Card Industry Data Security Standard (PCI DSS) standards
for ecommerce and retail business. If you protect your encryption
25
Data movement
• Replication
• Incorporation of changes since the replica was created
• Application testing
• Cutover
• Post-migration checks
Optimization
• Performance tuning
• Designing high availability
• Determining what events to log and monitor
• Creating a disaster recovery plan
Planning
This phase helps an organization assess the following issues:
Factors in a Migration
When you want to move a database that you are running on-
premises to a managed service in the cloud, you need to deal with
physical, software, and organizational issues. It requires attention to
several levels of change:
Planning | 27
doing a full migration. You might also keep some of the data (or
a copy of the data) permanently on-premises.
Readiness Assessment
A readiness assessment helps you to estimate the costs, the architec‐
ture of the cloud database, migration plans, and the impact of the
move to the cloud on compliance regulations. The result of a cloud
readiness assessment is a detailed report of your company’s readi‐
ness to move its databases to the cloud.
Following are brief descriptions of the key steps during a cloud
readiness assessment.
Stakeholder interviews
Talking to application developers, business users, and others
concerned with the use of data within your organization team
will help you to determine requirements pertaining to perfor‐
mance, high availability, and the features and capabilities of the
cloud-based databases.
Analysis of current on-premises databases
Go back over your current databases to determine growth pat‐
terns of data, backup and recovery strategies, ongoing data
exports and imports, and so on. Understanding the current
database usage patterns will help you when it’s time to decide
what databases to use in the cloud, and whether you’ll need a
particular database offering in order to get the capabilities you
need.
Prioritization of the databases to move
Pick the databases that you’d like to move to the cloud first. One
important criterion is the extent of changes to pass:[<span
Planning | 29
class="keep-together">applications</span> that will be
required, which in turn calls for coordination with developers.
Migration cost analysis
Perform a thorough analysis of the costs of migrating to the
cloud versus staying in the on-premises datacenters so that you
fully understand the TCO and ROI of the cloud migration.
Lowering costs by using a cloud database service might be one
of your key goals. But a poor choice of cloud services will defeat
this purpose.
Security and compliance
Sometimes, you need special regions or AZs to comply with
standards such as Service Organization Control 2 (SOC 2), PCI
DSS, or the US HIPAA. Fortunately, cloud providers often
match particular regions and AZs to these legal requirements.
In addition, there are specialized regions, such as AWS’s Gov‐
Cloud (US), which is an isolated AWS region subject to
FedRAMP High and Moderate baselines. Finally, you need to
check whether you can meet your organization’s service-level
agreements (SLAs) in your chosen cloud setting. These SLAs
typically include metrics for planned maintenance, backups,
recovery point objectives (RPOs), and recovery time objectives
(RTOs).
If you’ve done your cloud assessment correctly, you should also have
a good idea of the scope of your cloud migration. Some of your
applications might be so old that they would need to be completely
redesigned to move to the cloud. If you don’t currently have the
resources to rewrite the applications, you can keep them in on-
premises databases or move the entire servers into the cloud.
Migration steps
You should plan exactly when and how you will do the data
migration, along with preparations for rolling back the change if
later testing shows that the database is not working properly.
Establish tests and the success criteria for each step.
Application changes
You need to do this in coordination with the development team.
This includes scheduling of the application changes into the
development process and testing.
Planning | 31
you might need to run to overcome these issues and successfully
complete the database migration.
Data Movement
Cloud providers are highly alert to the requirements their potential
clients have about moving their on-premises databases to the cloud
with minimal cost and disruption. Each vendor offers tools to expe‐
dite the move. AWS, for instance, offers numerous papers laying out
in detail how to migrate from various on-premises databases to
AWS, including procedures for Oracle, MySQL, and PostgreSQL.
Even so, migrations to the cloud can involve disruptive and costly
downtimes. A migration tool, whether provided by the cloud vendor
or by a third-party provider, must be able to handle all aspects of the
database, such as schemas, user permissions, triggers, and stored
procedures.
We recommend that you keep a journal during your early migra‐
tions, because the lessons you learn along the way will inform you
and your colleagues as you pursue further migrations. Should
enough bad things happen that you decide to use another vendor—
or not to migrate at all—the journal will provide important evidence
to support that decision.
But you are likely to spend time testing the new cloud version before
you are ready to put it into production to make sure that applica‐
tions work, that security is in place, and that you are getting the per‐
formance you need. So you still might want to restart the original
version before you are ready to trust the new version, and then you
will use replication to synchronize the new one with the original
one.
Data Movement | 33
Migrating Applications
There are two basic strategies for moving your databases and related
applications:
Lift and shift
Move an entire database as is, with all of the applications it sup‐
ports, to the new database in the cloud. This is the “old wine in a
new bottle” application migration strategy given that you make
little or no use of cloud native features.
Redesign the databases
Rethink how your on-premises databases deal with administra‐
tive tasks such as scaling and high availability, and investigate
the cloud provider’s offerings in those areas. They are getting
more and more sophisticated. More work and effort is required
for this strategy, of course. You might also need to recode the
applications to adjust to the changes in database strategy.
Often, customers start with “lift and shift” and follow up with rede‐
signing and other modernizations.
Post-Migration Checks
After the data is completely copied over to the cloud database, vali‐
date the target database to ensure that all of the database objects are
present on the cloud database. Several tests determine whether the
migration was successful:
Validate data
This can be as simple as checking the number of rows, or run‐
ning a checksum to indicate that there was no loss or corrup‐
tion. More complex validation processes factor in the schema
changes inherent in heterogenous migrations. Unfortunately,
this basic validation is often forgotten.
Basic functionality
Perform end-to-end testing to ensure that you performed the
migration successfully and that the system is operating as it is
supposed to. Test the use of features that tend to differ between
database engines and versions, such as triggers and stored pro‐
cedures.
Optimization
At this point, you are presumably running smoothly and can con‐
gratulate your team all around for a job well done. This section sum‐
marizes the main tasks required of the DBA and other team
members as you move forward.
Availability
This, of course, is the fundamental requirement that you must meet
in any setting. Moving to the cloud, fortunately, removes some
causes of failure (if you properly configure the restarting of failed
services). Furthermore, the cloud vendor provides numerous tools
for predicting failures and alerting you to failures. To take advantage
of these, carry out the planning in this section (many of these activi‐
ties are also useful for performance optimization):
Disaster recovery (DR) plan
With a large and robust cloud vendor, you can fail over to a new
AZ if the current one fails. But you need both a plan and an
automated process for failover. The plan should address the
RTO, RPO, and geographic redundancy. As much as possible,
exploit the failover capabilities provided by the vendor instead
of handcrafting your own.
Optimization | 35
Logs and system monitoring
Determine the events that can indicate imminent problems as
well as problems that have already occurred. These can be
incorporated into automated tracking. The tracking should con‐
vey enough information to tell you the source of failure: for
instance, whether they stem from a user action such as a reboot
of a service, from an attack, or from other changes in the envi‐
ronment. Some failures can be considered normal and can be
addressed by your automated tools; these should be recorded
but do not need to issue alerts to the administrator.
Change monitoring
Administrators should always know what changes to database
configuration, instance sizing, or cluster topology can affect
availability. Modern development environments use robust pro‐
cesses for change tracking and version control so that every
change goes through a vetting process and can be reversed.
System testing
Try to determine the weak points in your system and anticipate
failure. Some teams go through “pre-mortem” exercises to iden‐
tify and remove potential sources of failure. Large sites can
afford to bring down systems deliberately and watch whether
recovery is adequate; this kind of testing, called chaos engineer‐
ing, was popularized through Netflix’s Chaos Monkey. Just as
you do regular restores to make sure backups are working, you
should test your recovery procedures.
Performance Optimization
Performance can benefit from the practices in the preceding section,
notably monitoring. Performance monitoring should allow you to
determine the relationships between events and changes in the data‐
base metrics, as well as to see discrepancies between the predicted
and actual performance trends. Performance can additionally be
maintained and improved through additional processes.
Workload testing
Growth in the size and complexity of data, as well as application
behavior changes, affect performance. Test performance regu‐
larly so that you learn of degradation before your customers tell
you about it; you can then scale or make other changes to adapt.
It can take a while for the database cache and table statistics to
Conclusion
A migration to the cloud is a long-term process. Start small, because
you will find you have a lot to learn along the way. Keep a journal
and honestly record all the mistakes and problems encountered.
Don’t be embarrassed if legacy systems harbor poor practices or out‐
right bugs that turn up during the migration—that will happen in
virtually every organization. Documenting the problems is the best
thing you can do for your company.
Conclusion | 37
Hopefully, one or more of your early migrations will go well and you
will be ready for a major move to the cloud. Doing so can reap bene‐
fits in costs, flexibility, and security. Not least in importance, moving
to the cloud will provide an up-to-date computing environment that
helps to draw leading staff, who want to be on the cutting edge, to
your company.
For many years after Amazon.com opened the first major cloud
offering, the trade press presented the question facing system
administrators and DBAs as “Cloud or not cloud?” Soon, on-
premises clouds and hybrid offerings joined pure cloud solutions as
options to consider. But the choices were always more complicated.
As this report has shown, offerings have multiplied rapidly. DBAs
must simultaneously evaluate databases along all the following axes:
39
In addition to laying out the basic criteria for choosing databases,
this report has tried to help you prepare a move to the cloud by pre‐
paring you for the changes that will likely occur in your responsibili‐
ties and tasks. Some responsibilities and tasks are simplified or
removed by moving to the cloud, but you will also have new tech‐
nologies to learn and will need to begin thinking in new ways about
goals such as high availability and optimization.
You will learn a lot during your first migration, or by starting a new
project in the cloud. Each project will clarify the landscape of cloud
databases for you, and give you ideas for your next project. And
hopefully, this report will alert you to what you need to look out for
along the way.
40 | Chapter 4: Conclusion
About the Authors
Wendy A. Neu is a principal consultant with AWS Professional
Services working on customers’ most difficult problems, building
high-quality, scalable, and architecturally sound systems. She is a
regular contributor to the AWS Database Blog and is certified in
AWS, Oracle, and Microsoft SQL Server. Prior to joining Amazon,
she worked as a consultant in Cincinnati, OH, helping customers
translate business needs into workable technology solutions.
Vlad Vlasceanu is a principal DB specialist solutions architect at
AWS, based out of the Santa Monica, California office. Vlad helps
customers adopt cloud native database solutions, like Amazon
Aurora, and deploy large-scale, high-performance database architec‐
tures on AWS. His focus is on designing and implementing sustain‐
able, cost-effective, and scalable database workloads that take
advantage of the latest best practices and capabilities that the AWS
platform offers. Prior to joining AWS, Vlad’s career included more
than 15 years of designing and developing both consumer focused
web-based applications as well as data-driven applications for the
energy industry. Vlad holds a Master of Science in Information Sys‐
tems from Baylor University.
Andy Oram brought to publication O’Reilly’s Linux series, the
groundbreaking book Peer-to-Peer, and the best seller Beautiful
Code. Andy has also authored many reports on technical topics such
as data lakes, web performance, and open source software. His arti‐
cles have appeared in The Economist, Communications of the ACM,
Copyright World, the Journal of Information Technology and Politics,
Vanguardia Dossier, and Internet Law and Business. Conferences
where he has presented talks include O’Reilly’s Open Source Con‐
vention, FISL (Brazil), FOSDEM, DebConf, and LibrePlanet. Andy
participates in the Association for Computing Machinery’s policy
organization, USTPC. He also writes for various websites about
health IT and about issues in computing and policy.
Sam R. Alapati is a data administrator at Solera Holdings in West‐
lake, Texas. He is part of the Big Data and Hadoop team. Sam is an
Oracle ACE, a recognition conferred by Oracle Technology Net‐
work. He is the author of Modern Linux Administration (O’Reilly,
2018) as well as more than 20 database and system administration
books. Sam has experience working with all three major cloud pro‐
viders: AWS, Microsoft Azure, and Google Cloud Platform.