本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 監控 Data Lifecycle Manager 政策 EventBridge
Amazon EBS和 Amazon Data Lifecycle Manager 會發出與生命週期政策動作相關的事件。您可以使用 AWS Lambda 和 Amazon CloudWatch Events 以程式設計方式處理事件通知。盡可能發出事件。如需詳細資訊,請參閱 Amazon CloudWatch Events 使用者指南 。
可用的事件如下:
注意
AMI 生命週期政策動作不會發出任何事件。
-
createSnapshot
—CreateSnapshot
動作成功或失敗時發出的 Amazon EBS事件。如需詳細資訊,請參閱Amazon Amazon EventBridge 活動 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": "" } }