✒️
SEI 802
  • Introduction
  • About These Notes
  • Syllabus
  • Development Workflow
    • Installfest
      • Mac OSX
      • Linux
      • Git Configuration
      • Sublime Packages
    • Command Line
      • The Terminal
      • Filesystem Navigation
      • File Manipulation
      • Additional Topics
    • Intro to Git
      • Version Control
      • Local Git
      • Remote Git
      • Git Recipes
    • Group Collaboration
      • Git Workflows
      • Project Roles and Tools
    • VS Code Tips & Tricks
  • HTML/CSS
    • HTML
    • CSS Selectors
    • CSS Box Model and Positioning
      • Box Model
      • Display and Positioning
      • Flexbox
      • Grid
      • Flexbox & Grid Games
      • Floats and Clears
      • Additional Topics
    • Advanced CSS
      • Responsive Design
      • Pseudo-Classes/Elements
      • Vendor Prefixes
      • Custom Properties
      • Additional Topics
    • Bootstrap
    • CSS Frameworks
    • Accessibility
  • JavaScript
    • Primitives
    • Arrays
    • Objects
    • Control Flow
      • Boolean Expressions
      • Conditionals
      • Loops
      • Promises
    • Functions
      • Callbacks
      • Timing Functions
      • Iterators
    • DOM and Events
    • DOM Manipulation
    • HTML5 Canvas
    • How To Reduce Redundancy
    • (2019) JavaScript OOP
    • (2016) OOP with Classes
    • (1995) OOP with Prototypes
      • Constructors
      • Prototypes
    • Intro to TDD
    • Scoping
    • Inheritance
      • Prototypal Inheritance
      • Call, Apply, and other Functions
      • ES6 Inheritance
      • Resources
    • Custom Node Modules
    • Additional Topics
      • AJAX, Fetch, and Async/Await
      • AJAX w/JSON and Localstorage
        • AJAX w/JSON
        • Local Storage
      • Async module
      • Data Scraping
  • jQuery
    • Intro
      • DOM Manipulation
      • Reddit Practice
      • Styling
      • Events
    • Plugins
    • AJAX
  • APIs
    • Fetch
    • AJAX w/jQuery
    • AJAX w/Fetch
  • Databases
    • Intro to SQL
    • Advanced SQL
    • MongoDB
      • Intro to NoSQL
      • CRUD in MongoDB
      • Data Modeling
      • Intermediate Mongo
  • Node/Express
    • Node
      • Intro to Node
      • Node Modules
      • Node Package Manager (NPM)
    • Express
      • Intro to Express
        • Routes
        • Views
        • Templates
        • Layouts and Controllers
        • CRUD & REST
          • Get and Post
          • Put and Delete
      • APIs with Express (request)
      • APIs with Express (axios)
    • Sequelize
      • Terminology
      • Setup
      • Using Models
      • Seeding Data
      • Validations and Migrations
      • Resources
      • 1:M Relationships
      • N:M Relationships
    • Express Authentication
      • Research Components
      • Code Components
      • Auth in Theory
        • Sessions
        • Passwords
        • Middleware
        • Hooks
      • Auth in Practice
        • Create the User
        • User Signup
        • Sessions
        • User Login
        • Authorization and Flash messages
    • Testing with Mocha and Chai
    • Mongoose
      • Mongoose Associations
    • JSON Web Tokens
      • Codealong
    • Additional Topics
      • oAuth
      • Geocoding with Mapbox
      • Geocoding and Google Maps
      • Cloudinary
      • Websockets with Socket.io
      • SASS
  • Ruby
    • Intro to Ruby
    • Ruby Exercises
    • Ruby Classes
    • Ruby Testing with Rspec
    • Ruby Inheritance
    • Ruby Data Scraping
  • Ruby on Rails
    • Intro to Rails
    • APIs with Rails
    • Asset Pipeline
    • Rails Auth and 1-M
      • Auth Components
    • Rails N:M
    • ActiveRecord Polymorphism
    • Additional Topics
      • oAuth
      • SASS
      • Rails Mailers
      • Cloudinary
      • Jekyll
  • React (Updated 2019)
    • ES6+/ESNext
      • Const and Let
      • Arrow Functions
      • Object Literals and String Interpolation
      • ES6 Recap
      • ES6 Activity
    • Intro to React
      • Create React App
      • Components and JSX
      • Virtual DOM
      • Props
      • Dino Blog Activity
      • Nested Components
      • Lab: LotR
    • React State
      • Code-Along: Mood Points
      • Code-Along: Edit Dino Blog
      • Lab: Simple Calc
      • Lifting State
    • React Router
      • Browser History/SPAs
      • React Router (lesson and full codealong)
      • Router Lab
    • Fetch and APIs
      • APIs with Fetch and Axios
      • Fetch the Weather
    • React Hooks
    • React LifeCycle
      • Lab: Component LifeCycle
    • React Deployment
    • Additional Topics
      • React Frameworks
        • Material UI Theming
      • Typescript
        • More Types and Syntax
        • Tsconfig and Declaration Files
        • Generics with Linked List
      • Redux
      • TypeScript
      • Context API
      • React Native
  • Meteor
  • Deployment and Config
    • Deploy - Github Pages
    • Deploy - Node/Sequelize
    • Deploy - Node/MongoDB
    • Deploy React
    • Deploy - Rails
      • Foreman (Environment Variables)
    • Deploy - AWS Elastic Beanstalk
    • Deploy - S3 Static Sites
    • Deploy - Django
    • Deploy - Flask
  • Data Structures and Algorithms
    • Recursion
    • Problem Solving - Array Flatten
    • Binary Search
    • Algorithm Complexity
    • Stacks and Queues
    • Bracket Matching
    • Ruby Linked Lists
      • Sample Code
      • Beginner Exercises
      • Advanced Exercises
    • JS Linked Lists
      • Sample Code
      • Beginner Exercises
      • Beginner Solutions
    • Hash Tables
    • Intro to Sorting
    • Insertion Sort
    • Bucket Sort
    • Bubble Sort
    • Merge Sort
    • Quick Sort
    • Heap Sort
    • Sorting Wrapup
    • Hashmaps
    • Trees and Other Topics
  • Python
    • Python Installation
    • Intro to Python
    • Python Lists
    • Python Loops
    • Python Dictionaries
    • Python Sets and Tuples
    • Python Cheatsheet
    • Python Functions
    • Python Classes
    • Python Class Inheritance
    • Intro to Flask
    • Intro to SQLAlchemy
      • Flask and SQLAlchemy
    • Using PyMongo
    • Intro to Django
    • CatCollector CodeAlong
      • URLs, Views, Templates
      • Models, Migrations
      • Model Form CRUD
      • One-to-Many Relations
      • Many-to-Many Relations
      • Django Auth
    • Django Cheatsheet
    • Django Auth
    • Django Polls App Tutorial
    • Django School Tool Tutorial
    • Django 1:M Relationships
    • Custom Admin Views
    • Data Structures and Algorithms
      • Recursion
      • Binary Search
      • Stacks and Queues
      • Linked Lists
      • Binary Trees
      • Bubble Sort
      • TensorFlow & Neural Networks
    • Adjacent Topics
      • Raspberry Pi
      • Scripting
  • Assorted Topics
    • History of Computer Science
    • Regular Expressions
    • Intro to WDI (Course Info)
    • Being Successful in WDI
    • Internet Fundamentals
      • Internet Lab
    • User Stories and Wireframing
      • Wireframing Exercise: Build an Idea
    • Post WDI
      • Learning Resources
      • Deliverables -> Portfolio
      • FAQ
  • Projects
    • Project 1
    • Project 2
    • Project 3
      • Project 3 Pitch Guidelines
    • Project 4
    • Past Projects
      • Project 1
      • Project 2
      • Project 3
      • Project 4
      • Portfolios
    • Post Project 2
    • MEAN Hackathon
      • Part 1: APIs
      • Part 2: Angular
    • Portfolio
  • Web Development Trends
  • Resources
    • APIs and Data
    • Tech Websites
    • PostgreSQL Cheat Sheet
    • Sequelize Cheat Sheet
    • Database Administration
  • Archived Section
    • (Archived) ReactJS
      • Intro to React
        • Todo List Codealong
        • Additional Topics
      • Deploy React
      • React with Gulp and Browserify
        • Setting up Gulp
        • Additional Gulp Tasks
      • React Router
        • OMDB Router
        • OMDB Search
        • Additional Resources
      • React Animations
        • CSS Animations
    • AngularJS
      • Intro to AngularJS
        • Components and SPA
        • Create an Angular App
      • Angular Directives and Filters
      • Angular Animation
      • Angular Bootstrap Directives
        • Bootstrap Modals
      • Angular $http
      • Angular Services
        • Service Recipes
        • ngResource
        • Star Wars Codealong
      • Angular Routing
      • Angular + Express
      • Angular Authentication
        • Additional Topics
      • Angular Components
      • Angular Custom Filters
      • Angular Custom Directives
Powered by GitBook
On this page
  • Objectives
  • Preparation
  • S3 - Simple Storage Service Intro (20 mins)
  • Creating a static website (15 mins)
  • Finally adding some content
  • Independent Practice (20 minutes)
  • Front end (Javascript) Libraries

Was this helpful?

  1. Deployment and Config

Deploy - S3 Static Sites

PreviousDeploy - AWS Elastic BeanstalkNextDeploy - Django

Last updated 3 years ago

Was this helpful?

Objectives

After this lesson, developers will be able to:

  • Describe S3 storage usages

  • Utilize S3 to store files and host website and Route53 for domain routing

  • Create and upload static content for a website

Preparation

Before this lesson, developers should already be able to:

  • Describe the difference between static and dynamic websites

  • Write HTML, CSS, JS to build a functioning website

S3 - Simple Storage Service Intro (20 mins)

Amazon S3, or Simple Storage Service, is an implementation of cloud storage offered by Amazon. Using S3 you can store large amounts of static content needed for websites and apps. Files, or Objects as they are referred to in Amazon docs, are stored in seperate Buckets that can reach sizes of up to 5 Terabytes.

S3 Buckets

Each file/object in the bucket receives a unique Key from the user when added to the bucket. Think of it like a folder in your file system. When you try to have two files with the same name you are given the choice of either replacing the old file or giving the new file a new name. S3 buckets work in a similar way.

But what does it mean?!

This means S3 is basically a big file system where you can keep and access content!

Creating a static website (15 mins)

One of the major uses of S3 is hosting a static website. S3 now has functionality built in to help with domain mapping which even allows you to use your custom domain name. S3 stands as a nice alternative to BitBalloon and other dropbox-esque services due to it's speed and custom nature.

To get our static site up and running we're going to be using not only S3 but also two other Amazon services. We'll also use Route53 for DNS resolution.

First we'll create our S3 buckets. We're going to be creating 3 different buckets for our site. Two will be linked to our domain and the 3rd will be for logs that S3 produces. This structure is recognized and utilized by S3 for static sites. Important Be sure to name the buckets the same name as your domain, whatever that may be!

By creating the buckets this way, Amazon will generate a URL according to that name:

Rinse and repeat bucket creation process for www.domainname.com and logs.domainname.com

Next we'll setup permissions for our buckets. Since this is a website we'll need parts of it to be accessible to clients. First, from the management console, click on the root domain bucket and click Properties.

Click Permissions and then Add Bucket Policy to change who can access files. Next we're going to input some config options into the popup editor. Go ahead and copy and paste this JSON code into that popup:

{
  "Version":"2012-10-17",
  "Statement": [{
    "Sid": "Allow Public Access to All Objects",
    "Effect": "Allow",
    "Principal": "*",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::example.com/*"
  }
 ]
}

Make sure to change the domain in the Resource value to match your bucket name!!!

Next enable logging from your root domain bucket. Click Logging in your bucket properties and edit the values like this:

Finally adding some content

By now we should have our buckets set up and ready for static content, so let's upload some!

First we're going to create two files on our computers to be uploaded, index.html and error.html.

index.html

<!DOCTYPE html>
<html>
  <body>
    <p>Hello, World!</p>
  </body>
</html>

error.html

<!DOCTYPE html>
<html>
  <body>
    <p>This is an error page.</p>
  </body>
</html>

Save those files somewhere on your local computer. Both of these files are recognized by S3 when we enable Static Web Hosting.

Next we're going to upload these files to our root domain bucket. From the management console click the Actions dropdown and select Upload. You can then either drag and drop or select the two files to upload.

After you find the files and click Start upload it should look like this:

Finally we need to configure one more aspect of our bucket, enabling Static Website Hosting. Back at the S3 management console open your root domain bucket and open Properties. Then open the Static Website Hosting section. Check the Enable website hosting option and enter in the information for your two files as such:

Click Save and you're done! You've just hosted a static website on S3, nice job!

Independent Practice (20 minutes)

Front end (Javascript) Libraries

purpose

home page

demos

Drawing / visual

obvious on homepage

Drawing / visual

Data Visualization

obvious on homepage

Physics

on homepage

2D

obvious on homepage

3D

2D Game engine

obvious on site

Voice recognition

homepage is demo

Audio generator / visualization

Typography

links on homepage

Note: This can be a pair programming activity or done independently.

Now that you have static content being served out to clients let's add some flavor to it! For this exercise go ahead and pick one frontend technology to add to your site to make it more robust. It can be anything you like but some popular ideas:

  • Angular

  • Jquery

  • D3

  • Phaser

Using that technology go ahead and try and code something simple but brand new. Then upload it to S3 and test it out! Now get those fingers moving!!

S3 Static Website
Static Site Buckets

Lets jump into the and click the "Create Bucket" button.

Bucket Properties
Bucket Policy
Logging
Uploading files
Upload complete
Static site settings

,

/

,

Need more?

http://example.com.s3-website-us-east-1.amazonaws.com/
S3 management console
http://www.javascripting.com/
http://svgjs.com/
http://paperjs.org/
nyan
Other demos
http://d3js.org/
http://wellcaffeinated.net/PhysicsJS/
http://cutjs.org/
http://threejs.org/
rubicks cube
more demos
http://www.html5quintus.com/
https://www.talater.com/annyang/
https://github.com/jeromeetienne/webaudiox
visualization
audio generator
http://letteringjs.com/
Create Bucket
Name Bucket