feat(logs): add L2 constructs for CloudWatch Logs vended log delivery - #38408
Open
letsgomeow wants to merge 4 commits into
Open
feat(logs): add L2 constructs for CloudWatch Logs vended log delivery#38408letsgomeow wants to merge 4 commits into
letsgomeow wants to merge 4 commits into
Conversation
Complete the remaining deliverables for the CloudWatch Logs vended log delivery L2s (DeliverySource/DeliveryDestination/Delivery): an integration test covering S3, CloudWatch Logs, and Firehose destinations from a single EventBridge source, a new "Log Delivery" README section, and awslint exclusions (with rationale, matching aws-bedrock-agentcore-alpha precedent) for the three ARN/physical-name/ ref-interface deviations required by this feature's design.
aws-cdk-automation
temporarily deployed
to
automation
July 27, 2026 05:07 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 27, 2026 05:07 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 27, 2026 06:26 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 27, 2026 06:26 — with
GitHub Actions
Inactive
mrgrain
requested changes
Jul 27, 2026
mrgrain
left a comment
Contributor
There was a problem hiding this comment.
@letsgomeow Is this PR considering the code currently available under https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/mixins-preview/lib/services/aws-logs ?
aws-cdk-automation
temporarily deployed
to
automation
July 27, 2026 09:37 — with
GitHub Actions
Inactive
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #37544.
Reason for this change
CloudWatch Logs vended log delivery lets services such as Amazon EKS, Amazon Bedrock, and Amazon
EventBridge deliver their logs directly to Amazon S3, CloudWatch Logs, or Kinesis Data Firehose,
without requiring an intermediate Lambda function or Kinesis stream. The underlying CloudFormation
resources (
AWS::Logs::DeliverySource,AWS::Logs::DeliveryDestination,AWS::Logs::Delivery) hadno L2 coverage in
aws-cdk-lib, forcing users onto rawCfn*constructs and manual IAM wiring.Description of changes
Adds three new L2 constructs to
aws-cdk-lib/aws-logs:DeliverySource— represents the AWS resource that emits logs (identified by ARN +LogType).DeliveryDestination— represents the target that receives logs (S3 bucket, CloudWatch Logs loggroup, or Kinesis Data Firehose delivery stream), via
DeliveryDestinationTarget.fromBucket()/.fromLogGroup()/.fromDeliveryStream().Delivery— connects oneDeliverySourceto oneDeliveryDestinationand automatically grantsthe
delivery.logs.amazonaws.comservice principal the permissions it needs on the destination(bucket policy / log group resource policy), scoped to the source's ARN with a
SourceArncondition (confused-deputy prevention). No grant is needed for Firehose — AWS creates the
AWSServiceRoleForLogDeliveryservice-linked role automatically.Also adds
LogTypeandOutputFormatenum-like classes, both with aLogType.of()/OutputFormatescape hatch for source/format values not yet exposed as static constants.
Design decisions / alternatives considered (for
awslint.jsonexcludes below):Three
awslintrules are excluded for this feature, following established precedent elsewhere inthe codebase (see
@aws-cdk/aws-bedrock-agentcore-alpha, which excludes all three for the sameunderlying reasons):
props-no-arn-refsDeliverySourceProps.resourceArnprops-physical-nameDeliveryPropsAWS::Logs::Deliveryhas noName-equivalent property in CloudFormation; AWS assigns the identifier (DeliveryId) automatically.prefer-ref-interfaceDeliveryProps.destinationDeliveryconstructor callsdestination.grantWrite(source), which requires the fullIDeliveryDestinationinterface —IDeliveryDestinationRef(bare identifiers only) doesn't expose grant methods. This exact pattern (a props field requiring the full interface because the constructor calls agrant*method on it) is also used independently in@aws-cdk/aws-bedrock-alpha'sAgentProps.guardrail/IGuardrail.grantApply(), suggesting it's an established convention rather than a one-off deviation.Alternatives considered and rejected:
resourceArnin aDeliverySourceResource.fromArn()-style abstract class: rejected —there's no behavioral difference across resource types to justify the abstraction (a single
fromArn()factory would be a speculative, empty wrapper).DeliveryfromResource/dropping the@resourcetag to sidestepprops-physical-name: rejected — would require hand-rollingIResource, breaks consistency withthe sibling
DeliverySource/DeliveryDestinationconstructs, and affects tooling that relies on@resource.Describe any new or updated permissions being added
Deliverywrites IAM permissions on the destination resource (not on any identity), scoped to thedelivery source's ARN via
aws:SourceArn, trusting only thedelivery.logs.amazonaws.comserviceprincipal:
s3:GetBucketAcl,s3:ListBucket,s3:PutObjectto the bucket policy.logs:CreateLogStream,logs:PutLogEventsto a log groupresource policy.
(
AWSServiceRoleForLogDelivery) covers this case.Description of how you validated changes
delivery-source.test.ts,delivery-destination.test.ts,delivery.test.ts(169 tests total in
aws-logs, all passing), covering all three destination types, cross-accountdelivery destination policies, import (
fromXxx) methods, and default/all-props construction.integ.delivery.ts, deploying oneDeliverySource(EventBridge event bus)fanned out to all three destination types (S3, CloudWatch Logs, Firehose) in a single stack.
Deploy-only (no
awsApiCallassertions), consistent with existing precedent for this class ofconfused-deputy IAM wiring (
aws-cloudtrail,aws-elasticloadbalancingv2'sinteg.alb.log.ts) —the resource-policy content itself is already covered exhaustively by unit tests.
--no-clean): confirmedactual log records flowing from an EventBridge event bus through the delivery pipeline into all
three destinations (S3 object, CloudWatch Logs stream, Firehose-delivered S3 object). Test stack
has since been deleted.
LogType.of()escape hatch,per-destination-type examples, grant behavior, cross-account delivery, delivery options, and
importing existing resources.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license