Skip to content

feat(bedrockagentcore): add manageDeliveryResourcePolicy opt-out for runtime observability - #38372

Open
sanyamk23 wants to merge 7 commits into
aws:mainfrom
sanyamk23:fix/bedrockagentcore-manage-delivery-resource-policy
Open

feat(bedrockagentcore): add manageDeliveryResourcePolicy opt-out for runtime observability#38372
sanyamk23 wants to merge 7 commits into
aws:mainfrom
sanyamk23:fix/bedrockagentcore-manage-delivery-resource-policy

Conversation

@sanyamk23

@sanyamk23 sanyamk23 commented Jul 22, 2026

Copy link
Copy Markdown

Issue # (if applicable)

Closes #38342.

When deploying many AgentCore Runtime constructs per account/Region, the per-stack AWS::Logs::ResourcePolicy and AWS::XRay::ResourcePolicy created by the observability delivery consume account-level quota slots (CloudWatch Logs: 10, X-Ray: lower). This adds a manageDeliveryResourcePolicy prop (defaults to true) that skips resource policy creation while still provisioning delivery sources, destinations, and deliveries. For same-account /aws/vendedlogs/ delivery, the log-delivery service-linked role provides write access without an explicit policy.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license and that I've followed the contributing guidelines.

@aws-cdk-automation
aws-cdk-automation requested a review from a team July 22, 2026 17:26
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 labels Jul 22, 2026
@mergify

mergify Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #38332. Mergify cannot evaluate rules on this PR. Once #38332 is merged or closed, Mergify will resume processing this PR. ⚠️

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@sanyamk23

Copy link
Copy Markdown
Author

Exemption Request: The PR already includes README changes in packages/aws-cdk-lib/aws-bedrockagentcore/README.md (prop documentation, observability section, and usage example for manageDeliveryResourcePolicy). The linter may not be detecting the module-level README change.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jul 22, 2026
@aws-cdk-automation
aws-cdk-automation dismissed their stale review July 22, 2026 17:40

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from ddff793 to f095c09 Compare July 31, 2026 16:08
@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from f095c09 to 3fc1cd1 Compare August 2, 2026 20:09
@sanyamk23

Copy link
Copy Markdown
Author

CI all green. Build workflow is action_required — needs a manual approve on the Actions tab. Note: mergify flagged a conflict with #38332, I'll rebase once that merges.

@sanyamk23

sanyamk23 commented Aug 11, 2026

Copy link
Copy Markdown
Author

I added an opt-out flag for manageDeliveryResourcePolicy in Bedrock Agent Core so users can control resource policies manually. Let me know if you have questions.

@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from 30497e0 to 528faac Compare August 17, 2026 12:19
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 12:19 — with GitHub Actions Active
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 12:19 — with GitHub Actions Active
@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from 528faac to 40b5b82 Compare August 17, 2026 13:39
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 13:39 — with GitHub Actions Active
@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from 40b5b82 to 359d334 Compare August 17, 2026 19:50
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:50 — with GitHub Actions Active
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:50 — with GitHub Actions Active
sanyamk23 and others added 7 commits August 18, 2026 01:26
…ross-repo PRs

When the GitHub API returns a 404 for the list reviews endpoint (which
can happen for cross-repo PRs from forks or when the PROJEN_GITHUB_TOKEN
lacks access to the source repository), treat it as no existing reviews
rather than crashing the entire validate-pr job.

Previously, the 404 error would propagate up to run().catch() in index.ts,
causing the process to exit with code 1 and failing the workflow.
…RemovalPolicy works

The BrowserCustom construct creates a CfnBrowserCustom plus a ServiceRole
child, so CDK never auto-assigns the Cfn resource as the default child.
This made Resource.applyRemovalPolicy() throw CannotApplyRemovalPolicy
when called on the L2. Explicitly set node.defaultChild to the CfnBrowserCustom,
matching how other L2 resources behave.

Part of aws#38327.
… removal policy

Adds a BrowserWithRemovalPolicy construct to the browser integ test that
calls applyRemovalPolicy(DESTROY) on the L2, and regenerates the snapshot
to cover the default-child fix from the parent commit.

Part of aws#38327.
…runtime observability

When deploying many AgentCore Runtime constructs per account/Region, the
per-stack AWS::Logs::ResourcePolicy and AWS::XRay::ResourcePolicy created
by the observability delivery consume account-level quota slots (CloudWatch
Logs: 10, X-Ray: lower). This adds a `manageDeliveryResourcePolicy` prop
(defaults to true) that skips resource policy creation while still
provisioning delivery sources, destinations, and deliveries. For same-account
/aws/vendedlogs/ delivery, the log-delivery service-linked role provides
write access without an explicit policy.

Closes aws#38342.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
… for runtime observability

Adds the manageDeliveryResourcePolicy prop to the Runtime properties table
and observability section, with an example showing how to opt out of
resource policy creation when deploying many runtimes per account/Region.
…faces under exactOptionalPropertyTypes

`ICluster` and `ITaskDefinition` declare several members optional (`?:`), but
the concrete classes exposed them through getters typed `T | undefined`. Under
TypeScript's `exactOptionalPropertyTypes`, a member typed `T | undefined` is not
assignable to an optional `?: T`, so consumers who enable the flag get TS2420
errors and type-checking `aws-cdk-lib` fails for them outright. The library does
not build with the flag, so the break is invisible to its own compile.

Affected members:
- `TaskDefinition.executionRole` (inherited by Ec2/External/Fargate task
  definitions), and
- `Cluster.defaultCloudMapNamespace`, `Cluster.autoscalingGroup`,
  `Cluster.executeCommandConfiguration`.

Convert each getter to a `public readonly x?: T` field. `executionRole` and
`defaultCloudMapNamespace` are populated after construction (by
`obtainExecutionRole` and `addDefaultCloudMapNamespace`), so they are set through
a module-private helper that assigns through a `Writeable` cast; the live view is
preserved. `autoscalingGroup` and `executeCommandConfiguration` are only set in
the constructor, so they use a direct guarded `readonly` assignment. The fields
stay `readonly`, so the jsii assembly is unchanged (the properties remain
optional and immutable) and `yarn compat` passes with no new entry. The internal
`ImportedCluster` is updated the same way so the module is fully clean.

Add behavior tests (undefined by default, populated from props, and the live
population via `obtainExecutionRole` / `addDefaultCloudMapNamespace`) and a
package-local guard that type-checks the package's concrete classes against
their interfaces under the flag, asserting the package stays clean.

Refs aws#37996
Merging main brought in addExistingDefaultCloudMapNamespace (aws#36812),
which reads and writes the private _defaultCloudMapNamespace backing
field that this branch replaces with a readonly
defaultCloudMapNamespace field written through
setDefaultCloudMapNamespace. The two sides touched different hunks so
git merged them without conflict, but the new method no longer compiled
(TS2551) and the build failed at jsii.

Route the new method through the field and its helper.
@sanyamk23
sanyamk23 force-pushed the fix/bedrockagentcore-manage-delivery-resource-policy branch from 359d334 to 2a78844 Compare August 17, 2026 19:57
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:57 — with GitHub Actions Active
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:58 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

5 participants