AHA is an incident management & communication framework to provide real-time alert customers when there are active AWS event(s). For customers with AWS Organizations, customers can get aggregated active account level events of all the accounts in the Organization. Customers not using AWS Organizations still benefit alerting at the account level.
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.
https://github.com/aws-samples/aws-health-aware/blob/6f047af3ec397e1cb5896f3c96dde9893d4bf880/handler.py#L354
The call to
get_account_name
inget_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 todescribe_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 theaffected_accounts
list when running in Org Mode.