in awsconfigstatuscheck-app/aws_config_status_check/ManagerFunction.py [0:0]
def PublishEventsForEachAccount(self):
for self.accountid in self.accounts:
jsonstr={}
index=0
jsonstr["aws_config_status_check_account"]=self.accountid
print("aws_config_status_check_account:", jsonstr)
event_bus_arn = "arn:aws:events:us-east-1:" + aws_account_id + ":event-bus/default"
response = self.cloudwatch_events.put_events(
Entries=[
{
"Detail": json.dumps(jsonstr),
"DetailType": "aws_config_status_check_event",
"EventBusName": event_bus_arn,
"Resources": [
lambda_function_arn
],
"Source": "awsconfigcheck.ManagerFn"
}
])
print("response", response)
response = self.cloudwatch.put_metric_data(
MetricData=[
{
'MetricName': 'TotalAccountsMonitoredForAWSConfig',
'Value': len(self.accounts)
}
],
Namespace='AWSConfigStatus'
)