What is OSS?
Alibaba Cloud’s Object Storage Service (OSS) is a secure, cost-effective, and high-durability cloud storage service. It allows you to upload and save massive volumes of data to the cloud. OSS is built to provide data durability of 99.9999999999 percent (twelve nines) and service availability of 99.995 percent.
RESTful API activities are supported by OSS and are not dependent on the OSS console. Data from all applications can be stored and accessed at any time and from any location.
To transfer huge amounts of data to and from Alibaba Cloud OSS, you can use API operations, SDKs, or OSS migration tools supplied by Alibaba Cloud. Apps and websites can store image, audio, and video objects in OSS buckets of the Standard storage class.
What is a Static Website?
Static websites are those in which all web pages include just static material, including client-side scripts such as JavaScript code. You can host your static website in an Object Storage Service (OSS) bucket and access it via the bucket’s API using the static website hosting capability.
This provides an inexpensive strategy for hosting your static pages without spending money and time on deploying and managing a server. Also, because the website pages are hosted on OSS you enjoy the rich benefits that are provided which include, security, reliability, durability, and more.
Now let us see how we can set it up on Alibaba OSS.
Requirements
You will need an Alibaba Cloud account with a valid payment method.
Task 1: create a new OSS bucket
- On the Alibaba Console search and select Object Storage Service (OSS):
- On the new page, click on Buckets then Create Bucket
- On the Create Bucket page, fill in the required information and click OK. Some things to note;
- Your bucket name must be globally unique
- Storage Class, Region, and Zone-redundant Storage cannot be changed after the bucket is created
- Next Upload your Homepages into the Bucket, for that click on files then Upload
- On the file upload page, you have the option to select files that resides on your local PC, here you select the web pages you want to be displayed:
- After Upload, take note of the file names:
Task 2: Setup Static Website Hosting
- Click on the newly created Bucket:
- On the next page, select Basic Settings:
- Under Static Pages select Configure:
- On the “Default Homepage setting”, type the name of your index page as represented in your Bucket, do the same for the “Default 404 page” and click save:
And that’s it, now you can configure the Bucket endpoints on your DNS to route requests to the Bucket public endpoint:
Conclusion
This is a very good way to redirect users when you are carrying out some tests or maintenance on your main web server, this way your site can be available in some capacity, probably telling your users that the site is currently undergoing maintenance.