forked from docs/doc-exports
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com> Co-authored-by: zhoumeng <zhoumeng35@huawei.com> Co-committed-by: zhoumeng <zhoumeng35@huawei.com>
196 lines
39 KiB
HTML
196 lines
39 KiB
HTML
<a name="elb_qs_0002"></a><a name="elb_qs_0002"></a>
|
|
|
|
<h1 class="topictitle1">Using Dedicated Load Balancers (Entry Level)</h1>
|
|
<div id="body0000001126827555"><div class="section" id="elb_qs_0002__section18950295143553"><h4 class="sectiontitle">Scenarios</h4><p id="elb_qs_0002__en-us_topic_0052569751_p13318235811">You have a web application, which often needs to handle heavy traffic and is deployed on two ECSs for load balancing.</p>
|
|
<p id="elb_qs_0002__en-us_topic_0052569751_p14697175632114">You can create a load balancer to distribute traffic across multiple backend servers based on the forwarding policy you have configured, which eliminates SPOFs and makes your application more available.</p>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section3453061616119"><h4 class="sectiontitle">Prerequisites</h4><ul id="elb_qs_0002__ul15892133835819"><li id="elb_qs_0002__li125716431158">You have added security group rules to allow traffic from the ports used by the two ECSs. (Alternatively, you can enable all ports first and then disable the ports that are no longer used after service deployment.)</li><li id="elb_qs_0002__li264157195913">You have verified that the security group containing the ECSs allows access traffic from the VPC where the load balancer works and that the health check function is normal.<div class="note" id="elb_qs_0002__note169701630151818"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0002__p1297043018186">If <strong id="elb_qs_0002__b176297540264">IP as a Backend</strong> is not enabled for a dedicated load balancer that has a TCP or UDP listener, there is no need to configure security group rules to allow traffic from the VPC where the load balancer backend subnet works to the backend servers.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section1973682033616"><h4 class="sectiontitle">Creating ECSs</h4><p id="elb_qs_0002__en-us_topic_0052569751_p193565412368">ECSs are used as backend servers.</p>
|
|
<div class="p" id="elb_qs_0002__en-us_topic_0052569751_p1942152771010">Each ECS needs an EIP for accessing the Internet, and the EIP is used for configuring the application on the ECS. You can determine whether to bind an EIP to each ECS based on your requirements.<ol id="elb_qs_0002__en-us_topic_0052569751_ol153061641103515"><li id="elb_qs_0002__en-us_topic_0052569751_li18503134213513">Log in to the management console.</li><li id="elb_qs_0002__en-us_topic_0052569751_li675519100420">In the upper left corner of the page, click <span><img id="elb_qs_0002__en-us_topic_0052569751_image397247655" src="en-us_image_0000001211126503.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__en-us_topic_0052569751_li18814181314416">Hover on <span><img id="elb_qs_0002__en-us_topic_0052569751_image9204162811814" src="en-us_image_0000001206511791.png"></span> in the upper left corner to display <strong id="elb_qs_0002__en-us_topic_0052569751_b1120518282810">Service List</strong> and choose <strong id="elb_qs_0002__en-us_topic_0052569751_b620772815814">Computing</strong> > <strong id="elb_qs_0002__en-us_topic_0052569751_b9208628484">Elastic Cloud Server</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li12985204673513"><p id="elb_qs_0002__en-us_topic_0052569751_p027115120107"><a name="elb_qs_0002__en-us_topic_0052569751_li12985204673513"></a><a name="en-us_topic_0052569751_li12985204673513"></a>Click <strong id="elb_qs_0002__en-us_topic_0052569751_b146751328145212">Create ECS</strong>, configure the parameters, and click <strong id="elb_qs_0002__en-us_topic_0052569751_b116871328205211">Create Now</strong>.</p>
|
|
<p id="elb_qs_0002__en-us_topic_0052569751_p690813309525"></p>
|
|
<div class="p" id="elb_qs_0002__en-us_topic_0052569751_p243964203718">The following table lists the specifications of the two ECSs.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="elb_qs_0002__en-us_topic_0052569751_table9439114212376" frame="border" border="1" rules="all"><caption><b>Table 1 </b>ECS specifications</caption><thead align="left"><tr id="elb_qs_0002__en-us_topic_0052569751_row144381942113712"><th align="left" class="cellrowborder" valign="top" width="46.949999999999996%" id="mcps1.3.3.3.1.4.3.1.2.3.1.1"><p id="elb_qs_0002__en-us_topic_0052569751_p2437164211370"><strong id="elb_qs_0002__en-us_topic_0052569751_b28748415542">Item</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="53.05%" id="mcps1.3.3.3.1.4.3.1.2.3.1.2"><p id="elb_qs_0002__en-us_topic_0052569751_p1437144223718"><strong id="elb_qs_0002__en-us_topic_0052569751_b577911814548">Example Value</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="elb_qs_0002__en-us_topic_0052569751_row19438184219379"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p143814421375">Name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p443818423371">ECS01 and ECS02</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row4438164219374"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p143834210373">OS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p7438154214376">CentOS 7.2 64bit</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row124388426378"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p34381142143710">vCPUs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p743854273713">2</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row54398427375"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p84381942143717">Memory</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p74385422371">4 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row104391342163719"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p134396423373">System disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p44391842123715">40 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row64392042193716"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p1843964233713">Data disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p1443984283717">100 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0052569751_row74391842173712"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0052569751_p13439144213370">Bandwidth</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0052569751_p19439174293718">5 Mbit/s</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li108811553173210">Submit your request.</li></ol>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section12375217165718"><h4 class="sectiontitle">Deploying the Application</h4><p id="elb_qs_0002__en-us_topic_0052569751_p19652191111417">Deploy Nginx on the two ECSs and edit two HTML pages so that a page with message "Welcome to ELB test page one!" is returned when ECS01 is accessed, and the other page with message "Welcome to ELB test page two!" is returned when ECS02 is accessed.</p>
|
|
<ol id="elb_qs_0002__en-us_topic_0052569751_ol5585103623813"><li id="elb_qs_0002__en-us_topic_0052569751_li7185175234820">Log in to the ECSs.</li><li id="elb_qs_0002__en-us_topic_0052569751_li4688114133916">Install and start Nginx.<ol type="a" id="elb_qs_0002__en-us_topic_0052569751_ol188621021113910"><li id="elb_qs_0002__en-us_topic_0052569751_li12862142143913">Run the <strong id="elb_qs_0002__en-us_topic_0052569751_b11385172415309">wget</strong> command to download the Nginx installation package for your operating system in use. CentOS 7.6 is used as an example here.<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen74712157217">wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li259319516119">Run the following command to create the Nginx yum repository:<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen1528319398215">rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1142112271116">Run the following command to install Nginx:<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen9609175010218">yum -y install nginx</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li197081130018">Run the following commands to start Nginx and configure automatic Nginx enabling upon ECS startup:<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen175165111635">systemctl start nginx
|
|
systemctl enable nginx</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li8864112163918">Enter <strong id="elb_qs_0002__en-us_topic_0052569751_b1924722415610">http://</strong><em id="elb_qs_0002__en-us_topic_0052569751_i1424810241361">EIP bound to the ECS</em> in the address box of your browser. If the following page is displayed, Nginx has been installed.<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig137471211561"><span class="figcap"><b>Figure 1 </b>Nginx installed successfully</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image1074715213563" src="en-us_image_0000001251062297.png"></span></div>
|
|
</li></ol>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li106574123399">Modify the HTML page of ECS01.<div class="p" id="elb_qs_0002__en-us_topic_0052569751_p1751133519291"><a name="elb_qs_0002__en-us_topic_0052569751_li106574123399"></a><a name="en-us_topic_0052569751_li106574123399"></a>Modify the <strong id="elb_qs_0002__en-us_topic_0052569751_b42291812145518">index.html</strong> file in the default root directory of Nginx <strong id="elb_qs_0002__en-us_topic_0052569751_b8694848145612">/usr/share/nginx/html</strong> to identify access to ECS01.<ol type="a" id="elb_qs_0002__en-us_topic_0052569751_ol17991841818"><li id="elb_qs_0002__en-us_topic_0052569751_li43715036155356">Open the <strong id="elb_qs_0002__en-us_topic_0052569751_b1389514265718">index.html</strong> file.<p id="elb_qs_0002__en-us_topic_0052569751_p57891004155356"><strong id="elb_qs_0002__en-us_topic_0052569751_b1282164811124">vim /usr/share/nginx/html<strong id="elb_qs_0002__en-us_topic_0052569751_b445614535191">/</strong>index.html</strong></p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li58659743155356">Press <strong id="elb_qs_0002__en-us_topic_0052569751_b458519175577">i</strong> to enter editing mode.</li><li id="elb_qs_0002__en-us_topic_0052569751_li53818751155356">Modify the <strong id="elb_qs_0002__en-us_topic_0052569751_b88821718115718">index.html</strong> file to be as follows:<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen7916115413439"> ...
|
|
<body>
|
|
<h1>Welcome to <strong>ELB</strong> test page one!</h1>
|
|
|
|
<div class="content">
|
|
<p>This page is used to test the <strong>ELB</strong>!</p>
|
|
|
|
<div class="alert">
|
|
<h2>ELB01</h2>
|
|
<div class="content">
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li5284577155356">Press <strong id="elb_qs_0002__en-us_topic_0052569751_b177811124135712">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0002__en-us_topic_0052569751_b18782192420576">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li74081445133915">Modify the HTML page of ECS02.<div class="p" id="elb_qs_0002__en-us_topic_0052569751_p17786250164018"><a name="elb_qs_0002__en-us_topic_0052569751_li74081445133915"></a><a name="en-us_topic_0052569751_li74081445133915"></a>Modify the <strong id="elb_qs_0002__en-us_topic_0052569751_b15325174513551">index.html</strong> file in the default root directory of Nginx <strong id="elb_qs_0002__en-us_topic_0052569751_b133261245105517">/usr/share/nginx/html</strong> to identify access to ECS02.<ol type="a" id="elb_qs_0002__en-us_topic_0052569751_ol37861150184013"><li id="elb_qs_0002__en-us_topic_0052569751_li6812121219197">Open the <strong id="elb_qs_0002__en-us_topic_0052569751_b723533995712">index.html</strong> file.<p id="elb_qs_0002__en-us_topic_0052569751_p1881241241910"><strong id="elb_qs_0002__en-us_topic_0052569751_b17812212181915">vim /usr/share/nginx/html<strong id="elb_qs_0002__en-us_topic_0052569751_b1794479197">/</strong>index.html</strong></p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1812121217199">Press <strong id="elb_qs_0002__en-us_topic_0052569751_b10784744125715">i</strong> to enter editing mode.</li><li id="elb_qs_0002__en-us_topic_0052569751_li12812912161915">Modify the <strong id="elb_qs_0002__en-us_topic_0052569751_b1541624511572">index.html</strong> file to be as follows:<pre class="screen" id="elb_qs_0002__en-us_topic_0052569751_screen074901414420">...
|
|
<body>
|
|
<h1>Welcome to <strong>ELB</strong> test page two!</h1>
|
|
|
|
<div class="content">
|
|
<p>This page is used to test the <strong>ELB</strong>!</p>
|
|
|
|
<div class="alert">
|
|
<h2>ELB02</h2>
|
|
<div class="content">
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1974961484220">Press <strong id="elb_qs_0002__en-us_topic_0052569751_b1816145211570">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0002__en-us_topic_0052569751_b881715218576">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li259417884118">Use your browser to access <strong id="elb_qs_0002__en-us_topic_0052569751_b6701226194619">http://</strong><em id="elb_qs_0002__en-us_topic_0052569751_i1571172614616">ECS01 EIP</em> and <strong id="elb_qs_0002__en-us_topic_0052569751_b18721926154617">http://</strong><em id="elb_qs_0002__en-us_topic_0052569751_i772102610468">ECS02 EIP</em> to verify that Nginx has been deployed.<p id="elb_qs_0002__en-us_topic_0052569751_p12966153132218">If the modified HTML pages are displayed, Nginx has been deployed.</p>
|
|
<ul id="elb_qs_0002__en-us_topic_0052569751_ul117591613242"><li id="elb_qs_0002__en-us_topic_0052569751_li1275991102411">HTML page of ECS01<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig1823119513251"><span class="figcap"><b>Figure 2 </b>Nginx successfully deployed on ECS01</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image162241919366" src="en-us_image_0167655332.png"></span></div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1049422182416">HTML page of ECS02<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig17457132212516"><span class="figcap"><b>Figure 3 </b>Nginx successfully deployed on ECS02</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image122741811610" src="en-us_image_0167655334.png"></span></div>
|
|
</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section15436447172917"><h4 class="sectiontitle">Creating a Load Balancer</h4><p id="elb_qs_0002__p206191913341">The load balancer needs an EIP to access the application deployed on the ECSs over the Internet. You can determine whether to bind an EIP to the load balancer based on your requirements. For details, see <a href="elb_pro_01_0004.html">Load Balancing on a Public or Private Network</a>.</p>
|
|
<ol id="elb_qs_0002__ol353744134512"><li id="elb_qs_0002__li66366715143438">In the upper left corner of the page, click <span><img id="elb_qs_0002__en-us_topic_0052569751_image1851513211124" src="en-us_image_0000001211126503.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__li17301740102218">Hover on <span><img id="elb_qs_0002__en-us_topic_0052569751_image762510132322" src="en-us_image_0000001417088430.png"></span> in the upper left corner to display <strong id="elb_qs_0002__en-us_topic_0052569751_b9121102522212">Service List</strong> and choose <strong id="elb_qs_0002__en-us_topic_0052569751_b61222025142217">Network</strong> > <strong id="elb_qs_0002__en-us_topic_0052569751_b4124425142210">Elastic Load Balancing</strong>. </li><li id="elb_qs_0002__li314119169018">Click <strong id="elb_qs_0002__en-us_topic_0052569751_b9879569293">Create Elastic Load Balancer</strong> and then configure the parameters.</li><li id="elb_qs_0002__li41251723101514">Click <strong id="elb_qs_0002__en-us_topic_0052569751_b978752975216">Create Now</strong>.</li><li id="elb_qs_0002__li9984122593614">Confirm the configuration and submit your request.</li><li id="elb_qs_0002__li1870167192111">View the newly created load balancer in the load balancer list.</li></ol>
|
|
<div class="note" id="elb_qs_0002__note171711554395"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0002__p817755163912">After you create a dedicated load balancer, configure the security group that contains the ECSs to allow traffic from the VPC where the load balancer works.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section26032025134916"><h4 class="sectiontitle">Procedure</h4><ol id="elb_qs_0002__elb_ug_hd_0007_ol198141563813"><li id="elb_qs_0002__elb_ug_hd_0007_li677391520332">Log in to the management console.</li><li id="elb_qs_0002__elb_ug_hd_0007_li675519100420">In the upper left corner of the page, click <span><img id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0240829509_image1542118117117" src="en-us_image_0000001211126503.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0029320966_li50026016224047">Hover on <span><img id="elb_qs_0002__elb_ug_hd_0007_image2028816163126" src="en-us_image_0000001167495475.png"></span> in the upper left corner to display <strong id="elb_qs_0002__elb_ug_hd_0007_b2027155551116">Service List</strong> and choose <strong id="elb_qs_0002__elb_ug_hd_0007_b060433420256">Computing</strong> > <strong id="elb_qs_0002__elb_ug_hd_0007_b1606334112520">Elastic Cloud Server</strong>.</li><li id="elb_qs_0002__elb_ug_hd_0007_li34401539214315">In the ECS list, locate the ECS and click its name.<p id="elb_qs_0002__elb_ug_hd_0007_p19982029214319"><a name="elb_qs_0002__elb_ug_hd_0007_li34401539214315"></a><a name="elb_ug_hd_0007_li34401539214315"></a>The ECS details page is displayed.</p>
|
|
</li><li id="elb_qs_0002__elb_ug_hd_0007_li18750165432511">Click <strong id="elb_qs_0002__elb_ug_hd_0007_b8423527069595">Security Groups</strong>, locate the security group, and view security group rules.</li><li id="elb_qs_0002__elb_ug_hd_0007_li45534692214355">Click the security group rule ID or <strong id="elb_qs_0002__elb_ug_hd_0007_b156915342119">Modify Security Group Rule</strong>. The security group details page is displayed.</li><li id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001390784280_en-us_topic_0029320966_li46525942225810">On the <strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b4329151617411">Inbound Rules</strong> tab page, click <strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b125512207411">Add Rule</strong>. Configure an inbound rule based on <a href="#elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416">Table 2</a>.
|
|
<div class="tablenoborder"><a name="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416"></a><a name="elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416"></a><table cellpadding="4" cellspacing="0" summary="" id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Security group rules</caption><thead align="left"><tr id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row102813095415"><th align="left" class="cellrowborder" valign="top" width="22.95%" id="mcps1.3.6.2.7.4.2.5.1.1"><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p428103020541">Backend Protocol</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.68%" id="mcps1.3.6.2.7.4.2.5.1.2"><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p4283307544">Policy</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="29.37%" id="mcps1.3.6.2.7.4.2.5.1.3"><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p92883085412">Protocol & Port</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.6.2.7.4.2.5.1.4"><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p82816307548">Source IP Address</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1328173035411"><td class="cellrowborder" valign="top" width="22.95%" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p728193015410">HTTP or HTTPS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.68%" headers="mcps1.3.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1728113025413">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.37%" headers="mcps1.3.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p14281430155413"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b2570134132116">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1499745325519"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b17299483213">Port</strong>: the port used by the backend server and health check port</p>
|
|
</td>
|
|
<td class="cellrowborder" rowspan="3" valign="top" width="25%" headers="mcps1.3.6.2.7.4.2.5.1.4 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p42853012545">Backend subnet of the load balancer</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row51717597200"><td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1518135920204">TCP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p7371172212119">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1268123713211"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b5790195712117">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p36815374217"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b128456413226">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1928113012544"><td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p32812305543">UDP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p20399113617560">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p828193011543"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b4915172062219">Protocol</strong>: UDP and ICMP</p>
|
|
<p id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1820894010565"><strong id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0000001420502298_b36016260226">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="elb_qs_0002__elb_ug_hd_0007_li1030715242413">Click <strong id="elb_qs_0002__elb_ug_hd_0007_b8423527061928">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section1261104918577"><h4 class="sectiontitle">Firewall Rules</h4><p id="elb_qs_0002__elb_ug_hd_0007_p3997193819710">To control traffic in and out of a subnet, you can associate a <span id="elb_qs_0002__elb_ug_hd_0007_ph1934982914313">firewall</span> with the subnet. Similar to security groups, <span id="elb_qs_0002__elb_ug_hd_0007_ph9459551627">firewall</span> rules control access to subnets and add an additional layer of defense to your subnets. Default <span id="elb_qs_0002__elb_ug_hd_0007_ph548414447310">firewall</span> rules reject all inbound and outbound traffic. If the subnet of a load balancer or associated backend servers has a <span id="elb_qs_0002__elb_ug_hd_0007_ph25361348193120">firewall</span> associated, the load balancer cannot receive traffic from the Internet or route traffic to backend servers, and backend servers cannot receive traffic from and respond to the load balancer.</p>
|
|
<p id="elb_qs_0002__elb_ug_hd_0007_p79433211595">Configure an inbound <span id="elb_qs_0002__elb_ug_hd_0007_ph13483315193217">firewall</span> rule to allow traffic from the VPC where the load balancer works to backend servers.</p>
|
|
<ol id="elb_qs_0002__elb_ug_hd_0007_ol17965143881417"><li id="elb_qs_0002__elb_ug_hd_0007_li20860192818532">Log in to the management console.</li><li id="elb_qs_0002__elb_ug_hd_0007_li1486022812537">In the upper left corner of the page, click <span><img id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0240829509_image1542118117117_1" src="en-us_image_0000001211126503.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__elb_ug_hd_0007_li59941052152319">Click <span><img id="elb_qs_0002__elb_ug_hd_0007_en-us_topic_0052569751_image762510132322" src="en-us_image_0000001508946757.png"></span> in the upper left corner of the page and choose <strong id="elb_qs_0002__elb_ug_hd_0007_b25374601717">Network</strong> > <strong id="elb_qs_0002__elb_ug_hd_0007_b162201329201711">Virtual Private Cloud</strong>.</li><li id="elb_qs_0002__elb_ug_hd_0007_li47160469161557">In the navigation pane on the left, choose <strong id="elb_qs_0002__elb_ug_hd_0007_b59331338171717">Access Control</strong> > <strong id="elb_qs_0002__elb_ug_hd_0007_b29361638161712"><span id="elb_qs_0002__elb_ug_hd_0007_ph293519386171">Firewall</span></strong>.</li><li id="elb_qs_0002__elb_ug_hd_0007_li30045754154757">In the <span id="elb_qs_0002__elb_ug_hd_0007_ph1592150133217">firewall</span> list, click the name of the <span id="elb_qs_0002__elb_ug_hd_0007_ph181401455183218">firewall</span> to switch to the page showing its details.</li><li id="elb_qs_0002__elb_ug_hd_0007_li1976338154757">On the <strong id="elb_qs_0002__elb_ug_hd_0007_b16992330173711">Inbound Rules</strong> or <strong id="elb_qs_0002__elb_ug_hd_0007_b1499353014377">Outbound Rules</strong> tab page, click <strong id="elb_qs_0002__elb_ug_hd_0007_b7993030143715">Add Rule</strong> to add a rule.<ul id="elb_qs_0002__elb_ug_hd_0007_ul185172012178"><li id="elb_qs_0002__elb_ug_hd_0007_li4511820191719"><strong id="elb_qs_0002__elb_ug_hd_0007_b103837331378">Action</strong>: Select <strong id="elb_qs_0002__elb_ug_hd_0007_b11383173311379">Allow</strong>.</li><li id="elb_qs_0002__elb_ug_hd_0007_li8626942141716"><strong id="elb_qs_0002__elb_ug_hd_0007_b145321729111419">Protocol</strong>: The protocol must be the same as the one you selected for the listener.</li><li id="elb_qs_0002__elb_ug_hd_0007_li9500202313188"><strong id="elb_qs_0002__elb_ug_hd_0007_b597212111711">Source</strong>: Set it to the VPC CIDR block.</li><li id="elb_qs_0002__elb_ug_hd_0007_li66251610162417"><strong id="elb_qs_0002__elb_ug_hd_0007_b27061041103719">Source Port Range</strong>: Select a port range.</li><li id="elb_qs_0002__elb_ug_hd_0007_li7464162916350"><strong id="elb_qs_0002__elb_ug_hd_0007_b176581841131420">Destination</strong>: If you keep the default value, <strong id="elb_qs_0002__elb_ug_hd_0007_b12659154112143">0.0.0.0/0</strong>, traffic will be allowed for all destination IP addresses.</li><li id="elb_qs_0002__elb_ug_hd_0007_li5915133319341"><strong id="elb_qs_0002__elb_ug_hd_0007_b2408174419143">Destination Port Range</strong>: Select a port range.</li><li id="elb_qs_0002__elb_ug_hd_0007_li75457153520">(Optional) <strong id="elb_qs_0002__elb_ug_hd_0007_b1732114010406">Description</strong>: Describe the <span id="elb_qs_0002__elb_ug_hd_0007_ph171149155338">firewall</span> rule.</li></ul>
|
|
</li><li id="elb_qs_0002__elb_ug_hd_0007_li162953310168">Click <strong id="elb_qs_0002__elb_ug_hd_0007_b1590315817230">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section184861920245"><h4 class="sectiontitle">Adding a Listener</h4><p id="elb_qs_0002__en-us_topic_0052569751_p845424162316">Add a listener to the created load balancer. When you add the listener, create a backend server group, configure a health check, and add the two ECSs to the created backend server group.</p>
|
|
<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig1748151712518"><span class="figcap"><b>Figure 4 </b>Traffic forwarding</span><br><span><img class="vsd" id="elb_qs_0002__en-us_topic_0052569751_image11982290355" src="en-us_image_0198607824.png"></span></div>
|
|
<ol id="elb_qs_0002__en-us_topic_0052569751_ol5476154122712"><li id="elb_qs_0002__en-us_topic_0052569751_li17301740102218">Hover on <span><img id="elb_qs_0002__en-us_topic_0052569751_en-us_topic_0052569751_image762510132322" src="en-us_image_0000001417088430.png"></span> in the upper left corner to display <strong id="elb_qs_0002__en-us_topic_0052569751_en-us_topic_0052569751_b9121102522212">Service List</strong> and choose <strong id="elb_qs_0002__en-us_topic_0052569751_en-us_topic_0052569751_b61222025142217">Network</strong> > <strong id="elb_qs_0002__en-us_topic_0052569751_en-us_topic_0052569751_b4124425142210">Elastic Load Balancing</strong>. </li><li id="elb_qs_0002__en-us_topic_0052569751_li44618046152949">Locate the created load balancer (<strong id="elb_qs_0002__en-us_topic_0052569751_b1335044112385">elb-01</strong>) and click its name.</li><li id="elb_qs_0002__en-us_topic_0052569751_li13174175374113">Under <strong id="elb_qs_0002__en-us_topic_0052569751_b253210575014">Listeners</strong>, click <strong id="elb_qs_0002__en-us_topic_0052569751_b14533105717014">Add Listener</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li2251125613498">Configure the listener and click <strong id="elb_qs_0002__en-us_topic_0052569751_b691390121716">Next</strong>.<ul id="elb_qs_0002__en-us_topic_0052569751_ul62511156154919"><li id="elb_qs_0002__en-us_topic_0052569751_li325135618495"><strong id="elb_qs_0002__en-us_topic_0052569751_b179131225111717">Name</strong>: Enter a name, for example, <strong id="elb_qs_0002__en-us_topic_0052569751_b93171021131715">listener-HTTP</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li82511563496"><strong id="elb_qs_0002__en-us_topic_0052569751_b2843182412014">Frontend Protocol/Port</strong>: Select a protocol and enter a port for the load balancer to receive requests. For example, set it to <strong id="elb_qs_0002__en-us_topic_0052569751_b5858103611180">HTTP</strong> and <strong id="elb_qs_0002__en-us_topic_0052569751_b0621123931810">80</strong>.</li></ul>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1895519482122">Create a backend <span id="elb_qs_0002__en-us_topic_0052569751_text13006102463">server</span> group and configure a health check.<ul id="elb_qs_0002__en-us_topic_0052569751_ul1688220191456"><li id="elb_qs_0002__en-us_topic_0052569751_li388214193454">Backend <span id="elb_qs_0002__en-us_topic_0052569751_text10994181524614">server</span> group<ul id="elb_qs_0002__en-us_topic_0052569751_ul118811219184517"><li id="elb_qs_0002__en-us_topic_0052569751_li1488191919457"><strong id="elb_qs_0002__en-us_topic_0052569751_b89061214814">Name</strong>: Enter a name, for example, <strong id="elb_qs_0002__en-us_topic_0052569751_b590781416110">server_group-ELB</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li19881201904512"><strong id="elb_qs_0002__en-us_topic_0052569751_b10510202318110">Load Balancing Algorithm</strong>: Select an algorithm that the load balancer will use to route requests, for example, <strong id="elb_qs_0002__en-us_topic_0052569751_b10511182313110">Weighted round robin</strong>.</li></ul>
|
|
</li></ul>
|
|
<ul id="elb_qs_0002__en-us_topic_0052569751_ul11882181919453"><li id="elb_qs_0002__en-us_topic_0052569751_li14882171984518">Health check<ul id="elb_qs_0002__en-us_topic_0052569751_ul7882161913451"><li id="elb_qs_0002__en-us_topic_0052569751_li188211917459"><strong id="elb_qs_0002__en-us_topic_0052569751_b172953281015">Protocol</strong>: Select a protocol for the load balancer to perform health checks on backend servers. If the load balancer uses TCP, HTTP, or HTTPS to receive requests, the health check protocol can be TCP or HTTP. Here we use HTTP as an example. Note that the protocol cannot be changed after the listener is added.</li><li id="elb_qs_0002__en-us_topic_0052569751_li15882121964513"><strong id="elb_qs_0002__en-us_topic_0052569751_b41837301711">Domain Name</strong>: Enter a domain name that will be used for health checks, for example, <strong id="elb_qs_0002__en-us_topic_0052569751_b7264118153110">www.example.com</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li1988214191451"><strong id="elb_qs_0002__en-us_topic_0052569751_b19750201420">Port</strong>: Enter a port for the load balancer to perform health checks on backend servers, for example, <strong id="elb_qs_0002__en-us_topic_0052569751_b0751160427">80</strong>.</li></ul>
|
|
</li></ul>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li48833192451">Click the name of the newly added listener. On the <strong id="elb_qs_0002__en-us_topic_0052569751_b184212435463">Backend Server Groups</strong> tab page on the right, click <strong id="elb_qs_0002__en-us_topic_0052569751_b93057133463">Add</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li2076511864619">Select the servers you want to add, set the backend port, and click <strong id="elb_qs_0002__en-us_topic_0052569751_b78921824714">Finish</strong>.<ul id="elb_qs_0002__en-us_topic_0052569751_ul19482182214415"><li id="elb_qs_0002__en-us_topic_0052569751_li2048352284418">Backend servers: Select <strong id="elb_qs_0002__en-us_topic_0052569751_b1131181520111">ECS01</strong> and <strong id="elb_qs_0002__en-us_topic_0052569751_b1332111512115">ECS02</strong>.</li><li id="elb_qs_0002__en-us_topic_0052569751_li6483922104411">Backend port: Set it to <strong id="elb_qs_0002__en-us_topic_0052569751_b1426218377321">80</strong>. Backend servers will use this port to communicate with the load balancer.</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section164467272278"><h4 class="sectiontitle">Verifying Load Balancing</h4><p id="elb_qs_0002__en-us_topic_0052569751_p159413171688">After the load balancer is configured, you can access the domain name to check whether the two ECSs are accessible.</p>
|
|
<ol id="elb_qs_0002__en-us_topic_0052569751_ol1177812309272"><li id="elb_qs_0002__en-us_topic_0052569751_li10778123092715">Modify the <strong id="elb_qs_0002__en-us_topic_0052569751_b169523165317">C:\Windows\System32\drivers\etc\hosts</strong> file on your PC to map the domain name to the load balancer EIP.<div class="p" id="elb_qs_0002__en-us_topic_0052569751_p108335351756">View the load balancer EIP on the <strong id="elb_qs_0002__en-us_topic_0052569751_b17232144617126">Summary</strong> page of the load balancer.<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig11400732555"><span class="figcap"><b>Figure 5 </b><strong id="elb_qs_0002__en-us_topic_0052569751_b1512134283920">hosts</strong> file on your PC</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image154003321252" src="en-us_image_0167652140.png"></span></div>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1677863072715">On the CLI of your PC, run the following command to check whether the domain name is mapped to the load balancer EIP:<p id="elb_qs_0002__en-us_topic_0052569751_p141804481111"><a name="elb_qs_0002__en-us_topic_0052569751_li1677863072715"></a><a name="en-us_topic_0052569751_li1677863072715"></a><strong id="elb_qs_0002__en-us_topic_0052569751_b099542951110">ping www.example.com</strong></p>
|
|
<p id="elb_qs_0002__en-us_topic_0052569751_p081752681216">If data packets are returned, the domain name has been mapped to the load balancer EIP.</p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li4888169202412">Use your browser to access <strong id="elb_qs_0002__en-us_topic_0052569751_b125484341231">http://www.example.com</strong>. If the following page is displayed, the load balancer has routed the request to ECS01.<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig174313116258"><span class="figcap"><b>Figure 6 </b>Accessing ECS01</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image2819142543217" src="en-us_image_0167652142.png"></span></div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0052569751_li1497010584220">Use your browser to access <strong id="elb_qs_0002__en-us_topic_0052569751_b1491813531834">http://www.example.com</strong>. If the following page is displayed, the load balancer has routed the request to ECS02.<div class="fignone" id="elb_qs_0002__en-us_topic_0052569751_fig897020534220"><span class="figcap"><b>Figure 7 </b>Accessing ECS02</span><br><span><img id="elb_qs_0002__en-us_topic_0052569751_image113469388329" src="en-us_image_0167652143.png"></span></div>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="elb_qs_0000.html">Getting Started</a></div>
|
|
</div>
|
|
</div>
|
|
|