cron - 如何为每个季度添加 CloudWatch 计划事件规则?
问题描述
我正在尝试设置将在每年每个季度运行的 CloudWatch 计划事件规则。但我收到了这个错误
"Parameter ScheduleExpression is not valid".
我尝试遵循 Cron 表达式
cron(0 0 1 */3 * ?)
cron(0 0 1 */3 ? *)
但不工作。有人可以帮忙吗?
解决方案
根据AWS 文档
您不能在 Day-of-month 和 Day-of-week 字段中都使用 *。如果你在一个中使用它,你必须使用 ? 在另一个。
此外,年份字段不支持?
通配符,因此您的第一个表达式无效。
第二个有效:
aws events put-rule --schedule-expression "cron(0 0 1 */3 ? *)" --name so-test1
{
"RuleArn": "arn:aws:events:eu-west-1:3333:rule/so-test1"
}
右括号后有空格吗?那个标记为对我无效
aws events put-rule --schedule-expression "cron(0 0 1 */3 ? *) " --name so-test1
An error occurred (ValidationException) when calling the PutRule operation: Parameter ScheduleExpression is not valid.
推荐阅读
- angular - 在两个不同组件中具有相同行为的按钮
- c++ - C ++中堆栈上的对象 - 面试问题
- android - 当应用程序在 Oreo 上终止时,服务未在后台运行
- javascript - 地图内的模态反应
- php - instagram BOT中socks4和http-s代理的区别
- string - 为什么 GDB 认为我的 Fortran 字符串是 ~4GiB
- javascript - Transpile forEach, map, filter and for of to length based for loop in JavaScript
- python - Flask-SQLAlchemy 'NoForeignKeysError'
- arm - 为什么 -marm 选项仍然会生成拇指指令?
- reactjs - 从状态变量读取时反应 lint 警告 react-hooks/exhaustive-deps