TechToSpeech / terraform-aws-serverless-static-wordpress

Terraform module for deploying Serverless Static Wordpress on AWS
GNU General Public License v3.0
196 stars 69 forks source link

Cloudwatch Log Groups: Edge Cache Region management #32

Open petewilcock opened 3 years ago

jtatum commented 3 years ago

One idea is to remove the CreateLogGroup permission from the lambda. That way it won't be able to create unlimited retention log groups in arbitrary regions. Note you'll also want to remove the AWSLambdaBasicExecutionRole - it has permissions to create log groups (and conflicts with the lambda-edge-cloudwatch-logs policy).

petewilcock commented 3 years ago

One idea is to remove the CreateLogGroup permission from the lambda.

I'm aware of this trick but I think it's a poor substitute (on AWS' part) for not having better configurability of the automatic log groups used by Lambdas. As the name of the group and the region the groups will be created in is known, this can be anticipated and configured ahead of time - it's just the hell of figuring out a method of doing this that doesn't require the user to pass 17 different providers to the module (I'm not even inflating that number!) to do the thing in each region.

jtatum commented 3 years ago

Yeah, exactly. Terraform doesn't exactly make this easy, either. On the balance, it's probably better to have no logs for the redirect service (are they even useful outside of test and dev?) than infinite retention logs, at least by my reckoning.

petewilcock commented 3 years ago

It's a fair point. I've seen ever-growing Cloudwatch log groups getting into the 100s of GBs because they were left unconfigured. :( It's a growing cost over time which is the antithesis of this set-up. I'll think about it, worst case it's another configurable flag 🤔