SlideShare a Scribd company logo
Intro to Scaling your Web App
on the Cloud with AWS
(for Frontend Developers)
Mauvis Ledford
CTO, Pathbrite
@krunkosaurus
Goals of this talk


Philosophy
•  Understand the common components of any Web Application Architecture and
   how they apply to AWS.
•  Understand the pieces that form “The Cloud” and the mindset you should have
   when building upon it.
Action
•  Regardless of your experience level, get you up and running and
   experimenting with the AWS. It’s relatively cheap, fun, and the future of web
   hosting.




2
Overview
What we’re going to cover

1.  Server and Network Basics
2.  Virtualization and the Cloud
3.  Why Amazon Cloud?
4.  The Cloud Philosophy
5.  Major Components of the AWS Dashboard
6.  Setting up Your First EC2 Instance
7.  Further Reading




3
Server and Network Basics
The Lingo

•  Server: Just a computer connected to the internet and used for serving data.
   Usually fast and on 24x7. Your laptop can be a server.
•  IP Address: A number assigned to each computer on a network used for
   communication. For example 10.0.0.1.
•  DNS: Also known as Domain Name System, is a distribution system that maps
   IP address to domain names so that you don’t have to remember IP
   addresses. For example “google.com” resolves to 74.125.224.67.
•  Port: A communication endpoint that a servers listens for requests on. The
   default port for webpages is port 80. When you type “google.com” in a web
   browser, it is actually visiting: 74.125.224.67:80
•  CDN: Or Content Delivery Network. Big, dumb, computers set up around the
   world to serve your static assets really fast.
•  Load Balancer: A piece of hardware or software that distributes load across
   many servers.


4
Server and Network Basics
The Lingo

•  Linux: Free, stable, secure, and open-source operating
   system used by most servers. It comes in many
   versions, all similar but with some differences. Our
   preference is CentOS.
    –  Linux is based on Unix, an older operating system, and if
       you use a Mac, it’s “guts” are based on Unix, too. That’s
       why the command line is similar.
    –  Though Linux can come with a GUI, for performance
       reasons, it is not generally installed on servers. You should
       get comfortable with the command line if not already.

•  Virtual Machine: A software abstraction that emulate the computer architecture and
   functions of a real computer. A computer can contain many virtual machines with their
   own operating systems each with an allotted percentage of CPU power and other
   resources.
    –  The operating system doesn’t know or care that it’s running in a virtual environment.
    –  The Cloud consists of virtual machines.

5
                                                          Image	
  from:	
  h,p://www.y-­‐tech.net/userfiles/image/Hos<ng/vps.jpg	
  
Virtualization and the Cloud
The problem of unpredictable usage




6
                                     From:	
  h,p://media.amazonwebservices.com/AWS_TCO_Web_Applica<ons.pdf	
  
Virtualization and the Cloud
Why is virtualization such a big deal?

Running “bare metal” servers is expensive, wasteful, and slow to
upgrade.
•  Most traditional servers sit underutilized, waiting for traffic spikes and that
   idling CPU is wasted.
•  Adding capacity involves ordering physical servers and going to a physical
   location to set them up. This takes hours / days.
In cloud environments you spin up new virtual instances in minutes.
Shared hosting is limited and not scalable.
•  Products like Dreamhost Shared Hosting works by putting lots of users on
   one “bare metal” server on one OS. Users are restricted using the OS user
   management and customers do not have root access. Security can be a
   potential issue.
In cloud environments you have full root access to your own operating system
to setup and manage as you wish.



7
Why Amazon Cloud?
Why we chose AWS


•  Reputation: Biggest and most well-
   known cloud provider.
•  Startup Cost: There is no upfront cost. Pay as little as $15/mo to run a
   “micro” server instance for 1 month. Only run it for 1 hour? Your bill is $0.02.
•  Customer base: AWS has an impressive customer base that includes
   Dropbox, Netflix, Yelp, AirBnB, Reddit, and Pinterest. Amazon.com itself made
   the switch in 2010.
•  Scalability: Scale up when you need it, the moment you need it. Clone or spin
   up new instances in minutes. Even learn to automate it so instances are
   created and destroyed based on metrics like overall CPU usage.
•  Everything in one place: From servers monitoring to DNS to it’s own CDN,
   Amazon has setup all the robust services you need to make and scale a great
   app all in one place.


8
Why Amazon Cloud?
Why we chose AWS

•  Ability to mix and match: Not interested in Amazon’s managed database
   service (RDS)? Setup your own MySQL instance on EC2 and run backups on
   it yourself. You can pick and choose which AWS services you like and / or
   stick to the open-source software you’re used to.
•  Familiarity: For the most part, there is no “black box magic” with Amazon.
   These are just virtualized Linux boxes in Data Centers around the globe. If
   you’re familiar with servers in general then you’re already familiar with much of
   AWS. There are no new command-line tricks or crazy proprietary workflows.
•  Aggressive pricing: There are a lot of new Cloud contenders out there and
   Amazon is constantly slashing prices to stay competitive.
•  Constant innovation: Every few weeks there seems to be a new product or
   service to make things easier.




9
The Cloud Philosophy
Fast and nimble

•  Elasticity: Scale horizontally instead of
   vertically.
•  Parallelization: Strength in numbers.
•  Decoupled Components: Every EC2
   instance has it’s job.
•  Automation: “If you’re SSH’ing in
   you’re doing it wrong.”
   Use Puppet, Chef, Salt, etc.
•  Design for Failure: “Design for failure
   and nothing will fail.”




10
                                         Image	
  from:	
  h,p://minibeasts-­‐bees.wikispaces.com/Images+%26+You+Tube+clips+of+bees	
  
Components of AWS
This is the Cloud: 9 Regions worldwide, 4 in North America




        •  A Region is essentially a cluster of “Availability Zones”.
        •  Edge Locations are for Cloudfront CDN.

11
Components of AWS
Availability Zones
                                   •  Each Region contains two or more
                                      “Availability Zones”.
                                   •  AZ’s are distinct locations within a region
                                      that are engineered to be isolated from
                                      failures in other AZ’s.
                                   •  AZ’s have low latency (sub 1-2ms) network
                                      connectivity to other AZ’s in the same
                                      region.
 •  By load balancing across separate Availability Zones, you can protect your
    applications from the failure of a single location.
 •  TIP: It is not generally necessary to load balance across multiple Regions. It
    requires traveling through the internet and is more technically and financially
    challenging—only the biggest of the big AWS customers do it.




12
                                       From:	
  h,p://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-­‐regions-­‐availability-­‐zones.html	
  
Components of AWS
      The AWS Dashboard


                                  ance
              and         Perform ring
     C reate e                   o
                            Monit rts.
        manag ers.               le
            serv            and a
v   i rtual




      13
Components of AWS
Using Cloudwatch metrics




       See up to 2 weeks of data on most every aspect of AWS from
       EC2 to EBS drives. Create alerts on any metric including billing.

14
Components of AWS
      The AWS Dashboard


                                  ance
              and         Perform ring
     C reate e                   o
                            Monit rts.
        manag ers.               le
            serv            and a
v   i rtual




             and
     cheap e.
Dirt nkabl
  Unsi        ti c
  Put  all sta
             t
     conten .
             e
      in her




      15
Components of AWS
 Data in an S3 bucket are stored across a whole Region.

                                                                                          •  Store	
  unlimited	
  
                                                                                             objects	
  up	
  to	
  5TB	
  in	
  
                                                                                             size.	
  
                                                                                          •  99.999999999%	
  
                                                                                             durability	
  and	
  
                                                                                             99.99%	
  availability	
  
                                                                                             of	
  objects	
  over	
  a	
  
                                                                                             given	
  year.	
  
                                                                                          •  Cheap:	
  500GB	
  of	
  
                                                                                             data	
  stored	
  in	
  S3	
  
                                                                                             cost	
  about	
  $50/mo	
  
                                                                                             to	
  store.	
  
                                                                                          •  Even	
  Twi,er’s	
  Vine	
  
                                                                                             uses	
  S3	
  for	
  videos.	
  

Note:	
  US	
  Standard	
  Region	
  ==	
  Northern	
  Virginia	
  or	
  Pacific	
  Northwest	
  using	
  network	
  
maps.	
  
16
Components of AWS
      The AWS Dashboard


                                  ance
              and         Perform ring
     C reate e                   o
                            Monit rts.
        manag ers.               le
            serv            and a
v   i rtual



          ve it
 B ut ser ere
          h
   From
             and
      cheap e.
Dirt nkabl
   Unsi       ti c
  Put  all sta
             t
      conten .
             e
      in her




      17
Components of AWS
S3 vs. Cloudfront




18
Components of AWS
      The AWS Dashboard

                                                                                   and
                                                                           ation          ve
                                  ance                          Clou dForm We      will ha e…
              and         Perform ring                                 init.
                                                                Cloud- to that     next t
                                                                                          im
     C reate e                   o
                            Monit rts.
        manag ers.               le                              to get
            serv            and a
v   i rtual
                                      ,
                               Cheap cy,
                                   ten                                          pers
                             low la twork                            ther develo e.
                                                                                r
                                   ne
                            global DNS                         Give o access he s!
          ve it                                                  AWS hare login
 B ut ser ere.                  of
                                       rs.                              s
  From
         h                      Serve                             Don’t
             and
      cheap e.
Dirt nkabl                                                                    ed
   Unsi                                                               l  manag sage
              ti c                                              Usefu ike Mes
  Put  all sta                                                      es l         PI.
             t
      conten .                                                servic and Email A
      in her
             e                                                Queue


                                                       and
                                             ed DB’s Most
                                       Manag ching.
                                             ca
                                     memory          backup
      19
                                      autoscale and ly.
                                                  ical
                                          automat
Components of AWS
EC2 Lingo

•  EC2: Amazon Elastic Compute Cloud is virtual computing enviornment and
   service that provides resizable computer capacity. Setup in minutes. Charged
   by the hour while running.
•  AMI: Amazon Machine Image is a special type of pre-configured operating
   system which is used to create a Virtual Machine within EC2. You can start
   with community run AMI’s and then make your own.
•  EIP: Elastic IP Address is a static IP address you can assign to an EC2
   instance so it has a none-changing semi-permanent address. They are free
   but limited to 10. More potentially available on request to Amazon.
•  Security Group: A virtual firewall to specify what ports are accessible on your
   EC2 instance.




20
Components of AWS
EC2 Lingo

•  EBS: Elastic Block Store is a persistent storage volume that can be attached
   to any running EC2 instance.
     –  Sized from 1 GB to 1 TB.
     –  Must be placed in the same Availability Zone as the EC2 instance.
     –  Each storage volume is automatically replicated within the same Availability Zone.
     –  EC2 instance can have multiple EBS volumes but EBS can not be mounted on more
        than one EC2 at time.
     –  Snapshots can be created from any EBS volume and stored in S3 to protect data or
        to be used as a starting point for a new volume. Snapshots are incremental.
     –  Like regular hard drive you can attach multiple volumes and stripe your data across
        them in a RAID configuration for increased I/O.
     –  You can also enable “provisioned IOPS” for higher performance for a cost.




21
Components of AWS
EC2 Lingo

•  Instance Storage: Temporary storage that most EC2 instance get for free. If
   the server reboots the data in Instant Storage stays but if the server is stopped
   all Instance Storage data is lost. Good for temporary data only. Originated
   before EBS existed, and only benefit over EBS is that it’s free.




22
Setting up Your First EC2 Instance
From the main Dashboard click “EC2”, then “Key Pair” at the bottom left.




23
Setting up Your First EC2 Instance
We want to use our existing SSH key so click “Import Key Pair”.




24
Setting up Your First EC2 Instance
Fill out a Keypair Name and then use terminal to paste your public ssh key.




                                                                          1	
  
                                                      mauvis1	
  

                                                                                               4	
  
                                                         3	
  paste	
  
                                                                                                       2	
  



     Create	
  a	
  new	
  SSH	
  key	
  if	
  you’ve	
  never	
  made	
  one	
  before:	
  
25   h,ps://help.github.com/ar<cles/genera<ng-­‐ssh-­‐keys	
  
Setting up Your First EC2 Instance
Your key pair is now created.




26
Setting up Your First EC2 Instance
Select “Instances” and then “Launch Instance”.




                       2	
  
               1	
  




27
Setting up Your First EC2 Instance
Click “Continue” on the Classic Wizard.




                                          1	
  



28
Setting up Your First EC2 Instance
Select the Amazon Linux AMI.




29
Setting up Your First EC2 Instance
Note the “Instance Type” dropdown and “AZ”. For now go with defaults.




30
Setting up Your First EC2 Instance
Advance options screen. Go with defaults.




31
Setting up Your First EC2 Instance
You can add EBS or Instance Volumes here. Default is 8GB EBS.




32
Setting up Your First EC2 Instance
Give the server a name and Continue.




33
Setting up Your First EC2 Instance
Specify your Key Pair and Continue.




34
Setting up Your First EC2 Instance
Go with the default security group that allows SSH.




35
Setting up Your First EC2 Instance
Confirm all settings and click “Launch”.




36
Setting up Your First EC2 Instance
Close confirmation window.




37
Setting up Your First EC2 Instance
In about 2 minutes your new instance should be ready.




38
Setting up Your First EC2 Instance
SSH into the server to test that your key works. Default user is “ec2-user”.




                                                                          One-time
                                                                         confirmation



                                                             Success




       You	
  could	
  also	
  have	
  create	
  the	
  same	
  instance	
  by	
  command-­‐line:	
  
39     	
  ec2-run-instances -t t1.micro -g quick-start-1 ami-54cf5c3d -v –key "mauvis1"
A complete sample web app architecture
Coming in part 2: Load balancing across Availability Zones




40
                                         From:	
  h,p://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf	
  
Additional Reading

•  Amazon Architecture Center: Amazon Architecture Center:
   http://aws.amazon.com/architecture/
•  Best Practices Whitepaper:
   http://media.amazonwebservices.com/AWS_Cloud_Best_Practices.pdf
•  Operation checklist:
   http://media.amazonwebservices.com/AWS_Operational_Checklists.pdf
•  Whitepaper on Autoscale:
   http://aws.amazon.com/autoscaling/
•  The Reddit AWS community:
   http://www.reddit.com/r/aws/
•  Mauvis’s Amazon EC2 Pricing Calculator Google Doc:
   http://goo.gl/Er90C




41
Thanks!

Feedback?
mauvis@pathbrite.com
@krunkosaurus
http://www.speakerdeck.com/krunkosaurus




42

More Related Content

PPTX
Nuts and bolts of running a popular site in the aws cloud
KEY
Cloud Computing & Scaling Web Apps
PDF
CloudStack Architecture Future
PDF
Global Netflix - HPTS Workshop - Scaling Cassandra benchmark to over 1M write...
PDF
InterCloud - Cloud based DRP
PDF
Netflix Velocity Conference 2011
PDF
Netflix in the Cloud
PDF
Netflix Cloud Platform Building Blocks
Nuts and bolts of running a popular site in the aws cloud
Cloud Computing & Scaling Web Apps
CloudStack Architecture Future
Global Netflix - HPTS Workshop - Scaling Cassandra benchmark to over 1M write...
InterCloud - Cloud based DRP
Netflix Velocity Conference 2011
Netflix in the Cloud
Netflix Cloud Platform Building Blocks

What's hot (8)

KEY
AmebaPico 裏側の技術やAWSの利用について
PPT
Architecture Best Practices on Windows Azure
PDF
CloudStack-Developer-Day
PPT
2010 06-10 aws overview - capgenimi sap
PPT
A Step By Step Guide To Put DB2 On Amazon Cloud
PDF
IBM Software Available In The Cloud With Amazon Web Services
PDF
Netflix Architecture Tutorial at Gluecon
PPTX
Using Amazon RDS to power enterprise applications (Peoplesoft)
AmebaPico 裏側の技術やAWSの利用について
Architecture Best Practices on Windows Azure
CloudStack-Developer-Day
2010 06-10 aws overview - capgenimi sap
A Step By Step Guide To Put DB2 On Amazon Cloud
IBM Software Available In The Cloud With Amazon Web Services
Netflix Architecture Tutorial at Gluecon
Using Amazon RDS to power enterprise applications (Peoplesoft)
Ad

Viewers also liked (20)

PPTX
An Overview of Windows Azure
PPTX
Blind Dates - Or the right choice of Test Users.
PDF
#SocialTVConf Presentations - 22/1/13 - Matt Locke from Storythings
PDF
Revista nº 165 - Diciembre 2012
PDF
Campus Mag - 160 Juin 2011
PDF
3091 karriär sverige_low
PPT
Programa de rutas científicas
PDF
El castanyer nerea
PDF
Expatriate Law in Latin America
PPS
No te preocupes si tus hijos no quieren estudiar
PDF
Presentación Protección de datos como estrategia empresarial: Un reto y una o...
PDF
Cap 5 minerales_industriales
PDF
weißBLAU 02/16 - Das Magazin des Marketing Club München
PPT
BABAHOYO
PDF
Tormenta rpg manual do combate - taverna do elfo e do arcanios
PPS
E metales 2011
PPT
Actividadpequera
PPTX
Rolling stones
PDF
"Ma dove vai se il contenuto non ce l'hai? Il ciclo di vita di un buon conten...
ODP
Procesos Constructivos - Sistema estructural de losas: Vigueta y Bovedillas
An Overview of Windows Azure
Blind Dates - Or the right choice of Test Users.
#SocialTVConf Presentations - 22/1/13 - Matt Locke from Storythings
Revista nº 165 - Diciembre 2012
Campus Mag - 160 Juin 2011
3091 karriär sverige_low
Programa de rutas científicas
El castanyer nerea
Expatriate Law in Latin America
No te preocupes si tus hijos no quieren estudiar
Presentación Protección de datos como estrategia empresarial: Un reto y una o...
Cap 5 minerales_industriales
weißBLAU 02/16 - Das Magazin des Marketing Club München
BABAHOYO
Tormenta rpg manual do combate - taverna do elfo e do arcanios
E metales 2011
Actividadpequera
Rolling stones
"Ma dove vai se il contenuto non ce l'hai? Il ciclo di vita di un buon conten...
Procesos Constructivos - Sistema estructural de losas: Vigueta y Bovedillas
Ad

Similar to Intro to Scaling your Web App on the Cloud with AWS (for frontend developers) Part 1 (20)

PDF
An intro to Amazon Web Services (AWS)
PDF
AMAZON CLOUD Course Content
PPTX
AWS basics
PDF
The Cloud as a Platform
PDF
Taking Web Application Deployment from Infancy to Maturity in AWS
PDF
Architecting for the cloud cloud providers
PPTX
AWS GLOBAL INFRA AND SERVICE LIST01.pptx
PDF
AWS 101 December 2014
PPTX
Components of AWS infrastructure and AWS Services.pptx
PDF
Preparing your IT infrastructure for thanksgiving
PDF
Aws cloud best_practices
PPTX
TV Connect: Improving the Connected Device Experience
PDF
AWS 101, London - September 2014
PDF
Lesson_02_AWS_Overview of AWS Platform for
PPTX
Wicked rugby
PPTX
Aws Solution Architecture Associate - summary
PDF
Prepare your IT Infrastructure for Thanksgiving
PDF
Cloud computing aws -key services
PDF
Cloud Computing With Amazon Web Services, Part 1: Introduction - When It's Sm...
PDF
Aws 101 cloud computing seminar (reference model included)
An intro to Amazon Web Services (AWS)
AMAZON CLOUD Course Content
AWS basics
The Cloud as a Platform
Taking Web Application Deployment from Infancy to Maturity in AWS
Architecting for the cloud cloud providers
AWS GLOBAL INFRA AND SERVICE LIST01.pptx
AWS 101 December 2014
Components of AWS infrastructure and AWS Services.pptx
Preparing your IT infrastructure for thanksgiving
Aws cloud best_practices
TV Connect: Improving the Connected Device Experience
AWS 101, London - September 2014
Lesson_02_AWS_Overview of AWS Platform for
Wicked rugby
Aws Solution Architecture Associate - summary
Prepare your IT Infrastructure for Thanksgiving
Cloud computing aws -key services
Cloud Computing With Amazon Web Services, Part 1: Introduction - When It's Sm...
Aws 101 cloud computing seminar (reference model included)

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
01-Introduction-to-Information-Management.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Cell Structure & Organelles in detailed.
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Basic Mud Logging Guide for educational purpose
01-Introduction-to-Information-Management.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
2.FourierTransform-ShortQuestionswithAnswers.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
VCE English Exam - Section C Student Revision Booklet
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Week 4 Term 3 Study Techniques revisited.pptx
Supply Chain Operations Speaking Notes -ICLT Program
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Anesthesia in Laparoscopic Surgery in India
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Cell Structure & Organelles in detailed.
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester

Intro to Scaling your Web App on the Cloud with AWS (for frontend developers) Part 1

  • 1. Intro to Scaling your Web App on the Cloud with AWS (for Frontend Developers) Mauvis Ledford CTO, Pathbrite @krunkosaurus
  • 2. Goals of this talk Philosophy •  Understand the common components of any Web Application Architecture and how they apply to AWS. •  Understand the pieces that form “The Cloud” and the mindset you should have when building upon it. Action •  Regardless of your experience level, get you up and running and experimenting with the AWS. It’s relatively cheap, fun, and the future of web hosting. 2
  • 3. Overview What we’re going to cover 1.  Server and Network Basics 2.  Virtualization and the Cloud 3.  Why Amazon Cloud? 4.  The Cloud Philosophy 5.  Major Components of the AWS Dashboard 6.  Setting up Your First EC2 Instance 7.  Further Reading 3
  • 4. Server and Network Basics The Lingo •  Server: Just a computer connected to the internet and used for serving data. Usually fast and on 24x7. Your laptop can be a server. •  IP Address: A number assigned to each computer on a network used for communication. For example 10.0.0.1. •  DNS: Also known as Domain Name System, is a distribution system that maps IP address to domain names so that you don’t have to remember IP addresses. For example “google.com” resolves to 74.125.224.67. •  Port: A communication endpoint that a servers listens for requests on. The default port for webpages is port 80. When you type “google.com” in a web browser, it is actually visiting: 74.125.224.67:80 •  CDN: Or Content Delivery Network. Big, dumb, computers set up around the world to serve your static assets really fast. •  Load Balancer: A piece of hardware or software that distributes load across many servers. 4
  • 5. Server and Network Basics The Lingo •  Linux: Free, stable, secure, and open-source operating system used by most servers. It comes in many versions, all similar but with some differences. Our preference is CentOS. –  Linux is based on Unix, an older operating system, and if you use a Mac, it’s “guts” are based on Unix, too. That’s why the command line is similar. –  Though Linux can come with a GUI, for performance reasons, it is not generally installed on servers. You should get comfortable with the command line if not already. •  Virtual Machine: A software abstraction that emulate the computer architecture and functions of a real computer. A computer can contain many virtual machines with their own operating systems each with an allotted percentage of CPU power and other resources. –  The operating system doesn’t know or care that it’s running in a virtual environment. –  The Cloud consists of virtual machines. 5 Image  from:  h,p://www.y-­‐tech.net/userfiles/image/Hos<ng/vps.jpg  
  • 6. Virtualization and the Cloud The problem of unpredictable usage 6 From:  h,p://media.amazonwebservices.com/AWS_TCO_Web_Applica<ons.pdf  
  • 7. Virtualization and the Cloud Why is virtualization such a big deal? Running “bare metal” servers is expensive, wasteful, and slow to upgrade. •  Most traditional servers sit underutilized, waiting for traffic spikes and that idling CPU is wasted. •  Adding capacity involves ordering physical servers and going to a physical location to set them up. This takes hours / days. In cloud environments you spin up new virtual instances in minutes. Shared hosting is limited and not scalable. •  Products like Dreamhost Shared Hosting works by putting lots of users on one “bare metal” server on one OS. Users are restricted using the OS user management and customers do not have root access. Security can be a potential issue. In cloud environments you have full root access to your own operating system to setup and manage as you wish. 7
  • 8. Why Amazon Cloud? Why we chose AWS •  Reputation: Biggest and most well- known cloud provider. •  Startup Cost: There is no upfront cost. Pay as little as $15/mo to run a “micro” server instance for 1 month. Only run it for 1 hour? Your bill is $0.02. •  Customer base: AWS has an impressive customer base that includes Dropbox, Netflix, Yelp, AirBnB, Reddit, and Pinterest. Amazon.com itself made the switch in 2010. •  Scalability: Scale up when you need it, the moment you need it. Clone or spin up new instances in minutes. Even learn to automate it so instances are created and destroyed based on metrics like overall CPU usage. •  Everything in one place: From servers monitoring to DNS to it’s own CDN, Amazon has setup all the robust services you need to make and scale a great app all in one place. 8
  • 9. Why Amazon Cloud? Why we chose AWS •  Ability to mix and match: Not interested in Amazon’s managed database service (RDS)? Setup your own MySQL instance on EC2 and run backups on it yourself. You can pick and choose which AWS services you like and / or stick to the open-source software you’re used to. •  Familiarity: For the most part, there is no “black box magic” with Amazon. These are just virtualized Linux boxes in Data Centers around the globe. If you’re familiar with servers in general then you’re already familiar with much of AWS. There are no new command-line tricks or crazy proprietary workflows. •  Aggressive pricing: There are a lot of new Cloud contenders out there and Amazon is constantly slashing prices to stay competitive. •  Constant innovation: Every few weeks there seems to be a new product or service to make things easier. 9
  • 10. The Cloud Philosophy Fast and nimble •  Elasticity: Scale horizontally instead of vertically. •  Parallelization: Strength in numbers. •  Decoupled Components: Every EC2 instance has it’s job. •  Automation: “If you’re SSH’ing in you’re doing it wrong.” Use Puppet, Chef, Salt, etc. •  Design for Failure: “Design for failure and nothing will fail.” 10 Image  from:  h,p://minibeasts-­‐bees.wikispaces.com/Images+%26+You+Tube+clips+of+bees  
  • 11. Components of AWS This is the Cloud: 9 Regions worldwide, 4 in North America •  A Region is essentially a cluster of “Availability Zones”. •  Edge Locations are for Cloudfront CDN. 11
  • 12. Components of AWS Availability Zones •  Each Region contains two or more “Availability Zones”. •  AZ’s are distinct locations within a region that are engineered to be isolated from failures in other AZ’s. •  AZ’s have low latency (sub 1-2ms) network connectivity to other AZ’s in the same region. •  By load balancing across separate Availability Zones, you can protect your applications from the failure of a single location. •  TIP: It is not generally necessary to load balance across multiple Regions. It requires traveling through the internet and is more technically and financially challenging—only the biggest of the big AWS customers do it. 12 From:  h,p://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-­‐regions-­‐availability-­‐zones.html  
  • 13. Components of AWS The AWS Dashboard ance and Perform ring C reate e o Monit rts. manag ers. le serv and a v i rtual 13
  • 14. Components of AWS Using Cloudwatch metrics See up to 2 weeks of data on most every aspect of AWS from EC2 to EBS drives. Create alerts on any metric including billing. 14
  • 15. Components of AWS The AWS Dashboard ance and Perform ring C reate e o Monit rts. manag ers. le serv and a v i rtual and cheap e. Dirt nkabl Unsi ti c Put all sta t conten . e in her 15
  • 16. Components of AWS Data in an S3 bucket are stored across a whole Region. •  Store  unlimited   objects  up  to  5TB  in   size.   •  99.999999999%   durability  and   99.99%  availability   of  objects  over  a   given  year.   •  Cheap:  500GB  of   data  stored  in  S3   cost  about  $50/mo   to  store.   •  Even  Twi,er’s  Vine   uses  S3  for  videos.   Note:  US  Standard  Region  ==  Northern  Virginia  or  Pacific  Northwest  using  network   maps.   16
  • 17. Components of AWS The AWS Dashboard ance and Perform ring C reate e o Monit rts. manag ers. le serv and a v i rtual ve it B ut ser ere h From and cheap e. Dirt nkabl Unsi ti c Put all sta t conten . e in her 17
  • 18. Components of AWS S3 vs. Cloudfront 18
  • 19. Components of AWS The AWS Dashboard and ation ve ance Clou dForm We will ha e… and Perform ring init. Cloud- to that next t im C reate e o Monit rts. manag ers. le to get serv and a v i rtual , Cheap cy, ten pers low la twork ther develo e. r ne global DNS Give o access he s! ve it AWS hare login B ut ser ere. of rs. s From h Serve Don’t and cheap e. Dirt nkabl ed Unsi l manag sage ti c Usefu ike Mes Put all sta es l PI. t conten . servic and Email A in her e Queue and ed DB’s Most Manag ching. ca memory backup 19 autoscale and ly. ical automat
  • 20. Components of AWS EC2 Lingo •  EC2: Amazon Elastic Compute Cloud is virtual computing enviornment and service that provides resizable computer capacity. Setup in minutes. Charged by the hour while running. •  AMI: Amazon Machine Image is a special type of pre-configured operating system which is used to create a Virtual Machine within EC2. You can start with community run AMI’s and then make your own. •  EIP: Elastic IP Address is a static IP address you can assign to an EC2 instance so it has a none-changing semi-permanent address. They are free but limited to 10. More potentially available on request to Amazon. •  Security Group: A virtual firewall to specify what ports are accessible on your EC2 instance. 20
  • 21. Components of AWS EC2 Lingo •  EBS: Elastic Block Store is a persistent storage volume that can be attached to any running EC2 instance. –  Sized from 1 GB to 1 TB. –  Must be placed in the same Availability Zone as the EC2 instance. –  Each storage volume is automatically replicated within the same Availability Zone. –  EC2 instance can have multiple EBS volumes but EBS can not be mounted on more than one EC2 at time. –  Snapshots can be created from any EBS volume and stored in S3 to protect data or to be used as a starting point for a new volume. Snapshots are incremental. –  Like regular hard drive you can attach multiple volumes and stripe your data across them in a RAID configuration for increased I/O. –  You can also enable “provisioned IOPS” for higher performance for a cost. 21
  • 22. Components of AWS EC2 Lingo •  Instance Storage: Temporary storage that most EC2 instance get for free. If the server reboots the data in Instant Storage stays but if the server is stopped all Instance Storage data is lost. Good for temporary data only. Originated before EBS existed, and only benefit over EBS is that it’s free. 22
  • 23. Setting up Your First EC2 Instance From the main Dashboard click “EC2”, then “Key Pair” at the bottom left. 23
  • 24. Setting up Your First EC2 Instance We want to use our existing SSH key so click “Import Key Pair”. 24
  • 25. Setting up Your First EC2 Instance Fill out a Keypair Name and then use terminal to paste your public ssh key. 1   mauvis1   4   3  paste   2   Create  a  new  SSH  key  if  you’ve  never  made  one  before:   25 h,ps://help.github.com/ar<cles/genera<ng-­‐ssh-­‐keys  
  • 26. Setting up Your First EC2 Instance Your key pair is now created. 26
  • 27. Setting up Your First EC2 Instance Select “Instances” and then “Launch Instance”. 2   1   27
  • 28. Setting up Your First EC2 Instance Click “Continue” on the Classic Wizard. 1   28
  • 29. Setting up Your First EC2 Instance Select the Amazon Linux AMI. 29
  • 30. Setting up Your First EC2 Instance Note the “Instance Type” dropdown and “AZ”. For now go with defaults. 30
  • 31. Setting up Your First EC2 Instance Advance options screen. Go with defaults. 31
  • 32. Setting up Your First EC2 Instance You can add EBS or Instance Volumes here. Default is 8GB EBS. 32
  • 33. Setting up Your First EC2 Instance Give the server a name and Continue. 33
  • 34. Setting up Your First EC2 Instance Specify your Key Pair and Continue. 34
  • 35. Setting up Your First EC2 Instance Go with the default security group that allows SSH. 35
  • 36. Setting up Your First EC2 Instance Confirm all settings and click “Launch”. 36
  • 37. Setting up Your First EC2 Instance Close confirmation window. 37
  • 38. Setting up Your First EC2 Instance In about 2 minutes your new instance should be ready. 38
  • 39. Setting up Your First EC2 Instance SSH into the server to test that your key works. Default user is “ec2-user”. One-time confirmation Success You  could  also  have  create  the  same  instance  by  command-­‐line:   39  ec2-run-instances -t t1.micro -g quick-start-1 ami-54cf5c3d -v –key "mauvis1"
  • 40. A complete sample web app architecture Coming in part 2: Load balancing across Availability Zones 40 From:  h,p://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf  
  • 41. Additional Reading •  Amazon Architecture Center: Amazon Architecture Center: http://aws.amazon.com/architecture/ •  Best Practices Whitepaper: http://media.amazonwebservices.com/AWS_Cloud_Best_Practices.pdf •  Operation checklist: http://media.amazonwebservices.com/AWS_Operational_Checklists.pdf •  Whitepaper on Autoscale: http://aws.amazon.com/autoscaling/ •  The Reddit AWS community: http://www.reddit.com/r/aws/ •  Mauvis’s Amazon EC2 Pricing Calculator Google Doc: http://goo.gl/Er90C 41