本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
登錄和監控 AWS Organizations
最佳實務是應該監控您的組織,以確保所做的變更都會記錄。這有助於您確保可以調查任何未預期的變更,並且可以復原不想要的變更。 AWS Organizations 目前支援兩 AWS 服務 種方式,可讓您監視組織以及組織內發生的活動。
記錄 AWS Organizations API呼叫 AWS CloudTrail
AWS Organizations 與 (提供中的使用者 AWS CloudTrail、角色或服務所採取的動作記錄) 的 AWS 服務整合 AWS Organizations。 CloudTrail 會擷取 AWS Organizations as 事件的所有API呼叫,包括來自 AWS Organizations 主控台的呼叫,以及從 AWS Organizations APIs. 如果您建立追蹤,您可以啟用持續交付 CloudTrail 事件到 Amazon S3 儲存貯體,包括 AWS Organizations. 如果您未設定追蹤,您仍然可以在 [事件歷程記錄] 中檢視 CloudTrail 主控台中最近的事件。使用收集的資訊 CloudTrail,您可以判斷提出的要求 AWS Organizations、提出的 IP 位址、製作人員、製作時間以及其他詳細資訊。
若要進一步了解 CloudTrail,請參閱使AWS CloudTrail 用者指南。
重要
您 AWS Organizations 只能檢視美國東部 (維吉尼亞北部) 區域的所有 CloudTrail 資訊。如果 CloudTrail 主機沒有看到您的 AWS Organizations 活動,請使用右上角的選單將主機設定為美國東部 (維吉尼亞北部)。如果您 CloudTrail 使用 AWS CLI 或SDK工具進行查詢,請將查詢導向至美國東部 (維吉尼亞北部) 端點。
AWS Organizations 中的資訊 CloudTrail
CloudTrail 在您創建帳戶 AWS 帳戶 時啟用。當活動發生在中時 AWS Organizations,該活動會與事件歷史記錄中的其他 AWS 服務 CloudTrail 事件一起記錄在事件中。您可以查看,搜索和下載最近的事件 AWS 帳戶。如需詳細資訊,請參閱檢視具有事 CloudTrail 件記錄的事件。
如需您 AWS 帳戶帳戶中正在進行事件的記錄 (包含 AWS Organizations的事件),請建立追蹤。追蹤可 CloudTrail 將日誌檔交付到 Amazon S3 儲存貯體。在您的中啟用記 CloudTrail 錄時 AWS 帳戶,對 AWS Organizations 動作進行的API呼叫會在記 CloudTrail 錄檔中追蹤,而這些呼叫會與其他 AWS 服務記錄一起寫入。您可以設定其他, AWS 服務 以進一步分析 CloudTrail 記錄中收集的事件資料並採取行動。如需詳細資訊,請參閱下列內容:
所有 AWS Organizations 動作均由記錄, CloudTrail 並將其記錄在「AWS Organizations API參考」中。例如,呼叫 CreateAccount
(包括CreateAccountResult
事件)、ListHandshakesForAccount
CreatePolicy
、並在 CloudTrail 記錄檔中InviteAccountToOrganization
產生項目。
每個日誌項目都會包含產生要求之人員的資訊。日誌記錄中的使用者身分資訊,可協助您判斷下列事項:
如需詳細資訊,請參閱CloudTrail userIdentity 元素。
瞭解 AWS 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
AWS Organizations 可以與 Amazon(以前的 Amazon EventBridge E CloudWatch vents)合作,以在組織中發生管理員指定的動作時引發事件。例如,由於這類動作的靈敏度,多數管理員會想要在每次有人在組織中建立新帳戶,或在成員帳戶的管理員嘗試離開組織時收到警告。您可以設定尋找這些動作的 EventBridge 規則,然後將產生的事件傳送至管理員定義的目標。目標可以是一個 Amazon SNS 主題,通過電子郵件或短信其訂閱者。您也可以建立 AWS Lambda 函式,記錄動作的詳細資訊以供日後審閱。
如需說明如何啟用以監視組織中重 EventBridge 要活動的教學課程,請參閱教學課程:使用 Amazon EventBridge 監控您組織的重要變更。
重要
目前僅在美國東部 (維吉尼亞北部) 區域託管 (儘管全球提供)。 AWS Organizations 若要執行本教學課程中的步驟,您必須將設定 AWS Management Console 為使用該區域。
要進一步了解 EventBridge,包括如何設定和啟用它,請參閱 Amazon EventBridge 使用者指南。