Get details of S3 requests

0

Hi, I was suprised to discover that I already reached the free tier of S3 request which is 20.000 request. How can I check the details of these requests, like IP of requester, date/time of requests etc? I tried to find the way to do it through Athena and Cloud Trail but without any success.

Thanks for your reply and help.

Farid
asked 5 months ago231 views
2 Answers
0

Hello.

To check events such as putobject in S3, you need to configure CloudTrail to record data events.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-cloudtrail-logging-for-s3.html

Although you cannot view the API history, I think enabling S3 access logs is a good way to understand the number of requests to a certain extent.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html

However, these settings can only be recorded from the day they are enabled, so you cannot check past request history.

profile picture
EXPERT
answered 5 months ago
0

Hi @Riku

I enabled server access log but after this I'm getting a lot of log files with similar informations inside of them...Enter image description hereEnter image description here

Not sure to get all API calls.

I followed policy below which seems to log only put request:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "S3ServerAccessLogsPolicy",
            "Effect": "Allow",
            "Principal": {
                "Service": "logging.s3.amazonaws.com"
            },
            "Action": [
                "s3:PutObject"
            ],
            "Resource": "arn:aws:s3:::DOC-EXAMPLE-DESTINATION-BUCKET/EXAMPLE-LOGGING-PREFIX*",
            "Condition": {
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:s3:::DOC-EXAMPLE-SOURCE-BUCKET"
                },
                "StringEquals": {
                    "aws:SourceAccount": "SOURCE-ACCOUNT-ID"
                }
            }
        }
    ]
}
Farid
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions