Created
July 13, 2022 20:25
-
-
Save dsmrt/f8c8f33c826cf65b8dacddb6522bd7dd to your computer and use it in GitHub Desktop.
aws application loadbalancer s3 bucket policy for access logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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}" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change
${Bucket}
to the bucket name and${AwsAccount}
to the right account id