AWS June Webinar Series - Best Practices: SQL Server on Amazon RDS and EC2

36
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ghim-Sim Chua, Darryl Osborne, Vlad Vlasceanu 06/18/2015 Best Practices for SQL Server on Amazon RDS and Amazon EC2

Transcript of AWS June Webinar Series - Best Practices: SQL Server on Amazon RDS and EC2

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

Ghim-Sim Chua, Darryl Osborne, Vlad Vlasceanu

06/18/2015

Best Practices for SQL Server on

Amazon RDS and Amazon EC2

Running SQL Server Workloads on AWS

How do you run SQL Server on AWS?

How do you run it efficiently and securely?

How do you deploy and operate a

high performance SQL Server

workload at scale?

How Do You Run

SQL Server on AWS?

The AWS Global Infrastructure

11 Regions Worldwide

Geographic areas where AWS services are available

30 Availability Zones (AZs)

Multiple, isolated locations within a region

Choose which regions and availability zones to deploy your workloads in.

AWS Services to Use when deploying SQL Server

Amazon Virtual Private

Cloud (VPC)

Amazon Elastic Compute

Cloud (EC2)

Amazon Relational

Database Service (RDS)

AWS Identity and Access

Management (IAM)

AWS Key Management

Service (KMS)

Amazon Elastic Block

Storage (EBS)

Amazon RDS for SQL Server

Solutions for Running SQL Server on AWS

SQL Server on EC2 Instances

Power, HVAC, net

Rack & stack

Server maintenance

OS patches

DB s/w patches

Database backups

High availability

DB s/w installs

OS installation

Scaling

App optimization

Power, HVAC, net

Rack & stack

Server maintenance

OS patches

DB s/w patches

Database backups

High availability

DB s/w installs

OS installation

Scaling

App optimization

AWS manages

You manage

?

Amazon RDS for SQL Server

• We recommend you consider RDS first

• Focus on tasks that bring value to your

business

• Focus on high level tuning tasks and

schema optimization

• Lack of in-house expertise managing

databases

Choosing the Right Solution for Your Needs

SQL Server on EC2 Instances

• You need full control over the DB instances

• Control over backups, replication and

clustering

• Use features and options not available in

Amazon RDS

• Size and performance needs exceed

Amazon RDS offering

Let’s Talk About Best Practices

for SQL Server on AWS

Run SQL Server Effectively on AWS

Features Security Scalability, Sizing

and Performance

Cost Optimization

SQL Server Feature Support on AWS

Amazon RDS for SQL Server SQL Server on Amazon EC2

Versions Supported: 2008 R2, 2012 2005*, 2008*, 2008 R2, 2012, 2014

Editions Supported: Express, Web, Standard, Enterprise*

High Availability: Automated failover, Multi-AZ Self-managed (AlwaysOn, Mirroring,

Log Shipping)

Encryption: Encrypted Storage using Amazon KMS (all editions); TDE Support

Authentication: SQL Server Authentication only Windows and SQL Server Auth.

Backups: Managed Automated Backups Leverage Maintenance Plans, or 3rd

party

Patching and

Maintenance:

Automatic Software Patching Self-managed

* Self installed

Run Your SQL Server Securely on AWS

Network Layer

Controls

DB Instance Access

Controls

Data Access

Controls

Encryption

Consider the following security layers offered by AWS:

Securing SQL Server on AWS: The Network

Amazon VPC: control subnets, AZ

specificity (DB Subnet Groups), route

tables and NACLs

Security Groups: restrict instance

traffic

Public Access: avoid it or limit it

1

2

3

Securing SQL Server on AWS: Instance Access

Control: Use IAM to control instance

lifecycle permissions, grant least

privileges

Audit: Use Amazon CloudTrial to log

AWS API invocations

1

2

Securing SQL Server on AWS: Data Access

Grant Least Privileges to applications

and end users

Amazon RDS: SQL Server

Authentication only

Amazon EC2: Windows and SQL Server

Authentication

1

2

3

Securing SQL Server on AWS: Encryption

Protect data at rest

Encrypted DB instances using Amazon KMS,

TDE, Column-level, encrypt before saving

Secure data in transit

Encrypted connections via SSL

1

2

Sizing to Meet Your Workload Demands

What is your workload’s demand pattern?

Constant, steady-state

Predictable fluctuations, steady-state

Growing, but predictable

Fluctuating, spiky

Sizing to Meet Your Workload Demands (cont.)

Range of DB

instance types

From: 1 vCPU and

1 GB of RAM

To: 40 vCPUs and

244 GB of RAM

Grouped in instance

families:

General Purpose

Memory Optimized

Compute Optimized

etc.

Scale up/down by

changing the

instance class

EC2EC2

EC2EC2

M4

Optimize Your SQL Server for Cost

SQL Server operational costs depend on:

region selected

instance class/type

storage type and size

runtime

Multi-AZ mode

pricing model

licensing model

The AWS Pricing Models Compared

On-Demand

Pay by the hour

No term commitment

EC2 Reserved Instances

No-upfront

Partial-upfront

All-upfront RIs

RDS Reserved Instances

Heavy

Medium

Light

Reserved Instances (RIs) available for 1 and 3 year terms

Save up to 60% over on-demand costs

Diving Deeper Into Running

SQL Server at Scale on AWS

Manage Your SQL Server Resources on AWS

Amazon

EC2 & RDS

Management

Console

AWS Command

Line Tools (CLI)

or

AWS Tools for

PowerShell

AWS SDKs AWS

CloudFormation

templates

Multiple ways to start and manage your AWS SQL Server resources

AWS Resource Management

Amazon RDS

Management Console

AWS Resource Management

AWS CLI

aws rds create-db-instance \

--db-instance-identifier MSSQLInstance \

--allocated-storage 200 \

--db-instance-class db.m2.4xlarge \

--engine sqlserver-se \

--license-model license-included \

--master-username awsuser \

--master-user-password mypassword

AWS Resource Management

{

"AWSTemplateFormatVersion" : "2010-09-09",

"Resources" : {

"DBInstance" : {

"Type": "AWS::RDS::DBInstance",

"Properties": {

"DBInstanceIdentifier" : "MSSQLInstance",

"Engine" : "sqlserver-se",

"LicenseModel" : "license-included",

"DBInstanceClass" : "db.m2.4xlarge",

"AllocatedStorage" : "200",

"MasterUsername" : "awsuser",

"MasterUserPassword" : "mypassword"

}

}

}

}

AWS Cloudformation

Monitoring Your SQL Server Workloads

Set Alarms & Notifications for abnormal conditions

Default metrics for Amazon EC2 & Amazon RDS

Add custom metrics (Amazon EC2)

Monitor performance using Amazon CloudWatch

Amazon RDS for SQL Server

Always Run Production Workloads in

Multi-AZ Mode

• Primary and secondary DB nodes in

different Availability Zones (AZ)

• Leverages SQL Server Mirroring

• Automatic failover (1-2 min. typically)

High Availability (HA)

High Availability (HA)

SQL Server on Amazon EC2

Use Native SQL Server Features:

• Log Shipping: typically used for DR,

increases availability

• Database Mirroring: mirrors principal to

secondary

• AlwaysOn Availability Groups: failover of

database group

Storage System I/O Performance

Amazon RDS Amazon EC2

Type Size Performance Size Performance Burst Capacity Pricing Model

Magnetic

Storage

20 GiB – 1 TiB ~ 100 IOPS 1 GiB – 1 TiB ~ 100 IOPS Yes, several

hundred IOPS

Allocated

storage; I/O

operations

General

Purpose

(SSD)

20 GiB – 4 TiB

(min. 100 GiB

recommended)

3 IOPS/GiB 1 GiB – 16 TiB 3 IOPS/GiB for

volumes 1 TiB

or less, up to

10,000 IOPS

for larger

volumes

Yes, up to

3000 IOPS per

volume,

subject to

credits (< 1 TiB

in size)

Allocated

storage

Provisioned

IOPS

(SSD)

100 GiB – 4 TiB

(min. 200 GiB

for Standard

ed.)

10 IOPS/GiB,

up to max.

20,000 IOPS

4 GiB – 16 TiB Up to 20,000

IOPS; ratio: 3

to 30 IOPS per

GiB

No, fixed

allocation

Allocated

storage;

Provisioned

IOPS

I/O Performance Planning

When sizing your storage subsystem keep in mind:

• Amazon RDS maximum channel bandwidth: 1000 Mbps

full duplex

• Amazon EBS maximum volume throughput: 320 MiB/s

• IOPS provisioning: each I/O up to 256 KiB = 1 IOPS

• Average Queue Depth: I/O requests waiting to be serviced

I/O Performance Planning

When sizing your storage subsystem keep in mind:

• First touch penalty for EBS volumes

• Consider Instance Storage with strong backup strategy

for high performance databases

• Amazon EC2: Consider striping multiple EBS volumes

• Amazon RDS: Storage cannot scale once deployed

Amazon RDS Built-in Management Features

• Automated backup and recovery

Max. Retention: 35 days

Restore to any second, typically up

to the last 5 minutes

• Push-button DB instance class scaling

• Automatic host replacement

Amazon RDS Built-in Management Features

• Automatic minor version upgrade

• Pre-configured parameters and options

• Configurable administrative windows of

time:

Backup Window: at least 30min

once a day

Maintenance Window: at least

30min once a week

Amazon RDS SQL Server Tooling Support

• Manage using common tools: e.g. SSMS

• Migrate data using:Amazon RDS Migration Tool

Microsoft SQL Server Database Publishing Wizard

• Maximum 30 databases per Amazon RDS

instance

• Data source for SSAS, SSIS and SSRS

Amazon RDS SQL Server Tooling Support

Not available on DB instance:

SSAS

SSIS

SSRS

Not supported:

Maintenance Plans

Database Mail

Linked Servers

MSDTC

Thank You!

Additional Resources

RDBMS in the Cloud: Deploying SQL Server on AWS:

http://d0.awsstatic.com/whitepapers/rdbms-in-the-cloud-sql-server-on-aws.pdf

Implementing Microsoft Windows Server Failover Clustering and SQL Server AlwaysOn Availability

Groups in the AWS Cloud:

http://aws.amazon.com/windows/resources/whitepapers/alwayson/

AWS Summit – Chicago: An exciting, free cloud conference designed to educate and inform new

customers about the AWS platform, best practices and new cloud services.

Details• July 1, 2015

• Chicago, Illinois

• @ McCormick Place

Featuring• New product launches

• 36+ sessions, labs, and bootcamps

• Executive and partner networking

Registration is now open• Come and see what AWS and the cloud can do for you.

• Click here to register: http://amzn.to/1RooPPL