Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The whole ELB collect failed when an ELB does not have a DNSName #5

Open
CorinneVerheyde opened this issue May 3, 2023 · 0 comments

Comments

@CorinneVerheyde
Copy link

On around 600 ELBs, on more than 150 aws accounts, we have 6 ELB without DNSName.
This make the script crash when collecting ELB.

$ aws_network_query -elb

--> Fail after several minutes
It generate no output file at all, as the program exit on an unexpecting error, whereas it as already collected a lot of ELB configurations.

Here is the error trace :

Traceback (most recent call last):
  File "/home/adm-coverheyde/.local/bin/aws_network_query", line 11, in <module>
    load_entry_point('aws-sts-network-query-tool==1.0.0', 'console_scripts', 'aws_network_query')()
  File "/usr/local/python3/lib/python3.7/site-packages/aws_sts_network_query_tool-1.0.0-py3.7.egg/aws_network_query/app.py", line 504, in main
  File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line 428, in result
    return self.__get_result()
  File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/local/python3/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/python3/lib/python3.7/site-packages/aws_sts_network_query_tool-1.0.0-py3.7.egg/aws_network_query/app.py", line 422, in worker
  File "/usr/local/python3/lib/python3.7/site-packages/aws_sts_network_query_tool-1.0.0-py3.7.egg/aws_network_query/app.py", line 390, in worker
  File "/usr/local/python3/lib/python3.7/site-packages/aws_sts_network_query_tool-1.0.0-py3.7.egg/aws_network_query/app.py", line 217, in process_load_balancer
KeyError: 'DNSName'

To confirm the issue was coming from the missing DNSName attribute on ELB, I removed the collection of the DNSName (in file aws_network_query/app.py, line 217). The script then finish well and collect all ELB.

216     for item in list:
217         #dict = {'AccountId': account, 'LoadBalancerArn': item['LoadBalancerArn'], 'DNSName': item['DNSName'], 'VpcId': item['VpcId'],'Region': region}
218         dict = {'AccountId': account, 'LoadBalancerArn': item['LoadBalancerArn'], 'VpcId': item['VpcId'],'Region': region}
219         print(f'Account {account}: New Load Balancer found {dict}')

--> Need to add a control if DNSName is not present on ELB ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant