本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用记录 AWS Backup API通话 CloudTrail
AWS Backup 与AWS CloudTrail提供用户、角色或服务所执行操作记录的 AWS 服务 服务集成。 CloudTrail 将所有API呼叫捕获 AWS Backup 为事件。捕获的调用包括来自 AWS Backup 控制台的调用和对 AWS Backup API操作的代码调用。使用收集的信息 CloudTrail,您可以确定向哪个请求发出 AWS Backup、发出请求的 IP 地址、发出请求的时间以及其他详细信息。
每个事件或日记账条目都包含有关生成请求的人员信息。身份信息有助于您确定以下内容:
-
请求是使用根用户凭证还是用户凭证发出的。
-
请求是否代表IAM身份中心用户发出。
-
请求是使用角色还是联合用户的临时安全凭证发出的。
-
请求是否由其他 AWS 服务发出。
CloudTrail 在您创建账户 AWS 账户 时在您的账户中处于活动状态,并且您自动可以访问 CloudTrail 活动历史记录。 CloudTrail 事件历史记录提供了过去 90 天中记录的管理事件的可查看、可搜索、可下载且不可变的记录。 AWS 区域有关更多信息,请参阅《AWS CloudTrail 用户指南》中的 “使用 CloudTrail 事件历史记录”。查看活动历史记录不 CloudTrail收取任何费用。
要持续记录 AWS 账户 过去 90 天内的事件,请创建跟踪或 CloudTrailLake 事件数据存储。
- CloudTrail 步道
-
跟踪允许 CloudTrail 将日志文件传输到 Amazon S3 存储桶。使用创建的所有跟踪 AWS Management Console 都是多区域的。您可以通过使用 AWS CLI创建单区域或多区域跟踪。建议创建多区域跟踪,因为您可以捕获账户 AWS 区域 中的所有活动。如果您创建单区域跟踪,则只能查看跟踪的 AWS 区域中记录的事件。有关跟踪的更多信息,请参阅《AWS CloudTrail 用户指南》中的为您的 AWS 账户创建跟踪和为组织创建跟踪。
通过创建跟踪,您可以免费将正在进行的管理事件的一份副本传送到您的 Amazon S3 存储桶,但是,会收取 Amazon S3 存储费用。 CloudTrail 有关 CloudTrail 定价的更多信息,请参阅AWS CloudTrail 定价
。有关 Amazon S3 定价的信息,请参阅 Amazon S3 定价 。 - CloudTrail 湖泊事件数据存储
-
CloudTrail Lak e 允许您对事件进行SQL基于查询的操作。 CloudTrail Lake 将基于行的格式的现有事件转换为 Apache JSON ORC
格式。ORC是一种列式存储格式,已针对快速检索数据进行了优化。事件将被聚合到事件数据存储中,它是基于您通过应用高级事件选择器选择的条件的不可变的事件集合。应用于事件数据存储的选择器用于控制哪些事件持续存在并可供您查询。有关 CloudTrail Lake 的更多信息,请参阅AWS CloudTrail 用户指南中的使用 AWS CloudTrail Lake。 CloudTrail 湖泊事件数据存储和查询会产生费用。创建事件数据存储时,您可以选择要用于事件数据存储的定价选项。定价选项决定了摄取和存储事件的成本,以及事件数据存储的默认和最长保留期。有关 CloudTrail 定价的更多信息,请参阅AWS CloudTrail 定价
。
AWS Backup 中的事件 CloudTrail
AWS Backup 在执行备份、恢复、复制或通知时生成这些 CloudTrail 事件。这些事件不一定是由 AWS Backup 公众使用产生的APIs。有关更多信息,请参阅《AWS CloudTrail 用户指南》中的AWS 服务 事件。
-
BackupDeleted
-
BackupJobCompleted
-
BackupJobStarted
-
BackupSelectionDeletedDueToSLRDeletion
-
BackupTransitionedToCold
-
CopyJobCompleted
-
CopyJobStarted
-
ReportJobCompleted
-
ReportJobStarted
-
RestoreCompleted
-
RestoreStarted
-
PutBackupVaultNotifications
了解 AWS Backup 日志文件条目
跟踪是一种配置,允许将事件作为日志文件传输到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。事件代表来自任何来源的单个请求,包括有关请求的操作、操作的日期和时间、请求参数等的信息。 CloudTrail 日志文件不是公共API调用的有序堆栈跟踪,因此它们不会按任何特定的顺序出现。
以下示例显示了一个演示StartBackupJob
、StartRestoreJob
、和DeleteRecoveryPoint
操作以及BackupJobCompleted
事件的 CloudTrail 日志条目。
{ "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T13:45:24Z", "eventSource": "backup.amazonaws.com", "eventName": "StartBackupJob", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "backupVaultName": "Default", "resourceArn": "arn:aws:ec2:us-east-1:123456789012:volume/vol-00a422a05b9c6asd3", "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "startWindowMinutes": 60 }, "responseElements": { "backupJobId": "8a3c2a87-b23e-4d56-b045-fa9e88ede4e6", "creationDate": "Jan 10, 2019 1:45:24 PM" }, "requestID": "98cf4d59-8c76-49f7-9201-790743931234", "eventID": "fe8146a5-7812-4a95-90ad-074498be1234", "eventType": "AwsApiCall", "recipientAccountId": "account-id" }, { "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T13:49:50Z", "eventSource": "backup.amazonaws.com", "eventName": "StartRestoreJob", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-00a129455bdbc9d99", "metadata": { "volumeType": "gp2", "availabilityZone": "us-east-1b", "volumeSize": "100" }, "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "idempotencyToken": "a9c8b4fb-d369-4a58-944b-942e442a8fe3", "resourceType": "EBS" }, "responseElements": { "restoreJobId": "9808E090-8C76-CCB8-4CEA-407CF6AC4C43" }, "requestID": "783ddddc-6d7e-4539-8fab-376aa9668543", "eventID": "ff35ddea-7577-4aec-a132-964b7e9dd423", "eventType": "AwsApiCall", "recipientAccountId": "account-id" }, { "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T14:52:42Z", "eventSource": "backup.amazonaws.com", "eventName": "DeleteRecoveryPoint", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "backupVaultName": "Default", "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-05f426fd9daab3433" }, "responseElements": null, "requestID": "f1f1b33a-48da-436c-9a8f-7574f1ab5fd7", "eventID": "2dd70080-5aba-4a79-9a0f-92647c9f0846", "eventType": "AwsApiCall", "recipientAccountId": "account-id" }, { "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "backup.amazonaws.com" }, "eventTime": "2019-01-10T08:24:39Z", "eventSource": "backup.amazonaws.com", "eventName": "BackupJobCompleted", "awsRegion": "us-east-1", "sourceIPAddress": "backup.amazonaws.com", "userAgent": "backup.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "2e7e4fcf-0c52-467f-9fd0-f61c2fcf7d17", "eventType": "AwsServiceEvent", "recipientAccountId": "account-id", "serviceEventDetails": { "completionDate": { "seconds": 1547108091, "nanos": 906000000 }, "state": "COMPLETED", "percentDone": 100, "backupJobId": "8A8E738B-A8C5-E058-8224-90FA323A3C0E", "backupVaultName": "BackupVault", "backupVaultArn": "arn:aws:backup:us-east-1:123456789012:backup-vault:BackupVault", "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-07ce8c3141d361233", "resourceArn": "arn:aws:ec2:us-east-1:123456789012:volume/vol-06692095a6a421233", "creationDate": { "seconds": 1547101638, "nanos": 272000000 }, "backupSizeInBytes": 8589934592, "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "resourceType": "EBS" } }
记录跨账户管理事件
使用 AWS Backup,您可以管理AWS Organizations结构 AWS 账户 内所有内容的备份。 AWS Backup 当您创建、更新或删除 AWS Organizations 备份策略(将备份计划应用于您的成员帐户)或存在无效的组织备份计划时,会在您的成员帐户中生成以下 CloudTrail 事件:
-
CreateOrganizationalBackupPlan
-
UpdateOrganizationalBackupPlan
-
DeleteOrganizationalBackupPlan
-
InvalidOrganizationBackupPlan
示例:用于跨账户管理的 AWS Backup 日志文件条目
跟踪是一种配置,允许将事件作为日志文件传输到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。事件代表来自任何来源的单个请求,包括有关请求的操作、操作的日期和时间、请求参数等的信息。 CloudTrail 日志文件不是公共API调用的有序堆栈跟踪,因此它们不会按任何特定的顺序出现。
以下示例显示了演示该CreateOrganizationalBackupPlan
操作的 CloudTrail 日志条目。
{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "backup.amazonaws.com"}, "eventTime": "2020-06-02T00:34:00Z", "eventSource": "backup.amazonaws.com", "eventName": "CreateOrganizationalBackupPlan", "awsRegion": "ca-central-1", "sourceIPAddress": "backup.amazonaws.com", "userAgent": "backup.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "f2642255-af77-4203-8c37-7ca19d898e84", "readOnly": false, "eventType": "AwsServiceEvent", "recipientAccountId": "account-id", "serviceEventDetails": { "backupPlanId": "orgs/544033d1-b19c-3f2a-9c20-40bcfa82ca68", "backupPlanVersionId": "ZTA1Y2ZjZDYtNmRjMy00ZTA1LWIyNTAtM2M1NzQ4OThmNzRj", "backupPlanArn": "arn:aws:backup:ca-central-1:123456789012:backup-plan:orgs/544033d1-b19c-3f2a-9c20-40bcfa82ca68", "backupPlanName": "mybackupplan", "backupRules": "[{\"id\":\"745fd0ea-7f57-3f35-8a0e-ed4b8c48a8e2\",\"name\":\"hourly\",\"description\":null,\"cryopodArn\":\"arn:aws:backup:ca-central-1:123456789012:backup-vault:ControllerCAMTestBackupVault\",\"scheduleExpression\":\"cron(0 0/1 ? * * *)\",\"startWindow\":\"PT1H\",\"completionWindow\":\"PT2H\",\"lifecycle\":{\"moveToColdStorageAfterDays\":null,\"deleteAfterDays\":\"7\"},\"tags\":null,\"copyActions\":[]}]", "backupSelections": "[{\"name\":\"selectiondatatype\",\"arn\":\"arn:aws:backup:ca-central-1:123456789012:selection:8b40c6d9-3641-3d49-926d-a075ea715686\",\"role\":\"arn:aws:iam::123456789012:role/OrganizationmyRoleTestRole\",\"resources\":[],\"notResources\":[],\"conditions\":[{\"type\":\"STRINGEQUALS\",\"key\":\"dataType\",\"value\":\"PII\"},{\"type\":\"STRINGEQUALS\",\"key\":\"dataType\",\"value\":\"RED\"}],\"creationDate\":\"2020-06-02T00:34:00.695Z\",\"creatorRequestId\":null}]", "creationDate": { "seconds": 1591058040, "nanos": 695000000 }, "organizationId": "org-id", "accountId": "123456789012" } }
以下示例显示了演示该DeleteOrganizationalBackupPlan
操作的 CloudTrail 日志条目。
{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "backup.amazonaws.com" }, "eventTime": "2020-06-02T00:34:25Z", "eventSource": "backup.amazonaws.com", "eventName": "DeleteOrganizationalBackupPlan", "awsRegion": "ca-central-1", "sourceIPAddress": "backup.amazonaws.com", "userAgent": "backup.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "5ce66cd0-b90c-4957-8e00-96ea1077b4fa", "readOnly": false, "eventType": "AwsServiceEvent", "recipientAccountId": "account-id", "serviceEventDetails": { "backupPlanId": "orgs/544033d1-b19c-3f2a-9c20-40bcfa82ca68", "backupPlanVersionId": "ZTA1Y2ZjZDYtNmRjMy00ZTA1LWIyNTAtM2M1NzQ4OThmNzRj", "backupPlanArn": "arn:aws:backup:ca-central-1:123456789012:backup-plan:orgs/544033d1-b19c-3f2a-9c20-40bcfa82ca68", "backupPlanName": "mybackupplan", "deletionDate": { "seconds": 1591058065, "nanos": 519000000 }, "organizationId": "org-id", "accountId": "123456789012" } }
以下示例显示了一个演示该事件的 CloudTrail 日志条目InvalidOrganizationBackupPlan
,该条目是在 AWS Backup 收到来自 Organizations 的无效备份计划时发送的。
{ "eventVersion": "1.08", "userIdentity": { "accountId": "123456789012", "invokedBy": "backup.amazonaws.com" }, "eventTime": "2022-06-11T13:29:23Z", "eventSource": "backup.amazonaws.com", "eventName": "InvalidOrganizationBackupPlan", "awsRegion": "Region", "sourceIPAddress": "backup.amazonaws.com", "userAgent": "backup.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "ab1de234-fg56-7890-h123-45ij678k9l01", "readOnly": false, "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "987654321098", "serviceEventDetails": { "effectivePolicyVersion": 7, "effectivePolicyId": "12345678-a9b0-123c-45d6-78e901f23456", "lastUpdatedTimestamp": "Jun 11, 2022 1:29:22 PM", "policyType": "BACKUP_POLICY", "effectiveBackupPlan": { "logicalName": "logical-name", "regions": [ "Region" ], "rules": [ { "name": "test-orgs", "targetBackupVaultName": "vault-name", "ruleLifecycle": { "deleteAfterDays": 100 }, "copyActions": [], "enableContinuousBackup": true } ], "selections": { "tagSelections": [ { "selectionName": "selection-name", "iamRoleArn": "arn:aws:iam::$account:role/role", "targetedTags": [ { "tagKey": "key", "tagValue": "value" } ] } ] }, "backupPlanTags": { "key": "value" } }, "organizationId": "org-id", "accountId": "123456789012" }, "eventCategory": "Management" }