Q: "I have a nightly task that load some data from RDS and then write it to S3, should I have 2 functions for this with API between them?"
#serverless #aws
1/14
In this case, if everything can be done within the 15 mins limit, I see no reason to split the functions.
Follow the KISS principle.
2/
E.g. to increase parallelism, you may split the task up into many small tasks, and fire off an invocation (separate function) to handle each.
Which means you need some sort of queue, but which?
3/
4/
To mitigate, run these in separate account.
5/
It'd work, but 2x the cost per million msgs compared to SNS, and has a default limit (soft) of 2400 msg/sec in.
In this case, I don't see an upside, but there are good reasons to choose EB over SNS in many scenarios: lumigo.io/blog/5-reasons…
6/
Then consider a queue where scaling behaviour is more gradual.
7/
Kinesis lets you precise control of max concurrency with no. of shards and parallelism per shard.
You can play games with these options.
8/
In that case, how about Step Function's Map state? Great for map-reduce type workload.
9/
10/
There are some powerful stuff you can do with nested workflows, but shouldn't be your first call! Go for simpler solutions first.
11/
If some of the steps are prone to error, then another good reason to split is to be able to retry individual steps without failing the whole thing.
Putting a queue between each step gives you that.
12/
end/