Skip to content

RFC for S3Files L2 CDK Constructs#932

Open
Adonca2203 wants to merge 6 commits into
aws:mainfrom
Adonca2203:adonca2203/s3files-l2-rfc
Open

RFC for S3Files L2 CDK Constructs#932
Adonca2203 wants to merge 6 commits into
aws:mainfrom
Adonca2203:adonca2203/s3files-l2-rfc

Conversation

@Adonca2203

Copy link
Copy Markdown

This is a request for comments about S3Fiels L2 Constructs. See #929 for
additional details.

APIs are signed off by @{BAR_RAISER}.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache-2.0 license

@Adonca2203 Adonca2203 force-pushed the adonca2203/s3files-l2-rfc branch from 309ae3c to bb52e36 Compare June 4, 2026 19:14

@badmintoncryer badmintoncryer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you for creating a rfc.

I've added some comments. And there are two things to say.

  • The proposal automates the IAM role but exposes no grant* surface for client principals (s3files:ClientMount/ClientWrite/ClientRootAccess). Worth adding grant methods (or a grants facade) so consumers can authorize Lambda/ECS/EC2 task roles idiomatically.

  • The CFN resources expose AcceptBucketWarning and ClientToken on FileSystem, and IpAddressType (IPV4_ONLY|IPV6_ONLY|DUAL_STACK) on MountTarget. None appear in the proposed API — AcceptBucketWarning in particular is needed for many buckets, and there’s no way to opt into IPv6/dual-stack mount targets.

Comment thread text/0929-s3files-l2-constructs.md Outdated
*
* @default - CDK generated name
*/
readonly fileSystemName?: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AWS::S3Files::FileSystem has no Name property. I think this prop is not needed.

Comment thread text/0929-s3files-l2-constructs.md Outdated
sizeLessThan: 1073741824,
trigger: s3files.ImportDataRuleTrigger.ON_FILE_ACCESS,
}],
expirationDataRules: [{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sizeLessThan (CFN: Integer bytes) and the expiration value (CFN: DaysAfterLastAccess, Integer days) are raw numbers in the proposal. Per the CDK design guidelines these should be Size / Duration. Note the CFN constraints when converting: DaysAfterLastAccess is an integer 1–365 days, so a Duration must validate whole days; SizeLessThan is in bytes.

Comment thread text/0929-s3files-l2-constructs.md Outdated
Comment on lines +97 to +103
synchronizationConfiguration: {
importDataRules: [{
prefix: '/',
sizeLessThan: 1073741824,
trigger: s3files.ImportDataRuleTrigger.ON_FILE_ACCESS,
}],
expirationDataRules: [{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: CFN requires exactly one ExpirationDataRule (min=max=1) and 1–10 ImportDataRules with exactly one root-prefix rule. The proposed expirationDataRules: ExpirationDataRule[] / importDataRules[] should validate this.

Comment on lines +44 to +47
vpcConfiguration: {
vpc,
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The README shows vpcSubnets but the interface defines subnets: ec2.ISubnet[] (required). Suggest aligning on a single name and using ec2.SubnetSelection (consistent with EFS L2 and other VPC-attached constructs) so users can pass { subnetType } rather than resolving subnets themselves.

@leonmk-aws leonmk-aws left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to grants, we should have metrics helper functions: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md#metrics

Comment thread text/0929-s3files-l2-constructs.md Outdated

Each method calls `iam.Grant.addToPrincipalOrResource` with the
appropriate `s3files:Client*` actions and an
`s3files:AccessedViaMountTarget` condition. A general-purpose

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't this condition be: s3files:AccessPointArn ?

Comment thread text/0929-s3files-l2-constructs.md Outdated
actions: ['s3files:ClientMount'],
principals: [new iam.AnyPrincipal()],
conditions: {
Bool: { 's3files:AccessedViaMountTarget': 'true' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't this be: s3files:AccessPointArn

Comment thread text/0929-s3files-l2-constructs.md Outdated

## Granting Access

Use `grant*` methods to authorize principals for NFS client operations.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's use grants facades for this: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md#grants (this is a minimal change)

Comment thread text/0929-s3files-l2-constructs.md Outdated
resource policy support
* `AccessPoint` L2 with POSIX user and root directory configuration
* `FileSystem.fromFileSystemAttributes()` and
`AccessPoint.fromAccessPointAttributes()` import methods

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Earlier it is mentioned that the methods name is fromAccessPointId not fromAccessPointAttributes

```ts
declare const fileSystem: s3files.FileSystem;

const accessPoint = fileSystem.addAccessPoint('AccessPoint', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fileSystem.addAccessPoint('AccessPoint', { path, createAcl, posixUser }), but the only interface defined later is AccessPointProps, which requires fileSystem. Are we missing an AccessPointOptions interface ?

Comment thread text/0929-s3files-l2-constructs.md Outdated
*
* @default - CDK generated name
*/
readonly accessPointName?: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CloudFormation doesn't have support for the name of an access point https://docs.aws.amazon.com/fr_fr/AWSCloudFormation/latest/TemplateReference/aws-resource-s3files-accesspoint.html, I believe this is only supported in the console ?

@leonmk-aws leonmk-aws left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Added a few more comments after the last changes

Comment thread text/0929-s3files-l2-constructs.md Outdated
action sets.
## Metrics

Use the metrics facade to create CloudWatch metric objects:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unfortunately the metrics facade is not ready yet so it cannot be used, we need to write the metrics methods by hand for now. I also means that there should not be metrics property on the Filesystem.
See this section of the design guidelines: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md#metrics, we should have at least a metric() method and additional metric methods for the ones we find relevant (e.g metricDataReadBytes etc)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I can include one in the doc here as an example but for actual implementation is there a priority list of metrics we want to expose if we are exposing each manually? maybe the top N make it into the first impl and we can add more down the road based on demand?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, later during the implementation or based on demand, additional methods can be added without any backwards compatibility concern.

Comment thread text/0929-s3files-l2-constructs.md Outdated
Comment thread text/0929-s3files-l2-constructs.md
/**
* Configuration for data import and expiration behavior.
*/
export interface SynchronizationConfiguration {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both importDataRules and ImportDataRules are required in CFN: AWS::S3Files::FileSystem SynchronizationConfiguration so they should not be optional in this interface, unless the L2 abstraction provides defaults configuration (@default - service defaults seems to imply that we don't).

Comment thread text/0929-s3files-l2-constructs.md Outdated
*
* @default - service defaults
*/
readonly expirationDataRule?: ExpirationDataRule;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we need to have this additional ExpirationDataRule type since it only holds daysAfterLastAccess property ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The L1 defines it as an object but we can flatten it for the L2

@Adonca2203 Adonca2203 force-pushed the adonca2203/s3files-l2-rfc branch from c53254c to e6ef122 Compare July 2, 2026 19:46

@leonmk-aws leonmk-aws left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See below

* expires. Must be a whole number of days between 1
* and 365.
*/
readonly daysAfterLastAccess: Duration;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Now that ExpirationDataRule is flattened away, daysAfterLastAccess sitting next to importDataRules reads like a threshold rather than the expiration action. The S3 Files console labels this "Data expiration after last access," so I'd rename it to match — dataExpiration: Duration (with "measured from last access" in the JSDoc).

Comment thread text/0929-s3files-l2-constructs.md Outdated
action sets.
## Metrics

Use the metrics facade to create CloudWatch metric objects:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, later during the implementation or based on demand, additional methods can be added without any backwards compatibility concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants