Skip to content

Instantly share code, notes, and snippets.

@moonape1226
Last active February 24, 2023 15:01
Show Gist options
  • Save moonape1226/a5cad88aa6564f18a024e6ac1a66adb1 to your computer and use it in GitHub Desktop.
Save moonape1226/a5cad88aa6564f18a024e6ac1a66adb1 to your computer and use it in GitHub Desktop.
S3 bucket policy for storing AWS NLB access log
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSLogDeliveryWrite",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${bucket_name}/prefix/AWSLogs/${your_account_id}/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
},
{
"Sid": "AWSLogDeliveryAclCheck",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:GetBucketAcl",
"Resource": "arn:aws:s3:::${bucket_name}"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment