3 ms·
"the future is now, and it's down because somebody used the secret key to drain the poster's bank account" To be sure, the author specifies that the IAM role b
by al2o3cr 11y ago
"the future is now, and it's down because somebody used the secret key to drain the poster's bank account"
To be sure, the author specifies that the IAM role being exposed here is only allowed to invoke the function. That's great for the security of the other resources on the account, but still allows a reasonably determined attacker to run up a Bill of Unusual Size quite rapidly.
For instance, the rate limiter currently kicks in at 1000TPS. Assuming the smallest memory size (128MB) and requests <100ms, that's a worst-case spend of roughly $18/day per Lambda function. Not the wallet-melting consequences of, say, accidentally posting AWS root credentials but not great either. Multiply that by the number of endpoints you'd likely want in a single-page app, and it gets expensive.
- kitbrennan 11y agoBut the same is true of any backend. Once you know the endpoint being used by the frontend, you can blast the backend with requests and one of two things will happen: * You will take down the site (a DoS attack). * Or the victim has auto-scaling and you rack up their AWS charges. This is hardly a unique problem to Lambda.
- michaelmior 11y agoThe question is whether or not the cost per request is higher than if you were running something similar on EC2.
- rattray 11y agoThe biggest difference is ease of rate limiting. With lambda, I imagine the best you could do would be check the IP in a Redis cache at the beginning of each request (if the SDK even includes that info) to minimize the damage. But there would be no way to fully stop an attacker without turning off the service entirely. If you run your own webserver, I think you can stop stuff like that more efficiently / without the expense, eg at the nginx level.
- jeffbarr 11y ago...and that's why CloudWatch allows you to set billing alerts. You could even route a billing alerts (via SNS) back to a Lambda function, use it to set a flag, and run in a reduced capacity mode if this is a concern. I always tell my audiences (I work for Amazon) that it should be possible to build a system where you know the actual cost of every web page you generate and every request you serve, and to make sure that each one has the ability to earn its keep (by ultimately driving revenue).
- rattray 11y agoAn official example repo (or, less ideally, a tutorial) of how to automate the cost-control would probably go a long way.