aws-health-aware
                                
                                 aws-health-aware copied to clipboard
                                
                                    aws-health-aware copied to clipboard
                            
                            
                            
                        Organization Account Name Lookup Too Frequent
https://github.com/aws-samples/aws-health-aware/blob/6f047af3ec397e1cb5896f3c96dde9893d4bf880/handler.py#L354
The call to get_account_name in get_affected_entities is currently in inside the loop around the returned entities for the Health event. As this is only used when Org Mode is turned on, and the call to describe_affected_entities_for_organization uses an awsAccountId filter, this means that the account name is looked up for the same account for each entity that is returned.
It would be more efficient to move the get_account_name call to the outside account loop so that it is only done once for each account in the affected_accounts list when running in Org Mode.