'Pass a variable into AWS Shadow

I am just learning about how to use shadows in AWS. So I want to be able to pass a variable into AWS so it's read by the Shadow (sorry if I'm not explaining this correctly, but I hope it makes sense). So basically, I have the following code:

Payload = """{ "state":
    { "report":
        {"seconds" : "10",
        "size" : "20"
        }
     },
"message: "Hello World"
}"""

And I get the exact same output in the "Device Shadow state" in AWS. So what I want to do is have seconds and size as a variable.

I have tried setting a variable as:

size = "20"

and then using it as:

Payload = """{ "state":
        { "report":
            {"seconds" : "10",
            "size" : size
            }
         },
    "message: "Hello World"
    }"""

however, this didn't work and the Classic Shadow in AWS disappeared. Can anyone please help?

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source