Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS...

54
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved ©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Introduction to Database Services Shaun Pearce AWS Solutions Architect

Transcript of Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS...

Page 1: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

©2015,  Amazon  Web  Services,  Inc.  or  its  affiliates.  All  rights  reserved ©2015,  Amazon  Web  Services,  Inc.  or  its  affiliates.  All  rights  reserved

Introduction to Database Services Shaun Pearce

AWS Solutions Architect

Page 2: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Today’s agenda

•  Why managed database services? •  A non-relational managed database •  A relational managed database •  A managed in-memory cache •  A managed data warehouse

Page 3: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Why managed database services?

Page 4: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

If you host your databases on-premises

Power, HVAC, net Rack & stack

Server maintenance

OS patches

DB s/w patches Database backups

Scaling High availability

DB s/w installs

OS installation

App optimization

Page 5: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

If you host your databases on-premises

Power, HVAC, net Rack & stack

Server maintenance

OS patches

DB s/w patches Database backups

Scaling High availability

DB s/w installs

OS installation

App optimization

Page 6: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

If you host your databases in Amazon EC2

Power, HVAC, net Rack & stack

Server maintenance

OS patches

DB s/w patches Database backups

Scaling High availability

DB s/w installs

OS installation

App optimization

Page 7: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

If you host your databases in Amazon EC2

OS patches

DB s/w patches Database backups

Scaling High availability

DB s/w installs

App optimization

Power, HVAC, net Rack & stack

Server maintenance OS installation

Page 8: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

If you choose a managed DB service

Power, HVAC, net Rack & stack

Server maintenance

OS patches

DB s/w patches Database backups

App optimization

High availability

DB s/w installs

OS installation

Scaling

Page 9: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

The self-managed vs. AWS-managed decision

Self-managed database (EC2) AWS-managed database

Operations You have full responsibility for upgrades and backup

AWS provides upgrades and backups as a service

Security You have responsibility for security of the OS and above

AWS provides security of the OS and DBMS installation and gives you tools to ensure DB security

Control Full control over parameters of OS and database

Database is a managed appliance, so you can easily automate

High Availability Replication can be complex and requires a lot of operational support

AWS provides failover as a packaged service

Page 10: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

A Managed Service for Each Major DB Type

Amazon DynamoDB

Document and key-value store

Amazon RDS

SQL database

engines

Amazon ElastiCache

In-memory

cache

Amazon Redshift

Data

warehouse

Page 11: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

What is Amazon DynamoDB?

Page 12: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon DynamoDB: a managed document and key-value store

•  Simple and fast to deploy •  Simple and fast to scale (to millions of IOPS) •  Data is automatically replicated •  Fast, predictable performance (backed by SSD storage) •  Secondary indexes offer fast lookups •  No cost to get started; pay only for what you consume

Page 13: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon DynamoDB is a schemaless database

table items

Attributes (name/value pairs)

Page 14: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Each item must include a key

Hash key (DynamoDB maintains an

unordered index)

CustomerID

Top Scores

Page 15: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Each item must include a key

Range key (DynamoDB maintains a

sorted index)

Hash key

CustomerID GameTitle

Top Scores

Page 16: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Local Secondary Indexes = alternate range keys

Range key

Hash key LSI

CustomerID GameTitle

TopScore

Top Scores

Page 17: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Global Secondary Indexes = “Pivot Charts” for your table

GSI

CustomerID GameTitle TopScore

Page 18: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon DynamoDB: provision throughput

100 Write capacity units

200 Read capacity units

Page 19: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

DynamoDB: What are capacity units?

1 1

1 1

Pay to bearer on demand 1 write per sec of up to 1KB

One write capacity unit

One read capacity unit

1 1

1 1

Pay to bearer on demand 1 read per sec of up to 4KB Eventually consistent reads at 50% off!

Page 20: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

CreateTable

UpdateTable

DeleteTable

DescribeTable

ListTables

PutItem

GetItem

UpdateItem

DeleteItem

BatchGetItem

BatchWriteItem

Query

Scan

Manage tables

Query specific items OR

scan full table

“Select”, “insert”, “update” items

Bulk select or update (max 1MB)

DynamoDB is optimized for developer productivity

Page 21: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Simple app architecture with Amazon DynamoDB

Elastic Load Balancing Amazon EC2

App Instances

Clients

DynamoDB

Business logic

Page 22: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Simple app architecture with Amazon DynamoDB

Clients

DynamoDB

Page 23: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How DynamoDB billing works

Monthly bill GB

Assumes DB instance accessed only from AWS region Further details at http://aws.amazon.com/dynamodb/pricing/

Storage consumed (plus 100 bytes per item)

= + +

≈ + + 100 GB * $0.25 100 * 720 hrs * $0.0065/10 200 * 720 hrs * $0.0065/50

≈ $165.40

100 Write capacity units

200 Read capacity units

Page 24: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

What is Amazon RDS?

Page 25: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon RDS: a managed SQL service

•  Simple and fast to deploy •  Simple and fast to scale •  AWS handles patching, backups, replication •  Compatible with your applications

–  Choose among Amazon Aurora, MySQL, PostgreSQL, Oracle, SQL Server

•  Fast, predictable performance •  No cost to get started; pay only for what you consume

Page 26: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How Amazon RDS delivers high performance

•  Choose General Purpose (SSD) storage for most workloads –  3 IOPS per GB provisioned, with burst capability up to 3000 IOPS

•  Choose Provisioned IOPS (SSD) storage for high, predictable performance –  Provision up to 3 TB storage and 30K IOPS per instance –  Scale IOPS up or down online

•  Choose a database instance type with the right amount of CPU and memory

Page 27: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How Amazon RDS backups work

•  Automated backups –  Restore your database to a point in time –  Enabled by default –  Choose a retention period, up to 35 days

•  Manual snapshots –  Initiated by you –  Persist until you delete them –  Stored in Amazon Simple Storage Service (Amazon S3) –  Build a new database instance from a snapshot when needed

Page 28: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Choose Multi-AZ for greater availability

•  An Availability Zone is a physically distinct, independent infrastructure

•  With Multi-AZ operation, your database is synchronously replicated to another zone in the same AWS region

•  Failover occurs automatically in response to the most important failure scenarios

•  Planned maintenance is applied first to backup

Page 29: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Choose Read Replicas for greater scalability

•  Offload read traffic to an automatically maintained read replica •  Create multiple read replicas, load-share traffic •  Easy to set up •  Available in Amazon RDS for MySQL and PostgreSQL

RDS

Page 30: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Choose cross-region snapshot copy for even greater durability, ease of migration

•  Copy a database snapshot to a different AWS region

•  Warm standby for disaster recovery

•  Or use it as a base for migration to a different region

Page 31: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Choose cross-region read replicas for enhanced data locality, even more ease of migration

•  Even faster recovery in the event of disaster

•  Bring data close to your customers

•  Promote to a master for easy migration

Page 32: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How to scale with Amazon RDS

•  Scale up or down with resizable instance types •  Scale your storage up with a few clicks while

online •  Offload read traffic to read replicas •  Use a cache (more on this in a while) •  Amazon RDS takes some of the pain out of

sharding

Page 33: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon Aurora: High Availability by Default

•  MySQL compatible

•  Delivers 5x MySQL’s throughput on the same hardware

•  Your data is replicated 6 ways across 3 AZs

•  Storage grows up to 64 TB seamlessly

•  Up to 15 Aurora Replicas with instant crash recovery

AZ 1 AZ 2 AZ 3

Virtualized, cross-AZ storage layer

Aurora

Aurora Aurora Aurora Aurora

Page 34: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How Amazon RDS billing works

Monthly bill = GB +

Assumes DB instance accessed only from Amazon EC2 Further details at http://aws.amazon.com/rds/pricing/

= 720 hrs * $0.20 + 100 GB * $0.115

= $155.5

db.m3.large; MySQL; Dublin; Single-AZ;

On-Demand

100 GB General Purpose

(SSD) 4 vCPUs;

15 GiB RAM

Page 35: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

What is Amazon ElastiCache?

Page 36: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

ElastiCache: resizable in-memory cache

•  High performance, resizable in-memory caching

•  Speed your application by bypassing database access and disk storage

•  Compatible with your existing applications –  Choose between the popular memcached and Redis

engines

Page 37: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Use Cases for Amazon ElastiCache

•  Performance or cost optimization of an underlying database

•  Storage of ephemeral key-value data •  High-performance application patterns

Page 38: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon ElastiCache: resilient app architecture

Elastic Load Balancing

Clients

AZ a

AZ b

Master

Read Replica

Page 39: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How Amazon ElastiCache billing works

Monthly bill = N ×

Further details at http://aws.amazon.com/elasticache/pricing/

= 2 nodes * 720 hrs * $0.182

= $262.08

m3.large; Oregon; On-Demand

2 vCPUs; 7.1 GB RAM

Page 40: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

What is Amazon Redshift?

Page 41: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon Redshift: a managed data warehouse

•  Petabyte-scale columnar database

•  Fully managed, fault tolerant architecture

•  Fast response time –  ~10x that of typical relational stores

•  Pricing as low as $1,000 per TB per year

Page 42: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Who uses Amazon Redshift?

•  Reduce costs by halting future HW expansion

•  Migrate completely from existing DW systems

•  Respond faster to business; provision in minutes

•  Improve performance by an order of magnitude

•  Make more data available for analysis

•  Access business data via standard reporting tools

•  Add analytic functionality to applications

•  Scale DW capacity as demand grows

•  Reduce HW & SW costs by an order of magnitude

Traditional Enterprise DW Companies with Big Data SaaS Companies

Page 43: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon Redshift architecture

Leader node

Compute nodes

Existing business intelligence tools

PostgreSQL JDBC/ODBC

Amazon S3

Amazon DynamoDB

AWS Data Pipeline

Amazon EMR

Page 44: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon Redshift dramatically reduces I/O

•  Column storage

•  Data compression

•  Zone maps

•  Direct-attached storage •  With row storage you do unnecessary I/O

•  To get average age, you have to read everything

ID Age State Amount

123 20 CA 500

345 25 WA 250

678 40 FL 125

957 37 WA 375

Page 45: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

•  With column storage, you only read the data you need

ID Age State Amount

123 20 CA 500

345 25 WA 250

678 40 FL 125

957 37 WA 375

•  Column storage

•  Data compression

•  Zone maps

•  Direct-attached storage

Amazon Redshift dramatically reduces I/O

Page 46: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

analyze compression listing; Table | Column | Encoding ---------+----------------+---------- listing | listid | delta listing | sellerid | delta32k listing | eventid | delta32k listing | dateid | bytedict listing | numtickets | bytedict listing | priceperticket | delta32k listing | totalprice | mostly32 listing | listtime | raw

•  Column storage

•  Data compression

•  Zone maps

•  Direct-attached storage •  COPY compresses

automatically

•  You can analyze and override

•  More performance, less cost

Amazon Redshift dramatically reduces I/O

Page 47: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

•  Column storage

•  Data compression

•  Zone maps

•  Direct-attached storage

10 | 13 | 14 | 26 |… … | 100 | 245 | 324

375 | 393 | 417…

… 512 | 549 | 623

637 | 712 | 809 …

… | 834 | 921 | 959

10

324

375

623

637

959

•  Track the minimum and maximum value for each block

•  Skip over blocks that don’t contain relevant data

Amazon Redshift dramatically reduces I/O

Page 48: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

•  Column storage

•  Data compression

•  Zone maps

•  Direct-attached storage

128 GB RAM

16 cores

16 TB disk

DW.HS1.8XL:

•  > 2 GB/s scan rate

•  Optimized for data processing

•  High disk density

16 GB RAM 2 cores

2 TB disk

DW.HS1.XL:

Amazon Redshift dramatically reduces I/O

Page 49: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Amazon Redshift: start small and grow big

Dense Storage Node (dw1.xlarge) 2 TB, 16 GB RAM, 2 cores Dense Compute Node (dw2.large) 0.16 TB, 16 GB RAM, 2 cores Single Node (2 TB) Cluster 2-32 Nodes (up to 64 TB)

8XL Dense Storage Node (dw1.8xlarge) 16 TB, 128 GB RAM, 16 cores, 10 GigE 8XL Dense Compute Node (dw2.8xlarge) 2.56 TB, 128 GB RAM, 16 cores, 10 GigE Cluster 2-100 Nodes (up to 1.6 PB)

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL 8XL

XL

XL XL XL XL XL XL XL XL

XL XL XL XL XL XL XL XL

XL XL XL XL XL XL XL XL

XL XL XL XL XL XL XL XL

Note: Nodes not to scale

Page 50: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

How Amazon Redshift billing works

Monthly bill = N ×

Further details at http://aws.amazon.com/rds/pricing/

= 3 nodes * 720 hrs * $0.25

= $540

dw2.large; Oregon; On-Demand

2 vCPUs; 15 GiB RAM; 0.16 TB SSD

Page 51: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

To sum up…

Page 52: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Review: AWS Managed Database Services

Amazon DynamoDB

Document and key-value store

Amazon RDS

SQL database

engines

Amazon ElastiCache

In-memory

cache

Amazon Redshift

Data

warehouse

Page 53: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Benefits of AWS Database Services

Pay only for what you use

No up-front cost

Managed services AWS handles installs,

patching, restarts

Designed for use with other AWS

services

Amazon EC2

Amazon SNS

Amazon S3

Amazon VPC

Amazon CloudWatch

AWS Data Pipeline

Easy to scale Grow as you need

Page 54: Introduction to Database Services - Amazon S3 · Introduction to Database Services Shaun Pearce AWS Solutions Architect . Today’s agenda ... App optimization Power, HVAC, net Rack

Thank You