AWS loadbalancer load save to S3
Step 1. Create s3 bucket, folder
https://console.aws.amazon.com/s3/
Step 2.
S3 -> click your bucket -> Permissions -> Bucket Policy -> Policy generator
https://console.aws.amazon.com/s3/
Step 2.
S3 -> click your bucket -> Permissions -> Bucket Policy -> Policy generator
![](https://www.changwoo.org/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBMUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--69e7d165856a95983dee3496b92ee700f6bd8d0b/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--6f46433a86a60941d22895fc082f4ece9544fc4f/image.png)
![](https://www.changwoo.org/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBMZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--2dc96661e7d5d2665ee35d56007f51a10c59e634/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--6f46433a86a60941d22895fc082f4ece9544fc4f/image.png)
arn:aws:s3:::bucket/prefix/AWSLogs/aws-account-id/*
![](https://www.changwoo.org/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBNQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--9db3fd5b253a01cf3a2f82bd25638ef6f98e4288/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--6f46433a86a60941d22895fc082f4ece9544fc4f/image.png)
Principal value is 027434742980 If your region is us-west-1
Select Actions is PutObject
The following table contains the account IDs to use in your bucket policy.
RegionRegion NameElastic Load Balancing Account ID
us-east-1 | US East (N. Virginia) | 127311923021
us-east-2 | US East (Ohio) | 033677994240
us-east-1 | US East (N. Virginia) | 127311923021
us-east-2 | US East (Ohio) | 033677994240
us-west-1 | US West (N. California) | 027434742980
us-west-2 | US West (Oregon) | 797873946194
ca-central-1 | Canada (Central) | 985666609251
eu-central-1 | EU (Frankfurt) | 054676820928
eu-west-1 | EU (Ireland) | 156460612806
eu-west-2 | EU (London) | 652711504416
eu-west-3 | EU (Paris) | 009996457667
eu-north-1 | EU (Stockholm) | 897822967062
ap-east-1 | Asia Pacific (Hong Kong) | 754344448648
ap-northeast-1 | Asia Pacific (Tokyo) | 582318560864
ap-northeast-2 | Asia Pacific (Seoul) | 600734575887
ap-northeast-3 | Asia Pacific (Osaka-Local) | 383597477331
ap-southeast-1 | Asia Pacific (Singapore) | 114774131450
ap-southeast-2 | Asia Pacific (Sydney) | 783225319266
ap-south-1 | Asia Pacific (Mumbai) | 718504428378
me-south-1 | Middle East (Bahrain) | 076674570225
sa-east-1 | South America (São Paulo) | 507241528517
us-gov-west-1* | AWS GovCloud (US-West) | 048591011584
us-gov-east-1* | AWS GovCloud (US-East) | 190560391635
cn-north-1* | China (Beijing) | 638102146993
cn-northwest-1* | China (Ningxia) | 037604701340
ca-central-1 | Canada (Central) | 985666609251
eu-central-1 | EU (Frankfurt) | 054676820928
eu-west-1 | EU (Ireland) | 156460612806
eu-west-2 | EU (London) | 652711504416
eu-west-3 | EU (Paris) | 009996457667
eu-north-1 | EU (Stockholm) | 897822967062
ap-east-1 | Asia Pacific (Hong Kong) | 754344448648
ap-northeast-1 | Asia Pacific (Tokyo) | 582318560864
ap-northeast-2 | Asia Pacific (Seoul) | 600734575887
ap-northeast-3 | Asia Pacific (Osaka-Local) | 383597477331
ap-southeast-1 | Asia Pacific (Singapore) | 114774131450
ap-southeast-2 | Asia Pacific (Sydney) | 783225319266
ap-south-1 | Asia Pacific (Mumbai) | 718504428378
me-south-1 | Middle East (Bahrain) | 076674570225
sa-east-1 | South America (São Paulo) | 507241528517
us-gov-west-1* | AWS GovCloud (US-West) | 048591011584
us-gov-east-1* | AWS GovCloud (US-East) | 190560391635
cn-north-1* | China (Beijing) | 638102146993
cn-northwest-1* | China (Ningxia) | 037604701340
Step 3.
S3 -> Permissions -> Bucket Policy
Input generated json and save
Step 4.
EC2 -> loadbalance -> Description -> Attributes -> Configure Access Logs
https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#LoadBalancers:sort=loadBalancerName
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html
https://docs.aws.amazon.com/ko_kr/elasticloadbalancing/latest/application/load-balancer-access-logs.html
Input generated json and save
Step 4.
EC2 -> loadbalance -> Description -> Attributes -> Configure Access Logs
![](https://www.changwoo.org/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBLdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--8cfada6f33cd061b4322bb86fc7c1acf7741a99d/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--6f46433a86a60941d22895fc082f4ece9544fc4f/image.png)
![](https://www.changwoo.org/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBMQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--02b289753936f458ab9b63ae97ed8b22393a14d8/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--6f46433a86a60941d22895fc082f4ece9544fc4f/image.png)
https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#LoadBalancers:sort=loadBalancerName
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html
https://docs.aws.amazon.com/ko_kr/elasticloadbalancing/latest/application/load-balancer-access-logs.html