-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(elasticloadbalancingv2): connection logs for ALB #30599
Conversation
if (bucket.encryptionKey) { | ||
throw new Error('Encryption key detected. Bucket encryption using KMS keys is unsupported'); | ||
} | ||
super.logAccessLogs(bucket, prefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a method with the same content as BaseLoadBalancer.logAccessLogs
to ApplicationLoadBalancer
to perform validation for ALB only.
However, modifying both methods would be necessary when changing the access log settings, so I changed it to call the base class implementation except for the validation.
#29382
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this change fundamentally not related to this PR for the connection logs? If so, it would be better to create a separated PR.
If not, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. I just made a minor comment.
if (bucket.encryptionKey) { | ||
throw new Error('Encryption key detected. Bucket encryption using KMS keys is unsupported'); | ||
} | ||
super.logAccessLogs(bucket, prefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this change fundamentally not related to this PR for the connection logs? If so, it would be better to create a separated PR.
If not, please let me know.
public logConnectionLogs(bucket: s3.IBucket, prefix?: string) { | ||
/** | ||
* KMS key encryption is not supported on Connection Log bucket for ALB, the bucket must use Amazon S3-managed keys (SSE-S3). | ||
* See https://docs.aws.amazon.com/elasticloadbalancing/latest/application/enable-access-logging.html#bucket-permissions-troubleshooting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link for the troubleshooting section is for the access logs not the connection logs.
I think the correct link is here.
@go-to-k |
* Enable connection logging for this load balancer. | ||
* | ||
* A region must be specified on the stack containing the load balancer; you cannot enable logging on | ||
* environment-agnostic stacks. See https://docs.aws.amazon.com/cdk/latest/guide/environments.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the @see
label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@go-to-k
Yes, add the @see
label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts
Show resolved
Hide resolved
...nteg.alb.log.imported-bucket.js.snapshot/aws-cdk-alb-log-imported-bucket-integ.template.json
Show resolved
Hide resolved
@shikha372 |
Thank you for your contribution @sakurai-ryo !! |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Reason for this change
ALB can output connection 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/load-balancer-connection-logs.html
Description of changes
The implementation is almost the same as for access logs.
However, since connection logs are not supported by NLB, but only by ALB, the
logConnectionLogs
method is added to theApplicationLoadBalancer
instead of theBaseLoadBalancer
.The needed BucketPolicy is described in the documentation only as follows, but to support buckets that still use the ACL, it is necessary to set the same policy that is currently set in the access logs.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/enable-connection-logging.html#attach-bucket-policy-connection
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