I have an aws lambda function on top of which I am trying to create a cloudwatch alarm using cloudformation template.
Lets say I have a lambda function named MyPackage-MyLambdaFunctionName but when I see my lambda in the aws console, it says MyPackage-MyLambdaFunctionName-M2DEESRWNF6I.
I am able to create the alarm by passing the below in the dimensions:
Dimensions:
- Name: FunctionName
Value: MyPackage-MyLambdaFunctionName-M2DEESRWNF6I
(Referring to How to set lambda alarm for specific lambda using CloudFormation)
But the issue is the lambda function is having a random component at the end (-M2DEESRWNF6I).
I have a cloudformation template which goes in a few accounts and creates these lambda functions. And since these random identifiers are different in each account, I cant put the above in cloudformation template, since it will work for one account but not for the others.
So, how can I achieve creating these cloudwatch alarms on my lamdba functions using the cloudformation template? such as does "Value" takes regex? I tried
MyPackage-MyLambdaFunctionName.*
which didnt work. Or is there a way to restrict the lambda function name to be just MyPackage-MyLambdaFunctionName (without the random identifier)
Any guidance/help is appreciated.
Thanks
FunctionName
for your lambda function, you should get exactly the name you've configured. – lexicore