Skip to content

Instantly share code, notes, and snippets.

@moonape1226
Last active February 24, 2023 15:08
Show Gist options
  • Save moonape1226/96f9191ec8933d6b6964e61e6d5f3521 to your computer and use it in GitHub Desktop.
Save moonape1226/96f9191ec8933d6b6964e61e6d5f3521 to your computer and use it in GitHub Desktop.
S3 bucket policy for storing AWS ALB access log
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::${aws_elb_account_id}:root"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${bucket_name}/prefix/AWSLogs/${your_account_id}/*"
},
{
"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"
}
}
},
{
"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