This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a case where we can't use the SNS messages created by CloudTrail. But we can use events created by S3 when an object is created. This messages look different then the one from CloudTrail but contain all necessary data. So I convert this message to a CloudTrail one and go on.
AWS S3 Event reference: https://docs.aws.amazon.com/AmazonS3/latest/UG/SettingBucketNotifications.html
Example S3 message:
{
"Records": [
{
"eventVersion": "2.0",
"eventSource": "aws:s3",
"awsRegion": "eu-west-1",
"eventTime": "2015-08-27T08:48:40.124Z",
"eventName": "ObjectCreated:Copy",
"userIdentity": {
"principalId": ""
},
"requestParameters": {
"sourceIPAddress": "127.0.0.1"
},
"responseElements": {
"x-amz-request-id": "",
"x-amz-id-2": ""
},
"s3": {
"s3SchemaVersion": "1.0",
"configurationId": "CloudTrailAdded",
"bucket": {
"name": "MyCloudTrailLogs",
"ownerIdentity": {
"principalId": ""
},
"arn": "arn:aws:s3:::MyCloudTrailLogs"
},
"object": {
"key": "AWSLogs//CloudTrail/eu-west-1/2015/08/26/<accountId_CloudTrail_eu-west-1_20150826T0015Z_3HX7CI5fnU0uEUp6.json.gz",
"size": 14358,
"sequencer": "0055DECEE7B29D2D6A"
}
}
}
]
}