AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation,...

61
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Steve Abraham, Solutions Architect Shree Kenghe, Solutions Architect November 29, 2016 Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution, and Replication DAT321

Transcript of AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation,...

Page 1: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Steve Abraham, Solutions Architect

Shree Kenghe, Solutions Architect

November 29, 2016

Workshop: Using the Database Migration

Service (DMS) for Database Consolidation,

Data Distribution, and Replication

DAT321

Page 2: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

What to Expect from the Session

Agenda

• Housekeeping

• Migrating to AWS

• SCT Overview

• DMS Overview

• Q&A

• Workshop

Page 3: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Housekeeping

Download:

http://chilp.it/203c7aa

Page 4: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Housekeeping

Page 5: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migrating to AWS

Page 6: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

• Quickly provision databases

• Multiple Availability Zones

• Rapid scaling

• Automated patching

• Easy read replica creation

• High durability

• Point in time recovery

• Detailed metrics

• Single-click encryption at rest

Amazon

RDS

Why AWS?

Page 7: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

• How will my on-premises data migrate to the cloud?

• How can I make it transparent to my users?

• How will on-premises and cloud data interact?

• How can I integrate my data assets within AWS?

• How can I move off of commercial databases?

How?

Page 8: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migration Options

• Lift and shift

• Leverage Amazon EC2 and Amazon S3

• Keep existing DB engine but migrate to Amazon RDS

• For example Oracle on-premises to RDS Oracle

• Migrate database engine

• Commercial engine to open source

• Maintenance window

• Maintenance window duration vs. CDC with 0 downtime

Page 9: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Database Migration Process

Page 10: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Phase Description Automation Effort (%)

1 Assessment SCT 5

2 Database schema conversion SCT/DMS 10

3 Application conversion/remediation SCT 25

4 Scripts conversion SCT 6

5 Integration with third-party applications 4

6 Data migration DMS 4

7 Functional testing of the entire system 30

8 Performance tuning SCT 2

9 Integration and deployment 7

10 Training and knowledge 2

11 Documentation and version control 2

12 Post production support 3

Database Migration Phases

Page 11: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

AWS Schema Conversion Tool

Overview

Page 12: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

AWS Schema Conversion Tool

Features

• Converts schema of one database engine to another

• Database Migration Assessment report for choosing the best target engine

• Code browser that highlights places where manual edits are required

The AWS Schema Conversion Tool helps

automate many database schema and code

conversion tasks when migrating from Oracle

and SQL Server to open source database

engines.

Page 13: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Convert Tables, Views, and Code

• Sequences

• User Defined Types

• Synonyms

• Packages

• Stored Procedures

• Functions

• Triggers

• Schemas

• Tables

• Indexes

• Views

Page 14: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Components of the Console

1. Source Schema

2. Action Items

3. Target Schema

4. Schema Element Details

5. Edit Window

Page 15: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Database Migration Assessment

1. Connect Schema

Conversion Tool to

source and target

databases.

2. Run Assessment

Report.

3. Read Executive

Summary.

4. Follow detailed

instructions.

Page 16: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Supported Conversions

Source Database Target Database

Microsoft SQL Server Amazon Aurora, Microsoft SQL Server, MySQL, PostgreSQL

MySQL MySQL, PostgreSQL

Oracle Amazon Aurora, MySQL, Oracle, PostgreSQL

Oracle Data Warehouse Amazon Redshift

PostgreSQL Amazon Aurora, MySQL, PostgreSQL

Teradata Amazon Redshift

Page 17: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

$0for software license

Allowed Use

Use Schema Conversion Tool to migrate database

schemas to Amazon RDS, Amazon Redshift, or Amazon

EC2–based databases

To use Schema Conversion Tool to migrate schemas to

other destinations, contact for special pricing

Pricing

Free software license

For active AWS customers with

accounts in good standing

Pricing, Terms & Conditions

Page 18: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Prerequisites

• Create Databases• Source

• Target

• Download AWS Schema Conversion Tool• http://amzn.to/2b2YE2a

• Download Drivers• http://amzn.to/2axE0Hn

• Update Global Settings

Page 19: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Global Settings – Logging

Page 20: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Global Settings – Drivers

Page 21: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Global Settings – Performance and Memory

Page 22: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Global Settings – Assessment Report

Page 23: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Time Considerations

• Any Hard Dates?

• Planning Time?

• Typically 2-3 Weeks

• Several Iterations

Page 24: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Database Considerations

• Number of Schemas?

• Number of Tables?

• Engine Specific Types?

• Users/Roles/Permissions?

Page 25: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Network Considerations

• Access (Firewalls, Tunnels, VPNs)?

• Which VPC?

• Which Security Groups?

Page 26: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Requirements Considerations

• Engine Selection Criteria?

• Which Tables Need to Move?

• Same Target For All Tables?

Page 27: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Temporary Work Schema

• Added to target DB instance

• After migration delete temporary work schema

• Schemas

• Microsoft SQL Server: AWS_SQLSERVER_EXT

• MySQL: AWS_MYSQL_EXT

• Oracle: AWS_ORACLE_EXT

• PostgreSQL: AWS_POSTGRESQL_EXT

Page 28: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

DMS Overview

Page 29: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

• Start your first migration in 10 minutes or less

• Keep your apps running during the migration

• Replicate within, to, or from Amazon EC2 or RDS

• Move data to the same or a different database engine

AWS

Database Migration

Service

(AWS DMS)

Page 30: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Customer

premises

Application users

AWS

Internet

VPN

• Start a replication instance

• Connect to source and target databases

• Select tables, schemas, or databases

Let AWS DMS create tables, load data, and keep them in sync

Switch applications over to the target at your convenience

Keep your apps running during the migration

AWS

DMS

Page 31: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Multi-AZ option for high availability

Customer

premises

or AWS

AWS

Internet

VPN

AWS DMS

AWS DMS

Page 32: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

AWS Database Migration service pricing

T2 for developing and periodic data migration tasks

C4 for large databases and minimizing time

T2 pricing starts at $0.018 per hour for T2.micro

C4 pricing starts at $0.154 per hour for C4.large

50 GB GP2 storage included with T2 instances

100 GB GP2 storage included with C4 instances

Data transfer inbound and within AZ is free

Data transfer across AZs starts at $0.01 per GB

Page 33: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migration Scenarios and Options

Page 34: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

On-Premises Migration Scenarios

• An on-premises database to a database on Amazon RDS DB

instance

• An on-premises database to a database on an Amazon EC2

instance

• Migration from an on-premises database to another on-premises

database is not supported.

Page 35: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

RDS Migration Scenarios

• A database on an Amazon RDS DB instance to an on-premises

database

• A database on an Amazon RDS DB instance to a database on an

Amazon RDS DB instance

• A database on an Amazon RDS DB instance to a database on an

Amazon EC2 instance

Page 36: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

EC2 Migration Scenarios

• A database on an Amazon EC2 instance to an on-premises

database

• A database on an Amazon EC2 instance to a database on an

Amazon EC2 instance

• A database on an Amazon EC2 instance to a database on an

Amazon RDS DB instance

Page 37: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

DMS Components

• Replication Instances

• Endpoints

• Tasks

Page 38: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Replication Instances

• Performs the work of the migration

• Tasks run on instances

• Can support multiple tasks

• AWS DMS currently supports T2 and C4 instance classes for

replication instances

Page 39: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Public and Private Replication Instances

• A replication instance should have a public IP address if the source

or target database is located in a network that is not connected to

the replication instance's VPC by using a virtual private network

(VPN), AWS Direct Connect, or VPC peering.

• A replication instance should have a private IP address when both

the source and target databases are located in the same network

that is connected to the replication instance's VPC by using a VPN,

AWS Direct Connect, or VPC peer.

Page 40: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Sources for AWS Database Migration Service

Customers use the following databases as a source for data migration using AWS

DMS: On-premises and Amazon EC2 instance databases:

• Oracle Database 10g – 12c

• Microsoft SQL Server 2005 – 2014

• MySQL 5.5 – 5.7

• MariaDB (MySQL-compatible data source)

• PostgreSQL 9.4 – 9.5

• SAP ASE 15.7+

RDS instance databases:

• Oracle Database 11g – 12c

• Microsoft SQL Server 2008R2 - 2014. CDC operations are not supported yet.

• MySQL versions 5.5 – 5.7

• MariaDB (MySQL-compatible data source)

• PostgreSQL 9.4 – 9.5

• Amazon Aurora (MySQL-compatible data source)

Page 41: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Targets for AWS Database Migration Service

Customers can use the following databases as a target for data replication using

AWS DMS:On-premises and EC2 instance databases:

• Oracle Database 10g – 12c

• Microsoft SQL Server 2005 – 2014

• MySQL 5.5 – 5.7

• MariaDB (MySQL-compatible data target)• PostgreSQL 9.3 – 9.5

• SAP ASE 15.7+

RDS instance databases:

• Oracle Database 11g – 12c

• Microsoft SQL Server 2008 R2 - 2014

• MySQL 5.5 – 5.7

• MariaDB (MySQL-compatible data target)

• PostgreSQL 9.3 – 9.5• Amazon Aurora (MySQL-compatible data target)

• Amazon Redshift

Page 42: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Tasks Overview

• Run on a replication instance

• Contain two and only two endpoints (source and target)

• Different migration methods available

• Specify selection and/or transformation rules

• Can run multiple tasks

Page 43: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migration Methods

• Migrate existing data

• Migrate existing data and replicate ongoing changes

• Replicate data changes only

Page 44: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

DMS – Change Data Capture (CDC)

“No Touch” design

• Reads recovery log of source database

• Using the engine’s native change data capture API

• No agent required on the source

Some requirements

• Oracle: Supplemental logging required

• MySQL: Full image row level bin logging required

• SQL Server: Recovery model bulk logged or full

• Postgres: wal_level = logical; max_replication_slots >= 1; max_wal_Senders >=1;

wal_sender_timeout = 0

Changes captured and applied as units of single committed transactions

Activated when load starts

No changes are applied until load completes, then applied as soon as possible in near real-time

Page 45: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Replication

Instance

Source Target

Start Full Load

Page 46: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

While Loading Data Also Capture Changes

Source TargetReplication Instance

Update

Page 47: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Load Complete - Apply Captured Changes

Source TargetReplication Instance

Update

Page 48: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Changes Reach Steady State

Source TargetReplication Instance

Update

Page 49: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Cutover - Shut Down Apps & Apply Remaining Changes

Source TargetReplication Instance

Update

Page 50: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Flip!

Source TargetReplication Instance

Update

Page 51: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Changes are Transactional and Come From the Logs

Migration Server

Source Target

Update

t

1

t

2

t

1

t

2

Page 52: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Replication

Instance

Source Target

Multiple Targets

Target

Target

Page 53: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migration

Server

Source Target

Multiple Sources

Source

Source

Page 54: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Migration

Server

Source

Target

Multiple Sources and Targets

Source

Source

Target

Page 55: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

You Don’t Have to Take Everything

Source

Target

Replication Instance

Page 56: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Homogenous or Heterogeneous

Replication

Instance

SQL Server MySQL

Replication

Instance

Oracle Oracle

Replication

Instance

Oracle Aurora

Page 57: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Lab

Page 58: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Lab Document

Download: http://chilp.it/499290a

Lab to be run in us-west-2 (Oregon) region

Page 59: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Lab

Page 60: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Thank you!

Page 61: AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for Database Consolidation, Data Distribution and Replication (DAT321)

Remember to complete

your evaluations!