Skip to content

Instantly share code, notes, and snippets.

@dsmrt
Created July 13, 2022 20:25
Show Gist options
  • Save dsmrt/f8c8f33c826cf65b8dacddb6522bd7dd to your computer and use it in GitHub Desktop.
Save dsmrt/f8c8f33c826cf65b8dacddb6522bd7dd to your computer and use it in GitHub Desktop.
aws application loadbalancer s3 bucket policy for access logging
{
"Version": "2012-10-17",
"Id": "AWSConsole-AccessLogs-Policy",
"Statement": [
{
"Sid": "AWSConsoleStmt",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::${AwsAccount}:root"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${Bucket}/loadbalancer/AWSLogs/${AwsAccount}/*"
},
{
"Sid": "AWSLogDeliveryWrite",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${Bucket}/loadbalancer/AWSLogs/${AwsAccount}/*",
"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}"
}
]
}
@dsmrt
Copy link
Author

dsmrt commented Jul 13, 2022

Change ${Bucket} to the bucket name and ${AwsAccount} to the right account id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment