Python Forum
AWS ELB auto tagging with Lambda and boto 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AWS ELB auto tagging with Lambda and boto 3
#1
I'm trying to build a function to auto tag aws elb v1 and v2 with cloud watch events, lambda, boto3 and python 2.7

elb v1 and v2 have same cloud watch event name CreateLoadBalancer, but json response is different.

I'm able to tag elb v2 with code as shown below, but getting KeyError('loadBalancers',)for elb v1

**elif eventname == 'CreateLoadBalancer':
    rlb = detail['responseElements']['loadBalancers']
    if rlb:
        for loadbalarn in rlb:
            elbv2.append(loadbalarn['loadBalancerArn'])
        logger.info(elbv2)
    else:
        elbv1.append(detail['requestParameters']['loadBalancerName'])
        logger.info(elbv1)**
ELB V1 json response -
ELB V2 json response -
Please provide any suggestions.

Thank you.

python-2.7
Reply


Messages In This Thread
AWS ELB auto tagging with Lambda and boto 3 - by karteekdavid - Aug-13-2018, 05:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to use boto library with compressed content in python3 avinash2020 1 1,930 Aug-13-2020, 09:24 PM
Last Post: avinash2020
  Boto 3 and Mongo DB zatlas1 2 2,988 May-23-2019, 07:32 PM
Last Post: zatlas1
  Text Processing and NLTK (POS tagging) TwelveMoons 2 4,927 Mar-16-2017, 02:53 AM
Last Post: TwelveMoons

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020