Using S3 as your Webserver

who is this guy?

  • steve bradford
  • sr. systems engineer at herff jones
  • AWS fanboy
  • i like to build stupid little things

why should we listen to you?

  • i've done this a lot
  • i've got certifications that say i know what i'm doing
  • i'm the one with the slides

who are you talking to?

  • people that are new to AWS
  • people that just want to host some things without managing servers

ok, what's AWS?

  • Amazon Web Services
  • Cloud Services
  • Dozens and Dozens of Services
  • competitors are Azure, GCS

ok, what's S3?

  • Simple Storage Service
  • Object Storage - NOT a filesystem
  • Unlimited storage of files up to 5TB
  • Fast, Durable, Reliable (mostly)
  • Simple to use and mis-use
  • Cheap - only pay for storage space and bandwidth out

neat!  what can i use it for?

  • storing lots of things that need to be accessed from more than one place
  • user storage
  • archives/backups
  • web assets
  • static sites
  • dynamic sites (with help from other services)

what's the plan today?

  • using the AWS console
  • create a new bucket
  • create a bucket policy
  • enable web hosting on bucket
  • put a file in the bucket
  • view the file at the bucket's URL

AWS console

  • how to login
  • access controls
  • navigation / selecting services

S3 bucket creation

  • S3 console section
  • naming your bucket
  • folders aren't folders, but that's ok

S3 bucket policies

  • specify the access rules for the bucket
  • buckets are private by default, policies change that
  • don't get these confused with IAM policies
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME_HERE/*"
        }
    ]
}

enable S3 hosting

  • check the box...

place a file in the bucket

  • upload via console
  • API access
  • AWS CLI tools

other things S3 can do

  • logging
  • versioning
  • lifecycle rules
  • lambda triggers

what if i want my own URL?

  • Certificate Manager
  • CloudFront
  • Route53

Certificate Manager

  • creation and renewal of SSL certs
  • only usable with certain AWS services (ELB, CloudFront)
  • requires SNI, so no really old IE browsers...

CloudFront

  • a content delivery network / really big cache
  • can server from many different origin types
  • allows customization of how URL paths are handled
  • fast, cheap
  • can use Certificate Manager certs for custom SSL domain names

Route53

  • AWS hosted and managed DNS
  • doman name registrations too
  • has the magical ALIAS record type

S3 Web Hosting

By steve bradford

S3 Web Hosting

An introduction to using AWS S3 to host static assets and sites.

  • 1,287