Blogs > Dominik Pinter > February 2012 > Amazon S3 provider for the CMS.IO namespace
I’m really happy to announce the brand new provider for the CMS.IO namespace. This feature enables you to store all files in your Kentico CMS web application to Amazon S3 (Simple Storage Service). This service is part of the Amazon web services cloud service. This blog post guides you through the installation and configuration of this provider.
We have included this provider into the latest hotfix package 6.0.18. After applying this hotfix, you still have to go through several steps to make it work. Installation of the provider depends on the type of project you are using.

Web site project

No special steps needs to be done.

Web application/Windows Azure project

  1. Add reference to CMSApp project to CMS.AmazonStorage.dll.
  2. Include ~/CMSPages/GetAmazonFile.aspx into CMSApp project.

Source code

  1. Include the AmazonStorage project into your Kentico CMS solution.
    1. Go through Visual studio migration wizard if you are using Visual studio 2010.
    2. Set .NET version to 4 if you are using this version of .NET in the rest of the solution.
  2. Add reference to CMSApp project to AmazonStorage project.
  3. Include ~/CMSPages/GetAmazonFile.aspx into CMSApp project.
Configuration of the storage is the same for all types of projects and it’s all done via application settings keys in the web.config file:

<add key="CMSStorageProviderAssembly" value="CMS.AmazonStorage" /> - Specifies that the Amazon S3 storage assembly is used.

<add key=”CMSExternalStorageName” value=”Amazon” /> - Specifies a provider name (this value is used in URL generation logic).

<add key=”CMSAmazonBucketName”  value=”YourBucketName” /> - You need to specify the name of the bucket where you want to save the files. This bucket must already exist. A bucket name must be unique in the whole Amazon namespace so the provider doesn’t create it by itself.

<add key=” CMSAmazonAccessKeyID” value=”YourKey” /> - ID of an Amazon access key which is used for the authentication to the S3 storage.

<add key=”CMSAmazonAccessKey” value=”Your secret” /> - The Amazon access key which is used for the authentication to the S3 storage.

All the keys above are mandatory. There is also a set of optional keys:

<add key=”CMSAmazonTempPath” value=”PathToTemp” /> - Path to the directory where temporary files are stored. If you don’t specify this key, the temporary directory will be created in the OS temporary directory.

<add key=”CMSAmazonCachePath” value=”PathToCache” /> - Path to directory where cached files are stored. If you don’t specify this key temporary directory will be created in the OS temporary directory.

<add key=“CMSAmazonEndPoint“ value=“endpoint“ /> - Endpoint to the Amazon S3 storage. Here you can also specify the endpoint of the CloudFront content delivery network. If you don’t specify this key, the endpoint will be in format <yourbucketname>.s3.amazonaws.com.

<add key=“CMSAmazonPublicAccess“ value=“true/false“ /> - Specifies whether objects (files) in Amazon S3 uploaded through Kentico CMS are accessible for public users. The default value is true when an end point is specified. Otherwise, the default value is false.

I hope you will like this new provider. If you have any questions or remarks, let me know through the comments.
Posted: 2/17/2012 8:23:29 AM by Dominik Pinter | with 7 comments
 
Trackback URL: http://devnet.kentico.com/trackback/c2bf5284-0fe0-4e2f-933b-67d96b11d26f/Amazon-S3-provider-for-the-CMS-IO-namespace.aspx?culture=en-US

Comments
kentico_dominikp
Hi thanga,
yes you are right, I apologize for typos in my blog post. I have updated the post. I hope that it's all correct now.
5/5/2012 4:20:44 AM
thanga
I figured out the issue. The correct config key are: Note, there NO ".dll" in CMSStorageProviderAssembly

<add key="CMSExternalStorageName" value="Amazon" />
<add key="CMSStorageProviderAssembly" value="CMS.AmazonStorage" />
5/3/2012 1:38:26 PM
thanga
Is there any update on this issue? I am also getting the error that the assembly cannot be found
5/3/2012 1:16:57 PM
kentico_dominikp
Hi Rick,
currently, you can use only 1 bucket for all your files. In future (probably next release of Kentico CMS), you will be able to map buckets to certain paths in file system.

You can inherit from classes in AmazonStorage and override its behavior, this is the only way how can you customize provider. Do you want to change some specific thing or you were asking in general?
2/21/2012 2:08:42 AM
Rick Seinfeld
Perfect! What if I would like to utilize more then one bucket (one for video streaming, one for public data storage and one for private data storage), how am I supposed to do that? Is there any way I can customize the provider now?
2/21/2012 1:12:47 AM
kentico_dominikp
Hi David,
are you using WebProject or WebApplication? For WebApplication, you must add reference to CMSApp project (WebApp project) on CMS.AmazonStorage.dll.

Setting key <add key="CMSStorageProviderAssembly" value="CMS.AmazonStorage.dll" /> should set up IsExternalStorage to true and also set up ExternalStorageName to "amazon".

At first point, it seems that you configured settings correctly. If you don't success please write me an e-mail (dominikp (at) kentico (dot) com) and we will figure out what's wrong.
2/18/2012 3:25:09 AM
David Conder
Hi Dominik,

This is great to see! However I'm running into an issue. If I used the web.config settings you specify, whenever I try to upload a file, it doesn't work. When I click the "Save" button, the upload screen just refreshes and nothing happens.

I checked the value of: CMS.IO.StorageHelper.IsAmazonStorage and it's set to False, but CMS.IO.StorageHelper.IsExternalStorage is set to true.

I then changed the app setting CMSExternalStorageName to Amazon, and now CMS.IO.StorageHelper.IsAmazonStorage is true. However, I still can't upload any files, it just refreshes the page when I hit Save.

I finally tried adding the app key <add key="CMSStorageProviderAssembly" value="CMS.AmazonStorage.dll" /> but I'm getting an error that the assembly cannot be found (even though it's in the /bin folder).

Here are my actual web.config settings...can you take a look at what is causing the issue?

<add key="CMSExternalStorageName" value="Amazon" />
<!--<add key="CMSStorageProviderAssembly" value="CMS.AmazonStorage.dll" />-->
<add key="CMSAmazonBucketName" value="<bucketname>" />
<add key="CMSAmazonAccessKeyID" value="<access key>" />
<add key="CMSAmazonAccessKey" value="<secret>" />
<add key="CMSAmazonTempPath" value="c:\dev\kentico6_2\temp\" />
<add key="CMSAmazonCachePath" value="c:\dev\kentico6_2\cache\" />
<add key="CMSAmazonEndPoint" value="<cloudfront url>" />
<add key="CMSAmazonPublicAccess" value="true" />
2/17/2012 11:51:16 AM
Leave comment Subscribe



 Security code
Personal Info
Dominik Pinter
Hi, I'm Sr. Developer at Kentico. My main interests are Azure platform and web application security. My blog will be primary focused on these two topics. 
Useful Links

Save the Date

Denver
September 17-18, 2012

Prague
October 1-2, 2012

 
Archive
Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2012 Kentico Software | Powered by Kentico CMS