Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An Introduction to Static Sites and AWS

An Introduction to Static Sites and AWS

This is a talk meant for new web developers which explains how to best deploy static websites using Amazon.

Specifically, I cover how to install and use the Amazon CLI tools to upload sites to Amazon S3 for fast, cheap hosting. I also cover how to use Amazon Cloudfront to speed sites up for everyone in the world.

Lastly, I also cover how to buy domains with DNSimple (the best registrar!)

Randall Degges

November 09, 2015
Tweet

More Decks by Randall Degges

Other Decks in Programming

Transcript

  1. An Introduction to Static
    Sites and AWS
    @rdegges

    View Slide

  2. I’m Randall Degges
    Developer Evangelist at
    Stormpath
    Python / Node / Go
    Hacker

    View Slide

  3. View Slide

  4. What’s a Static Site?
    Server
    Show me the site!
    Ok, here’s some HTML.

    View Slide

  5. View Slide

  6. What’s a Dynamic Site?
    Server
    Show
    m
    e
    the
    site!
    Ok, here’s some HTML.
    Node.js
    Hey, give me the
    website! Someone
    wants it!
    Ok dude! Here’s
    the website.

    View Slide

  7. View Slide

  8. What Should I Do?

    View Slide

  9. FAST

    View Slide

  10. AS

    View Slide

  11. FUCK!

    View Slide

  12. Server
    Wow this site is so
    fast! I’m going to
    tell all my friends
    about it.

    View Slide

  13. VS

    View Slide

  14. Server
    Wow. This site is slow. I hate
    this website. I hate all
    websites. I hate the internet.

    View Slide

  15. ● How to host static websites on
    Amazon S3.
    ● How to make really REALLY fast
    websites with Amazon Cloudfront.
    ● How to buy and manage domain
    names and DNS.
    ● How to deploy real sites like a boss
    with DNS.
    ● Whatever else ya wanna know =)

    View Slide

  16. Let’s Build a Resume Site

    View Slide

  17. http://themeforest.net

    View Slide

  18. What is AWS?

    View Slide

  19. What is S3?

    View Slide

  20. SO FAST AND CHEAP
    *3 cents per GB

    View Slide

  21. www.mywebsite.com

    View Slide

  22. Set it Up
    aws.amazon.com

    View Slide

  23. https://github.com/rdegges/resume.rdegges.com
    OR
    Make your own Git repository and add some html.

    View Slide

  24. < IAM User Creation Demo >

    View Slide

  25. Setup the AWS CLI Tool
    $ brew install python
    $ sudo pip install awscli
    $ aws configure
    default region: us-east-1

    View Slide

  26. Create an S3 Bucket

    View Slide

  27. $ aws s3 mb s3://resume.rdegges.com
    $ aws s3 website s3://resume.rdegges.com --index-document
    index.html
    $ aws s3 sync . s3://resume.rdegges.com --exclude '.git/*'
    --exclude 'Makefile' --acl public-read --delete

    View Slide

  28. View Slide

  29. View Slide

  30. Cool site.
    Lame URL.

    View Slide

  31. DNS!
    http://domai.nr

    View Slide

  32. DNSimple

    View Slide

  33. https://dnsimple.com/r/d9a8f0b92dfb78
    Make an Account

    View Slide

  34. Buy a Domain

    View Slide

  35. Setup DNS to Point to S3

    View Slide

  36. Cool site!
    Cool URL!
    Not as fast as
    Google tho :(

    View Slide

  37. What’s a CDN?
    www.mywebsite.com
    (Website is in China)

    View Slide

  38. In Depth
    www.mywebsite.com
    I’m in Los Angeles!
    DNS
    California
    Ireland
    China
    UK
    Hmm. This guy is in
    California. Let’s send
    him to the California
    servers!

    View Slide

  39. Introducing Cloudfront!

    View Slide

  40. California
    Ireland
    China
    UK
    etc

    View Slide

  41. < Setup Cloudfront Distribution >

    View Slide

  42. Cool site!
    Cool URL!
    So fast!

    View Slide

  43. Automating Deployments
    S3_BUCKET=s3://resume.rdegges.com/
    all:
    aws s3 sync . $(S3_BUCKET) --exclude '.git/*' --exclude 'Makefile'
    --acl public-read --delete

    View Slide

  44. View Slide

  45. BONUS: SSL
    www.mywebsite.com

    View Slide

  46. You’re awesome.
    @rdegges

    View Slide