o'reilly webcast: architecting applications for the cloud

68
Copyright 2009 HyperStratus Architecting Applications Architecting Applications for the Cloud for the Cloud Jorge Noa Jorge Noa CTO, HyperStratus CTO, HyperStratus [email protected] [email protected] v7

Upload: oreilly-media

Post on 09-May-2015

3.988 views

Category:

Technology


0 download

DESCRIPTION

This presentation analyzes aspects of the Amazon EC2 IaaS cloud environment that differ from a traditional data center and introduces general best practices for ensuring data privacy, storage persistence, and reliable DBMS backup. Presented by Jorge Noa, CTO of Hyperstratus

TRANSCRIPT

Page 1: O'Reilly Webcast: Architecting Applications For The Cloud

Copyright 2009 HyperStratus

Architecting Applications Architecting Applications for the Cloudfor the Cloud

Jorge NoaJorge NoaCTO, HyperStratusCTO, HyperStratus

[email protected]@HyperStratus.com

v7

Page 2: O'Reilly Webcast: Architecting Applications For The Cloud

About HyperStratus

• Silicon Valley-based cloud computing consultancy

• Founded by executives with deep experience in corporate IT, enterprise software, and global consultancy

• We assist clients in establishing cloud computing strategies, cloud application architectures, system selection and implementations

• We also provide cloud computing training and workshops

Page 3: O'Reilly Webcast: Architecting Applications For The Cloud

Introduction to Cloud Architecture

Page 4: O'Reilly Webcast: Architecting Applications For The Cloud

What is the Cloud?What is the Cloud?

The illusion of infinite computing resources available on The illusion of infinite computing resources available on demand, thereby eliminating the need for Cloud demand, thereby eliminating the need for Cloud Computing users to plan far ahead for provisioningComputing users to plan far ahead for provisioning

Huge Huge ResourcesResources

The elimination of an upThe elimination of an up--front commitment by Cloud front commitment by Cloud users, thereby allowing companies to start small and users, thereby allowing companies to start small and increase hardware resources only when there is an increase hardware resources only when there is an increase in their needsincrease in their needs

No No CommitmentCommitment

The ability to pay for use of computing resources on a The ability to pay for use of computing resources on a shortshort--term basis as needed (e.g., processors by the term basis as needed (e.g., processors by the hour and storage by the day) and release them as hour and storage by the day) and release them as neededneeded

Pay by thePay by theDrinkDrink

UC Berkeley RAD Lab DefinitionUC Berkeley RAD Lab Definition

Page 5: O'Reilly Webcast: Architecting Applications For The Cloud

Key Cloud BenefitsKey Cloud Benefits

IT agility as systems can be sized to meet demand IT agility as systems can be sized to meet demand ----as load scales, system resources are easily obtained as load scales, system resources are easily obtained to ensure SLAs can be metto ensure SLAs can be met

Huge Huge ResourcesResources

No No CommitmentCommitment

Move IT payments from CAPEX to OPEX. Pay only for Move IT payments from CAPEX to OPEX. Pay only for actual resources consumed. Tie IT cost to business actual resources consumed. Tie IT cost to business benefit receivedbenefit received

Pay by thePay by theDrinkDrink

No longer face the tradeoff between overprovisioning No longer face the tradeoff between overprovisioning (waste of capital) and underprovisioning (waste of (waste of capital) and underprovisioning (waste of users)users)

Page 6: O'Reilly Webcast: Architecting Applications For The Cloud

Cloud Service CategoriesCloud Service Categories

• Infrastructure as a Service (Iaas)– Amazon EC2– GoGrid– Eucalyptus

• Platform as a Service (PaaS)– Google AppEngine (Python, Java)– Windows Azure (.Net)

• Software as a Service (Saas)– Salesforce.com– Gmail

Page 7: O'Reilly Webcast: Architecting Applications For The Cloud

Public Cloud Public Cloud ---- IaaSIaaS

Private Cloud Private Cloud ---- IaaSIaaS

Public Cloud Public Cloud ---- PaaSPaaS

Public Cloud Public Cloud ---- SaaSSaaS

LessLessStructuredStructured

MoreMoreStructuredStructured

MoreMoreControlControl

Less Less ControlControl

How the Cloud is DeliveredHow the Cloud is Delivered

Page 8: O'Reilly Webcast: Architecting Applications For The Cloud

IsolatedIsolated SharedShared

PrivatePrivate

PublicPublic

Internal Private CloudInternal Private Cloud External Private CloudExternal Private Cloud

Virtual Private CloudVirtual Private Cloud Public CloudPublic Cloud

TerremarkTerremarkHP (EDS)HP (EDS)

AT&TAT&TIBMIBM

IBMIBMHPHP

Cisco/VMwareCisco/VMwareMicrosoftMicrosoft

3Tera3TeraEucalyptusEucalyptus

Amazon (AWS)Amazon (AWS)GoGridGoGrid

RackspaceRackspaceCohesiveFT CohesiveFT (VPN Cubed)(VPN Cubed)Amazon VPC (Amazon VPC (IPsecIPsec VPN)VPN)

IaaS Cloud ProvidersProviders

Page 9: O'Reilly Webcast: Architecting Applications For The Cloud

Cloud Application ExampleCloud Application Example

•• Grows from 1MM to 100+ MM insurance claims/day Grows from 1MM to 100+ MM insurance claims/day in one weekin one week

•• Traditional solution: $750K new hardware + Traditional solution: $750K new hardware + $30K/month maintenance/hosting$30K/month maintenance/hosting

•• Cloud solution: $600/month Amazon Web ServicesCloud solution: $600/month Amazon Web Services

Page 10: O'Reilly Webcast: Architecting Applications For The Cloud

Cloud TaxonomyCloud Taxonomy

Source: Christofer Hoff, Cloud Security Source: Christofer Hoff, Cloud Security Alliance Alliance ““Security Guidance for Critical Security Guidance for Critical Areas of Focus in Cloud Computing,Areas of Focus in Cloud Computing,”” Page Page 2222

••Foundation of cloud is virtualizationFoundation of cloud is virtualization

••Upper cloud services are incremental to Upper cloud services are incremental to lower cloud serviceslower cloud services

••Lower level services are key for higher level Lower level services are key for higher level services services

Page 11: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS/Paas in Detail

• Amazon AWS EC2 is an IaaS environment with RESTfulWeb Services API to allocate & manage resources

Adapted: Christofer Hoff, Adapted: Christofer Hoff, ““The Frogs Who Desired a King”

Adapted: Christofer Hoff, Adapted: Christofer Hoff, ““The Frogs Who Desired a King”

Components Providers

Page 12: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS/PaaS in Detail

• AWS SQS, SimpleDB, and CloudFront are PaaS Middleware • Google AppEngine and Microsoft Azure are PaaS AppServers

Components Providers

Adapted: Christofer Hoff, Adapted: Christofer Hoff, ““The Frogs Who Desired a King”

Page 13: O'Reilly Webcast: Architecting Applications For The Cloud

Basic Amazon AWS Concepts and Considerations

Page 14: O'Reilly Webcast: Architecting Applications For The Cloud

Amazon Web Services

• Elastic Compute Cloud – EC2 (IaaS)• Simple Storage Service – S3 (IaaS)• Elastic Block Storage – EBS (IaaS)• SimpleDB (SDB) (PaaS)• Simple Queue Service – SQS (PaaS)• CloudFront (S3 based Content Delivery

Network – PaaS)• Consistent AWS Web Services API

Page 15: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Taxonomy :AWS Components

• Images - S3 “Gold-Master” VM Images• Compute - EC2 Instance Types• Storage - Default Local Disks, EBS, S3• Network – Regions, Availability Zones, Virtual NICs• IPAM/DNS

– Internet Protocol Address Management– Domain Name System

• Security– Network Firewalls– S3 file ACLs

Page 16: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Taxonomy :AWS Components (cont)

• IAM/Auth – (Identity Access Mgmt) AWS Credentials & X.509 Certificates

• VMM – (Virtual Machine Mgmt) Self-Discovery, Auto-Configuration

• LB & Transport – (Load Balancing) AWS Auto-Scaling• API – Web API, Command-Line Tools• Mgmt - AWS Mgmt Console, Firefox Elasticfox plug-in

Page 17: O'Reilly Webcast: Architecting Applications For The Cloud

PaaS Taxonomy :AWS Components

• Messaging/Queuing – Simple Queue Service (SQS)

• Database – SimpleDB (SDB)

Page 18: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Network Component : Network Component : EC2 Regions & ZonesEC2 Regions & Zones

• Amazon EC2 locations are composed of Regions which contain Availability Zones.

• Regions consist of one or more Availability Zones, are geographically dispersed in separate geographic areas or countries– Currently only two Regions: “us-east-1”, “eu-west-1”

• Availability Zones are distinct datacenter locations that are engineered to be insulated from failures in other Zones and provide inexpensive, low latency network connectivity to other Availability Zones in the same Region– E.g. “us-east-1a”, “us-east-1b”, …

Page 19: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Network Component : Network Component : EC2 Regions & Zones (cont)EC2 Regions & Zones (cont)

• Traffic between Availability Zones in a single region is on AWS-controlled redundant infrastructure

• All traffic between Regions is across a multiple Tier-1 Public Internet infrastructure

Page 20: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Image Component:EC2 and AMIs

• EC2 provides elastic computing capacity. • EC2 instances provide empty virtual machines into which users

install desired software assets: operating system, middleware platforms, configuration files and application(s).

• EC2 instantiates the collection of these running instance assetsas an “Amazon Machine Image” (AMI).

• An AMI is digitally signed and encrypted by the owner using private x.509 key. AWS has a copy of the corresponding public X.509 certificate for decrypting an AMI at EC2 Instance “launch”time

• An AMI is equivalent to a “Gold Master” image of the configured VM in an EC2 instance

• Multiple EC2 instances can be launched from the same AMI

Page 21: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Image Component : S3 and AMIs

• S3 File storage – Reliable web accessible file-based storage using a special file name syntax – “<bucket>/<folder>/<filename>”

• EC2 AMIs are stored in S3 as a “bundle” of segmented 10MB files and EC2 VM instances are instantiated (launched) from their S3 AMI.

• Users can create their own AMIs from scratch (P2V); use pre-built public AMIs; or use a pre-built AMI as a starting point and then add custom software assets to finalize the desired AMI.

• Updating an EC2 AMI requires a full “bundling” process and results in a second AMI, different than the original one.

Page 22: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Compute Component:Compute Component:AWS EC2AWS EC2

•• EC2 is based upon Xen Hypervisor (with EC2 is based upon Xen Hypervisor (with significant constraints)significant constraints)

• 1 EC2-CU = CPU capacity of 1.0-1.2 GHz 2007Opteron or 2007 Xeon

•• Compute capacity is defined at granular levels Compute capacity is defined at granular levels ––I.e Number of CPU Cores and I.e Number of CPU Cores and ““Compute UnitsCompute Units””per core (1 core @ 1CU up to 8 cores @2.5 CU)per core (1 core @ 1CU up to 8 cores @2.5 CU)

•• Virtual Memory ranges are 1.7GB, 7.5GB and Virtual Memory ranges are 1.7GB, 7.5GB and 15GB depending on instance type15GB depending on instance type

•• Default quota of 20 VM instances per account Default quota of 20 VM instances per account

Page 23: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Compute Component :Compute Component :EC2 Compute Unit

• Several AWS benchmarks and tests manage the consistency and predictability of the performance of an EC2 Compute Unit

• Over Time, there may be several different types of physical commodity hardware underlying EC2 instances, but EC2-CU performance should remain constant

Page 24: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Storage ComponentComponent : EC2, EBS, S3EC2, EBS, S3

•• EC2 Instance Default Local Storage EC2 Instance Default Local Storage ––ephemeral virtual disks that are integral part of ephemeral virtual disks that are integral part of EC2 VM instanceEC2 VM instance–– Range from 170GB to 1.8TB total space, 1 to 5 disksRange from 170GB to 1.8TB total space, 1 to 5 disks

•• Elastic Block Storage Elastic Block Storage –– EC2 Additional EC2 Additional persistent disk volumes that can be attached persistent disk volumes that can be attached and mounted on a and mounted on a runningrunning VM. VM. –– 1TB max per volume, default quota of 20 volumes1TB max per volume, default quota of 20 volumes

•• S3 File storage S3 File storage –– Reliable web accessible fileReliable web accessible file--based storage. based storage. –– 5GB max per file5GB max per file

Page 25: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Storage Component :Storage Component :EBSEBS

•• An EBS volume is created in a user specified An EBS volume is created in a user specified AWS Availability Zone. AWS Availability Zone.

•• AWS equivalent of a local SAN RAID Disk and AWS equivalent of a local SAN RAID Disk and can only be attached to one can only be attached to one runningrunning EC2 EC2 instance at a time in the same Zoneinstance at a time in the same Zone

•• Appears to running OS VM as standard disk Appears to running OS VM as standard disk drivedrive

•• Must be partitioned and/or formatted with file Must be partitioned and/or formatted with file system before being mountedsystem before being mounted

•• Higher reliability, lower latency and higher Higher reliability, lower latency and higher throughput than than Instance Default Storagethroughput than than Instance Default Storage

•• Supports live snapshots to S3Supports live snapshots to S3

Page 26: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Storage Component :Storage Component :S3S3

•• S3 File storage S3 File storage –– Reliable web accessible file Reliable web accessible file storage (storage (s3.amazonaws.com). .

•• Buckets are created in user assigned Buckets are created in user assigned Regions Regions ((““usus--easteast--11””, , ““eueu--westwest--11””))

•• Unlimited number of index folders and files Unlimited number of index folders and files (i.e. objects) per bucket, 5GB max per file(i.e. objects) per bucket, 5GB max per file

•• Files in a bucket are replicated Files in a bucket are replicated to to geographically dispersed Zones in the geographically dispersed Zones in the bucketbucket’’s Regions Region

Page 27: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Storage Component :Storage Component :EC2 Ephemeral Storage Notes

• All Default Local instance storage devices (I.e. non-EBS EC2 volumes) are ephemeral and all data on them is lost when the instance is terminated (or crashes and cannot be rebooted). Use S3, EBS, or SDB for permanent data.

• Analogous to the file system lifecycle of a Linux Live-CD that uses RAM drives

• However, default instance storage data is retained on reboot.

• This is a major EC2 constraint that must be taken into consideration in an application’s design.

Page 28: O'Reilly Webcast: Architecting Applications For The Cloud

EC2 Dynamic Data :Typical S3 Usage Pattern

Page 29: O'Reilly Webcast: Architecting Applications For The Cloud

EC2 Dynamic Data :Typical EBS Usage Pattern

Page 30: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Network Component : Network Component : EC2 Virtual NICEC2 Virtual NIC

•• Each EC2 Instance has only one Virtual NIC that Each EC2 Instance has only one Virtual NIC that is assigned a is assigned a dynamicdynamic EC2 MAC Address and EC2 MAC Address and internal private IP Address internal private IP Address

•• AWS VM Prevents network crossAWS VM Prevents network cross--talk among talk among usersusers

•• No visibility beyond individual machine NIC No visibility beyond individual machine NIC traffic traffic ---- even among correlated machines in the even among correlated machines in the same application configurationsame application configuration

•• Communicating within multiCommunicating within multi--tier VM tier VM configurations typically involves dynamic configurations typically involves dynamic DNS server registrationDNS server registration

Page 31: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS IPAM/DNS Component : Component : EC2 IP Addresses & DNSEC2 IP Addresses & DNS

•• No customer control of initial VM IP Address or No customer control of initial VM IP Address or DNS name assignmentsDNS name assignments

•• EC2 routers map two IP addresses to the EC2 EC2 routers map two IP addresses to the EC2 Instance Instance •• dynamic EC2 Private Address (RFCdynamic EC2 Private Address (RFC--1918, e.g. 1918, e.g.

10.x.x.x)10.x.x.x)•• dynamic EC2 Public Address using Network dynamic EC2 Public Address using Network

Address Translation (NAT) (Note: public address Address Translation (NAT) (Note: public address range belongs to AWS) range belongs to AWS)

• IP Address is a component of the DNS name• Up to 5 fixed public Elastic-IP Addresses and DNS

names can be pre-allocated for an AWS account and later assigned to a running EC2 instance.

Page 32: O'Reilly Webcast: Architecting Applications For The Cloud

IaaS Security Component : Security Component : EC2 Security Groups & ACLsEC2 Security Groups & ACLs

• EC2 Security Groups function as network firewall configurations.– A Security Group is a named collection of incoming

network traffic rules for an EC2 account.• Access to each S3 file is controlled by its own

Access Control List (ACL).– ACL allows READ, WRITE, and FULL CONTROL

(includes access to ACL) privileges on:• “Everyone”• “Authenticated Users” (only valid AWS users)• A list of individual AWS users or groups

Page 33: O'Reilly Webcast: Architecting Applications For The Cloud

PaaS Messaging/Queuing Component :AWS SQS

• Highly Reliable Message Queuing Service with built-in redundancy within user assigned Regions

• Messages accessible from anywhere via Web API

• Up to 8 KB of Unicode data per message• Messages can be retained in queues for up to 4

days• Messages can be sent and read simultaneously

but FIFO not guaranteed• Queues can be securely shared with other AWS

accounts and Anonymously. Queue sharing can also be restricted by IP address and time-of-day.

Page 34: O'Reilly Webcast: Architecting Applications For The Cloud

PaaS Database Component :AWS SimpleDB US Beta

• Enhanced ISAM-like database service• Simple web services interface to create and

store multiple data sets and query your data• Data is automatically indexed• Data stored in US-east-1 Region (Beta

restriction) and automatically replicated to geographically dispersed Zones

• Requests originating from an application running in same Amazon Region will have near-LAN latency.

Page 35: O'Reilly Webcast: Architecting Applications For The Cloud

PaaS Database Component :AWS SimpleDB US Beta (cont)

• Similar to MyISAM with enhanced features– No SQL grammar support– No table JOIN– Simple WHERE criteria

• 100 domains (tables) quota per account, max 10GB per domain, max 256 attributes (columns) per row, max 1KB data per attribute (cell)

• Typically used to store App logs, EC2 Instance configurations, Application state, Instance status, analytics, indexes to S3 data

• Scale-out is as simple as creating new domains, rather than building out new servers.

Page 36: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Cloud Application Design

Page 37: O'Reilly Webcast: Architecting Applications For The Cloud

Cloud App Design Attributes

Abstract Resources

Focus on your needs, not on hardware specs. As your needs change, so should your resources.

On-Demand Provisioning

Ask for what you need, exactly when you need it. Get rid of it when you don’t need.

Scalability Design should allow for resources to scale up or down depending on usage needs.

No Up-Front Costs

No contracts or long-term commitments.Pay only for what you use but design for the possibility of enhanced resource usage.

DynamismEach machine instance must be capable of dynamically identifying its configuration and relationship to other resources in the system.

Page 38: O'Reilly Webcast: Architecting Applications For The Cloud

Cloud Application Design:10 Best Practices

1. Build cloud apps, not apps in the cloud2. Virtualize the application stack3. Design for failure and nothing fails4. Design for scalability5. Loose coupling lets you maximize plug&play6. Design for dynamism7. Build Security into every component8. Leverage native cloud storage options9. Leverage best cloud Management Tools10. Don't fear cloud constraints

Page 39: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Don’t Just Build apps in the cloud

• Don’t simply port traditional Apps to the Cloud• Traditional Application Stacks are architected in functional silos• Each silo has its own machines, network, management, and support

Data Tier

Source: GigaSpace, “Practical Guide for Developing Enterprise Application on the Cloud”

Business tier

Back-up

Back-up

Back-upBack-up

Load Balancer

Web Tier

Messaging

Page 40: O'Reilly Webcast: Architecting Applications For The Cloud

Build Cloud Apps:Virtualize the Application Stack

• Re-factor to use standardized VM containers. Each instance should use self-discovery, be self configurable, and network independent

• Use cloud standardized Messaging & DB when possible• Leverage inherent EBS replication and snapshots for DBMS

Users

Load Balancer

Web Processing Units

BusinessProcessing Units

DBDB

Source: GigaSpace, “Practical Guide for Developing Enterprise Application on the Cloud”

Page 41: O'Reilly Webcast: Architecting Applications For The Cloud

Build Cloud Apps:Compensate for Ephemeral Storage

• EC2 instance default storage can only be used for transient data (e.g. intermediate or temp data files). Don’t use it for archival data logs such as login logs or error dumps.– Consider using SDB to store persistent archival data records

that can be associated with a key (e.g. timestamp)

• If OK to recover only from most recent backup, consider restoring data from S3 at boot-up and backing-up current data to S3 at shutdown.

• If not OK, use EBS attached volumes for all persistent file data.

• DBMS should always use EBS volumes

Page 42: O'Reilly Webcast: Architecting Applications For The Cloud

Build Cloud Apps:Compensate for Ephemeral Storage

(cont)• Consider using soft-links (Linux) to map portions

of the ephemeral Default Storage application file tree to persistent EBS volumes– This can be used for archival data logs such as login

logs or error dumps (.i.e /var/logs/ files can be soft linked to EBS volume).

• If only small chunks of persistent storage is needed for each Instance, consider using EBS volumes exported on EC2 NFS servers.

Page 43: O'Reilly Webcast: Architecting Applications For The Cloud

Build Cloud Apps:Compensate for Dynamic IP Address

• Attach ElasticIP for Internet-facing EC2 instances (e.g. the HAProxy load-balancer instance)

• Use dynamic DNS CNAME registration of EC2 instance internal IP address or use SDB

• EC2 instances should only use the internal IP address for communicating with each other (free!).

Page 44: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Design for Failure

• "Everything fails, all the time“, Werner Vogels, CTO Amazon.com

• Avoid single points of failure• Assume everything fails, and design

backwards• Design for failure and your App won’t fail

Page 45: O'Reilly Webcast: Architecting Applications For The Cloud

Design for Failure:What Can Fail in AWS?

• The EC2 Instance may crash• Portions of Zone may not be accessible (i.e.

internal network problem within Zone)– EC2 Instance in a Zone may not be launch-able– EBS volumes in a Zone may not be accessible

• AWS Services in a Region may not be accessible (very low probability)– S3 buckets in Region may not be accessible– SDB domains (tables) in a Region may not be

accessible– SQS Queues in a Region may not be accessible

Page 46: O'Reilly Webcast: Architecting Applications For The Cloud

Design for Failure:Use Failure Tolerant Features

• Use Elastic IP addresses (or their DNS names) for consistent and re-mappable routes

• Use multiple EC2 Availability Zones• Use EBS for persistent file systems and

snapshots. – Snapshots can be used to restore EBS volumes on other

Zones– Use Rsync for real-time synchronization of RBS volumes

across Zones

• Create multiple DBMS slaves across Availability Zones

• Use real-time monitoring (Amazon CloudWatch or RightScale)

Page 47: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Design for Scalability

• A scalable architecture is critical to take advantage of a scalable infrastructure

• Characteristics of Truly Scalable Service– Increasing resources results in a proportional

(linear) increase in performance– A scalable service is capable of handling

heterogeneity– A scalable service is operationally efficient– A scalable service is resilient– A scalable service becomes more cost

effective when it grows

Page 48: O'Reilly Webcast: Architecting Applications For The Cloud

Design for Scalability:Linear Performance Increase

• E.g. Doubling EC2 instances doubles performance (doubles throughput while maintaining same response time)– Minimize centralized locks

• No central point of data storage contention – Shared Nothing– Sharding– Distributed Caching

• Loose coupling of processing requestors and responders

Page 49: O'Reilly Webcast: Architecting Applications For The Cloud

Design for Scalability :Use AWS Elastic Features

• Use Load Balancing on multiple layers: either your own (e.g. HAProxy EC2 instance) or AWS Elastic Load Balancing

• Use Cloud monitoring systems: either your own (e.g. CollectD) or AWS CloudWatch

• Use Auto-scaling technology (Free with CloudWatch)

Page 50: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Build Loosely Coupled Systems

• Use Independent components• Design everything as a Black Box with well

defined inputs and outputs• Use subsystem de-coupling for Hybrid

models• Use Load-balanced clusters of Black

Boxes to maximize plug&play

Page 51: O'Reilly Webcast: Architecting Applications For The Cloud

Loose Coupling:Use Message Queues

• Use MQueue system such as Amazon SQS or Gearman to pass along requests

• Each message queue consumer can be a cluster of EC2 instances

Controller C

Controller CController

B

Controller BController

A

Controller A

Controller A

Controller B

Controller C

Controller A

Controller B

Controller C

Q Q Q

Tight Coupling

Loose Coupling using Queues

Page 52: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Design for Dynamism

• Don’t assume health or fixed location of components

• Use designs that are resilient to reboot and re-launch

• Bootstrap your instances based on self-discovery (E.g. EC2 Metadata API)– Store configurations in SimpleDB to bootstrap instances

• Enable dynamic configuration– Store application, subsystem, and EC2 instance state in

SimpleDB so instances can know health of system

Page 53: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Security in every component

• Use de-perimiterized security model• Create distinct network Security Groups for each

Amazon EC2 instance cluster• Use group-based network rules for controlling

access between components• Restrict external access to specific IP ranges• Encrypt data “at-rest” in Amazon S3• Encrypt data “in-transit” (SSL)• Consider encrypted EBS file systems for

sensitive data

Page 54: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Leverage Storage Solutions

• Amazon S3: large static objects• Amazon CloudFront: content distribution• Amazon SimpleDB: simple data

indexing/querying• Amazon EC2 local disc drive : transient

data• Amazon EBS: RDBMS persistent storage

+ S3 Snapshots

Page 55: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Leverage Best AWS Mgt Tools

• Management of any but the simplest cloud application configurations is very cumbersome without advanced tools.

• RightScale is a script-based instance provisioning, monitoring, & auto-scaling system– Supports collaborative sharing & reuse of scripts

• Kaavo Infrastructure & Middleware On Demand (IMOD) is an “Application Centric Management System”– manages a multitier cloud application system as

though it were a monolithic application

Page 56: O'Reilly Webcast: Architecting Applications For The Cloud

Best Practices:Don't fear cloud constraints

• Think “out of the box” and leverage cloud features to solve EC2 constraints

• Not enough EC2 instance RAM? – Distribute load across machines– Try shared distributed cache

• Components use Static IP addresses?– Boot script for software reconfiguration from

SimpleDB or use DNS CNAME• Local data center DBSM has better IOPS?

– Try multiple read-only / sharding / DB clustering

Page 57: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools

Page 58: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools: Basic Tools

• Amazon native AWS tools only leverage basic AWS API capability– AWS Management Console

• Firefox plugins are slightly more advanced– Elasticfox – EC2 Instance, EBS, EIP

management– S3 Organizer – S3 file upload/download

(similar to ftp plugin)• CloudBerry Explorer – Windows S3 file

upload/download application, slightly better than S3 Organizer

Page 59: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools: Ideal Advanced Tools

• Attaching EBS volumes, EIPs, and other resources should be scripted and managed by “Cloud Deployment & Mgmt System” (CDMS)

• CDMS should incorporate standards-based Performance Monitoring services

• Should incorporate standards-based Event Notification services

• Should incorporate Auto-scaling configuration services as remediation of Performance/Load Events

• CDMS should incorporate Administrator Collaboration allowing sharing and partitioning of admin responsibilities

Page 60: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools: Ideal Advanced Tools (cont)

• CDMS Should allow for automated provisioning of EC2 instances

• Should allow sharing of scripts and launch/terminate of instances based on group roles or at least read/write/execute rights.

• Should allow for re-use generalized scripts• Should allow for auto-scaling based on dynamic

load evaluation functions• CDMS should support escalating event

notification to groups of users.– Should have interfaces to other EMS (e.g. Nagios)

Page 61: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools: RightScale

• Script-based instance provisioning, monitoring, & auto-scaling system

• Manages complex deployments involving multiple instance clusters

• Re-use of version-controlled scripts in different deployments

• Full automation of auto-scaling, remediation, notification and automatic configuration

• Cloud application developer and administrator collaboration framework

Page 62: O'Reilly Webcast: Architecting Applications For The Cloud

RightScale Provisioning Pattern

• RightScale proxy server uses modified Push Pattern– “Boot Finished” event triggers automated “provisioning commands” sequence

Adapted: 2009 CummunityOne West Conference:“Practical Cloud Computing Patterns”

Page 63: O'Reilly Webcast: Architecting Applications For The Cloud

RightScale Lifecycle Mgmt Pattern

• RightScale uses an Injection Pattern to push individual command scripts into a running EC2 instance or an entire deployed cluster of instances

• Boot Scripts are automatically run at Instance Launch after OS “boot_finished” event

• Operational Scripts are run during automated Event Handling or manual operations

• Decommissioning Scripts are automatically run prior to Instance Termination

Page 64: O'Reilly Webcast: Architecting Applications For The Cloud

Current RightScale Cloud Service Monitoring Pattern

• Based on collectd framework

Source: 2009 CummunityOne West Conference:“Practical Cloud Computing Patterns”

Page 65: O'Reilly Webcast: Architecting Applications For The Cloud

Native AWS CloudWatch

• RightScale will likely eventually incorporate CloudWatch

Source: 2009 CummunityOne West Conference:“Practical Cloud Computing Patterns”

Page 66: O'Reilly Webcast: Architecting Applications For The Cloud

AWS Management Tools: Kaavo IMOD

• Kaavo Infrastructure & Middleware On Demand “Application Centric Management System”

• Proxy server manages complex multitier cloud application system as if it were a monolithic application via IMOD System Definitions

• Quickstart Kaavo provides out of the box System Definitions for deploying popular multi-tier HA infrastructure:

• Ruby on Rails, LAMP, Tomcat, Jboss• IMOD workflow engine monitors application run-time state

events and responds dynamically with user customized Event Workflows (e.g. MySQL scale-up/scale-down)

Page 67: O'Reilly Webcast: Architecting Applications For The Cloud

Kaavo IMOD :

• IMOD Engine monitors events and responds with Work Flows

Source: Kaavo IMOD Data Sheet

Page 68: O'Reilly Webcast: Architecting Applications For The Cloud

Q&A :Q&A :More ResourcesMore Resources

•• www.hyperstratus.comwww.hyperstratus.com– White Paper:

“Migrating Applications to the Cloud: An Amazon Web Services Case Study”

– Cloud Computing Workshops (via UnitekEducation)

[email protected]