Exemplo n.º 1
0
#!/usr/bin/env python
import os, sys
from myboto3 import elb_client, lbNames, stackId_from_name

lbName = 'CachetLoadBalancer'
if not (0 < len(sys.argv) <= 2):
    print("""usage: %s [*LoadBalancerName*]

Delete load lalancer *LoadBalancerName*. If no *LoadBalancerName* is given
we use %s.""" % (os.path.basename(sys.argv[0]), lbName))
    sys.exit(1)

if len(sys.argv) == 2: lbName = sys.argv[1]

if lbName not in lbNames():
    print("Load Balancer %s doesn't exists, nothing done" % lbName)
    sys.exit(2)

result = elb_client.delete_load_balancer(LoadBalancerName=lbName)
print(result)
Exemplo n.º 2
0
#!/usr/bin/env python
import os, sys
from myboto3 import elb_client, lbNames

lbName = 'CachetLoadBalancer'
if not(1 <= len(sys.argv) <= 2):
    print("""usage: %s [*LoadBalancerName*]

Create elastic load balancer for php cachet test application.
The default stack is %s.""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

if len(sys.argv) == 2: lbName = sys.argv[1]

if lbName in lbNames():
    print("Load Balancer %s already exists, nothing done" % lbName)
    sys.exit(2)

# FIXME: turn 'AWS-OpsWorks-PHP-App-Server'
# info 'sg-8366a4e4'
result = elb_client.create_load_balancer(
    # Required parameters
    LoadBalancerName=lbName,

    Listeners=[
        {
            'Protocol': 'HTTP',
            'LoadBalancerPort': 80,
            'InstanceProtocol': 'HTTP',
            'InstancePort': 8000,
        },
Exemplo n.º 3
0
#!/usr/bin/env python
import os, sys
from myboto3 import elb_client, lbNames

lbName = 'CachetLoadBalancer'
if not (1 <= len(sys.argv) <= 2):
    print("""usage: %s [*LoadBalancerName*]

Create elastic load balancer for php cachet test application.
The default stack is %s.""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

if len(sys.argv) == 2: lbName = sys.argv[1]

if lbName in lbNames():
    print("Load Balancer %s already exists, nothing done" % lbName)
    sys.exit(2)

# FIXME: turn 'AWS-OpsWorks-PHP-App-Server'
# info 'sg-8366a4e4'
result = elb_client.create_load_balancer(
    # Required parameters
    LoadBalancerName=lbName,
    Listeners=[
        {
            'Protocol': 'HTTP',
            'LoadBalancerPort': 80,
            'InstanceProtocol': 'HTTP',
            'InstancePort': 8000,
        },
    ],
Exemplo n.º 4
0
#!/usr/bin/env python
"""Print the names of the OpsWorks stacks defined"""
import os, sys
from myboto3 import lbNames, elb_client

full = False
if not (1 <= len(sys.argv) <= 2):
    print(
        """usage: %s [full]

Print the names of the Load Balancers defined.
"""
        % os.path.basename(sys.argv[0])
    )
    sys.exit(1)

if len(sys.argv) == 2 and sys.argv[1] == "full":
    full = True

if full:
    lbs = elb_client.describe_load_balancers()
    import pprint

    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(lbs)
else:
    print(", ".join(lbNames()))
Exemplo n.º 5
0
#!/usr/bin/env python
"""Print the names of the OpsWorks stacks defined"""
import os, sys
from myboto3 import lbNames, elb_client

full = False
if not (1 <= len(sys.argv) <= 2):
    print("""usage: %s [full]

Print the names of the Load Balancers defined.
""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

if len(sys.argv) == 2 and sys.argv[1] == 'full': full = True

if full:
    lbs = elb_client.describe_load_balancers()
    import pprint
    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(lbs)
else:
    print(', '.join(lbNames()))