Cloud
Why should you use Alibaba Cloud & what are the initial steps to complete the set-up
22nd November 2019
30 minsWhen it comes to Cloud Computing, the very first name that comes to anyone’s mind is the Amazon Web Service AWS.
AWS caters to diverse cloud-based products ranging from computing to migration, storage to security and many others. AWS is a name trusted by almost everyone around the world. But when it comes to the Chinese market, people tend to think twice before opting for AWS.
A few rumours were heard about AWS leaving the China Market in the past which did not actually happen. At that time, it was difficult to decide whether to go with AWS in Chinese market or not. The other option available was Alibaba Cloud also known as Aliyun. Alibaba Cloud is a subsidiary company of Alibaba Group which provides cloud services to online businesses in China and international market. The current situation is that one cannot put themselves on the global map without considering the huge Chinese market.
Now there are many options available to host your website in China. The very first option is to host it from your own country. But you will probably not go with this option because your website will be hosted outside Mainland China and their search engines may not index your full website.
Another option is using Content Delivery Network CDN to deliver content without hosting websites in Mainland China. But this option will affect the load speed of your website depending on the geographic location of CDN. You probably want to go with the Hong Kong location if you want to host your website through CDN. To avoid all such problems like SEO rankings, load speed of website, etc., hosting your website in Mainland China is the best option. The search engines will treat your website as a local website if you are deploying a China optimized website. This will boost your search engine visibility and SEO ranking.
You must be having questions regarding how you can launch your website in China. The same questions arise when we needed to launch the website for our client located in Mainland China. There were two server options available: AWS and Alibaba but as our targeted audience were based in China, Alibaba Cloud platform was preferred. Alibaba Cloud and its products were used according to the requirements of the website. There are specific rules that need to be followed inorder to launch your website in China. This blog will help you figure out the step by step process to host your website.
The topics covered in the blog are:
The other Alibaba Cloud Products that were used are
To purchase the server, there were two options available, one was Alibaba International and other was Alibaba for Mainland China. The account on both the platforms are considered to be different. Links for both platforms (International and Mainland China) are https://www.alibabacloud.com/ and https://cn.aliyun.com/
Proceeding with Alibaba International platform was pretty straightforward and much similar to AWS. But the problem occured when there was a need to set up the server and migrate domain, set up SSL and setup CDN (Content Delivery Network) using ECS (Elastic Compute Service) which is one of the Alibaba products.
In order to host a website in China, there were some procedures that were needed to follow. The first step in that process was to file for an ICP(Internet Content Provider) license. An ICP licence is a registration number and it allows a website to operate on hosting servers and it is a legal requirement set by the Chinese Government. ICP licence is the only way to guarantee fast loading for your website hosted in Mainland China. ICP Licence is divided into two categories: ICP Filling and ICP Commercial Licence.
It is the first level of certification and all applicants must apply for it regardless of whether the website is commercial or non-commercial. The ICP filling can take several months but Alibaba Cloud provides the processing within 20 working days.
It allows online platforms or third-party sellers of goods and services to host their website in Mainland China. After obtaining both ICP licence only, one can host their e-commerce website in Mainland China.
International companies without having a registered business office in Mainland China are not eligible to obtain an ICP license. The domestic companies or joint ventures (JVs) with domestic stakes only can apply for ICP licence.
All the details regarding ICP Licence are available on the links mentioned below.
After obtaining the ICP licence, the hosting plan was selected. Alibaba provides different cloud servers that fulfills the requirements to host your website. We opted for Elastic Computing Service (ECS). It provides elastic and virtual cloud service for hosting the website. There were different purchasing options available; you can select the one which is suitable as per your need. You can find a list of all the hosting plans and their details on this link https://www.alibabacloud.com/solutions/hosting
After selecting the proper hosting server, in my case ECS, its instance had to be selected. ECS instance is a virtual machine that contains the components like memory, network, OS and CPU. These ECS instances are categorized into different categories of instance families which caters different business scenarios (mainly memory specification and CPU). I had a platform for on-demand video streaming and basically an educational platform so the ECS instance that I selected was (ECS.mn4.large). This instance provides 2 virtual CPUs and 8 GiB memory.
Once you are done with purchasing the server, you will need to install/setup LAMP stack. It is an open-source software installed together to enable a server to host a website. LAMP stands for Linux, Apache, MySQL, and PHP. The first thing needed was to have an Active Alibaba Cloud account. To launch ECS on a Linux machine was an easy task. I followed some simple steps given below:
1. Logged into my Alibaba Cloud ECS Management Console. On the dashboard select Product Service > Elastic Compute Service. You will be taken to the ECS overview dashboard. You click Instances on the sidebar to navigate to the Instances menu.
2. The next step is to create an instance. There are two packages available and you need to select the data center region and availability zone to launch the instance.
3. Select Choose Instance type > Generation. Select the generation as per your computing requirement.
4. Select Network type > Classic/VPC network. Select Network billing type.
5. Under operating systems, select Ubuntu or any other Linux server select a version for the server from the drop-down menu. Under the Storage section, select the storage type as per your requirement.
6. Under Security Setup, you can set a password for server’s security. This task can also be performed from the console later.
7. At last, you can review your purchase and can modify it if required. To confirm and launch the server, click Activate.
Here, Linux will be installed. The details and commands to install Apache, MySQL and PHP are given in the following link https://www.alibabacloud.com/getting-started/projects/how-to-install-lamp-stack
The complete guide for set up is given here
Please note these links explains the LAMP setup for OS Ubuntu 18.04
Once you are done with the setup of lamp at times you need to set up security groups as well which can be done from the console of the instance after you login.
8. Under Instances > Manage to manage ECS instance.
9. Navigate to Security Group(left panel) > Configure Rules.
Check whether the instance is already set to allow inbound traffic from Port 80. If not, select Add Security Group Rules to create a new rule.
Enter the details as shown below and click OK.
After you are done with all the setup of the server, the next step would be mapping domain with server.
Domain Transfer
If your domain is registered with another provider, then you will need to migrate your domain to Alibaba. So there are some additional steps that you need to follow.
When international domain names like .com, .net and .org are transferred to Alibaba Cloud your(domain name registrant) email address must be working and verified. Then follow the below given procedure.
How to check the transfer status?
You can find the detailed information in the following link:
https://www.alibabacloud.com/help/doc-detail/54077.htm?spm=a3c0i.o54076en.b99.18.7c84fbddfnrz5
The transfer process can be done by following the steps below:
Smooth migration before transfer:
Submit transfer:
Verify transfer after successful completion:
You can find the detailed guidelines for domain transfer to Mainland China from the link:
Domain Mapping is the most important and crucial part. DNS servers create a DNS record that provide information regarding a domain name or hostname, especially its current IP address. A Records are the type of DNS record. An A record maps a domain name to computer’s IP address which is hosting the domain.
Navigate to Alibaba Cloud DNS from your console. The Following screen will appear
Click on Add Domain Name
If you click on Confirm, you will see a somewhat similar screen compared to below screen. You will have to add a new record if you are using a new domain.
Click on the Add Record and you will see the following screen
Here, “A” stands for Address. When you are adding an A record, you are mapping the IPv4 address of the Instance with the Domain Name. You can also have multiple A records for the same Domain Name.
“CNAME” stands for Canonical Name. As the name implies, it is used to map the canonical name to the Domain.
The detailed guidelines to map the domain are given in the below link:
https://www.alibabacloud.com/blog/essential-guide-to-alibaba-cloud-domain-name-system-dns_593751
Until now, it is assumed that your server would be up and running with the mapped domain.
Next comes the setup of SSL(if required). If you are integrating online payments to your website you will need to consider cloud security products in order to protect against attacks like DDoS (Distributed Denial of Service) and other common attacks. So, SSL is a necessary step that needs to be implemented.
For example: ( openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr )
Organization name: the name that is legally registered for your business.
Organization Unit: enter the DBA name, if applicable.
Common Name: full domain name/URL that you are securing.
Locality: name of city or locality where the organization is registered.
State/Province: name of state/province where the organization is registered.
Country: Two-letter country code from where the organization is registered (the ISO format).
You can get further details for generating CSR from the links below:
https://in.godaddy.com/help/apache-generate-csr-certificate-signing-request-5269 and https://www.alibabacloud.com/help/doc-detail/42218.htm
You can get the detailed information from the link below:
From the link below, you can gain the details to configure cname records from the console of Alibaba Cloud:
https://partners-intl.aliyun.com/help/doc-detail/27144.htm?spm=a2c63.p38356.b99.33.708f799aod5oY5
Once the CSR is verified, SSL certificate will be issued by the provider on the registered email address.
If your server is an apache server thus you need to deploy SSL certificate.
mkdir /etc/apache2/ssl
cp -r YourDomainName_public.crt /etc/apache2/ssl
cp -r YourDomainName_chain.crt /etc/apache2/ssl
cp -r YourDomainName.key /etc/apache2/ssl
sudo a2enmod ssl
ls /etc/apache2/sites-available
after the SSL module is enabled and view the created file named default-ssl.conf in the directory.
You can find further details from the link below:
<VirtualHost *:443>
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /var/www/ssl/xyz.crt
SSLCertificateKeyFile /var/www/ssl/xyz.key
SSLCertificateChainFile /var/www/ssl/xyz_bundle.crt
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<Directory /var/www/html/example.com/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Alibaba provides storage services that allow you to store, archive and backup any amount of data in the cloud. This service is called Object Storage Service shortly known as OSS. This storage service that is provided by Alibaba is pretty much similar to the S3 bucket provided by Amazon Web Services (AWS). OSS allows you to retrieve and store various unstructured data files including the text files, images and audio files, video files, etc. over the network regardless of time and location.
Alibaba provides API and SDK interfaces to migrate massive data into Alibaba Cloud OSS. There are various concepts for storage provided by Alibaba Cloud OSS. They are Bucket, Object, Region, Endpoint and AccessKey. The steps to create a bucket from Alibaba Cloud Console are as follows:
CREATE BUCKET
A bucket is a type of container for objects that are stored in OSS.
You can find various methods to create a bucket from the link given below:
https://www.alibabacloud.com/help/doc-detail/31885.htm?spm=a2c63.p38356.879954.4.3bb34fe0JofTNr
UPLOAD OBJECT
You can find various methods to upload the object from the link below:
https://www.alibabacloud.com/help/doc-detail/31886.htm?spm=a2c63.p38356.b99.19.77c65dc494FJlI
DOWNLOAD OBJECT
You can find various methods to download the object from the link below:
https://www.alibabacloud.com/help/doc-detail/31887.htm?spm=a2c63.p38356.b99.20.56d275c5wvXGab
DELETE OBJECT
You can find various methods to delete the object from the link below:
https://www.alibabacloud.com/help/doc-detail/31888.htm?spm=a2c63.p38356.b99.21.7e905a208HrDW0
DELETE BUCKET
You can find various methods to delete the bucket from the link below:
https://www.alibabacloud.com/help/doc-detail/31889.htm?spm=a2c63.p38356.b99.22.18d37262UpR0Ou
In order to access the buckets present in OSS, AccessKey ID and AccessKey Secret are necessary.
You can find different methods to obtain AccessKey ID and AccessKey Secret from the link below:
The identity of request sender is done by using the AccessKey Id or AccessKey Secret by the method of symmetric encryption. The AccessKey Id is used by the OSS to identify the user. The AccessKey Secret is used for signature encryption by the user and it is used by the OSS to verify the signature. The AccessKey of Alibaba Cloud account has permissions to access its resources.
In order to send a request to the OSS as a user, a signature key is generated in a specific format. That signature key must be encrypted by you using your AccessKey Secret. This will generate a verification code. After the request is received, OSS finds the AccessKey Secret based on the AccessKey Id and then extracts the signature string and verification code in the same manner. If the verification code that is calculated is the same as provided verification code, the OSS determines that the request is valid. Else, OSS rejects the request.
The other product I used was ApsaraVideo for VOD. ApsaraVideo for VOD provides on-demand audio and video streaming solutions. It transcodes the uploaded, edited and collected audio/video files based on transcoding settings. It provides web-based consoles, APIs and SDKs like player SDK and upload SDK. In order to activate the ApsaraVideo VOD, you need to purchase it from the Alibaba Cloud Website. After you’ve purchased the plan, you can log into ApsaraVideo VOD console and start using the service.
You can upload your videos from the video upload function from the ApsaraVideo for VOD console. You can upload multiple audios, videos and image resources at the same time. In order to upload the video, follow the steps given below:
UPLOAD VIDEO
CONFIGURE TRANSCODING SETTING
You must complete the transcoding setting before uploading the video. The transcoding templates are available and you can select any one of them to process single or multiple videos. The Standard HLS Transcoding templates were used in this case. If not, the default template is selected for transcoding. Check the configuration and management if you are uploading the video for the first time. All future videos will be transcoded as per your selected transcoding template. You can configure different definitions, customized resolutions, bit rates and watermarks.
EDIT VIDEO INFORMATION
SELECT STORAGE ADDRESS
START UPLOADING & VIEW PROGRESS
You can find the list of supported extension formats and other details for uploading a video from the following link: https://www.alibabacloud.com/help/doc-detail/86058.htm?spm=a2c63.p38356.b99.12.377971e8tmtDAG
The drawback for using this product was, everything was to be managed by the console interface that is provided by Alibaba Cloud. My requirement was to upload the video from the custom admin panel with compression and processing made on video. So MPS(Media Processing Service) was selected. With the help of this, any large video was divided into small files and stored on OSS so that the end-user while viewing the video doesn’t experience buffering. You can integrate the Java, .Net, PHP, Python, and NodeJS SDKs into your code. The source code and examples for SDK integration are given in the links below:
https://docs.open.alipay.com/54/103419/
https://www.alibabacloud.com/help/faq-detail/38990.htm?spm=a2c63.p38356.879954.11.7239b03eq38scS
I hope by this time, your server has been all set and running successfully. The purpose of this blog is to make the task a bit easier for the developers who are looking forward to work with the China market and Alibaba Cloud.
There are options like hosting from your own country or using CDN but if you are serving the audience in China then, these options will slow down the loading speed of your website and the search engines of china will not treat your website as a local website.
The best option for your audience in China is to host your website in Mainland China with Alibaba Cloud service. It will definitely reflect in SEO ranking of your website as your website will appear as a local website for the search engines in China. The process and steps for Alibaba Cloud server setup for Mainland China and International platforms are different.
Our team had faced lots of challenges and had referred every possible website, resource and contacted their support team to setup Alibaba server and make it work for our client. Alibaba Cloud policies are changing frequently so I hope by the time you are reading this blog, their policies may not have changed.