Infrastructure
Since we require privilege for using raw sockets, we no longer can run on AWS Lambda. However, fargate with spot pricing could be a good alternative.
We have to think about how to deploy this. AWS Batch could help, or we can create an sqs queue that will hold our tasks, then after pushing our tasks we'll start up x amount of fargate tasks to retrieve stuff from sqs and kill them after a single job.
AWS Lambda ARM
- 0.0000000017 per 128mb per ms
- 0.0000017 per 128mb per second
- 0.000102 per 128mb per minute
- 0.0000000267 per 2048mb per ms
- 0.0000267 per 2048mb per second
- 0.0016 per 2048mb per minute
- pay per second
- size measured in memory
Fargate spot pricing ARM
- 0,00016429 per vCPU per minute
- pay per minute
- size measured in vCPU, minimum = 2Gb mem
This means lambda is 0,00016429 - 0.000102 = 0.00006229 CHEAPER per vCPU per minute, when we don't care about memory. This means lambda is 0,0016 - 0,00016429 = 0.00143571 MORE EXPENSIVE per vCPU per second, when we compare to 2048mb lambda.
Lets say we will run 10 tasks for a full hour a day for every day of the month.
With lambda 2048mb we would pay 0.0016 60 10 * 31 = $29.76 With fargate we would pay 0,00016429 * 60 * 10 * 31 = $3.055794
UPDATE, Fargate cost described above is actually still missing the GB per hour. BUT I also see fargate tasks have a lower minimum, the minimum is 0.25vCPU with 0.5GB.
They have a fargate pricing calucation example (I don't think it uses spot instances even!):
5 tasks running on ARM for 10 minutes every day, with 1vCPU and 2GB mem, for the whole month cost a total of $1.02.
That is missing data transfer cost and public ip cost but still, I think we can work with that!! AWS Batch will be great for this as well.