aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.46k stars 3.82k forks source link

(aws-fsx): NetApp ONTAP file system #30848

Open badmintoncryer opened 1 month ago

badmintoncryer commented 1 month ago

Describe the feature

Supporting for creating FSx for NetApp ONTAP file system by OntapFileSystem class like existing LusterFileSystem class.

new fsx.OntapFileSystem(stack, 'OntapMultiAzFileSystem', {
  vpc,
  vpcSubnets: vpc.privateSubnets,
  storageCapacityGiB: 5120,
  ontapConfiguration: {
    automaticBackupRetention: Duration.days(7),
    dailyAutomaticBackupStartTime: new fsx.DailyAutomaticBackupStartTime({
      hour: 1,
      minute: 0,
    }),
    deploymentType: fsx.OntapDeploymentType.MULTI_AZ_2,
    diskIops: 15360,
    endpointIpAddressRange: '192.168.39.0/24',
    fsxAdminPassword: 'fsxPassword1',
    haPairs: 1,
    prefferredSubnet: vpc.privateSubnets[0],
    routeTables: [vpc.privateSubnets[0].routeTable, vpc.privateSubnets[1].routeTable],
    throughputCapacity: 384,
    weeklyMaintenanceStartTime: new fsx.MaintenanceTime({
      day: fsx.Weekday.SUNDAY,
      hour: 1,
      minute: 0,
    }),
  },
  removalPolicy: RemovalPolicy.DESTROY,
});

Use Case

AWS CDK can create FSx file systems (such as Lustre, NetApp ONTAP, Windows File Server, OpenZFS) using the CfnFileSystem construct. We can create only Lustre file systems with the LustreFileSystem construct, which is really useful due to its numerous validation methods for properties.

It is difficult for users to create a NetApp ONTAP file system via CfnFileSystem because there are many restrictions on properties. Therefore, I think it would also be useful to have an OntapFileSystem construct.

Proposed Solution

Define OntapFileSystem class by extending fsx.FileSystemBase class.

export class OntapFileSystem extends FileSystemBase {
  public static fromOntapFileSystemAttributes(scope: Construct, id: string, attrs: FileSystemAttributes): IFileSystem {
    class Import extends FileSystemBase {
      public readonly dnsName = attrs.dnsName;
      public readonly fileSystemId = attrs.fileSystemId;
      public readonly connections = OntapFileSystem.configureConnections(attrs.securityGroup);
    }
    return new Import(scope, id);
  }

  constructor(scope: Construct, id: string, props: OntapFileSystemProps) {
    super(scope, id);
    this.validateProps(props);

    this.fileSystem = new CfnFileSystem(this, 'Resource', {
      fileSystemType: OntapFileSystem.DEFAULT_FILE_SYSTEM_TYPE,
      subnetIds: props.vpcSubnets.map((subnet) => subnet.subnetId),
      backupId: props.backupId,
      kmsKeyId: props.kmsKey?.keyId,
      ontapConfiguration: {
        ...
      },
    });
})

Other Information

No response

Acknowledgements

CDK version used

2.147.0

Environment details (OS name and version, etc.)

irrelevant

khushail commented 1 month ago

Hi @badmintoncryer , thanks for requesting this useful feature and volunteering to contribute a PR for the same.

For L2 construct contribution, one has to submit RFC and get the approval on design. Once that is submitted and approved, PR can be submitted for the review. However this whole contribution process is currently under review and being reassessed. Please feel free to check this ReadMe on L2 construct submission..