I need to plan a task in AWS CloudWatch events so that it runs once every two days. I'm trying to use the expression below, but I keep receiving the message that ScheduleExpression is not acceptable.
cron(0 0 */2 * ? *)
Java code is attached below:
String cronExpression = "cron(0 0 */2 * ? *)"
PutRuleRequest request = new PutRuleRequest();
request
.withName(eventName)
.withRoleArn("arn:aws:iam::****")
.withScheduleExpression(cronExpression)
.withState(RuleState.ENABLED);
PutRuleResult result = cloudwatchConfig.cloudwatch().putRule(request);