createFileSystem method

Future<CreateFileSystemResponse> createFileSystem({
  1. required FileSystemType fileSystemType,
  2. required int storageCapacity,
  3. required List<String> subnetIds,
  4. String? clientRequestToken,
  5. String? kmsKeyId,
  6. CreateFileSystemLustreConfiguration? lustreConfiguration,
  7. List<String>? securityGroupIds,
  8. StorageType? storageType,
  9. List<Tag>? tags,
  10. CreateFileSystemWindowsConfiguration? windowsConfiguration,
})

Creates a new, empty Amazon FSx file system.

If a file system with the specified client request token exists and the parameters match, CreateFileSystem returns the description of the existing file system. If a file system specified client request token exists and the parameters don't match, this call returns IncompatibleParameterError. If a file system with the specified client request token doesn't exist, CreateFileSystem does the following:

  • Creates a new, empty Amazon FSx file system with an assigned ID, and an initial lifecycle state of CREATING.
  • Returns the description of the file system.
This operation requires a client request token in the request that Amazon FSx uses to ensure idempotent creation. This means that calling the operation multiple times with the same client request token has no effect. By using the idempotent operation, you can retry a CreateFileSystem operation without the risk of creating an extra file system. This approach can be useful when an initial call fails in a way that makes it unclear whether a file system was created. Examples are if a transport level timeout occurred, or your connection was reset. If you use the same client request token and the initial call created a file system, the client receives success as long as the parameters are the same.

May throw BadRequest. May throw ActiveDirectoryError. May throw IncompatibleParameterError. May throw InvalidImportPath. May throw InvalidExportPath. May throw InvalidNetworkSettings. May throw InvalidPerUnitStorageThroughput. May throw ServiceLimitExceeded. May throw InternalServerError. May throw MissingFileSystemConfiguration.

Parameter fileSystemType : The type of Amazon FSx file system to create, either WINDOWS or LUSTRE.

Parameter storageCapacity : Sets the storage capacity of the file system that you're creating.

For Lustre file systems:

  • For SCRATCH_2 and PERSISTENT_1 SSD deployment types, valid values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.
  • For PERSISTENT HDD file systems, valid values are increments of 6000 GiB for 12 MB/s/TiB file systems and increments of 1800 GiB for 40 MB/s/TiB file systems.
  • For SCRATCH_1 deployment type, valid values are 1200 GiB, 2400 GiB, and increments of 3600 GiB.
For Windows file systems:
  • If StorageType=SSD, valid values are 32 GiB - 65,536 GiB (64 TiB).
  • If StorageType=HDD, valid values are 2000 GiB - 65,536 GiB (64 TiB).

Parameter subnetIds : Specifies the IDs of the subnets that the file system will be accessible from. For Windows MULTI_AZ_1 file system deployment types, provide exactly two subnet IDs, one for the preferred file server and one for the standby file server. You specify one of these subnets as the preferred subnet using the WindowsConfiguration > PreferredSubnetID property.

For Windows SINGLE_AZ_1 and SINGLE_AZ_2 file system deployment types and Lustre file systems, provide exactly one subnet ID. The file server is launched in that subnet's Availability Zone.

Parameter clientRequestToken : A string of up to 64 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the AWS Command Line Interface (AWS CLI) or an AWS SDK.

Parameter securityGroupIds : A list of IDs specifying the security groups to apply to all network interfaces created for file system access. This list isn't returned in later requests to describe the file system.

Parameter storageType : Sets the storage type for the file system you're creating. Valid values are SSD and HDD.

  • Set to SSD to use solid state drive storage. SSD is supported on all Windows and Lustre deployment types.
  • Set to HDD to use hard disk drive storage. HDD is supported on SINGLE_AZ_2 and MULTI_AZ_1 Windows file system deployment types, and on PERSISTENT Lustre file system deployment types.
Default value is SSD. For more information, see Storage Type Options in the Amazon FSx for Windows User Guide and Multiple Storage Options in the Amazon FSx for Lustre User Guide.

Parameter tags : The tags to apply to the file system being created. The key value of the Name tag appears in the console as the file system name.

Parameter windowsConfiguration : The Microsoft Windows configuration for the file system being created.

Implementation

Future<CreateFileSystemResponse> createFileSystem({
  required FileSystemType fileSystemType,
  required int storageCapacity,
  required List<String> subnetIds,
  String? clientRequestToken,
  String? kmsKeyId,
  CreateFileSystemLustreConfiguration? lustreConfiguration,
  List<String>? securityGroupIds,
  StorageType? storageType,
  List<Tag>? tags,
  CreateFileSystemWindowsConfiguration? windowsConfiguration,
}) async {
  ArgumentError.checkNotNull(fileSystemType, 'fileSystemType');
  ArgumentError.checkNotNull(storageCapacity, 'storageCapacity');
  _s.validateNumRange(
    'storageCapacity',
    storageCapacity,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(subnetIds, 'subnetIds');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    63,
  );
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.CreateFileSystem'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FileSystemType': fileSystemType.toValue(),
      'StorageCapacity': storageCapacity,
      'SubnetIds': subnetIds,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
      if (lustreConfiguration != null)
        'LustreConfiguration': lustreConfiguration,
      if (securityGroupIds != null) 'SecurityGroupIds': securityGroupIds,
      if (storageType != null) 'StorageType': storageType.toValue(),
      if (tags != null) 'Tags': tags,
      if (windowsConfiguration != null)
        'WindowsConfiguration': windowsConfiguration,
    },
  );

  return CreateFileSystemResponse.fromJson(jsonResponse.body);
}