イベント履歴
{
"eventVersion": "1.05",
"userIdentity": {
"type": "AssumedRole",
"principalId": "...:yohei-a",
"arn": "arn:aws:sts::234567890123:assumed-role/AdminRole/yohei-a",
"accountId": "234567890123"
},
"eventTime": "2020-04-30T11:08:31Z", ★
"eventSource": "signin.amazonaws.com",
"eventName": "SwitchRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "72.**.***.64",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36",
"requestParameters": null,
"responseElements": {
"SwitchRole": "Success"
},
"additionalEventData": {
"SwitchFrom": "arn:aws:sts::123456789012:assumed-role/Admin/yohei-a",
"RedirectTo": "https://console.aws.amazon.com/console/home"
},
"eventID": "a3a42af4-0c3b-4654-9894-5d618767ee18", ★
"eventType": "AwsConsoleSignIn",
"recipientAccountId": "234567890123"
}
S3 に出力された CloudTrail を確認する
- 同じ日付の CloudTrail ログを S3 からダウンロードする。
$ aws s3 cp --recursive s3://cloudtrail-234567890123-do-not-delete/AWSLogs/234567890123/CloudTrail/us-east-1/2020/04/30/ .
$ find . -name '*.gz' -print0|xargs -0 gunzip
$ find . -name '*.json' -print0|xargs -0 grep -l a3a42af4-0c3b-4654-9894-5d618767ee18
./234567890123_CloudTrail_us-east-1_20200430T1110Z_eP2ntD241s6Psiy1.json
- 234567890123_CloudTrail_us-east-1_20200430T1110Z_eP2ntD241s6Psiy1.json を開く
(中略)
{
"eventVersion": "1.05",
"userIdentity": {
"type": "AssumedRole",
"principalId": "...:yohei-a",
"arn": "arn:aws:sts::234567890123:assumed-role/AdminRole/yohei-a",
"accountId": "234567890123"
},
"eventTime": "2020-04-30T11:08:31Z", ★
"eventSource": "signin.amazonaws.com",
"eventName": "SwitchRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "72.**.***.64",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36",
"requestParameters": null,
"responseElements": {
"SwitchRole": "Success"
},
"additionalEventData": {
"SwitchFrom": "arn:aws:sts::234567890123:assumed-role/Admin/yohei-a",
"RedirectTo": "https://console.aws.amazon.com/console/home"
},
"eventID": "a3a42af4-0c3b-4654-9894-5d618767ee18", ★
"eventType": "AwsConsoleSignIn",
"recipientAccountId": "234567890123"
}
]
}