I’m trying to build a state function to trigger a lambda function repeatedly with different JSON payloads. As a theoretical example, my goal is to input the state function with a JSON payload like
{
"Apples": ["Gala", "Granny Smith", "Honey Crisp"]
"Store": "Trader Joes"
}
I then need the state function to create three different JSON payloads with some pre-set information using this input:
{
"Apple":"Gala",
"Store": "Trader Joes",
"Color":"Red"
}
{
"Apple":"Granny Smith",
"Store":"Trader Joes",
"Color":"Green"
}
{
"Apple":"Honey Crisp",
"Store":"Trader Joes",
"Color":"Red"
}
The “Store” value needs to be taken from the input JSON, while the respective colors will always be the same for each apple.
The state function then needs to trigger the lambda 3 times with each built payload. The reason I want to do this instead of just sending all three payloads is that the real JSON payloads are longer and would require modifying things like “Store” over and over again, so I’d love to be able to just send the list I want and have the state function build the payload.
I know a Map state would be good to trigger the lambda 3 times with the payloads, but I don’t think it can do the payload building I need, since to my knowledge it just looks inside it’s input and ships the data to the lambda. I know I could also do some modifications with a Pass state, but I’m not sure how to split into different payloads and customize them with preset variables the way I need.
Is this functionality possible in a simple way in AWS state functions?