Skip to content

feat(runtime): support s3BucketMount filesystem configurations - #2897

Closed
sasha177 wants to merge 1 commit into
feat/snapshotfrom
feat/s3-bucket-mount
Closed

sasha177 wants to merge 1 commit into
feat/snapshotfrom
feat/s3-bucket-mount

Conversation

@sasha177

@sasha177 sasha177 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds s3BucketMount (Mountpoint for Amazon S3) as a filesystemConfigurations entry for runtimes, in agentcore.json and in agentcore add runtime --filesystem-configurations. Fields: bucket and mountPath (required), prefix, s3BucketOwner and s3BucketRegion (optional).

Design decisions:

  • V2 only, set explicitly. The service mounts S3 buckets only on platform version V2, so the schema requires platformVersion: "V2" rather than relying on the service default. The --filesystem-configurations help says so.
  • Shape-only checks. Like EFS and S3 Files, the CLI checks only the entry's shape (bucket and prefix length, mountPath pattern, owner and Region formats). The CDK app and the service check the bucket and prefix rules. The object is strict, so a misspelled s3BucketOwner fails instead of being dropped.
  • Read-write, like the other mounts. The execution role that agentcore deploy creates gets read-write access scoped to the bucket and prefix, from aws/agentcore-l3-cdk-constructs#480.
  • The MCP and A2A Python templates include S3 bucket mounts in their file tools.
  • No VPC requirement and no per-type count; the existing five-entry limit and unique mount paths apply.

Depends on aws/agentcore-l3-cdk-constructs#480. Deploying needs an @aws/agentcore-cdk release that supports s3BucketMount, and a bump of the pin in src/assets/cdk/package.json. The current pin (1.2.0) rejects the entry at synth, so this should merge with or after that bump.

Related Issue

Closes #2898

Documentation PR

Not applicable.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran bun test (one failure, CodeZipDevRunner > starts tsx directly when Node dependencies exist, fails the same way on feat/snapshot without this change)
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable
    (CI does not run them for you): not run yet; deploying needs the @aws/agentcore-cdk release above. Planned for the bug bash.
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run audit
  • I ran bun run secrets:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them (adds a golden snapshot, src/handlers/project/add/runtime/__snapshots__/index.test.ts.snap)
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained
    by this PR (none re-recorded)
  • This PR does not change command.md (the release workflow regenerates it)

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published (needs aws/agentcore-l3-cdk-constructs#480 and its release)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@sasha177
sasha177 force-pushed the feat/s3-bucket-mount branch from d6dad35 to a5adc86 Compare November 23, 2026 23:48

@jariy17 jariy17 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just small nits, otherwise they are good!

The mount should be read-write by default, which is set in aws/agentcore-l3-cdk-constructs#480, so please drop the read-only wording here.

return undefined;
}
// Strict so a misspelled optional key, such as s3BucketOwner, fails instead of dropping the check.
export const S3BucketMountConfigSchema = z.strictObject({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This copies the L3 bucket and prefix grammar (about 110 lines, same regexes and limits), and L3 runs the same check at synth, before CloudFormation starts. EFS and S3 Files only mirror the ARN pattern and mount path here, so this is the one type where the two copies are likely to drift when the service adds a placeholder or character. Could the CLI keep a lighter check (bucket and mountPath shape, the V2 rule) and leave the full grammar to L3? Also, the comment above says this avoids a failure partway through a deploy; L3 already fails at synth, so the CLI copy only moves the error to add and validate.

* anything is created. Entries that aren't S3 bucket mounts are ignored; schema validation reports bad ones.
*/
export function s3BucketMountNotes(
filesystemConfigurations: unknown,

@jariy17 jariy17 Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't print deploy notes for other filesystem configurations. Please remove this.

Comment thread src/projectSchemas/runtime.ts Outdated
"Must be a path under /mnt with exactly one subdirectory (e.g. /mnt/bucket)",
)
// "/mnt/." is /mnt itself, which would hide every other mount, and "/mnt/.." is the root.
.refine(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as on L3: the existing types' mountPath schemas still accept /mnt/. and /mnt/... Either share one mountPath schema across all filesystem types or drop this check so the types stay consistent.


More: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-v2-optimize.html

### S3 bucket mounts

@jariy17 jariy17 Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No other filesystem type has a README section. Please remove this for now.

code to work that is the same for every request, and create random values
(`secrets` or `os.urandom()`), timestamps, and credentials inside the
request handler.
- Under an `s3BucketMount` path, write whole files and close them. Keep git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this. We don't follow this for other filesystem configurations.

{{#if sessionStorageMountPath}}- {{sessionStorageMountPath}}: ephemeral session storage (lost when session ends)
{{/if}}{{#each efsMounts}}- {{mountPath}}: EFS persistent storage (persists across sessions and agent restarts)
{{/each}}{{#each s3Mounts}}- {{mountPath}}: S3 Files persistent storage (durable, backed by S3)
{{/each}}{{#each s3BucketMounts}}- {{mountPath}}: S3 bucket mount (durable; read-only unless the runtime was granted write access; a file is saved to S3 when it is closed; write whole files, as appending, renaming and editing in place are not supported)

@jariy17 jariy17 Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The other mount types get one short clause each in this prompt. I'd keep the Mountpoint semantics (write whole files) and drop "read-only unless the runtime was granted write access". The mount should be read-write by default (see aws/agentcore-l3-cdk-constructs#480), and it's IAM guidance the model can't act on.

code to work that is the same for every request, and create random values
(`/dev/urandom`, not the `crypto` module), timestamps, and credentials
inside the request handler.
- Under an `s3BucketMount` path, write whole files and close them. Keep git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this too.


More: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-v2-optimize.html

### S3 bucket mounts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove as we don't do this for other file systems.

});
});

test("an S3 bucket mount prints what deploy grants and how to add write access", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please ask your agent to perform a golden test here. Instead of stubbing it.

flag(
"filesystem-configurations",
"filesystem mount configurations (JSON)",
"filesystem mount configurations (JSON); an s3BucketMount needs --platform-version V2 and gets read-only S3 access",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please drop "gets read-only S3 access". The mount should be read-write by default (see aws/agentcore-l3-cdk-constructs#480), and no other filesystem type puts its permissions in this help text.

@sasha177
sasha177 force-pushed the feat/s3-bucket-mount branch from a5adc86 to 48273c4 Compare November 24, 2026 17:03
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 24, 2026

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look good. We can't launch this until CloudFormation supports S3BucketMount in all regions, so please don't merge until then.

@jariy17

jariy17 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Superseded: this change shipped in v1.3.0 through the release branch (agentcore-cli #2925, agentcore-l3-cdk-constructs #494). Thanks @sasha177!

@jariy17 jariy17 closed this Nov 25, 2026
@jariy17
jariy17 deleted the feat/s3-bucket-mount branch November 25, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants