26
Route 53 + AWS Cloudfront Howto  Contents  Create Linux Instance  Install and configure Webserver with PHP  Add “Domain” to Route 53 Service  Add AWS Name Servers to Domain Registrar  Create a DNS record for the Webserver  Create and configure Cloudfront Distribution Set (CDS) for Webserver  Create a CNAME to Webserver CDS  Test CDS Geolocation using public proxy servers  Create Windows instance in Singapore Region  Install Firefox and app.telemetry Page Speed Monitor Plugin on Instance  Run Page Load Test against Webserver CDS  Create S3 bucket with static webpage  Create CDS to S3 bucket   Create a CNAME to S3 bucket CDS  Run Page Load Test against S3 bucket CDS  Create Elastic Load balancer pointing to Webserver Instance  Create CDS to Elastic Load balancer  Create a CNAME to Elastic Load balancer CDS  Run Page Load Test against S3 bucket CDS 

AWS Cloudfront Howto

Embed Size (px)

DESCRIPTION

AWS Cloudfront Howto

Citation preview

Page 1: AWS Cloudfront Howto

Route 53 + AWS Cloudfront How‐to  

Contents  Create Linux Instance 

Install and configure Webserver with PHP 

Add “Domain” to Route 53 Service 

Add AWS Name Servers to Domain Registrar 

Create a DNS record for the Webserver 

Create and configure Cloudfront Distribution Set (CDS) for Webserver 

Create a CNAME to Webserver CDS 

Test CDS Geo‐location using public proxy servers 

Create Windows instance in Singapore Region 

Install Firefox and app.telemetry Page Speed Monitor Plugin on Instance 

Run Page Load Test against Webserver CDS 

Create S3 bucket with static webpage 

Create CDS to S3 bucket  

Create a CNAME to S3 bucket CDS 

Run Page Load Test against S3 bucket CDS 

Create Elastic Load balancer pointing to Webserver Instance 

Create CDS to Elastic Load balancer 

Create a CNAME to Elastic Load balancer CDS 

Run Page Load Test against S3 bucket CDS   

Page 2: AWS Cloudfront Howto

Create Linux Instance 

EC2   Instances  Launch Instance  Amazon Linux (t1.micro)  zen‐web 

 

Instance up and running 

 

   

Page 3: AWS Cloudfront Howto

Install and configure Webserver with PHP 

Install httpd & PHP 

 

 

Create a php dir and add apache permission

  

o Add “php” directory to php.conf 

 

 

Page 4: AWS Cloudfront Howto

o Add php script for server and client IP address 

  

o Start httpd server 

 

 

o Connect to the web‐server 

 

   

Page 5: AWS Cloudfront Howto

Add “Domain” to Route 53 Service 

Run Domain Wizard

  

 

Note: In my example domain is “zecircletech.com” and registrar godday.com.  

 

   

Page 6: AWS Cloudfront Howto

Add AWS Name Servers to Domain Registrar 

Login to Registrar Domain Administration and update Name Server

  

Disable HTTP Forwarding 

 

 

   

Page 7: AWS Cloudfront Howto

Create a DNS record for the Webserver 

Run Route 53 Wizard 

  

Test new domain 

 

   

Page 8: AWS Cloudfront Howto

Create and configure Cloudfront Distribution Set 

Run CDS Wizard 

 

 

 

Page 9: AWS Cloudfront Howto
Page 10: AWS Cloudfront Howto

 

Note 1: Name should be www.zencircletech.com(webserver) and not zencircletech.com Note 2: Add CDN CNAME global.zencircletech.com was added later Note 3: First distribution has no S3 buckets or load‐balancers  

Cloud distribution set created 

   

 

Test Cloudfront domain 

 

Page 11: AWS Cloudfront Howto

Create a CNAME to Webserver CDS 

Add record set to Domain in Route 53 Service 

   

 

Test CNAME pointing to CDS CNAME (Working!!) 

 

   

Page 12: AWS Cloudfront Howto

Test CDS Geo‐location using public proxy servers 

http://www.publicproxyservers.com/proxy/list2.html 

 

France public proxy: www.go.unblockyoutuber.com/

  

Singapore public proxy : anoncloud.se

 

   

Page 13: AWS Cloudfront Howto

Restriction example: Add United States to “Blacklist” 

  

  

  

 

 

Page 14: AWS Cloudfront Howto

 

CDN Page load Test Methodology:  We will create a webpage with large image, it will part of be 

CDN Distributed Set, and hence it will be replicated. We will create an access point to test load 

time. Access point will be a windows 2003 instance in from Singapore region. A region with 

significantly large geo‐graphic distance will show a significant difference in load time.   

Create a webpage with very large image 

Size and source code of web page [root@domU-12-31-39-06-BC-4B ~]# ls -lh /var/www/php/eso.jpg -rw-r--r-- 1 root root 4.9M Oct 6 2013 /var/www/php/eso.jpg [root@domU-12-31-39-06-BC-4B ~]# cat /var/www/php/pload.php <?php <img src="eso.jpg" alt="eso telescope"> ?>

 

Create Windows instance in Singapore Region 

Create a new VPC in Singapore Region and launch a windows 2003 32 bit instance 

 Note: VPC is mandatory in Singapore Zone. 

 

Install Firefox and app.telemetry Page Speed Monitor Plugin on Instance 

https://addons.mozilla.org/en‐US/firefox/addon/apptelemetry/ 

Plugin will help determine the load time for webpage. 

   

Page 15: AWS Cloudfront Howto

Run Page Load Test against Webserver CDS 

Connect directly to Webserver and note down the load time 

 Note: Delete browser cache 

Connect to the CDS URL 

  

 

Page 16: AWS Cloudfront Howto

Create S3 bucket with static webpage 

http://docs.aws.amazon.com/AmazonS3/latest/dev/website‐hosting‐custom‐domain‐

walkthrough.html 

 

Create a bucket “s3.zencircletech.com” & edit bucket policy

  

Create first webpage (index.hml page with image) <img src=https://s3.amazonaws.com/s3.zencircletech.com/download.jpg alt="aws_logo"> <h1>zen-s3</h1>

Upload index.hml and image to the bucket

 

   

Page 17: AWS Cloudfront Howto

Configure bucket for static hosting

  

Create a new sub domain “s3.zencircletech.com” and add bucket Endpoint 

  

 

Page 18: AWS Cloudfront Howto

 

Create CDS to S3 bucket  

Create html file with large image file and upload to s3 bucket index2.hml <img src=https://s3.amazonaws.com/s3.zencircletech.com/eso.jpg alt="eso"> <h1>large-img-s3</h1>

   

Page 19: AWS Cloudfront Howto

Create Cloudfront distribution set of the S3 bucket 

  

 

   

Page 20: AWS Cloudfront Howto

Create a CNAME to S3 bucket CDS 

Create Record Set in Route 53 Service 

  

   

Page 21: AWS Cloudfront Howto

Run Page Load Test against S3 bucket CDS 

Test using previous created instance in Singapore region 

  

 

   

Page 22: AWS Cloudfront Howto

Create Elastic Load Balancer pointing to Webserver Instance 

Run Elastic Load Balancer Wizard 

 

 

 

 

Page 23: AWS Cloudfront Howto

 

 

 

 

Page 24: AWS Cloudfront Howto

 

 

   

Page 25: AWS Cloudfront Howto

Create CDS to Elastic Load balancer 

Run CDS Wizard 

  

Create a CNAME to S3 Elastic Load Balancer CDS 

Create Record Set in Route 53 Service 

 

Page 26: AWS Cloudfront Howto

 

 

Run Page Load Test against S3 bucket CDS 

Test using previous created instance in Singapore region 

  

 

Note: Different CNAME for S3 Bucket and Elastic Load Balancer were created for how‐

to, practically they may not be needed.