serverless-step-functions
serverless-step-functions copied to clipboard
Config cloudWatch with serverless.yml Error
I follow this example about config CloudWatchLogs for the Express Workflow
stepFunctions:
stateMachines:
hellostepfunc1:
type: EXPRESS
loggingConfig:
level: ERROR
includeExecutionData: true
destinations:
- Fn::GetAtt: [MyLogGroup, Arn]
But It not clear. What is the MyLogGroup and how I can config for this? I try to create a function lambda MyLogGroup and build but I have an issue:
Error: The CloudFormation template is invalid: ValidationError: Template error: instance of Fn::GetAtt references undefined resource MyLogGroup
Can help me with 1 example?
@horike37
@nuskirk I found this issue today, so I happy to explain:
this error displays because you do not have such a resource defined, so arn cannot be fetched.
What you can do is to define with cloudformation a new log group, and then refer to it:
Within the serverless.yml
in the resources do:
resources:
Resources:
YourNameForTheLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 30
After this, in your step functions definition add:
loggingConfig:
level: ERROR
includeExecutionData: true
destinations:
- !GetAtt YourNameForTheLogGroup.Arn
And that's it:
@nuskirk can you check it, and ping here, so @horike37 could close the issue :)