php script to get server details ( details.php )

            echo $_SERVER['SERVER_ADDR'];


Place this in the s3 bucket and mention the same in below bootstrapping script.

aws ec2 bootstrapping script

yum install httpd php -y
yum update -y
aws s3 cp --recursive s3://YOUR_BUCKET_NAME /var/www/html/
service httpd start
chkconfig httpd on

This runs the apache and pulls out the details.php file and placed in the apache public folder which is details.php.

Ec2 instances

When starting the instances make sure you place one instance in zone-a and another two in zone-b

Instance private ip AZ zone us-east-1a us-east-1b us-east-1b

Now attach these instances to ELB say is the DNS name generated.

Now disable the cross zone load balancing and hit the below url in three browser instances and observe the ip address echoed on console. Here the requests are not routed to all instances equally.

Now enable the cross zone load balancing and hit the same above url and check the console. This time you will see requests hit equally to all the nodes.