
Use AWS CLI to create Amazon EventBridge Rules with schedule expressions and configure retry policies (MaximumRetryAttempts & MaximumEventAgeInSeconds) targeting AWS Lambda
aws events put-rule to create a scheduled rule and aws events put-targets to attach a Lambda target with a configured retry policy that controls MaximumRetryAttempts (0-185) and MaximumEventAgeInSeconds (60-86400) to handle failed invocations.aws events put-rule \
--name "retry-rule-test" \
--schedule-expression "rate(5 minutes)" \
--state ENABLED \
--description "Runs every 5 minutes with retry policy" \
&& \
aws events put-targets \
--rule "retry-rule-test" \
--event-bus-name "default" \
--targets "$(cat <<EOF
[
{
"Id": "my-target-id",
"Arn": "<LAMBDA_ARN>",
"RetryPolicy": {
"MaximumRetryAttempts": 3,
"MaximumEventAgeInSeconds": 3600
}
}
]
EOF
)"