Project Management optimize

Host Web assets with Amazon EC2 endpoints

Here's a look at using one feature of Amazon EC2 that allows you to host a static Web site or resources.

Cloud is the buzzword that continues to dominate the IT landscape, with a number of vendors providing a variety of solutions to put your IT resources out there. There is Microsoft Windows Azure, the Google Cloud, Amazon Elastic Compute Cloud (EC2), Apple's iCloud, and more.

At a basic level, cloud computing is just another hosting solution, but the cloud services go a lot further with plenty of features and services available. Here's a look at using one feature of Amazon EC2 that allows you to host a static Web site or resources.

Build it and they will come

Amazon's goal is to be the online store of everything for everybody, and the company has done a great job of moving toward that goal. In the process of building such an enterprise, Amazon encountered and overcame the numerous challenges of hosting a large-scale application with so many users. Amazon's EC2 offering makes this infrastructure and expertise available to you. Taking advantage of it is as simple as adding Amazon Web Services (AWS) to your existing Amazon account, or creating a new Amazon account and adding it. Once the account is setup, the service is easily accessed via the AWS Management Console, which provides a Web-based interface for managing your services -- you select the service before accessing the console. Figure A shows the console for my account opened for Amazon Simple Storage Service (S3). Figure A

Working with the AWS Management Console (Click the image to enlarge.)

Put it in a bucket

The EC2 service utilizes Amazon S3, which provides distributed storage for the Internet. It offers a pay as you go model, so you only pay for the actual storage space used.

The basic element of Amazon S3 is the bucket. These buckets are containers for your files. The caveat is the naming of a bucket. The name must be unique across the Amazon system; for this reason, Amazon encourages the use of domain names in bucket names. Figure A shows my buckets in the list on the left section of the page, and Figure B shows the top bucket selected with its contents displayed on the right (one jpg file). Figure B

Viewing buckets and their contents with console (Click the image to enlarge.)

The bucket as a destination

Buckets can also be used to host static Web content. Yes, you can host a site on Amazon without going through domain registration with the caveat of only using static content, which is a throwback to the early days of the Web (think brochureware). Another drawback is the odd URL that will be used to access content, which is shown later.

The endpoint feature is available via bucket properties, so right-click the bucket and choose Properties (Figure C). Next, select the Website tab to access the endpoint feature (Figure D). Figure C

Accessing bucket properties in the AWS Management Console (Click the image to enlarge.)
Figure D

Working with the endpoint feature of a bucket (Click the image to enlarge.)

The Enabled checkbox on the Website tab turns it on, thus making the bucket an endpoint. The full endpoint URL is listed at the bottom of the Properties pane (told you it isn't user friendly). Also, you must identify index and error documents in the spaces provided. The index file is displayed when requests are made to the root of the endpoint. The error file is delivered when errors are encountered.

Once all information is saved, you click the Save button to make the changes permanent. At this point, load one of the files in your browser using the bucket's base URL. This presents an issue as displayed in Figure E. Figure E

Security issues encountered when viewing endpoint resources. (Click the image to enlarge.)
As you can see from Figure E, there is another step to take before a bucket asset is accessible anonymously via the Web: You must set up the appropriate level of access. Once again, you access the folder properties with the Permissions tab now used as shown in Figure F. This allows you to add individual users (asp01 displayed) as well as set the level for the world - in this case Everyone is given the View permission. This is repeated for the individual files within the bucket. Figure F

Security issues encountered when viewing endpoint resources (Click the image to enlarge.)

Amazon offers another way to apply security via a bucket policy; the Add bucket policy button (shown in the lower right of Figure C) provides access to this feature. Bucket policies use a special syntax, and you can use the AWS Policy Generator to create your own. More information is available online.

Opening the cloud

From my vantage point, the endpoint feature has been well-received by the Web community. While there are not very many, if any, static Web sites in existence today, this feature does provide a great platform for hosting static content and files (think images) for a site. It is interesting to think about combining a static content generator like Jekyll with endpoints. The next couple years will be interesting to see where this feature and Amazon's offerings go. In the meantime, this will be a niche feature.

Have you joined the cloud bandwagon? Do you use any cloud services now? Share our thoughts and experience with the community.

About

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a productio...

2 comments
sipeki
sipeki

I would like to use EC2 solution for client backup of files that they have on their pc's and servers. The only problem, as always, with the cloud is the geographical location of the servers. Do you think that Amazon will introduce a feature that restricts were data is stored geographically on EC2 infrastructure? As my clients are based in Scotland the data needs to be keep within the EU. Will the law need to change, or will the provide what is required?

aspatton
aspatton

I've read a few things suggesting you can locate the closest data center when working with data (check out GeoIP). It seems you can decide what region to store your data - check out the S3 site faq.