目标:使用Cloud Custodian,我希望 EC2 实例在每周一早上 CST 早上 7 点停止,并在每周日晚上 11 点开始。(此 EC2 实例每周一将运行 8 小时以执行特定任务,剩余时间应保持关闭)。这将是选择加入政策
有人可以在下面查看我的书面政策。我正在尝试使用基于标签的配置来实现这一点。不知道怎么样?
- name: ec2-off-hours-stop
resource: ec2
comments: |
Stop EC2 instances, every monday morning at 7:00 AM (CST)
filters:
- type: offhour
default_tz: ct
tag: c7n_maid_offhours
opt-out: false
offhour: 7 (How do I mention Monday? off=M,7)
mode:
schedule: "rate(60 minutes)"
type: periodic
execution-options:
output_dir: s3://abcdreports/abcdLogs/{account_id}/
actions:
- stop
- name: ec2-off-hours-start
resource: ec2
comments: |
Start EC2 instances, every sunday night at 11:00 PM (CST)
filters:
- type: onhour
default_tz: ct
tag: c7n_maid_offhours
opt-out: false
onhour: 23 (How do I mention Sunday? on=U,23)
mode:
schedule: "rate(60 minutes)"
type: periodic
execution-options:
output_dir: s3://abcdreports/abcdLogs/{account_id}/
actions:
- start