• EC2 Purchase Options (launch type)

    ec2-on-demand

    • Instances of different sizes run on the same EC2 hosts – consuming a defined alloaction of resources.
    • Predictable Pricing
    • No capacity reserveration
    • No discount
    • Short term workloads
    • No interruption

    spot

    • selling unused EC2 host capacity for up to 90% discount
    • if spot price goes above your maximum price, then your instance is terminated
      -> NEVER USE SPOT FOR WORKLOADS WHICH CANT TOLERATE INTERRUPTIONS

    reserved

    • reduced or removed per seconds price
    • Unused Reservation stil billed
    • you can reserve part of your instance (?)
    • No-Upfront cost; this gives you slight saving
    • All Upfront; this gives greatest discount, no per seconds fee
    • Partial upfront: middle ground of No/All upfront, this gives you reduced per second fee

    dedicated hosts

    • soley for you
    • No instance charge, pay for HOST

    dedicated instance

    • you don’t own host or share the host but you have dedicated hardware
  • Virtualization

    Single piece of hardware running multiple OS.
    For OS to run, it needs to run on preveliged mode.

    Emulated Virtualization
    Hypervisor,the software that runs on preveliged mode, comes in.

    To put it into architecture, it looks like the following:

    App1 App2 App3
    OS1 OS2 OS3
    -h y p e r v i s o r—
    cpu/mem network devices

    Hypervisor feeds fake information (cpu/memory/disk) to the os1,2,3. And OS treat them as real and will try to do privileged operation directly on its ‘fake’ hardware. However, any privilege operation OS request, hypervisor intercept it and translate it into binary (aka Binary Translation).
    But this translation process takes long and have negative effect on the performance.

    So here comes Para-Virtualization:
    Instead of OS requesting directly on the hardware, they call hypervisor for any privileged operation.

    Hardware Assited Virtualization:
    Hardware itself aware of virtualization. CPU contains specific instruction and capabilities so hypervisor can configure and suport these virutalization. Hardware knows what to expect providing least amount of performance degradation. Hardware still has to talk to hypervisor though.

    It flows like the following:
    App1 App2 App3
    HARD <—-OS1 OS2 OS3 |—<-> h y p e r v i s o r // where hypervisor goes back and forth with harddrive
    cpu/mem network devices

    SR-IOV
    PCIe device is aware of virtualization. So single PCIe device looks like multiple device to OS without having hypervisor translate them.
    This feature is enabled in EC2 under “enhanced networking”.

  • Instance Store Volumes

    • Local on EC2 Host
    • Physically connected to one EC2 Host
    • Block Storage Devices
    • instances on that host can access them
    • Highest storage performance in AWS
    • Included in instance price
    • Attached at Launch
    • you pay for this anyway, it’s already included in instance price

    Say instane-1 is on EC2 host A and it migrated to EC2 host B, any data it had on Instance Store, it will lose all of them upon migration.
    And instance-1 will be attached with new Instace Store Volumes.

    Instance Store Volumes – type

    D3 = 4.6 GB/s throughput, much higher throughput than EBS-HDD’s.
    I3 = 16 GB/s of sequential throughput
    MORE IOPS and Throughput vs EBS

    Instance Store vs EBS

    • need persistence? use EBS
    • need reslience? use EBS
    • Storage needs to be isolated from instance lifecycle? use EBS
    • If you need high performance … then it depends because EBS also has some with high performace but Instance Store is generally faster
  • Ec2 is:

    • EC2 Instances are virtual machines (OS + Resources)
    • EC2 Instances run on EC2 Hosts
    • Shared Hosts (you share EC2 Hosts with other customer who use EC2), Dedicated Hosts: Soley for you but you pay for whole Host. It’s Shared by defualt.

    EC2 instance’s storage is AZ specific meaning EBS on AZ-B cannot interact with EC2 that are on AZ-A.
    EC2 instance is also AZ specific, you can’t natively move EC2 that are on AZ-A to AZ-B. There are way to migrate this tho.

    What is EC2 Good for?

    • Traditional OS+Application Compute
    • Long-Running Compute
    • Server style applications
    • .. burst or steady-state load
    • Monolithic application stacks
    • Migrated application workloads or Disaster Recovery

  • NAT

    what is NAT?
    -> A set of process – remapping SRC or DST IPs

    NAT does IP masquerading – it hides CIDR blocks behind one IP

    It gives private CIDR range outgoing internet access

    NAT Architecture:

    1. private CIDR blocks will be re-mapped via its Route Table and will be passed to NAT Gateway
    2. NAT Gateway will then be re-mapped and will be passed to Internet GateWay
    3. Ta-da! Public internet access!

    NACL

    filter what comes in/out of VPC subnet which means connection within a subnet aren’t impacted by NACLs

    NACL is stateless, inbound and outbound needs to be specified (if applicable)

    each subnet can be associated with one NACL whereas one NACL can be associated with many subnet

  • When objects are stored a “HTTP/1.1 200 OK” response is probided by S3 API endpoint
    It uses Cycling Redunadncy Checks to see corruption and fix.

    S3 Standard

    • has a milliseconds first byte latency(very fast delivery) and object ca be made publicly available
    • price per 1000 request

    S3 Standard-IA

    • per GB data retrieval fee, overall cost increase with frequent data access
    • has a minimum capacity charge of 128KB per object
    • has minimum duration charge of 30 days (like, you will still be charge worth of 30 days even if you retreive the data before its 30 days renewal period)

    S3 One Zone-IA

    • has minimum duration charge of 30 days
    • only has one az
    • retreival fee per GB exist
    • cheapest classes

    S3 Glacier-Instant

    • retreival fee
    • minimum duration charge is 90 days
    • millisecond access
    • 3az

    S3 Glacier-Flexible

    • 3az
    • storage cost is cheap
    • cold obj (not immediately availble)
    • require retrieival process
    • minuite to hour to retreive

    S3 Glacier-Deep Archive

    • 40KB min billable size
    • 180 Day min billable duration
    • retreival take longer than flexible
    • first byte latency: hours to days

    S3 Intelligent-Tiering

    • divided by tiers;frequenct access, infrequent access, archive instant access, archive access, deep archive
    • it monitors object usuage and automatically assign which tier it goes into
    • As objects are access they’re moved back to the frequent access tier. There are no trieval fees for accessing objects
    • has monitoring, automation cost
    • good for when usuage is changing

  • S3 is

    • Global Storage Platform – regional based/resilient
    • Public service, unlimited data & multi_user
    • Movies, Audio, Photos, Text, Large Data sets
    • Economical & accessed via UI/CLI/API/HTTP

    Object:
    Key/Value pair, say you have koala.jpg then
    key: koala.jpg
    value: (some binary of that image)

    object size can go up to 5TB

    S3 bucket is GLOBALLY UNIQUE, so no same bucket name (just like your riot account)
    S3 is flat structure, not like file system where we have folders.
    S3 bucket has 100 soft limit and 1000 hard limit
    Key = name, Value=data

    S3 is an object store – not file or block
    you can’t mount a S3 bucket as (K:/ or /images)

  • I’ve always stored my notes on local. So just to make it online and publicly available, I’m starting my blog post! It will mostly be about my study.