An To Cloud Databases: A Guide For Administrators
An To Cloud Databases: A Guide For Administrators
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
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. An Introduction to Cloud
Databases, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the authors and do not represent the
publisher’s views. While the publisher and the authors have used good faith efforts to
ensure that the information and instructions contained in this work are accurate, the
publisher and the authors disclaim all responsibility for errors or omissions, including
without limitation responsibility for damages resulting from the use of or reliance on this
work. Use of the information and instructions contained in this work is at your own risk.
If any code samples or other technology this work contains or describes are subject to
open source licenses or the intellectual property rights of others, it is your responsibility
to ensure that your use thereof complies with such licenses and/or rights.
This work is part of a collaboration between O’Reilly and AWS. See our statement of
editorial independence.
978-1-492-04482-6
[LSI]
Table of Contents
4. Conclusion……………………………………………………………39
iii
CHAPTER 1
Database Options in the Cloud
But this dramatic shift in computing and database access also shows
up in the types of services offered and the evolution of professional
jobs in computing. Managed databases of many sorts are now part
of every major cloud vendor’s offerings. The use of these databases
will remove many tasks performed by a database administrator (DBA)
in traditional environments where an organization owns its own
hardware, which we’ll call on-premises environments. Moving to the
cloud will add new tasks, change some existing tasks, and provide a
subtly different context for understanding many of the tasks.
This report helps the DBA and related staff—such as data scientists,
data architects, and application developers—choose among cloud
offerings. It explains on a general level what responsibilities the DBA
should expect to perform in the cloud environment. Finally, it offers
guidelines for migration.
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.
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?
But the vendors have invested great effort into new offerings of
their own, sometimes called cloud native databases. Vendors provide
evidence that the cloud native databases perform better, scale more
easily, and are cheaper in the long run. Thus, testimonials from
Autodesk and InfoScout suggest that AWS engineers have solved
many of the scaling and efficiency problems of managing relational
databases in the cloud with their own database, Amazon Aurora. Cloud
native databases are also designed to scale enormously, a task that has
historically been difficult for relational databases.
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 have 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 patching
software, backing up the databases, and so on. This report focuses on
managed databases, as defined in “Self-Managed Versus Managed
Databases” on page 5, because they offer several extra benefits 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 database
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 proactively
tuning application performance.
Other tasks include helping set up batch and real-time data pipelines to
ingest and transform batch and streaming data. Building, maintaining,
and tuning highly distributed data pipelines are important functions
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.
Application
Application
Database
Database
Monitoring Monitoring
Access
Access
Platform
Platform
Network Isolation
Some common cloud features to protect your systems on the network
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 communication 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 network
gateways.
You can, in addition, set up a virtual private gateway that extends your
corporate network into your VPC and permits access to the database
instances in that VPC through a VPN of your choice.
Direct Connections
NOTE Instead of a VPN, you can connect systems outside
the cloud to systems within the cloud through Direct
Connect 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)/Transport
Layer Security (TLS).
Data Encryption
In the cloud, it’s easy to encrypt your data to provide additional
protection 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 e-commerce 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
We look at each major stage in the following sections.
Planning
This phase helps an organization assess the following issues:
• Relevant elements of the current environment: applications,
databases, and critical workloads
• Whether the application or workload will run properly in the cloud
provider’s environment
• How the migration will help meet business objectives
• Requirements for the end state of the system
• The cost of running the current computing environment in the
cloud, which should be a comprehensive return on investment, as
explained in “Planning operational costs” on page 18
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
Major Migration Tasks
We suggest the following steps for a successful migration.
Create a cloud migration plan
The cloud migration plan should list all the databases and
applications in the order in which you want to move them to the
cloud. The final assessment plan should delineate the migration
plan for all databases. If you need new resources—in software,
finance, or personnel—in the new database environment, that
should also be in the plan.
Determine who performs the migration
DBAs and developers should work together on the migration
effort because each team has something to offer. While choosing
staff, you can also decide whether to employ a migration service
provided by the cloud vendor or a third-party company.
Educational tasks
These include broad brush tasks such as understanding the use
of the cloud vendor’s tools, the specific features of the target
database engine, the scope of the database migration, and the
architecture of the cloud databases.
Create the cloud database architecture
Select the type of databases that you want to use, as well as
whether to use a managed or self-managed database. When
making this choice, weigh all relevant factors such as cost,
performance, reliability, and scalability.
Choose a migration process
“Migrating the Database” on page 32 lays out the criteria for
choosing among replication, backup/restore, or a dedicated
migration service.
For a self-managed database, create your computing infrastructure
If you choose to manage your own databases in the cloud, create
virtual instances and deploy them through the vendor’s compute
service, such as Amazon Elastic Compute Cloud (Amazon EC2).
Determine opportunities for architectural changes
You might find that choices you made on-premises are no longer
right for the new environment in the cloud. For instance, you
might be able to consolidate shards.
Readiness Assessment
A readiness assessment helps you to estimate the costs, the architecture
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 readiness 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
performance, 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
patterns 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 that will be required,
which in turn calls for coordination with developers.
Planning | 29
Migration cost analysis
Perform a thorough analysis of the costs of migrating to the
cloud versus staying in the on-premises data centers so that
you fully understand the TCO and ROI of the cloud migration.
Planning | 31
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 expedite
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 migrations
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.
Start a replication instance. Let the AWS Database Migration Service create
tables, load data, and keep them in sync.
Connect to source and target databases.
Switch applications over to the target
Select tables, schemas, or databases. at your convenience.
Application Users
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
supports, 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 redesigning
and other modernizations.
Post-Migration Checks
After the data is completely copied over to the cloud database,
validate 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 running
a checksum to indicate that there was no loss or corruption.
More complex validation processes factor in the schema changes
inherent in heterogeneous 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 procedures.
Optimization
At this point, you are presumably running smoothly and can
congratulate your team all around for a job well done. This section
summarizes 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 activities 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
convey enough information to tell you the sources 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 environment. 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
processes 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
identify 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
engineering, 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
database 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
regularly so that you learn of degradation before your
customers tell you about it; you can then scale or make other
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 outright 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 benefits
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:
• Third-party vendor, on-premises, or hybrid
• Relational or one of the many nonrelational varieties
• Managed or self-managed
• Cloud native (e.g., Amazon Aurora) or cross-platform (e.g., MySQL)
• Whether to take advantage of performance enhancements such
as solid-state drives or caches
• Physical locations of cloud regions and availability zones
• Ease of migration
• Relevant skills needed and possessed by your staff
• Other aspects of vendor support and reputation
It is not a good idea to prematurely tie yourself to a choice in one area
before looking at all options. It can well be that you can save a lot
of money and improve customer experience by taking on some extra
training or making a leap into an unfamiliar technology.
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 preparing
you for the changes that will likely occur in your responsibilities and
tasks. Some responsibilities and tasks are simplified or removed by
moving to the cloud, but you will also have new technologies 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, Ohio, 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 architectures on AWS. His fo-
cus is on designing and implementing sustainable, cost-effective, and
scalable database workloads that take advantage of the latest best
practices and capabilities that the AWS platform offers. Prior to joi-
ning 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 Systems 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
articles 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 Convention, 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 Westlake,
Texas. He is part of the Big Data and Hadoop team. Sam is an Oracle
ACE, a recognition conferred by Oracle Technology Network. 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 providers: AWS,
Microsoft Azure, and Google Cloud Platform.