CDP:URL Rewriting pattern

From AWS-CloudDesignPattern
(Difference between revisions)
Jump to: navigation, search
(Configuration)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
[[Category: CDP: All Patterns]] [[Category: CDP: Patterns for Processing Dynamic Content]] {{List of CDP}} {{NoT}}
+
[[Category: CDP: All Patterns]][[Category: CDP: Patterns for Processing Dynamic Content]]{{List of CDP}}{{NoT}}  
 
Saving Static Content   
 
Saving Static Content   
  
Line 6: Line 6:
  
 
== Explanation of the Cloud Solution/Pattern ==
 
== Explanation of the Cloud Solution/Pattern ==
The use of Internet storage is a way to distribute access of static content. This makes it possible to handle the load without increasing the number of virtual servers.  
+
You can use Internet storage to distribute access of static content. This makes it possible to handle the load without increasing the number of virtual servers.  
  
The use of this method requires that the URL for the static content be changed to a URL for the Internet storage, but along with a method of directly adjusting the static content, it is also possible to change the URL, at the time of delivery, using the Filter function of the web server. Moreover, instead of delivering from Internet storage, it is also possible to deliver the content from a content delivery server.  
+
Using this method requires that the URL for the static content be changed to a URL for the Internet storage. But this does not imply that you always have to adjust the static content directly; you can use the the Filter function of the web server to change the URL at the time of delivery. Instead of delivering from Internet storage, you can also deliver the content from a content delivery server.  
  
 
== Implementation ==  
 
== Implementation ==  
In AWS, Amazon Simple Storage Service (S3) can be used in delivery of static content. Using content located on Amazon Simple Storage Service (S3) as the original, and using the CloudFront content delivery service makes it possible to deliver content globally without delay.  
+
In AWS, you can use the Amazon Simple Storage Service (S3) to deliver static content. You can deliver content globally without delay by using content located on Amazon Simple Storage Service (S3) as the original, and using the CloudFront content delivery service.  
  
 
(Procedure)
 
(Procedure)
 
* Upload (synchronize) a portion of the static content (JavaScript/CSS/images, etc.) of the EC2 to S3.
 
* Upload (synchronize) a portion of the static content (JavaScript/CSS/images, etc.) of the EC2 to S3.
* If necessary, generate a CloudFront using, as the original, the S3 wherein the static content has been uploaded (synchronized). (When CloudFront is used, it is also possible to use an EC2 instance directly as the original server, rather than S3.)
+
* If necessary, generate a CloudFront using, as the original, the S3 where the static content has been uploaded (synchronized). (When CloudFront is used, it is also possible to use an EC2 instance directly as the original server, rather than S3.)
 
* Overwrite the static content URLs in the HTML tags with those of the S3 or of CloudFront.
 
* Overwrite the static content URLs in the HTML tags with those of the S3 or of CloudFront.
* It is possible to use the Apache filter module (mod_ext_filter<ref group="Related Blog"> {{Related Blog |blog=suz-lab - blog |title= Changing the URLs of Images, Etc., to those of CloudFront Using "mod_ext_filter" |url=http://blog.suz-lab.com/2010/03/modextfilterurlcloudfront.html}}  </ref>/mod_sed<ref group="Related Blog"> {{Related Blog|blog=suz-lab - blog |title= Changing the URLs of Images, Etc., in HTML to those of S3 or CloudFront Using "mod_sed"|url=http://blog.suz-lab.com/2012/05/modsedhtmlurls3cloudfront.html}} </ref>)or Nginx, prepared as a proxy, to perform the overwriting dynamically.  
+
* You can use the Apache filter module or Nginx, prepared as a proxy, to perform the overwriting dynamically.  
  
 
== Configuration ==
 
== Configuration ==
Line 23: Line 23:
  
 
== Benefits ==  
 
== Benefits ==  
* Distribution of access of static content to S3/CloudFront can provide greater robustness to load and can also reduce EC2 costs.
+
* You can provide greater robustness to load and can also reduce EC2 costs through distributing the access of static content to S3/CloudFront.
* The use of CloudFront is also a way to handle latency caused by distance in worldwide delivery.
+
* You can use CloudFront as a way to handle latency caused by distance in worldwide delivery.
* When mod_ext_filter/mod_sed, Nginx, or the like is used, this pattern can be applied through the insertion of a filter, without modifying the original HTML file. Moreover, it is easy to fall back to the state wherein CloudFront is not used, by simply turning the filter off.  
+
* When mod_ext_filter/mod_sed, Nginx, or the like is used, you can use this pattern by inserting a filter, without modifying the original HTML file. You can easily fall back to the state where CloudFront is not used, by simply turning the filter off.  
  
 
== Cautions ==   
 
== Cautions ==   
* When CloudFront is used, there may be some cases wherein deletion or updating may be delayed due to content caching.  
+
* When CloudFront is used, there may be some cases where deletion or updating may be delayed due to content caching.
 
+
== Other == 
+
 
+
== Related Blog ==
+
<references group="Related Blog"/>
+

Latest revision as of 06:21, 26 November 2012

Architect

Saving Static Content

Contents

Problem to Be Solved

When a web service is provided by a virtual server, if the number of accesses becomes too large, the load is handled by increasing the number of virtual servers or upgrading the specifications of the virtual servers. However, often the majority of the accesses are requests for static content, so how to distribute access to static content has become an important issue.

Explanation of the Cloud Solution/Pattern

You can use Internet storage to distribute access of static content. This makes it possible to handle the load without increasing the number of virtual servers.

Using this method requires that the URL for the static content be changed to a URL for the Internet storage. But this does not imply that you always have to adjust the static content directly; you can use the the Filter function of the web server to change the URL at the time of delivery. Instead of delivering from Internet storage, you can also deliver the content from a content delivery server.

Implementation

In AWS, you can use the Amazon Simple Storage Service (S3) to deliver static content. You can deliver content globally without delay by using content located on Amazon Simple Storage Service (S3) as the original, and using the CloudFront content delivery service.

(Procedure)

  • Upload (synchronize) a portion of the static content (JavaScript/CSS/images, etc.) of the EC2 to S3.
  • If necessary, generate a CloudFront using, as the original, the S3 where the static content has been uploaded (synchronized). (When CloudFront is used, it is also possible to use an EC2 instance directly as the original server, rather than S3.)
  • Overwrite the static content URLs in the HTML tags with those of the S3 or of CloudFront.
  • You can use the Apache filter module or Nginx, prepared as a proxy, to perform the overwriting dynamically.

Configuration

2XNdewVsgellO3x8-570C8.png

Benefits

  • You can provide greater robustness to load and can also reduce EC2 costs through distributing the access of static content to S3/CloudFront.
  • You can use CloudFront as a way to handle latency caused by distance in worldwide delivery.
  • When mod_ext_filter/mod_sed, Nginx, or the like is used, you can use this pattern by inserting a filter, without modifying the original HTML file. You can easily fall back to the state where CloudFront is not used, by simply turning the filter off.

Cautions

  • When CloudFront is used, there may be some cases where deletion or updating may be delayed due to content caching.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox