-
To define a load balancer
1. Start the Create Load Balancer wizard:
-
From the AWS Management Console,
select Amazon EC2 from the drop-down list box, then
click Sign in to the AWS Console, and log in with the email
address and password you used when signing up for Amazon EC2.Tip If you pause for a long period of time during this procedure, the AWS
Management Console automatically logs you out. To stay logged in while you work
through this tutorial, click Settings in the top right corner
of the console window and clear the Sign out on inactivity
check box. -
Click Load Balancers in the Navigation pane.
The console displays the Load Balancers pane.
-
From the Load Balancers pane, click Create Load Balancers.
The DEFINE LOAD BALANCER page of the
Create a New Load Balancer wizard opens.
这块可以设置自定义的服务器来负责负载均衡,其余的是亚马逊提供的服务器。如可以建立一个nginx 服务器,然后让指向多个示例的端口,nginx服务器的端口设置为80,就可以在以上选择自定义。 -
-
On the DEFINE LOAD BALANCER page, enter a name
for your load balancer (e.g., myLB). -
Leave the Listener Configuration set to the default value for this example.
Important The default settings require that your Amazon EC2 HTTP servers are active and accepting requests on port 80.
-
Click Continue.
The CONFIGURE HEALTH CHECK page of the Create a New Load Balancer wizard opens.
To configure the health check
-
On the CONFIGURE HEALTH CHECK page of the Create a New Load Balancer wizard, set the Configuration Options for your load balancer.
-
Leave Ping Protocol set to its default value of
HTTP
. -
Leave Ping Port set to its default value of 80.
Elastic Load Balancing uses the Ping Port to send health check queries to your Amazon EC2 instances.
Important Your Amazon EC2 instances must accept incoming traffic on this port. This guide assumes that each of
your instances has a working HTTP server that accepts incoming traffic on port80
. -
In the Ping Path field, replace the default value with a single forward slash ("/").
Elastic Load Balancing sends health check queries to the path you specify in Ping Path.
This example uses a single forward slash so that Elastic Load Balancing sends the query to your HTTP server's default
home page, whether that default page is namedindex.html
,default.html
, or
a different name.
-
-
Leave the Advanced Options set to their default values.
-
Click Continue.
The ADD INSTANCES page of the Create a New Load Balancer wizard opens.
To add Amazon EC2 instances
-
On the ADD EC2 INSTANCES page of the
Create a New Load Balancer wizard,
select the check box next to each instance you want to add.Important This guide assumes that you have already created two
or more Amazon EC2 instances with active HTTP servers. -
Click Continue.
The REVIEW page of the Create a New Load Balancer wizard opens.
-
Review your settings. You can make changes to the settings by clicking the edit link
for a specific step in the process.Important After you create a load balancer, you can modify any of the settings, except for
Load Balancer Name and Port Configuration.
To rename a load balancer or change its port configuration, create a replacement load balancer. -
Click Create.
A confirmation window opens.
-
Click Close.
The confirmation window closes, returning you to the Load Balancers page.
Your new load balancer now appears in the list. -
Select the check box next to your load balancer.
A set of tabs opens with details about your new load balancer.
To test your load balancer, copy the DNS Name value that is listed in the Description
tab and paste it into the address field of an Internet-connected web
browser. If your load balancer is working, you will see the default page
of your HTTP server.Normally you'd continue using the load balancer. However, for the
purposes of this tutorial, we're going to show you how to terminate the
load balancer immediately.
Click Delete Load Balancer to continue. -
-