Nested dictionary creation with setdefault
Use a defaultdict like so:
from collections import defaultdict

resource_dict = lambda: defaultdict(list)
service_dict = lambda: defaultdict(resource_dict)
region_dict = lambda: defaultdict(service_dict)
execution_log = defaultdict(region_dict)

execution_log['AWS']['region']['service']['resource'].append({
                &quot;id&quot;: 'resource_id',
                &quot;action&quot;: 'resource_action',
                &quot;timestamp&quot;: &quot;%Y-%m-%d %H:%M:%S&quot;,
            })

execution_log

output:
defaultdict(&lt;function __main__.&lt;lambda&gt;()&gt;,
            {'AWS': defaultdict(&lt;function __main__.&lt;lambda&gt;()&gt;,
                         {'region': defaultdict(&lt;function __main__.&lt;lambda&gt;()&gt;,
                                      {'service': defaultdict(list,
                                                   {'resource': [{'id': 'resource_id',
                                                      'action': 'resource_action',
                                                      'timestamp': '%Y-%m-%d %H:%M:%S'}]})})})})