<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alibaba cloud &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/alibaba-cloud/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Tue, 03 Nov 2020 22:08:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Alibaba Cloud, CentOS: Build WordPress site using NFS, RDS and Load Balancers</title>
		<link>https://blog.andreev.it/2019/04/alibaba-cloud-centos-build-wordpress-site-using-nfs-rds-and-load-balancers/</link>
					<comments>https://blog.andreev.it/2019/04/alibaba-cloud-centos-build-wordpress-site-using-nfs-rds-and-load-balancers/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Mon, 15 Apr 2019 16:50:40 +0000</pubDate>
				<category><![CDATA[Alibaba]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Alibaba cloud]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=5202</guid>

					<description><![CDATA[I got an invitation to attend an event in NYC for the Alibaba cloud,&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>I got an invitation to attend an event in NYC for the Alibaba cloud, so I decided to play a little bit with their cloud offering. I was actually surprised to see that they are doing a really good job. While many features are still not there, the ease and simplicity of Alibaba cloud is a plus. If you are familiar with AWS, it won&#8217;t take you more than 5 minutes to feel comfortable. The interface, although different is very intuitive. You can get a free trial (a credit card and phone verification are needed) and start playing. Visit this <a href="https://us.alibabacloud.com/" rel="noopener noreferrer" target="_blank">link </a>to start. Once you open an account and verify it, you&#8217;ll be presented with a console.<br />
I&#8217;ve decided to demonstrate how to start in Alibaba Cloud by building a WordPress site running on two instances behind a load balancer. The database will be a MySQL RDS offering from Alibaba. They still don&#8217;t offer NFS filesystem, so I had to create an instance for that. First thing first.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-01.png"><img fetchpriority="high" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-01.png" alt="" width="1792" height="1063" class="aligncenter size-full wp-image-8482" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-01.png 1792w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-300x178.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-1024x607.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-768x456.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-1536x911.png 1536w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-1170x694.png 1170w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-01-585x347.png 585w" sizes="(max-width: 1792px) 100vw, 1792px" /></a></p>
<h1>VPC</h1>
<p>The ubiquitous VPCs from AWS are named the same in Alibaba and they serve the same purpose. From the top menu choose a region, from the left click on <strong>Virtual Private Cloud</strong> and then click on <strong>Create VPC</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-02.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-02.png" alt="" width="451" height="282" class="aligncenter size-full wp-image-8483" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-02.png 451w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-02-300x188.png 300w" sizes="(max-width: 451px) 100vw, 451px" /></a><br />
I&#8217;ll name my VPC, <strong>TestVPC </strong>and the CIDR (size of the VPC in terms of available IPs and subnets) is going to be 192.168.0.0/16 (which is default).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-03.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-03.png" alt="" width="565" height="432" class="aligncenter size-full wp-image-8484" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-03.png 565w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-03-300x229.png 300w" sizes="(max-width: 565px) 100vw, 565px" /></a><br />
If you scroll down, you&#8217;ll see that you&#8217;ll also have to create a <strong>VSwitch</strong>. A <strong>VSwitch </strong>is nothing by a subnet or availability zone (AZ) in AWS terms. My first one will be called VSwitchA in Virginia Zone A and I&#8217;ll carve a smaller subnet 192.168.1.0/24 for that.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-04.png" alt="" width="504" height="469" class="aligncenter size-full wp-image-8485" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-04.png 504w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-04-300x279.png 300w" sizes="(max-width: 504px) 100vw, 504px" /></a><br />
Let&#8217;s create another one, but this time in a different zone. The subnets can&#8217;t overlap. On the left side, you&#8217;ll see the menu for <strong>VSwitches</strong>, so click there and then click on<strong> Create VSwitch</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-05.png" alt="" width="493" height="321" class="aligncenter size-full wp-image-8486" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-05.png 493w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-05-300x195.png 300w" sizes="(max-width: 493px) 100vw, 493px" /></a><br />
Do pretty much the same as previously. Choose the right VPC this time, name the VSwitch, choose the second zone and choose a different subnet. In my case it&#8217;s 192.168.2.0/24.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-06.png" alt="" width="596" height="540" class="aligncenter size-full wp-image-8487" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-06.png 596w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-06-300x272.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-06-585x530.png 585w" sizes="(max-width: 596px) 100vw, 596px" /></a></p>
<h1>Security Groups</h1>
<p>We&#8217;ll need several <strong>Security Groups</strong>. From the top left menu, click on <strong>Security Groups</strong> and the click on <strong>Create Security Group</strong> from the top right.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-07.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-07.png" alt="" width="256" height="368" class="aligncenter size-full wp-image-8488" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-07.png 256w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-07-209x300.png 209w" sizes="(max-width: 256px) 100vw, 256px" /></a><br />
For the Load Balancer, we&#8217;ll need a security group that will allow port 80 from everywhere (0.0.0.0/0). For the two instances that will run Apache and PHP, we&#8217;ll allow port 22 only from specific addresses and port 80 allowed from the load balancer only. We don&#8217;t want the actual instances to be exposed on port 80 on the Internet. For the RDS instance, we&#8217;ll create a security group that allows port 3306 (MySQL) from the two instances only. Finally, for the NFS server, we&#8217;ll also allow access from the two instances only on port 2049 (TCP).<br />
Here is an example of what I did for the first security group. I choose a <strong>custom </strong>template, named it <strong>sgLoadBalancer</strong>, added a description and chose my <strong>TestVPC</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-08.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-08.png" alt="" width="691" height="454" class="aligncenter size-full wp-image-8489" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-08.png 691w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-08-300x197.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-08-585x384.png 585w" sizes="(max-width: 691px) 100vw, 691px" /></a><br />
You can&#8217;t create the rules like you do in AWS, but once you create the security group, you&#8217;ll see a pop-up reminding you to create the rules. Click on <strong>Create Rules Now</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-09.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-09.png" alt="" width="593" height="223" class="aligncenter size-full wp-image-8490" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-09.png 593w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-09-300x113.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-09-585x220.png 585w" sizes="(max-width: 593px) 100vw, 593px" /></a><br />
This is how my rule for HTTP traffic looks like.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-10.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-10.png" alt="" width="513" height="479" class="aligncenter size-full wp-image-8491" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-10.png 513w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-10-300x280.png 300w" sizes="(max-width: 513px) 100vw, 513px" /></a><br />
Name the second security group <strong>sgInstances</strong>, but before you create the group copy the security group ID for the first group that you created.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-11.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-11.png" alt="" width="852" height="93" class="aligncenter size-full wp-image-8493" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-11.png 852w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-11-300x33.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-11-768x84.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-11-585x64.png 585w" sizes="(max-width: 852px) 100vw, 852px" /></a><br />
When you add the rules for the 2nd security group for the instances, make sure that you change the <strong>Authorization Type</strong> parameter to <strong>Security Group</strong> instead of <strong>IPv4 CID Block</strong>. This way you can specify that another security group has access to a specific port, not an IP. We don&#8217;t know the IP of the load balancer and it probably changes from time to time.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-12.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-12.png" alt="" width="473" height="432" class="aligncenter size-full wp-image-8494" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-12.png 473w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-12-300x274.png 300w" sizes="(max-width: 473px) 100vw, 473px" /></a><br />
You have to create another rule for the instances. This time for the port 22. I chose to restrict port 22 to my home IP only. This is how those rules actually look like once created.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-13.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-13.png" alt="" width="777" height="245" class="aligncenter size-full wp-image-8495" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-13.png 777w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-13-300x95.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-13-768x242.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-13-585x184.png 585w" sizes="(max-width: 777px) 100vw, 777px" /></a><br />
For the next two security group, copy the security group ID of the newly created group <strong>sgInstances</strong>.<br />
Create two new security groups, <strong>sgRDS </strong>and <strong>sgNFS</strong>. For <strong>sgRDS </strong>allow port <strong>3306 </strong>from the security group ID of <strong>sgInstances </strong>and for <strong>sgNFS </strong>allow port <strong>2049 </strong>for the same security group ID of <strong>sgInstances</strong>.<br />
At the end you should have 4 security groups: sgLoadBalancer, sgInstances, sgRDS and sgNFS. These are the rules.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-14.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-14.png" alt="" width="385" height="131" class="aligncenter size-full wp-image-8496" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-14.png 385w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-14-300x102.png 300w" sizes="(max-width: 385px) 100vw, 385px" /></a><br />
And these security groups should be assigned to these resources.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-15.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-15.png" alt="" width="314" height="106" class="aligncenter size-full wp-image-8497" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-15.png 314w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-15-300x101.png 300w" sizes="(max-width: 314px) 100vw, 314px" /></a></p>
<h1>SSH Keys</h1>
<p>Before we start provisioning the servers, let&#8217;s create a SSH key pair so we can access them. The menu for the creation of SSH keys is bellow <strong>Security Groups</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-16.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-16.png" alt="" width="694" height="269" class="aligncenter size-full wp-image-8498" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-16.png 694w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-16-300x116.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-16-585x227.png 585w" sizes="(max-width: 694px) 100vw, 694px" /></a><br />
Click on <strong>Create SSH Key Pair</strong> in the top right corner. You can import or create your own key pair. I chose to create the key pair.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-17.png" alt="" width="799" height="322" class="aligncenter size-full wp-image-8499" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-17.png 799w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-17-300x121.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-17-768x310.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-17-585x236.png 585w" sizes="(max-width: 799px) 100vw, 799px" /></a><br />
As a result you&#8217;ll get a certificate file (.pem). Keep this file somewhere safe. If you use putty to connect to your instances, you&#8217;ll have to <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html#putty-private-key" rel="noopener noreferrer" target="_blank">convert </a>this file to ppk using puttygen.  </p>
<h1>NFS instance</h1>
<p>From the menu, go to <strong>Instances </strong>and then from the top right, click <strong>Create Instance</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-18.png" alt="" width="730" height="281" class="aligncenter size-full wp-image-8500" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-18.png 730w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-18-300x115.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-18-585x225.png 585w" sizes="(max-width: 730px) 100vw, 730px" /></a><br />
I am going with <strong>Pay-As-You-Go</strong> model and <strong>Random </strong>zone. Choose your instance type. The cheapest are under <strong>Entry-Level (Shared)</strong>. I went with 1 CPU and 1GB RAM and 20GB disk on CentOS 7.6 x-64. Looks like 20GB is minimum, I couldn&#8217;t choose anything below 20GB for the disk. Click <strong>Next: Networking</strong> when you are done here.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-19.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-19.png" alt="" width="1366" height="1612" class="aligncenter size-full wp-image-8501" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-19.png 1366w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-254x300.png 254w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-868x1024.png 868w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-768x906.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-1302x1536.png 1302w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-1170x1381.png 1170w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-19-585x690.png 585w" sizes="(max-width: 1366px) 100vw, 1366px" /></a><br />
On the Networking screen, I have these settings. The defaults for the VPC and the zone, click to <strong>Assign public IP</strong> and click to select a security group. For some reason, I was able to select only one security group, so select <strong>sgInstances </strong>as a security group.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-20.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-20.png" alt="" width="1366" height="1012" class="aligncenter size-full wp-image-8502" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-20.png 1366w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-20-300x222.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-20-1024x759.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-20-768x569.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-20-1170x867.png 1170w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-20-585x433.png 585w" sizes="(max-width: 1366px) 100vw, 1366px" /></a><br />
If you click next, you&#8217;ll see the <strong>System Configuration </strong>page. Specify the key that you&#8217;ve selected, name the instance so it shows up properly in the console, add a description if you want and enter the hostname (optional). From here, you can accept the default and next-through all the way to the end. Alibaba will create the instance for you in 1-3 minutes.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-21.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-21.png" alt="" width="1366" height="893" class="aligncenter size-full wp-image-8504" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-21.png 1366w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-21-300x196.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-21-1024x669.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-21-768x502.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-21-1170x765.png 1170w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-21-585x382.png 585w" sizes="(max-width: 1366px) 100vw, 1366px" /></a><br />
After the instance is create, go back to the <strong>Security Groups</strong> menu and find the <strong>sgNFS </strong>group. Click on <strong>Manage Instances</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-22.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-22.png" alt="" width="1088" height="114" class="aligncenter size-full wp-image-8505" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-22.png 1088w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-22-300x31.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-22-1024x107.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-22-768x80.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-22-585x61.png 585w" sizes="(max-width: 1088px) 100vw, 1088px" /></a><br />
From the top right, click on <strong>Add Instance</strong> and add the <strong>nfs </strong>instance. This way, we&#8217;ll have both <strong>sgInstances </strong>and <strong>sgNFS </strong>securty groups attached to the <strong>nfs </strong>server.<br />
Go back to your instances and you&#8217;ll see the instance is up and running. SSH to its public IP and specify the SSH key to log in. Your username is <strong>root</strong> and the ppk file is your password.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-23.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-23.png" alt="" width="1102" height="112" class="aligncenter size-full wp-image-8506" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-23.png 1102w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-23-300x30.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-23-1024x104.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-23-768x78.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-23-585x59.png 585w" sizes="(max-width: 1102px) 100vw, 1102px" /></a><br />
Once you are in, you&#8217;ll be greeted with the Alibaba banner.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-24.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-24.png" alt="" width="418" height="170" class="aligncenter size-full wp-image-8507" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-24.png 418w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-24-300x122.png 300w" sizes="(max-width: 418px) 100vw, 418px" /></a><br />
Now you are ready to install the NFS filesystem that will be used as a shared disk for both WordPress instances. I already have a small tutorial for this, so go to this <a href="https://blog.andreev.it/?p=4180" rel="noopener noreferrer" target="_blank">link </a>and do the server part. You can skip the part for the firewall (last two commands). The firewall is not enabled by default on Alibaba CentOS. SELinux is also disabled. Once you are done, we have to download WordPress and extract it under the <strong>nfs </strong>share. Then, we we build the webservers we&#8217;ll mount this directory and point our webserver there.</p>
<pre class="brush: bash; title: ; notranslate">
cd /nfs
wget https://www.wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz --strip 1
</pre>
<h1>RDS</h1>
<p>We&#8217;ll use the PaaS offering from Alibaba for our MySQL database. From the menu on the left, click <strong>AsparaDB for RDS</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-25.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-25.png" alt="" width="316" height="208" class="aligncenter size-full wp-image-8508" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-25.png 316w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-25-300x197.png 300w" sizes="(max-width: 316px) 100vw, 316px" /></a><br />
Click <strong>Create Instance</strong> in the top right corner. This is what I chose for my database. Make sure <strong>Pay-As-You-Go</strong> is selected and then choose the RDS instance in the same region as your other instances. The engine is MySQL 5.7 with no HA. I chose a small 1 CPU/1GB DB instance with 20GB storage.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-26.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-26.png" alt="" width="1299" height="1325" class="aligncenter size-full wp-image-8509" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-26.png 1299w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-26-294x300.png 294w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-26-1004x1024.png 1004w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-26-768x783.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-26-1170x1193.png 1170w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-26-585x597.png 585w" sizes="(max-width: 1299px) 100vw, 1299px" /></a><br />
Click <strong>Buy Now</strong> and then <strong>Pay Now</strong> when you are done. If you go to the console, you won&#8217;t see your database. Just wait for a minute or two and it will show up with a status of <strong>Creating</strong>. After 3-5 mins, once the status changes to <strong>Running</strong>, click on the database. Let&#8217;s assign a security group first. Click on <strong>Basic Infomation</strong> on the left and then click on <strong>Set Whitelist</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-27.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-27.png" alt="" width="581" height="306" class="aligncenter size-full wp-image-8510" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-27.png 581w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-27-300x158.png 300w" sizes="(max-width: 581px) 100vw, 581px" /></a><br />
Look at the bottom right, where it says <strong>Add to Security Group</strong>. The names won&#8217;t show up, so get your security group ID for <strong>sgRDS </strong>from the <strong>Security Groups</strong> menu first. Unlike AWS, you can assign only one security group per DB instance. If you get an error that this operation is not supported, do not assign a security group. Just whitelist the VPC subnet. Click <strong>Add a Whitelist Group</strong> and add the VPC subnet 192.168.0.0/16.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-28.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-28.png" alt="" width="595" height="490" class="aligncenter size-full wp-image-8511" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-28.png 595w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-28-300x247.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-28-585x482.png 585w" sizes="(max-width: 595px) 100vw, 595px" /></a><br />
Now, go to the <strong>Accounts </strong>menu on the left and click <strong>Create Account</strong> on the right. I&#8217;ve created a superuser called <strong>dbmaster</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-29.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-29.png" alt="" width="1119" height="916" class="aligncenter size-full wp-image-8512" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-29.png 1119w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-29-300x246.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-29-1024x838.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-29-768x629.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-29-585x479.png 585w" sizes="(max-width: 1119px) 100vw, 1119px" /></a><br />
Again, go to <strong>Databases </strong>menu on the left and click <strong>Create Database</strong> on the right. Type the name of the database <strong>dbwordpress </strong>and click to create a new account. You&#8217;ll be back at the accounts menu. This time create a user called <strong>wordpress </strong>and make it a standard user. It&#8217;s kind of kludgy, but now you have to go back to the <strong>Databases </strong>menu, click <strong>Create Database</strong> again, fill the name <strong>dbwordpress </strong>again, but this time you can choose the account that you just created.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-30.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-30.png" alt="" width="697" height="496" class="aligncenter size-full wp-image-8513" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-30.png 697w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-30-300x213.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-30-585x416.png 585w" sizes="(max-width: 697px) 100vw, 697px" /></a><br />
Finally, go to the <strong>Basic Information</strong> menu and choose the menu next to Intranet address. Here you have to create a whitelist group of IPs that can access the database. By default, only 127.0.0.1 is allowed. We have to enter our VPC CIDR.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-31.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-31.png" alt="" width="509" height="193" class="aligncenter size-full wp-image-8514" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-31.png 509w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-31-300x114.png 300w" sizes="(max-width: 509px) 100vw, 509px" /></a><br />
Once you do that, you&#8217;ll see your RDS hostname.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-32.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-32.png" alt="" width="662" height="334" class="aligncenter size-full wp-image-8515" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-32.png 662w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-32-300x151.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-32-585x295.png 585w" sizes="(max-width: 662px) 100vw, 662px" /></a></p>
<h1>WordPress instances</h1>
<p>We&#8217;ll create two instances, install Apache + PHP, mount the NFS system and configure the web server. First, create two instances, each in a different zone. Use the section above for the NFS server. Name the servers <strong>web1 </strong>and <strong>web2 </strong>and assign the <strong>sgInstances </strong>security group to both of them. Make sure you choose <strong>Pay-As-You-Go</strong> model and assign public IPs so you can log in. And choose the SSH key pair that we created. Log to both of the instances.<br />
First, mount the NFS system. Replace the IP with the IP of your NFS server in the <strong>mount </strong>command. </p>
<pre class="brush: bash; title: ; notranslate">
yum -y install nfs-utils
mount 192.168.1.91:/nfs /var/www/html
echo &quot;192.168.1.91:/nfs       /var/www/html    nfs     defaults 0 0&quot; &gt;&gt; /etc/fstab
chown -R apache:apache /var/www/html
</pre>
<p>Then, check if you can reach the RDS MySQL server. You should receive some garbage.</p>
<pre class="brush: bash; highlight: [1,2]; title: ; notranslate">
yum -y install telnet
telnet rm-2evrh4h3aq9tk800z.mysql.rds.aliyuncs.com 3306
Trying 172.16.1.41...
Connected to rm-2evrh4h3aq9tk800z.mysql.rds.aliyuncs.com.
Escape character is '^]'.
N
5.7.20-log▒F5;I!]:p]H3R&#x5B;^mysql_native_password
</pre>
<p>Second, install Apache and all PHP modules on both servers. I&#8217;ll install PHP 5.4 because it&#8217;s already in the default repo. You should install PHP 7.x, it&#8217;s a little bit more work.</p>
<pre class="brush: bash; title: ; notranslate">
yum -y install httpd php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt
systemctl enable httpd
systemctl start httpd
</pre>
<p>Now, we have to configure the Apache server. It&#8217;s a simple change in <strong>/etc/httpd/conf/httpd.conf</strong> file. You&#8217;ll probably want to use virtual hosts, but in interest of keeping this short, I&#8217;ll use a single site config. Find the directive that says #ServerName www.example.com:80 and remove the comment.</p>
<pre class="brush: bash; title: ; notranslate">
sed -i '/ServerName www/s/^#//g' /etc/httpd/conf/httpd.conf
</pre>
<h1>Load Balancer</h1>
<p>From the menu on the left, click on <strong>Server Load Balancer</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-33.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-33.png" alt="" width="232" height="337" class="aligncenter size-full wp-image-8516" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-33.png 232w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-33-207x300.png 207w" sizes="(max-width: 232px) 100vw, 232px" /></a><br />
Once the screen shows up, click on <strong>Create SLB Instance</strong>. Then choose the specs. Make sure it is in the same region with your instances and in the same zones (VSWitches). Name the load balancer too, e.g. <strong>lbWordPress</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-34.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-34.png" alt="" width="868" height="731" class="aligncenter size-full wp-image-8517" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-34.png 868w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-34-300x253.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-34-768x647.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-34-585x493.png 585w" sizes="(max-width: 868px) 100vw, 868px" /></a><br />
Once it&#8217;s ready, click on <strong>Add Backend Servers</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-35.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-35.png" alt="" width="1005" height="102" class="aligncenter size-full wp-image-8518" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-35.png 1005w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-35-300x30.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-35-768x78.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-35-585x59.png 585w" sizes="(max-width: 1005px) 100vw, 1005px" /></a><br />
From the list of the available servers, choose web1 and web2 in the <strong>Default Server Group</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-36.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-36.png" alt="" width="664" height="291" class="aligncenter size-full wp-image-8519" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-36.png 664w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-36-300x131.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-36-585x256.png 585w" sizes="(max-width: 664px) 100vw, 664px" /></a><br />
Click on <strong>Next: Set Weight and Port</strong> button and click <strong>OK</strong> to accept the defaults. Go back to the load balancer and this time click <strong>Configure Listener</strong> (above <strong>Add Backend Servers</strong>).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-37.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-37.png" alt="" width="1063" height="134" class="aligncenter size-full wp-image-8520" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-37.png 1063w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-37-300x38.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-37-1024x129.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-37-768x97.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-37-585x74.png 585w" sizes="(max-width: 1063px) 100vw, 1063px" /></a><br />
Choose HTTP traffic, port 80, click <strong>Modify </strong>next to <strong>Advanced </strong>and <strong>Enable Session Persistence</strong>. Click <strong>Next</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-38.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-38.png" alt="" width="640" height="511" class="aligncenter size-full wp-image-8521" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-38.png 640w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-38-300x240.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-38-585x467.png 585w" sizes="(max-width: 640px) 100vw, 640px" /></a><br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-39.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-39.png" alt="" width="394" height="208" class="aligncenter size-full wp-image-8522" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-39.png 394w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-39-300x158.png 300w" sizes="(max-width: 394px) 100vw, 394px" /></a><br />
On this screen click on <strong>Default Server Group</strong>, type port <strong>80 </strong>for the servers and click <strong>Next</strong>. You can accept the defaults in the next screen or make a change if you like.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-40.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-40.png" alt="" width="1010" height="499" class="aligncenter size-full wp-image-8523" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-40.png 1010w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-40-300x148.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-40-768x379.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-40-585x289.png 585w" sizes="(max-width: 1010px) 100vw, 1010px" /></a><br />
Open a browser and go to your load balancer IP. It might take up a minute for the LB to configure so be patient if your browser is just sitting there.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-41.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-41.png" alt="" width="397" height="126" class="aligncenter size-full wp-image-8524" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-41.png 397w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-41-300x95.png 300w" sizes="(max-width: 397px) 100vw, 397px" /></a><br />
If you used my username and database names, fill out the config page like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/04/P130-42.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/04/P130-42.png" alt="" width="776" height="567" class="aligncenter size-full wp-image-8525" srcset="https://blog.andreev.it/wp-content/uploads/2019/04/P130-42.png 776w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-42-300x219.png 300w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-42-768x561.png 768w, https://blog.andreev.it/wp-content/uploads/2019/04/P130-42-585x427.png 585w" sizes="(max-width: 776px) 100vw, 776px" /></a><br />
&#8230;and pretty much that&#8217;s it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2019/04/alibaba-cloud-centos-build-wordpress-site-using-nfs-rds-and-load-balancers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
