I am trying to learn and play a bit with aws serevices. I want to create a rule in the eventbridge that would simply lanch a lambda function when an rds database instance is started.
Here is the rule I use:
{
"version": "0",
"detail-type": "RDS DB Instance Event",
"source": "aws.rds",
"region": "eu-south-2",
"resources": ["XXX"],
"detail": {
"EventCategories": ["notification"],
"SourceType": "DB_INSTANCE",
"SourceArn": "XXX",
"Message": "DB instance started.",
"EventID": "RDS-EVENT-0088"
}
}
I get an error "Event pattern is not valid. Reason: "version" must be an object or an array at... " I guess it is a formating error, but literally can't figure it out... I'm just passing a string. When I try to test the pattern from the official documentation I get the same error.
It is probably something very stupid, but I would greatly appreciate your help.
Your rule is wrong.
This is the not the rule but an example of event which will be matched by rule.
You can actually create a rule by doing the following:-
go to eventbridge , create rule
select event source as aws
choose sample events type as enter my own and enter the below mentioned event ( this is the event which is generated when instance is started as per title of questions). to check other event id, follow docs
0088 event id is the event when rds instance is started
{
"version": "0",
"id": "68f6e973-1a0c-d37b-f2f2-94a7f62ffd4e",
"detail-type": "RDS DB Instance Event",
"source": "aws.rds",
"account": "123456789012",
"time": "2018-09-27T22:36:43Z",
"region": "us-east-1",
"resources": ["arn:aws:rds:us-east-1:123456789012:db:mysql-instance-2018-10-06-12-24"],
"detail": {
"EventCategories": ["failover"],
"SourceType": "DB_INSTANCE",
"SourceArn": "arn:aws:rds:us-east-1:123456789012:db:mysql-instance-2018-10-06-12-24e",
"Date": "2018-09-27T22:36:43.292Z",
"SourceIdentifier": "rds:mysql-instance-2018-10-06-12-24",
"Message": "A Multi-AZ failover has completed.", // Message would be something else
"EventID": "RDS-EVENT-0088"
}
}
create a custom pattern and use the following json.
{
"source": ["aws.rds"],
"detail-type": ["RDS DB Instance Event"],
"detail": {
"EventID": ["RDS-EVENT-0088"]
}
}
If you test this rule, for the event above mentioned it will match.
how to find sample event [ as per comments ]