Beispiel #1
0
def delete(name, region, test=False, aws_key=None, aws_secret=None):
    """
    Ensure an ELB does not exist

    Parameters
    ----------
    region : str
        The availability region the ELB is in
    test : bool, optional
        If true, don't actually perform the delete
    aws_key : str, optional
        The access key id for AWS. May also be specified as 'aws:key' in a
        pillar.
    aws_secret : str, optional
        The secret access key for AWS. May also be specified as 'aws:secret' in
        a pillar.

    """
    elbconn = __salt__['aws_util.elbconn'](region, aws_key, aws_secret)
    elb = _get_elb(name, region, aws_key, aws_secret, elbconn)

    if elb is not None:
        if not test:
            elb.delete()
        return True
Beispiel #2
0
def delete(
    name,
    region,
    test=False,
    aws_key=None,
        aws_secret=None):
    """
    Ensure an ELB does not exist

    Parameters
    ----------
    region : str
        The availability region the ELB is in
    test : bool, optional
        If true, don't actually perform the delete
    aws_key : str, optional
        The access key id for AWS. May also be specified as 'aws:key' in a
        pillar.
    aws_secret : str, optional
        The secret access key for AWS. May also be specified as 'aws:secret' in
        a pillar.

    """
    elbconn = __salt__['aws_util.elbconn'](region, aws_key, aws_secret)
    elb = _get_elb(name, region, aws_key, aws_secret, elbconn)

    if elb is not None:
        if not test:
            elb.delete()
        return True
def main():
    elb_dns = create_LoadBalancer()
    load_dns = create_LoadGenerator()
    create_AutoScaling()
    print "While waiting for 'InService', go tag your ELB now."
    time.sleep(4 * 60)  # wait for "InService" for instances in ELB
    start_Warmup(load_dns, elb_dns)
    activate_LoadGenerator(load_dns, elb_dns)
    print "View Log at:"
    print "http://" + load_dns + "/view-logs?name=result_chihangw_iwantplay.txt"
    print "Good Luck!!!"
    time.sleep(60 * 42)
    # delete all the configuration and ELB
    ag.shutdown_instances()
    ag.delete()
    lc.delete()
    elb.delete()
import boto.ec2.cloudwatch

import os
import time

# create elb connection
elb_conn = boto.ec2.elb.ELBConnection(
  'AKIAIMMVA5TNRP7KRHKA',
  'hECzayjh4i4baoJTERaZbIzTqZn1eH9GHfkb7Ek3')

elb = elb_conn.get_all_load_balancers()[0]

# create an autoscale connection
as_conn = boto.ec2.autoscale.AutoScaleConnection(
  'AKIAIMMVA5TNRP7KRHKA',
  'hECzayjh4i4baoJTERaZbIzTqZn1eH9GHfkb7Ek3')

lc = as_conn.get_all_launch_configurations(names=['as_launch_configuration'])[0]
ag = as_conn.get_all_groups(['as_group'])[0]


# clean up
ag.shutdown_instances()
while len(as_conn.get_all_autoscaling_instances()) > 0:
  time.sleep(10)

ag.delete()
time.sleep(5)
lc.delete()
elb.delete()
Beispiel #5
0
 def delete_load_balancers(self):
     self.logger.info('Deleting load balancers')
     for elb in self.elb.get_all_load_balancers():
         self.logger.info('\tDeleting load balancer {}'.format(elb.name))
         elb.delete()
import boto.ec2.elb
import boto.ec2.autoscale
import boto.ec2.cloudwatch

import os
import time

# create elb connection
elb_conn = boto.ec2.elb.ELBConnection(
    'AKIAIMMVA5TNRP7KRHKA', 'hECzayjh4i4baoJTERaZbIzTqZn1eH9GHfkb7Ek3')

elb = elb_conn.get_all_load_balancers()[0]

# create an autoscale connection
as_conn = boto.ec2.autoscale.AutoScaleConnection(
    'AKIAIMMVA5TNRP7KRHKA', 'hECzayjh4i4baoJTERaZbIzTqZn1eH9GHfkb7Ek3')

lc = as_conn.get_all_launch_configurations(
    names=['as_launch_configuration'])[0]
ag = as_conn.get_all_groups(['as_group'])[0]

# clean up
ag.shutdown_instances()
while len(as_conn.get_all_autoscaling_instances()) > 0:
    time.sleep(10)

ag.delete()
time.sleep(5)
lc.delete()
elb.delete()