This course explores the Alibaba Object Storage Service (OSS), covering the basics of the service and then looking at its features through guided demonstrations from the Alibaba Cloud Platform.
- Understand basic OSS concepts.
- Learn how to manage buckets and objects on OSS,
- Understand how to carry out image processing
- Learn how to carry out website hosting and monitoring on top of OSS
- Learn about Alibaba custom domains and anti-leeching features
- Learn about OSS's security model
This course is intended for anyone who wants to learn more about Alibaba OSS, as well as anyone studying for the ACP Cloud Computing certification exam.
To get the most out of this course, you should have a basic understanding of the Alibaba Cloud platform.
So in the Settings, you can find a section called Static Pages in the Settings for each bucket. Here you set a default 404 page and a default homepage. These need to be files that are located in the bucket. And whenever a user visits your bucket, one of these pages will be displayed. If the page they requested is not found, they'll get sent to the default 404 page. If they visit the default homepage, that's what will be displayed. And additionally, you can bind a custom domain name. So we'll test that out a little bit later.
We'll create a new bucket, upload some files into the bucket, and then try binding a domain name to that bucket. And typically it's a good idea to bind a domain name. It makes your site look much more professional. If you're just using the bucket endpoint, it doesn't look too good. You can also monitor your site. Again, you can monitor key metrics for your buckets via our free monitoring tool, CloudMonitor. And you can also get interesting and valuable information from the logs. So if you've turned on logging for your bucket and you're collecting logs, you can get valuable information about how many requests you're receiving in near real time.
Down at the bottom of the slide here, you can see a few examples of the types of metrics that are available to you. So you can see Network Error Account, Network Throughput, Storage Space Used and more. So let's take a look at all this in the console. Let's actually continue to use the bucket we set up earlier for the image processing demo. So we're going to add some HTML files into this bucket. Let's upload those now. So just as I did before, I'll upload the files by clicking on the Upload button, and then I'll fetch them from my Downloads folder, which is where I saved them. Let's go back to Downloads.
Here's my index.html and my notfound.html. And then we'll upload both of those. There we go. They're now part of our bucket. I can clear the Upload Tasks list. And now I need to set up my bucket for web hosting. So I need to go to Basic Settings, and you'll see all of the settings for the bucket are here under basic settings. I want to go to Static Pages. And I'll click Configure to set up a default homepage and also a default 'not found' page. And I will click Save. And you'll notice there's also an option, let me click on Configure to show that again, there's an option here to put your homepage into a subfolder if you want. I've chosen not to do that because both of these folder, excuse me, both of these files are in the root. They're at the top level in the bucket. They don't have any kind of directory prefix in the object name. So I can just put those names in directly, and now the bucket is ready.
So let's see what happens if I try to visit this URL. I think you'll be surprised by what will happen. So let's take a look. So if I go visit this item. If I go visit index.HTML, the page doesn't display. Did you see what happened? Let me do that again. So what actually happened is the HTML document got downloaded. If you want to display the page directly in the browser, you actually have to bind a domain name to your bucket. So let's take a look at how to do that. And the domain name doesn't have to belong to your Alibaba Cloud Account. It could be with a different domain name registrar. But for convenience, I'll show you how to do this from Alibaba's domain name and DNS service. So first thing I need to do is open up a new tab, and go over to the domains part of the console. Let's take a look at that.
Let's see what domains we have available to use here. So I've got two. I've got functiontime.xyz, which I use for testing our function compute service, and chinasite.xyz, which is just a generic domain for doing all kinds of demos. So I'm going to go ahead and take this and use it to go ahead and create a static site. So let's do that now. So I need to go into the OSS management console. And again, we'll go to Basic Settings. And actually from here, there should be a place where I can go ahead and bind that to my bucket. Excuse me, not in here. It's actually under Custom Domain Names. So if I go under Transmission, there's Domain Names here. From here, I can bind a custom domain name. So let's do that.
I'll click on Bind Custom Domain, and I will choose chinasite.xyz. Now because this is under my Alibaba Cloud account, I can click check this radio button here to set up the CNAME records that point to my bucket endpoint automatically. So I'll do that. I'll set up a CNAME record automatically here. Let's do that. Click Submit. If I want to check that that has been successfully configured, I can go over to the DNS console. Let's close this tab. We don't need that anymore. So I go over to DNS and I'll check the records that are configured for chinasite.xyz. And I can see there's a CNAME record that's pointing at my bucket endpoint there.
Let's configure another one for www as well, so that we can have that point to our bucket. So I'll click Add Record. I'll make another CNAME record for www that points at our bucket endpoint, and I'll click Confirm. So now that that's done, I shouldn't be able to go to chinasite.xyz. And sure enough, I get cute bunnies and cute kitties. And you'll notice, I've actually linked, in the index.html file, I've actually set up two image tags that point to the images that are in the same OSS bucket. So those two images, that bunny and that kitten that I put into my bucket earlier, I can to those directly from within the index.html file that I've just added to my bucket. So you can put a full static site up here.
Alibaba Cloud, founded in 2009, is a global leader in cloud computing and artificial intelligence, providing services to thousands of enterprises, developers, and governments organizations in more than 200 countries and regions. Committed to the success of its customers, Alibaba Cloud provides reliable and secure cloud computing and data processing capabilities as a part of its online solutions.