getting started with aws ec2. from zero to hero

39
Getting Started with AWS EC2. From Zero to Hero 13 April 2016 George Yanev Telerik, a Progress Company DevOps Engineer

Upload: awsbulgaria

Post on 08-Feb-2017

160 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Getting Started with AWS EC2. From Zero to Hero

Getting Started with AWS EC2. From Zero to Hero

13 April 2016George Yanev

Telerik, a Progress CompanyDevOps Engineer

Page 2: Getting Started with AWS EC2. From Zero to Hero

About Me

● Started as System Administrator with passion for Open Source. First distro Slackware.

● Few years ago get interested in coding and as Open Source enthusiast and System Administrator picked Python.

● Moved to DevOps as it match my believe that if you love what you do, you will find ways to do it better.

Page 3: Getting Started with AWS EC2. From Zero to Hero

What to expect

● Introduction to EC2.● Go beyond the introduction in some areas like Xen, Burstable instances,

Instance type, Enhanced networking● Dive in the Price Options

Page 4: Getting Started with AWS EC2. From Zero to Hero

HistoryStarted in 25 August 2006 in BETA with m1.small instance

Interesting facts:

- m1.small instance from 2006 was 2.27 times more expensive than today- No persistent storage until 20 August 2008 when EBS was introduced- Only Linux- No AWS Management Console- No Auto Scaling

Page 5: Getting Started with AWS EC2. From Zero to Hero

Let’s talk a little bit about the Hardware

● Data centers● Racks● Servers● Networking● Data storage

Page 6: Getting Started with AWS EC2. From Zero to Hero

Hardware● Rack ● Switch

Page 7: Getting Started with AWS EC2. From Zero to Hero

Virtualization● Hypervisor type is XEN ● Curious facts

○ Operating System is probably RedHat based

○ Different XEN version in the same region

Page 8: Getting Started with AWS EC2. From Zero to Hero

EC2 Hypervisor guests types

● HVM (Hardware Virtual Machine a.k.a Hardware-assisted virtualization)● PV (Paravirtualization)

Page 9: Getting Started with AWS EC2. From Zero to Hero

HVM

● Guest system doesn’t know it has been virtualized● By default slower than PV in I/O scenarios (not true anymore)● Depends on the Hardware (Intel - VT, AMD - AMD-V)● Secure Hardware isolation

Page 10: Getting Started with AWS EC2. From Zero to Hero

HVM Speed

HVM is currently at least on par as performance goes with PV thanks to:

● New hardware extensions: SR-IOV● Xen improvements● Kernel host improvements - vector callbacks, MSI remapping, interrupt

remapping● PV drivers - storage drivers, network drivers

Page 11: Getting Started with AWS EC2. From Zero to Hero

EC2 Hypervisor guests pros

● HVM (Hardware Virtual Machine a.k.a Hardware-assisted virtualization)○ Bursty CPU Loads.○ High Memory Instances.○ Enhanced Networking Instances.

● PV (Paravirtualization)○ None

If you like benchmarks: http://www.phoronix.com/scan.php?page=article&item=amazon_ec2_pvhvm&num=1

Page 12: Getting Started with AWS EC2. From Zero to Hero

EC2 Instance type

Page 13: Getting Started with AWS EC2. From Zero to Hero

Instance family● T, M - General purpose● C - Compute optimized ● R - Memory optimized● I, D - Storage optimized● G - GPU instances

Page 14: Getting Started with AWS EC2. From Zero to Hero

Instance generation

● Each new generation add feature, boost performance. If you are unsure which generation to use, choose the latest.

Page 15: Getting Started with AWS EC2. From Zero to Hero

Instance size

● Starting from nano reaching out to 8xlarge (and the monster X1 SAP HANA)● http://www.ec2instances.info/

Page 16: Getting Started with AWS EC2. From Zero to Hero

Instance types

● Next dozen of slides will try to explain○ The different Instance types○ Which role suits each Instance type○ Instance types key facts

Page 17: Getting Started with AWS EC2. From Zero to Hero

vCPU

● What exactly AWS means by vCPU?

Each vCPU is a hyperthread of an Intel Xeon core. In general, one vCPU more-or-less correlates to half a physical core.

Page 18: Getting Started with AWS EC2. From Zero to Hero

T2 (Burstable Performance Instances)

● Features○ High Frequency Intel Xeon Processors with Turbo up to 3.3GHz○ Burstable CPU, governed by CPU Credits, and consistent baseline performance○ Lowest-cost general purpose instance type, and Free Tier eligible (t2.micro only)○ Balance of compute, memory, and network resources

Page 19: Getting Started with AWS EC2. From Zero to Hero

Burstable Performance Instances

● Burstable Performance Instances provide a baseline level of CPU performance with the ability to burst above the baseline.

Page 20: Getting Started with AWS EC2. From Zero to Hero

Burstable Performance Instances #2● Understand how credit works

Page 21: Getting Started with AWS EC2. From Zero to Hero

M4 (General Purpose Instances)

● Features○ 2.4 GHz Intel Xeon® E5-2676 v3 (Haswell) processors.○ EBS-optimized by default at no additional cost.○ Support for Enhanced Networking.○ Balance of compute, memory, and network resources.

● No local storage, only EBS.● Probably the most versatile Instances.● Fixed Performance Instances as opposed to the T2 instances.

Page 22: Getting Started with AWS EC2. From Zero to Hero

EBS

● General Purpose SSD volumes. ● Provisioned IOPS SSD volumes.● EBS Magnetic volumes.● Snapshot capabilities.● Bound to a specific Availability Zone.● Not bound to the current instance.

Page 23: Getting Started with AWS EC2. From Zero to Hero

General Purpose SSD volume

● Speed and credit accumulation depends on the volume size● Initial I/O credit balance is 5 400 000. This is enough to sustain 30minutes of

maximum burst.

Page 24: Getting Started with AWS EC2. From Zero to Hero

EBS Optimized● Free and enabled by default for M4, C4 and D2 Instances.● Paying a fee if your instance is not M4, C4 or D2: http://aws.amazon.

com/ec2/pricing/#EBS-Optimized_Instances● Dedicated throughput between the EC2 Instance and Amazon EBS.

Throughput Max 16K IOPS Max bandwidth (MB/s)

450 Mbps 3,600 56.25

M4.large EBS max performance

Page 25: Getting Started with AWS EC2. From Zero to Hero

Enhanced Networking

● What is Enhanced Networking?● How it’s working?

Page 26: Getting Started with AWS EC2. From Zero to Hero

Enhanced Networking #2

● Do you need it?

In few words: probably not but depends on your usage.

Benchmarks: http://blogs.scalablelogic.com/2013/12/enhanced-networking-in-aws-cloud.html

Page 27: Getting Started with AWS EC2. From Zero to Hero

Enhanced Networking #3

● Requirements○ Instances of the following type: C4, C3, R3, I2, M4, and D2○ HVM AMI○ Launch in VPC ○ Linux kernel module ixgbevf, minimum recommended version 2.14.2

● How-to enable it: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#test-enhanced-networking

Page 28: Getting Started with AWS EC2. From Zero to Hero

M3 (General Purpose Instances)

● Compare to the M4

○ No EBS Optimized by default.

○ Has a SSD-based instance storage for fast I/O performance.

○ Lack enhanced networking.

○ More expensive than M4

Page 29: Getting Started with AWS EC2. From Zero to Hero

C4 (Compute Optimized Instances)

● Features

○ High frequency Intel Xeon E5-2666 v3 (Haswell) processors optimized specifically for EC2

○ EBS-optimized

○ Ability to control processor C-state and P-state configuration on the c4.8xlarge instance type

○ Support for Enhanced Networking and Clustering

Page 30: Getting Started with AWS EC2. From Zero to Hero

C3 (Compute Optimized Instances)

● Compare to the C4

○ No EBS Optimized by default.

○ Has a SSD-based instance storage for fast I/O performance.

○ Lack enhanced networking.

○ More expensive than M4

Page 31: Getting Started with AWS EC2. From Zero to Hero

R3 (Memory Optimized Instances)

● Features○ High Frequency Intel Xeon E5-2670 v2 (Ivy Bridge) Processors

○ Lowest price point per GiB of RAM

○ SSD Storage

○ Support for Enhanced Networking

Hint: EBS Optimized is not enabled by default

Good for NoSQL databases like MongoDB, Distributed memory cache.

Page 32: Getting Started with AWS EC2. From Zero to Hero

I2 (High I/O Optimized Instances)

● Features○ High Frequency Intel Xeon E5-2670 v2 (Ivy Bridge) Processors

○ SSD Storage

○ Support for TRIM

○ Support for Enhanced Networking

○ High Random I/O performance

Page 33: Getting Started with AWS EC2. From Zero to Hero

Purchasing Options

● First thing first. This site is a must: http://www.ec2instances.info/ while calculating the price.

● Three ways to pay for EC2 Instances○ On-Demand○ Reserved○ Spot Instances

Page 34: Getting Started with AWS EC2. From Zero to Hero

On-Demand Instances

● Key features:○ Pay by the hour ○ Without any up-front payment or long-term commitment○ Increase/Decrease compute capacity at will

Page 35: Getting Started with AWS EC2. From Zero to Hero

Reserved Instances

● Key features:○ Significant discount (up to 75%) compared to On-Demand instances.○ Always available for the Operating System and Availability zone in which you purchased it.○ If you don’t use it you lose money as you’ve already prepaid for it.

○ Somewhat hard to change or in some instances impossible to change. As example you can't move it in a different region.

○ You can sell it

Page 36: Getting Started with AWS EC2. From Zero to Hero

Spot Instances

● Key features:○ Usually lower hourly rates than On-Demand instances.○ No upfront commitment (same as On-Demand instances).○ You bid for the Spot Instances (they are AWS spare resource).○ They will be shutdown if the current price is above the maximum you have specified.

Page 37: Getting Started with AWS EC2. From Zero to Hero

Recap: Getting most of this presentation

● Use HVM AMI● Use in the beginning On-Demand instances. They are flexible and you are paying

only for each started hour.● Choose instance By-Resource Approach● Start with smaller instances and change with bigger if needed. Change instance

type is cheap (stop/change/start) as long as you are using EBS and and the instance will not be moved to different Availability Zone.

● http://www.ec2instances.info/

Page 38: Getting Started with AWS EC2. From Zero to Hero

Q&A