With the elasticity of AWS, you no longer need to forecast demand and buy up front. You get the ability to scale up to meet the needs of spiky workloads, but then give that capacity back when the spike is over. Whether your dealing with annual spikes like the December retail boom, monthly or quarterly spikes associated with accounting workloads, or unpredictable spikes associated with web marketing, or any other situation where demand changes over time, cloud has considerable advantage over the traditional IT investment model.
In general you can say that with Beanstalk and OpsWorks you have higher level services that abstract thingsvs the DIY world of cloudformation and EC2 and friends (cloudwatch, autoscaling, ELB)SO WHY SHOULD SOMEONE USE OPSWORKS
Glenn GoreBuilding Web-Scale Applications with AWSManager Solutions Architects
I am Barack Obama, Ask me anythingReddit Needed to Scale for a special guest• 2,987,307 pageviews on the day of the IAmA• President Obama’s user page received 428,004pageviews on the day of the IAMA• Added 60 dedicated instance to handle the increasedload• At peek transfering 48 MB/s to the internet
While You Scale• Architect for Failure– Failures do happen• Architect with Security– Security must happen
Why Is Scale Important?SelfHostingWasteCustomerDissatisfactionActual demandPredicted DemandRigid ElasticActual demandAWS
Loose coupling sets you free!• The looser theyre coupled, the bigger they scale– Independent components– Design everything as a black box– Decouple interactions– Load-balance clustersController A Controller B Controller CController A Controller B Controller CQ Q QTight CouplingUse Amazon SQS as BuffersLoose Coupling
Allows for Parallel Processing and Failure• Fan out• Use varied instance types• Use varied billing models
Lets you Auto ScaleAuto ScalingAutomatic resizing of compute clusters based on demandTrigger auto-scaling policyFeature DetailsControl Define minimum and maximum instance poolsizes and when scaling and cool down occurs.Integrated to AmazonCloudWatchUse metrics gathered by CloudWatch to drivescaling.Instance types Run Auto Scaling for On-Demand and SpotInstances. Compatible with VPC.as-create-auto-scaling-group MyGroup--launch-configuration MyConfig--availability-zones eu-west-1a--min-size 4--max-size 200
…and Spread the LoadElastic Load Balancing• Create highly scalable applications• Distribute load across EC2 instancesin multiple availability zonesFeature DetailsAvailable Load balance across instances in multipleAvailability ZonesHealth checks Automatically checks health of instances andtakes them in or out of serviceSession stickiness Route requests to the same instanceSecure sockets layer Supports SSL offload from web and applicationservers with flexible cipher supportMonitoring Publishes metrics to CloudWatch
But usually some state has to reside somewhereCookies in browserMemory-resident session managerSession databaseFramework-provided session handler
So this store of state needs to be…PerformantScalableReliable
Where should session state reside?Trigger auto-scaling policySession StateServiceNot HereHereState must reside OUTSIDEthe scope of the elements youwish to scale
And what do I build it on?The state service itself mustbe well architected
IAM Temporary Security Credentials• Use Cases Identity Federation to AWS APIs Mobile and browser-based applications Consumer applications with unlimited users• Scales to millions of users– No need to create an IAM identity for every user
AWS AccountCredentialsIAM UserTemporarySecurityCredentialsThe IAM Hierarchy of PermissionsPermissions ExampleUnrestricted access to all enabledservices and resourcesAction: *Effect: AllowResource: *(implicit)Access restricted by Group andUser policiesAction: [‘s3:*’, ‘sts:Get*’]Effect: AllowResource: *Access restricted by generatingidentity and further by policiesused to generate tokenAction: [ ‘s3:Get*’ ]Effect: AllowResource:‘arn:aws:s3:::userbucket/*’
AWS Application Management SolutionsElastic Beanstalk OpsWorks CloudFormation EC2Convenience ControlHigher-level Services Do it yourself
Data Tier ScalingThe bane of the Architect’s existence
Vertical Scaling“We’re gonna need a bigger box”• Simplest approach• Can now leverage PIOPs• High I/O instances• Easy to change instance sizes• Will hit an endpoint eventuallyhi1.4xlargem2.4xlargem1.small
Master/Slave Horizontal Scaling• Reasonably simple to adapt to• Can now leverage PIOPs• Easy to change instances sizes• Will hit an endpoint eventually
Sharded Horizontal ScalingHash RingABCD• More complex at the application layer• ORM support can help• No practical limit on scalability• Operation complexity/sophistication• Shard by function or key space• RDBMS or NoSQL
Horizontal Scaling – Fully ManagedDynamoDB• Provisioned throughput NoSQL database• Fast, predictable performance• Fully distributed, fault tolerant architecture• Considerations for non-uniform dataFeature DetailsProvisionedthroughputDial up or down provisioned read/writecapacity.PredictableperformanceAverage single digit millisecond latenciesfrom SSD-backed infrastructure.Strong consistency Be sure you are reading the most up todate values.Fault tolerant Data replicated across Availability Zones.Monitoring Integrated to CloudWatch.Secure Integrates with AWS Identity and AccessManagement (IAM).ElasticMapReduceIntegrates with Elastic MapReduce forcomplex analytics on large datasets.
Petabyte-Scale Data WarehousingFeature DetailsOptimized forDataWarehousingRedshift uses a variety of innovations toobtain very high query performance ondatasets ranging in size from hundredsof gigabytes to a petabyte or more.Scalable Easily scale the number of nodes in yourdata warehouse up or down as yourperformance or capacity needs changeFault tolerant Data replicated across AvailabilityZones.Monitoring Integrated to CloudWatch.Secure Encrypt data in transit and at rest. Canalso be run in VPC to isolate your datawarehouse cluster.S3 intergration Loads data in parallel to each node fromS3.ElasticMapReduceIntegrates with ERM via Data Pipeline.
Summary• Use these techniques (and many, many others) situationally• Awareness of the options is the first step to good design• Scaling is the ability to move the bottlenecks around to theleast expensive part of the architecture• AWS makes this easier – so your application is not a victim ofits own success