I am using cloudwatch scheduled event to trigger my lambda function after specific time interval. I would like to use cloud-formation template to add this rule in cloudwatch. I have gone through cloudformation templates documentation but I am not able to find out way to configure events using cloud formation template. Can anyone please suggest how to implement it using cloud formation template.
I am using below template.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Provision environment specific",
"Resources": {
"lambdaScheduler": {
"Type": "AWS::CloudWatch::Event",
"Properties": {
"detail-type": "Scheduled Event",
"source": "aws.events",
"name": "TEST_EVENT_10_MINS_RULE",
"schedule-expression": "rate(5 minutes)"
}
}
}
}
I am getting A client error (ValidationError) occurred when calling the ValidateTemplate operation: Template format error: Unrecognized resource type: AWS::CloudWatch::Event
error message when I validate it using aws cli.
The following steps are needed to create a CloudWatch dashboard with a custom resource. Create a CloudFormation template and add a Lambda-backed custom resource. Write the code creating, updating, and deleting a CloudWatch dashboard. Generate the JSON code describing the customized dashboard.
To enable CloudWatch logs for an ApiGateway Stage using CloudFormation for every method call to your API, you need to set the DataTraceEnabled property to true for all methods in your AWS::ApiGateway::Stage resource.
Use the AWS CloudFormation console to monitor the status of your AWS CloudFormation stack and detect if stack creation fails. The ArcGIS for Server web GIS templates also create logs, which are copied to a CloudWatch log group, to help you troubleshoot issues.
Adding CloudWatch event rules and schedules in now available, see https://aws.amazon.com/about-aws/whats-new/2016/04/amazon-cloudwatch-events-now-supported-in-aws-cloudformation-templates/
I am pretty sure the CloudWatch Event is yet to be exposed via the CloudFormation API. There is normally some lag between new features in AWS and them being implemented/exposed by the CloudFormation team.
Here is the list of resources currently available via CloudFormation. http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
As one can see there is only one resource in the Cloudwatch namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With