Provisioning Durable Storage with S3
Here we are going to create a web server named DinoStorage, which is completely working in the cloud, using the AWS services. I have already created the templates for the website on my local computer using Visual Studio and My SQL database. Now we have to move this template to AWS and make it work as well as highly available.
Amazon Simple Storage Service (Amazon S3)
Amazone S3 is a secure, durable, highly-scalable cloud storage from Amazone. S3 uses buckets to store data, S3 buckets has to have unique names. Here I have created two buckets named dinostoredegradedram and dinostoreresourcesram. This buckets will be hosting DinoStor's data like images.
I have also created following folders in dinostoreresourcesram bucket.
· siteimages
· productimages
· css (for style sheets)
· js (for java script)
· configurations (for config files)
Then I have copied the product images from the local computer.
Then uploaded it to the dinostoreresourcesram bucket, productimages folder.
As well as the site images to the site images folder. Then I have right clicked on each folder and made it public, now I can click on the link in the properties to open it.
Now we have to prepare the Visual Studio program to redirect to the bucket images.
First, we have to find the bootstrap file in the local system and open it in the Visual Studio.In the local bootstrap.css file, find the ‘background-image: URL’ and I have changed the link to point to the appropriate cloud S3 based image folder in the bucket.
Then I have uploaded the bootstrap.ccs file from the local machine to the bucket's ccs folder.
I have also copied 'local \NET702.DinoStore\ NET702.DinoStore\scripts\bootstrap.js AND \NET702.DinoStore\ NET702.DinoStore\scripts\jquery-2.0.2.js' files to the bucket's Js folder. I have made the the copied files public, in the bucket.
Then I have copied the URL of bootstrap.css, bootstrap.js, and jquery-2.0.2.js from the cloud and edited in Visual Studio, in the Solution Items ‘index.html'.
Then uploaded the edited Intex file from local \NET702.DinoStore\ NET702.DinoStore\index.html file, to dinostoredegradedram bucket and made the file public.
Next, I have made the dinostoredegraded bucket act as a website by altering the bucket properties by enabling Website Hosting and pointing the index document settings to the appropriate HTML file
Now I have to make all the folders in the bucket public.
Now we have to switch the program to use the S3 objects, we have to change the link of the copied files in site1.master file in Visual Studio.
Now in the SQL database, we need to change the path to the appropriate S3 path. In the product table, I have changed each items path by copying the URL from the bucket.
Finally in Visual Studio, the NET702.DinoStore project, build the project and right click on the Default.aspx object and choose to View in Browser.
Now the website has been opened and I have checked the path of the image, it is from the S3.
No comments:
Post a Comment