in python/gwlb/create_tg_sample.py [0:0]
def main():
"""
Creates Target Group (TG)
Accepts:
--tg_name: TG name
--vpc_id: VPC id to associate TG with
Usage:
python create_tg_sample.py \
--tg_name boto3-gwlb1-tg1 \
--vpc_id vpc-xxxx
"""
parser = argparse.ArgumentParser()
parser.add_argument('--tg_name', required=True,
help='specify target group name', type=str)
parser.add_argument('--vpc_id', required=True,
help='specify vpc id', type=str)
args = parser.parse_args()
############################
# Define script variables:
############################
tg_name = args.tg_name
vpc_id = args.vpc_id
tg1_args = {
'name': tg_name,
'protocol': 'GENEVE',
'port': 6081,
'healthchkproto': 'HTTP',
'healthchkport': '80',
'healthchkpath': '/',
'vpc_id': vpc_id,
'type': 'instance'
}
#############################
# Target Group:
tg1 = create_tg(**tg1_args)
print(f"TG ARN: {tg1[1]}")