feat(elasticloadbalancingv2): health check logs for ALB#36227
feat(elasticloadbalancingv2): health check logs for ALB#36227ren-yamanashi wants to merge 18 commits intoaws:mainfrom
Conversation
| bucket.addToResourcePolicy( | ||
| new PolicyStatement({ | ||
| actions: ['s3:PutObject'], | ||
| principals: [this.resourcePolicyPrincipal()], |
There was a problem hiding this comment.
This code is followed logConnectionLogs method.
The key point when use resourcePolicyPrincipal method, this public method (logHealthCheckLogs) needs specified region on the stack.
But, based on the documents I think we can choice don't use resourcePolicyPrincipal method like here code.
(see: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/enable-health-check-logging.html)
principals: [new iam.ServicePrincipal('logdelivery.elasticloadbalancing.amazonaws.com')],And when we choice it, not needs specified region on the stack.
Q. Which I choice? Use resourcePolicyPrincipal method? or not use?
Current situation is not same when implementation logConnectionLogs method, so I want advice for you.
There was a problem hiding this comment.
What could you think about this?
There was a problem hiding this comment.
Personally, I’d prefer to implement it using the ServicePrincipal method, but I think it’s better to align with the existing implementation…
For now, let’s keep the current implementation as is, and could you discuss this with the maintainers again?
There was a problem hiding this comment.
Okay. I follow you.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Show resolved
Hide resolved
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
…feat/alb-healthcheck-log
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Show resolved
Hide resolved
badmintoncryer
left a comment
There was a problem hiding this comment.
Thank you for your contribution! I've added some comments.
...cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.log.enable-acl.ts
Outdated
Show resolved
Hide resolved
...cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.log.enable-acl.ts
Outdated
Show resolved
Hide resolved
...cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.log.enable-acl.ts
Outdated
Show resolved
Hide resolved
...cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.log.enable-acl.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Show resolved
Hide resolved
…feat/alb-healthcheck-log
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
ren-yamanashi
left a comment
There was a problem hiding this comment.
Thanks review! I fixed and reply your comments.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Outdated
Show resolved
Hide resolved
| bucket.addToResourcePolicy( | ||
| new PolicyStatement({ | ||
| actions: ['s3:PutObject'], | ||
| principals: [this.resourcePolicyPrincipal()], |
There was a problem hiding this comment.
What could you think about this?
...cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.log.enable-acl.ts
Outdated
Show resolved
Hide resolved
badmintoncryer
left a comment
There was a problem hiding this comment.
Thanks! I've replied your comments.
062cbf1 to
db0fccd
Compare
|
I fixed! Please confirm |
…feat/alb-healthcheck-log
|
Thank you for your great work! |
This PR is similar to #30599
Reason for this change
ALB can output health check logs as well as access logs to the S3 bucket, but this is not yet supported by L2 Construct.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/enable-health-check-logging.html
Description of changes
Since health check logs are not supported by NLB, but only by ALB, the
logHealthCheckLogsmethod is added to theApplicationLoadBalancerinstead of theBaseLoadBalancer.The needed BucketPolicy is described in the documentation only as follows.
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "logdelivery.elasticloadbalancing.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/prefix/AWSLogs/123456789012/*" } ] }Description of how you validated changes
add unit tests and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license