AWS Cloudfront Howto

Preview:

DESCRIPTION

AWS Cloudfront Howto

Citation preview

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   

Create Linux Instance 

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

 

Instance up and running 

 

   

Install and configure Webserver with PHP 

Install httpd & PHP 

 

 

Create a php dir and add apache permission

  

o Add “php” directory to php.conf 

 

 

o Add php script for server and client IP address 

  

o Start httpd server 

 

 

o Connect to the web‐server 

 

   

Add “Domain” to Route 53 Service 

Run Domain Wizard

  

 

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

 

   

Add AWS Name Servers to Domain Registrar 

Login to Registrar Domain Administration and update Name Server

  

Disable HTTP Forwarding 

 

 

   

Create a DNS record for the Webserver 

Run Route 53 Wizard 

  

Test new domain 

 

   

Create and configure Cloudfront Distribution Set 

Run CDS Wizard 

 

 

 

 

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 

 

Create a CNAME to Webserver CDS 

Add record set to Domain in Route 53 Service 

   

 

Test CNAME pointing to CDS CNAME (Working!!) 

 

   

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

 

   

Restriction example: Add United States to “Blacklist” 

  

  

  

 

 

 

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. 

   

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 

  

 

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

 

   

Configure bucket for static hosting

  

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

  

 

 

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>

   

Create Cloudfront distribution set of the S3 bucket 

  

 

   

Create a CNAME to S3 bucket CDS 

Create Record Set in Route 53 Service 

  

   

Run Page Load Test against S3 bucket CDS 

Test using previous created instance in Singapore region 

  

 

   

Create Elastic Load Balancer pointing to Webserver Instance 

Run Elastic Load Balancer Wizard 

 

 

 

 

 

 

 

 

 

 

   

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 

 

 

 

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. 

Recommended