SST CRON Example (EventBridge Rules)
# SST CRON Example (EventBridge Rules)
This example derives from the SST CRON example. We will work through the weather example, and use the invoke lambda directly to test out the functionality of the CRON. We will also be able to see details about when this CRON is configured to run.
- Serverless Stack Tutorial
- Serverless Stack Original Source Code
- Modified GitHub Source Code
In this example we will post some messages to the SNS topic and then view the Lambda's invocation CloudWatch logs.
# Commandeer Lambda Invoke Testing Tool
# Add Message Section
# Resources Section
Under this is the Resources section. This will give you a list of related AWS resources that are associated with this test. In our case, we have 4 resources.
- CloudWatch Log - aws/lambda/dev-commandeer... - this is where all logging from your Lambda goes
- Lambda - dev-commandeer-imageResizeHandler... - this is the lambda that is invoked when a file is saved to the /photos location of the bucket
- IAM Execution Role - dev-commandeer-image-photoResize... - this is the IAM role that is assumed by the lambda. This is important, especially if the lambda is going to save data to another AWS resource like S3, DynamoDB, or SQS. It will need to be configured with the proper permissions. You normally do this in the SST code
- EventBridge Rule - dev-commandeer-image... - this is the EventBridge rule that invokes the lambda
Each of these can be clicked on to view the resource, and make any changes to it.
# Results Section
On the right-hand side is where the results reside. Before you run it, you will see the brief explanation for the tool. Once you add your payload and client context, this is where you will see the CloudWatch log information. This is also where the resources are shown. You can then simply close any resource, to return back to the results.
# Conclusion
Combining the Commandeer testing tools this with the auto-refreshing of Lambda's that SST provides really makes for a magical testing experience.