| OLD | NEW |
| 1 .. _elb_tut: | 1 .. _elb_tut: |
| 2 | 2 |
| 3 ========================================================== | 3 ========================================================== |
| 4 An Introduction to boto's Elastic Load Balancing interface | 4 An Introduction to boto's Elastic Load Balancing interface |
| 5 ========================================================== | 5 ========================================================== |
| 6 | 6 |
| 7 This tutorial focuses on the boto interface for Elastic Load Balancing | 7 This tutorial focuses on the boto interface for Elastic Load Balancing |
| 8 from Amazon Web Services. This tutorial assumes that you have already | 8 from Amazon Web Services. This tutorial assumes that you have already |
| 9 downloaded and installed boto, and are familiar with the boto ec2 interface. | 9 downloaded and installed boto, and are familiar with the boto ec2 interface. |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 >>> import boto | 47 >>> import boto |
| 48 >>> conn = boto.connect_elb() | 48 >>> conn = boto.connect_elb() |
| 49 | 49 |
| 50 In either case, conn will point to an ELBConnection object which we will | 50 In either case, conn will point to an ELBConnection object which we will |
| 51 use throughout the remainder of this tutorial. | 51 use throughout the remainder of this tutorial. |
| 52 | 52 |
| 53 A Note About Regions and Endpoints | 53 A Note About Regions and Endpoints |
| 54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 55 Like EC2 the ELB service has a different endpoint for each region. By default | 55 Like EC2 the ELB service has a different endpoint for each region. By default |
| 56 the US endpoint is used. To choose a specific region, instantiate the | 56 the US endpoint is used. To choose a specific region, instantiate the |
| 57 ELBConnection object with that region's endpoint. | 57 ELBConnection object with that region's information. |
| 58 | 58 |
| 59 >>> ec2 = boto.connect_elb(host='eu-west-1.elasticloadbalancing.amazonaws.com') | 59 >>> from boto.regioninfo import RegionInfo |
| 60 >>> reg = RegionInfo(name='eu-west-1', endpoint='elasticloadbalancing.eu-west-1.
amazonaws.com') |
| 61 >>> elb = boto.connect_elb(region=reg) |
| 62 |
| 63 Another way to connect to an alternative region is like this: |
| 64 |
| 65 >>> import boto.ec2.elb |
| 66 >>> elb = boto.ec2.elb.connect_to_region('eu-west-1') |
| 67 |
| 68 Here's yet another way to discover what regions are available and then |
| 69 connect to one: |
| 70 |
| 71 >>> import boto.ec2.elb |
| 72 >>> regions = boto.ec2.elb.regions() |
| 73 >>> regions |
| 74 [RegionInfo:us-east-1, |
| 75 RegionInfo:ap-northeast-1, |
| 76 RegionInfo:us-west-1, |
| 77 RegionInfo:ap-southeast-1, |
| 78 RegionInfo:eu-west-1] |
| 79 >>> elb = regions[-1].connect() |
| 60 | 80 |
| 61 Alternatively, edit your boto.cfg with the default ELB endpoint to use:: | 81 Alternatively, edit your boto.cfg with the default ELB endpoint to use:: |
| 62 | 82 |
| 63 [Boto] | 83 [Boto] |
| 64 elb_endpoint = eu-west-1.elasticloadbalancing.amazonaws.com | 84 elb_region_name = eu-west-1 |
| 85 elb_region_endpoint = elasticloadbalancing.eu-west-1.amazonaws.com |
| 65 | 86 |
| 66 Getting Existing Load Balancers | 87 Getting Existing Load Balancers |
| 67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 88 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 68 | 89 |
| 69 To retrieve any exiting load balancers: | 90 To retrieve any exiting load balancers: |
| 70 | 91 |
| 71 >>> conn.get_all_load_balancers() | 92 >>> conn.get_all_load_balancers() |
| 72 | 93 |
| 73 You will get back a list of LoadBalancer objects. | 94 You will get back a list of LoadBalancer objects. |
| 74 | 95 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 To enable zones: | 214 To enable zones: |
| 194 | 215 |
| 195 >>> lb.enable_zones(['us-east-1c']) | 216 >>> lb.enable_zones(['us-east-1c']) |
| 196 | 217 |
| 197 Deleting a Load Balancer | 218 Deleting a Load Balancer |
| 198 ------------------------ | 219 ------------------------ |
| 199 | 220 |
| 200 >>> lb.delete() | 221 >>> lb.delete() |
| 201 | 222 |
| 202 | 223 |
| OLD | NEW |