使用 “ CloudWatch 事件” 监控您的政策 - Amazon EBS

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 “ CloudWatch 事件” 监控您的政策

Amazon EBS 和 Amazon Data Lifecycle Manager 发出与生命周期策略操作相关的事件。您可以使用 AWS Lambda 和 Amazon CloudWatch Events 以编程方式处理事件通知。尽最大努力发出事件。有关更多信息,请参阅 Amazon Ev CloudWatch ents 用户指南

提供的事件如下:

注意

AMI 生命周期策略操作不会触发任何事件。

  • createSnapshot – 当 CreateSnapshot 操作成功或失败时发出的 Amazon EBS 事件。有关更多信息,请参阅 Amazon f EventBridge or Amazon EBS

  • DLM Policy State Change – 当生命周期策略进入错误状态时发出的 Amazon Data Lifecycle Manager 事件。此事件包含有关导致错误的问题的描述。

    下面是在 IAM 角色授予的权限不足时发出的事件的示例。

    { "version": "0", "id": "01234567-0123-0123-0123-0123456789ab", "detail-type": "DLM Policy State Change", source": "aws.dlm", "account": "123456789012", "time": "2018-05-25T13:12:22Z", "region": "us-east-1", "resources": [ "arn:aws:dlm:us-east-1:123456789012:policy/policy-0123456789abcdef" ], "detail": { "state": "ERROR", "cause": "Role provided does not have sufficient permissions", "policy_id": "arn:aws:dlm:us-east-1:123456789012:policy/policy-0123456789abcdef" } }

    下面是在超过限制时发出的事件的示例。

    { "version": "0", "id": "01234567-0123-0123-0123-0123456789ab", "detail-type": "DLM Policy State Change", "source": "aws.dlm", "account": "123456789012", "time": "2018-05-25T13:12:22Z", "region": "us-east-1", "resources": [ "arn:aws:dlm:us-east-1:123456789012:policy/policy-0123456789abcdef" ], "detail":{ "state": "ERROR", "cause": "Maximum allowed active snapshot limit exceeded", "policy_id": "arn:aws:dlm:us-east-1:123456789012:policy/policy-0123456789abcdef" } }
  • DLM Pre Post Script Notification – 前置或后置脚本启动、成功或失败时发出的事件。

    以下是 VSS 备份成功时的示例事件。

    { "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "DLM Pre Post Script Notification", "source": "aws.dlm", "account": "123456789012", "time": "2023-10-27T22:04:52Z", "region": "us-east-1", "resources": ["arn:aws:dlm:us-east-1:123456789012:policy/policy-01234567890abcdef"], "detail": { "script_stage": "", "result": "success", "cause": "", "policy_id": "arn:aws:dlm:us-east-1:123456789012:policy/policy-01234567890abcdef", "execution_handler": "AWS_VSS_BACKUP", "source": "arn:aws:ec2:us-east-1:123456789012:instance/i-01234567890abcdef", "resource_type": "EBS_SNAPSHOT", "resources": [{ "status": "pending", "resource_id": "arn:aws:ec2:us-east-1::snapshot/snap-01234567890abcdef", "source": "arn:aws:ec2:us-east-1:123456789012:volume/vol-01234567890abcdef" }], "request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6", "start_time": "2023-10-27T22:03:29.370Z", "end_time": "2023-10-27T22:04:51.370Z", "timeout_time": "" } }