Hosting a static web site on Amazon Web Services (AWS)

20
AWS Static Web Hosting S3 & Route53 by Erick Brito Cloud Competency Group

description

A guide how to host a static web site on Amazon Web Services (AWS). Based on S3 & Route53

Transcript of Hosting a static web site on Amazon Web Services (AWS)

  • AWS Static Web Hosting S3 & Route53 by Erick Brito Cloud Competency Group
  • Hands on In few minutes you will have a hosted site with static content Requirements: Internet access Your credit card / your AWS account An html editor A domain name Out of the scope Html authoring CDN (Amazon CloudFront) We will review at high level by Erick Brito 31/07/2014
  • AWS S3 Quick review S3 for Simple Storage Service Use cases Content Storage and Distribution Storage for Data Analysis Backup, Archiving and Disaster Recovery Static Website Hosting Benefits: Secure Reliable (durability-availability) Scalable Fast Inexpensive by Erick Brito 31/07/2014
  • S3 Advices When to use Store large objects Key-value store Get/Put/List Unilimited storage Versioning Very high durability & throughput For storing persistent data (Blob store by Erick Brito Not to be used Complex queries Low latency Search Need transactions Best practices Use random hash prefix for keys Ensure a random access pattern Use Amazon CloudFront for hight throughput GETs and PUTs Consider parallel thread to read and write 31/07/2014
  • The Cloud New paradigms The cloud brings the scalability The old problems become bigger Simplicity is the key! S3 / Data Lifecycle Management As your data ages, Amazon S3 takes care of automatically and transparently migrating your data to new hardware as hardware fails or reaches its end of life. This eliminates the need for you to perform expensive, time-consuming, and risky hardware migrations. Amazon S3 also enables you to automatically archive your data to lower cost storage as your data ages. You can define rules to automatically archive sets of Amazon S3 objects to Amazon Glacier based on their lifetime. by Erick Brito 31/07/2014
  • Where we go? To create a Static Web Site We assume we already have: Internet access Your credit card / your AWS account Covered by David Lotts An html editor and the content A domain name by Erick Brito 31/07/2014
  • The Architecture by Erick Brito 31/07/2014
  • Pricing We have to make some assumptions to define the next variables in order to estimate the price Number of files and size. Total size Frequency to update files # Domain names # Locations to distribute the content Number of Visits by Erick Brito 31/07/2014
  • S3 Pricing almost inexpensive http://calculator.s3.amazonaws.com/index.html by Erick Brito 31/07/2014
  • The Benefits Improve performance using a CDN, the second rule by http://yslow.org/user-guide/ https://developer.yahoo.com/performance/rules.html#cdn http://www.amazon.ca/High-Performance-Web-Sites-Essential/dp/0596529309 Scalability Availability Cost reduction by Erick Brito 31/07/2014
  • Cooking the recipe 1. Get the ingredients 1. AWS account 2. Choose a Domain name 3. Have your content 2. Configure Storage on Amazon S3 1. Covered by David Lotts 2. the bucket names has the domain name! 3. Associate a Domain name with your website (Route53) by Erick Brito 31/07/2014
  • Configure Storage on Amazon S3 1. Create a new bucket with the same name as the domain, other for the subdomain www and other for the logs on the same region. 2. Add permissions and create bucket policy for the root bucket (domain). 3. Enable logging 1. Target logs.domainname 2. Prefix root/ 4. Upload content to the root bucket 5. Enable website hosting on the root 1. Define index page 2. Define error page 6. Redirect traffic from www to root by Erick Brito { "Version":"2008-10-17", "Statement":[{ "Sid":"Allow Public Access to All Objects", "Effect":"Allow", "Principal": { "AWS": "*" }, "Action":["s3:GetObject"], "Resource":["arn:aws:s3:::example.com/*"]}]} Create 3 new buckets Add permissions Enable logging Upload content Enable web hosting Redirect traffic
  • Where we are? by Erick Brito 31/07/2014
  • Associate a Domain with the website Route53 1. Create a Hosted Zone with the Domain Name 2. Configure the A record for the root domain 1. Alias: yes 2. Alias Target (the root bucket) 3. Routing policy: Simple 3. For the www subdomain, configure another A record 1. Alias: yes 2. Target the (root domain) 3. Routing policy: Simple by Erick Brito 31/07/2014
  • Configure the DNS on the provider Retrieve the 4 servers from Route 53 record type NS. Those values are generated by AWS when creating the new Hosted Zone Manage your Domain Settings updating the Nameservers with the values retrieved on the previous step. by Erick Brito Register the domain name Create a new hosted zone Create 2 new records (Type A) Configure the Domain Name Servers with the values from the record type NS 31/07/2014
  • Next steps not covered AWS Glacier: Amazon Glacier is an extremely low-cost storage service that provides secure and durable storage for data archiving and backup. In order to keep costs low, Amazon Glacier is optimized for data that is infrequently accessed and for which retrieval times of several hours are suitable. With Amazon Glacier, customers can reliably store large or small amounts of data for as little as $0.01 per gigabyte per month AWS CloudFront: More than a CDN by Erick Brito 31/07/2014
  • Other scenarios by Erick Brito Total Cost: $1122/m S3+Route53: $2/m CloudFront:$44/m 31/07/2014
  • references http://awsdocs.s3.amazonaws.com/gettingstarted/latest/awsgsg-swh.pdf http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting- intro.html http://aws.amazon.com/documentation/gettingstarted/ http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting- intro.html by Erick Brito 31/07/2014
  • Tools http://tntdrive.com http://www.gladinet.com/p/downloadmsi_715_mir01.htm http://s3browser.com by Erick Brito 31/07/2014
  • Q & A Now it is time to ask questions! Contact: Erick Brito http://blog.erickbrito.ca http://ca.linkedin.com/in/erickbrito [email protected] 31/07/2014by Erick Brito