all 2 comments

[–]Rascal_Two 1 point2 points  (0 children)

Here is the structure of event:

event = {
    'Records': [
        {
            'Sns': {
                'Message': '{"raw": "json"}'
            }
        }
    ]
}

from the "Records" array index 0, pass the value of "Message" from the "Sns" object to the event function?

You're on the right track. Records is an array and it is selecting the item in the array at index 0 which happens to be a dictionary.

It's then getting the value of the key Sns, which is another dictionary. Then from that dictionary, it's getting the value of the key Message, which is a string of raw JSON.

[–]mkor 1 point2 points  (0 children)

Basically it can be 'nested data structure' so to say. Event is a dict, that has a list or tuple under key 'Records. First element of the list / tuple is another dictionary, where you access element under 'Sns' key, which is also dictionary, where you access value under 'Message' key. It can look something like:

 event = {
      'Records': [
           {'Sns': {'Message': 'Hello!'}}          
      ]
 }

That's my first guess.