Amazon Organizations 中的日志记录和监控 - Amazon Organizations
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

Amazon Organizations 中的日志记录和监控

您应对组织进行监控,确保对所做的更改进行记录,这是最佳实践。这有助于确保能够调查任何意外的更改,并回滚不需要的更改。Amazon Organizations 目前支持两种 Amazon 服务,帮您监控组织和组织内部的活动。

使用 Amazon Organizations 记录 Amazon CloudTrail API 调用

Amazon Organizations 与 Amazon CloudTrail 集成,后者是在 Amazon 中记录用户、角色或 Amazon Organizations 服务所执行操作的服务。CloudTrail 将对 Amazon Organizations 的所有 API 调用均作为事件捕获,包括来自 Amazon Organizations 控制台的调用和对 Amazon Organizations API 的代码调用。如果您创建跟踪记录,则可以使 CloudTrail 事件持续传送到 Amazon S3 存储桶(包括 Amazon Organizations 的事件)。如果您不配置跟踪记录,则仍可在 CloudTrail 控制台中的事件历史记录中查看最新事件。使用 CloudTrail 收集的信息,您可以确定向 Amazon Organizations 发出了什么请求、发出请求的 IP 地址、何人发出的请求、请求的发出时间以及其他详细信息。

要了解有关 CloudTrail 的更多信息,请参阅《Amazon CloudTrail用户指南》。

重要

您只能在美国东部(弗吉尼亚北部)区域查看 Amazon Organizations 的所有 CloudTrail 信息。如果无法在 CloudTrail 控制台中看到您的 Amazon Organizations 活动,请使用右上角的菜单将控制台设为美国东部(弗吉尼亚北部)。如果您使用 Amazon CLI 或开发工具包工具查询 CloudTrail,请将您的查询引至美国东部(弗吉尼亚北部)终端节点。

CloudTrail 中的 Amazon Organizations 信息

在您创建 Amazon Web Services 账户时,将在该账户上启用 CloudTrail。当 Amazon Organizations 中发生活动时,该活动将记录在 CloudTrail 事件中,并与其他 Amazon 服务事件一同保存在 Event history(事件历史记录)中。您可以在 Amazon Web Services 账户中查看、搜索和下载最新事件。有关更多信息,请参阅使用 CloudTrail 事件历史记录查看事件

对于Amazon Web Services 账户中的事件的持续记录(包括 Amazon Organizations 的事件),请创建跟踪记录。通过跟踪记录,CloudTrail 可将日志文件传送至 Amazon S3 桶。在您的Amazon Web Services 账户中启用了 CloudTrail 日志记录时,对 Amazon Organizations 操作的 API 调用在 CloudTrail 日志文件中跟踪,它们随其他Amazon服务记录一起写入到这些文件中。您可以配置其他Amazon服务,进一步分析在 CloudTrail 日志中收集的事件数据并采取措施。有关更多信息,请参阅下列内容:

CloudTrail 记录所有 Amazon Organizations 操作,Amazon Organizations API 参考中介绍了这些操作。例如,对 CreateAccount(包括 CreateAccountResult 事件)、ListHandshakesForAccountCreatePolicyInviteAccountToOrganization 的调用将在 CloudTrail 日志文件中生成条目。

每个日志条目都包含有关生成请求的人员的信息。日志条目中的用户身份信息可帮助您确定以下内容:

  • 请求是使用根用户凭证还是 IAM 用户凭证发出的

  • 请求是使用 IAM 角色还是联合身份用户的临时安全凭证发出的

  • 请求是否由其它 Amazon 服务发出

有关更多信息,请参阅 CloudTrail userIdentity 元素

了解 Amazon Organizations 日志文件条目

跟踪是一种配置,可用于将事件作为日志文件传送到您指定的 Amazon S3 存储桶。CloudTrail 日志文件包含一个或多个日志条目。一个事件表示来自任何源的一个请求,包括有关所请求的操作、操作的日期和时间、请求参数等方面的信息。CloudTrail 日志文件不是公用 API 调用的有序堆栈跟踪,因此它们不会按任何特定顺序显示。

示例日志条目:CloseAccount

以下示例显示了示例 CloseAccount 调用的 CloudTrail 日志条目,该调用是在调用 API 和关闭账户的工作流开始在后台处理时生成的。

{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAMVNPBQA3EXAMPLE:my-admin-role", "arn": "arn:aws:sts::111122223333:assumed-role/my-admin-role/my-session-id", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDAMVNPBQA3EXAMPLE", "arn": "arn:aws:iam::111122223333:role/my-admin-role", "accountId": "111122223333", "userName": "my-session-id" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2022-03-18T18:17:06Z" } } }, "eventTime": "2022-03-18T18:17:06Z", "eventSource": "organizations.amazonaws.com", "eventName": "CloseAccount", "awsRegion": "us-east-1", "sourceIPAddress": "192.168.0.1", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...", "requestParameters": { "accountId": "555555555555" }, "responseElements": null, "requestID": "e28932f8-d5da-4d7a-8238-ef74f3d5c09a", "eventID": "19fe4c10-f57e-4cb7-a2bc-6b5c30233592", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }

以下示例显示了在后台关闭账户的工作流成功完成后,CloseAccountResult 调用的 CloudTrail 日志条目。

{ "eventVersion": "1.08", "userIdentity": { "accountId": "111122223333", "invokedBy": "organizations.amazonaws.com" }, "eventTime": "2022-03-18T18:17:06Z", "eventSource": "organizations.amazonaws.com", "eventName": "CloseAccountResult", "awsRegion": "us-east-1", "sourceIPAddress": "organizations.amazonaws.com", "userAgent": "organizations.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "readOnly": false, "eventType": "AwsServiceEvent", "readOnly": false, "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "111122223333", "serviceEventDetails": { "closeAccountStatus": { "accountId": "555555555555", "state": "SUCCEEDED", "requestedTimestamp": "Mar 18, 2022 6:16:58 PM", "completedTimestamp": "Mar 18, 2022 6:16:58 PM" } }, "eventCategory": "Management" }

示例日志条目:CreateAccount

以下示例显示了一个示例 CreateAccount 调用的 CloudTrail 日志条目,该调用是在调用 API 和创建账户的工作流开始在后台处理时生成的。

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AIDAMVNPBQA3EXAMPLE:my-admin-role", "arn": "arn:aws:sts::111122223333:assumed-role/my-admin-role/my-session-id", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDAMVNPBQA3EXAMPLE", "arn": "arn:aws:iam::111122223333:role/my-admin-role", "accountId": "111122223333", "userName": "my-session-id" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-09-16T21:16:45Z" } } }, "eventTime": "2018-06-21T22:06:27Z", "eventSource": "organizations.amazonaws.com", "eventName": "CreateAccount", "awsRegion": "us-east-1", "sourceIPAddress": "192.168.0.1", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...", "requestParameters": { "tags": [], "email": "****", "accountName": "****" }, "responseElements": { "createAccountStatus": { "accountName": "****", "state": "IN_PROGRESS", "id": "car-examplecreateaccountrequestid111", "requestedTimestamp": "Sep 16, 2020 9:20:50 PM" } }, "requestID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "111111111111" }

以下示例显示了在后台创建账户的工作流成功完成后,CreateAccount 调用的 CloudTrail 日志条目。

{ "eventVersion": "1.05", "userIdentity": { "accountId": "111122223333", "invokedBy": "..." }, "eventTime": "2020-09-16T21:20:53Z", "eventSource": "organizations.amazonaws.com", "eventName": "CreateAccountResult", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "....", "requestParameters": null, "responseElements": null, "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "readOnly": false, "eventType": "AwsServiceEvent", "recipientAccountId": "111122223333", "serviceEventDetails": { "createAccountStatus": { "id": "car-examplecreateaccountrequestid111", "state": "SUCCEEDED", "accountName": "****", "accountId": "444455556666", "requestedTimestamp": "Sep 16, 2020 9:20:50 PM", "completedTimestamp": "Sep 16, 2020 9:20:53 PM" } } }

以下示例显示了在 CreateAccount 后台工作流无法创建账户后生成的 CloudTrail 日志条目。

{ "eventVersion": "1.06", "userIdentity": { "accountId": "111122223333", "invokedBy": "AWS Internal" }, "eventTime": "2018-06-21T22:06:27Z", "eventSource": "organizations.amazonaws.com", "eventName": "CreateAccountResult", "awsRegion": "us-east-1", "sourceIPAddress": "AWS Internal", "userAgent": "AWS Internal", "requestParameters": null, "responseElements": null, "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "readOnly": false, "eventType": "AwsServiceEvent", "recipientAccountId": "111122223333", "serviceEventDetails": { "createAccountStatus": { "id": "car-examplecreateaccountrequestid111", "state": "FAILED", "accountName": "****", "failureReason": "EMAIL_ALREADY_EXISTS", "requestedTimestamp": Jun 21, 2018 10:06:27 PM, "completedTimestamp": Jun 21, 2018 10:07:15 PM } } }

示例日志条目:CreateOrganizationalUnit

以下示例演示示例 CreateOrganizationalUnit 调用的一个 CloudTrail 日志条目。

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AIDAMVNPBQA3EXAMPLE", "arn": "arn:aws:iam::111111111111:user/diego", "accountId": "111111111111", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "diego" }, "eventTime": "2017-01-18T21:40:11Z", "eventSource": "organizations.amazonaws.com", "eventName": "CreateOrganizationalUnit", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36", "requestParameters": { "name": "OU-Developers-1", "parentId": "r-a1b2" }, "responseElements": { "organizationalUnit": { "arn": "arn:aws:organizations::111111111111:ou/o-aa111bb222/ou-examplerootid111-exampleouid111", "id": "ou-examplerootid111-exampleouid111", "name": "test-cloud-trail" } }, "requestID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "111111111111" }

示例日志条目:InviteAccountToOrganization

以下示例演示示例 InviteAccountToOrganization 调用的一个 CloudTrail 日志条目。

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AIDAMVNPBQA3EXAMPLE", "arn": "arn:aws:iam::111111111111:user/diego", "accountId": "111111111111", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "diego" }, "eventTime": "2017-01-18T21:41:17Z", "eventSource": "organizations.amazonaws.com", "eventName": "InviteAccountToOrganization", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36", "requestParameters": { "notes": "This is a request for Mary's account to join Diego's organization.", "target": { "type": "ACCOUNT", "id": "111111111111" } }, "responseElements": { "handshake": { "requestedTimestamp": "Jan 18, 2017 9:41:16 PM", "state": "OPEN", "arn": "arn:aws:organizations::111111111111:handshake/o-aa111bb222/invite/h-examplehandshakeid111", "id": "h-examplehandshakeid111", "parties": [ { "type": "ORGANIZATION", "id": "o-aa111bb222" }, { "type": "ACCOUNT", "id": "222222222222" } ], "action": "invite", "expirationTimestamp": "Feb 2, 2017 9:41:16 PM", "resources": [ { "resources": [ { "type": "MASTER_EMAIL", "value": "diego@example.com" }, { "type": "MASTER_NAME", "value": "Management account for organization" }, { "type": "ORGANIZATION_FEATURE_SET", "value": "ALL" } ], "type": "ORGANIZATION", "value": "o-aa111bb222" }, { "type": "ACCOUNT", "value": "222222222222" }, { "type": "NOTES", "value": "This is a request for Mary's account to join Diego's organization." } ] } }, "requestID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "111111111111" }

示例日志条目:AttachPolicy

以下示例演示示例 AttachPolicy 调用的一个 CloudTrail 日志条目。该响应指示,在请求尝试附加到的根中,由于请求的策略类型未启用,调用失败。

{ "eventVersion": "1.06", "userIdentity": { "type": "IAMUser", "principalId": "AIDAMVNPBQA3EXAMPLE", "arn": "arn:aws:iam::111111111111:user/diego", "accountId": "111111111111", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "diego" }, "eventTime": "2017-01-18T21:42:44Z", "eventSource": "organizations.amazonaws.com", "eventName": "AttachPolicy", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36", "errorCode": "PolicyTypeNotEnabledException", "errorMessage": "The given policy type ServiceControlPolicy is not enabled on the current view", "requestParameters": { "policyId": "p-examplepolicyid111", "targetId": "ou-examplerootid111-exampleouid111" }, "responseElements": null, "requestID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventID": "EXAMPLE8-90ab-cdef-fedc-ba987EXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "111111111111" }

Amazon EventBridge

Amazon Organizations 可以与 Amazon EventBridge(之前称为 Amazon CloudWatch Events)结合使用,从而在组织中发生管理员指定的操作时生成事件。例如,大多数管理员希望每次在组织中创建新账户时,或成员账户的管理员尝试离开组织时收到提醒,因为这些都是敏感操作。您可以配置 EventBridge 规则来监控这些操作,然后将生成的事件发送到管理员定义的目标。目标可以是 Amazon SNS 主题,向订阅者发送电子邮件或短信。您还可以创建一个 Amazon Lambda 函数,记录操作的详细信息以备稍后查看。

有关如何启用 EventBridge 以监控组织中关键活动的教程,请参阅 教程:使用 Amazon EventBridge 监控对您的组织进行的重要更改

要了解有关 EventBridge 的更多信息,包括如何配置和启用该服务,请参阅《Amazon EventBridge 用户指南》