Steps:
1. Create 2 instances and add http port and also install nginx enable it .
2. For load balancer u will need target group
3. Go to EC2 service scroll down u will see target groups
4. Create target group > add instances > save and create .
5. Now create load balancer (Application load balancer) > configure it give name , vpc ,select availability zones, select Target Groups u created and create load balancer.
6. Check it your load balancer is working or not.
7. If working , Create s3 bucket and go to permission > bucket policy and edit it :-
8. Note :- Find policy from this by searching on google enable access log of load balancer to s3
Policy :-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws-us-gov:iam::elb-account-id:root"
},
"Action": "s3:PutObject",
"Resource": "s3-bucket-arn"
}
]
}
9. Save it.
10. Now go to load balancer u created > go to attributes section > scroll down and u will see this monitoring sec enable access logs and add our bucket
11. Save changes.
12. U will see ur logs folder in ur s3 bucket.