https://pulumi.com logo
#aws
Title
# aws
l

little-market-63455

05/21/2021, 8:19 AM
I guess this question came up before, but how can I control the retention of lambda logs. Since Pulumi assigns the unique suffix to resource names (which I want to keep), I cannot predict what the log group name for the lambda is going to be so I cannot create it before hand and declare it as a manual dependency. Is there a way to accomplish this atm
l

lemon-machine-35564

05/21/2021, 2:11 PM
AWS automatically creates log groups for Lambdas unless you create it yourself. To control the settings, create the log group yourself after the Lambda is deployed. Naming is something like
/aws/lambda/{lambdaName}
.
l

little-market-63455

05/21/2021, 2:18 PM
Wouldn't you be in a race condition with AWS or you would have to poll until AWS have created it? I am more in favor of creating it myself but then I would have to override pulumi's auto naming feature
l

lemon-machine-35564

05/21/2021, 2:28 PM
You don’t have to override their autonaming, just have to create the log group right after the Lambda and use the name from the newly created resource.
We have a helper function that does it all for us
l

little-market-63455

05/21/2021, 3:30 PM
I see what you are saying. I was basically afraid of a situation where I am competing with the lambda itself creating that log group but I guess I can only prevent that from happening by denying it permissions
l

lemon-machine-35564

05/21/2021, 6:58 PM
Yeah the log group isn’t created by AWS until the function is actually invoked