I'd like to run a Lambda task on a fixed schedule, with some configuration passed into it by the CloudWatch Scheduled Event that triggers the task. Looking at the documentation here, I can see that Cloudwatch Scheduled Events look like this:
{
"id": "53dc4d37-cffa-4f76-80c9-8b7d4a4d2eaa",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "123456789012",
"time": "2015-10-08T16:53:06Z",
"region": "us-east-1",
"resources": [ "arn:aws:events:us-east-1:123456789012:rule/MyScheduledRule" ],
"detail": {}
}
My Lambda task is written in Go, and I can see that event.CloudWatchEvent
lets me access the JSON in the event's detail
field, but I can't figure out how to create a Cloudwatch Scheduled Event rule with some custom detail. Any thoughts?