Skip to content

create_file_system

create_file_system(
    creation_token: CreationToken,
    *,
    config_overrides: Optional[EFSClientConfig] = None,
    performance_mode: Optional[PerformanceMode] = None,
    encrypted: Optional[Encrypted] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    throughput_mode: Optional[ThroughputMode] = None,
    provisioned_throughput_in_mibps: Optional[ProvisionedThroughputInMibps] = None,
    availability_zone_name: Optional[AvailabilityZoneName] = None,
    backup: Optional[Backup] = None,
    tags: Optional[Tags] = None,
) -> FileSystemDescription

Creates a new, empty file system. The operation requires a creation token in the request that Amazon EFS uses to ensure idempotent creation (calling the operation with same creation token has no effect). If a file system does not currently exist that is owned by the caller's Amazon Web Services account with the specified creation token, this operation does the following:

  • Creates a new, empty file system. The file system will have an Amazon EFS assigned ID, and an initial lifecycle state creating.

  • Returns with the description of the created file system.

Otherwise, this operation returns a FileSystemAlreadyExists error with the ID of the existing file system.

For basic use cases, you can use a randomly generated UUID for the creation token.

The idempotent operation allows you to retry a CreateFileSystem call without risk of creating an extra file system. This can happen when an initial call fails in a way that leaves it uncertain whether or not a file system was actually created. An example might be that a transport level timeout occurred or your connection was reset. As long as you use the same creation token, if the initial call had succeeded in creating a file system, the client can learn of its existence from the FileSystemAlreadyExists error.

For more information, see Creating a file system in the Amazon EFS User Guide.

The CreateFileSystem call returns while the file system's lifecycle state is still creating. You can check the file system creation status by calling the DescribeFileSystems operation, which among other things returns the file system state.

This operation accepts an optional PerformanceMode parameter that you choose for your file system. We recommend generalPurpose PerformanceMode for all file systems. The maxIO mode is a previous generation performance type that is designed for highly parallelized workloads that can tolerate higher latencies than the generalPurpose mode. MaxIO mode is not supported for One Zone file systems or file systems that use Elastic throughput.

The PerformanceMode can't be changed after the file system has been created. For more information, see Amazon EFS performance modes.

You can set the throughput mode for the file system using the ThroughputMode parameter.

After the file system is fully created, Amazon EFS sets its lifecycle state to available, at which point you can create one or more mount targets for the file system in your VPC. For more information, see CreateMountTarget. You mount your Amazon EFS file system on an EC2 instances in your VPC by using the mount target. For more information, see Amazon EFS: How it Works.

This operation requires permissions for the elasticfilesystem:CreateFileSystem action.

File systems can be tagged on creation. If tags are specified in the creation action, IAM performs additional authorization on the elasticfilesystem:TagResource action to verify if users have permissions to create tags. Therefore, you must grant explicit permissions to use the elasticfilesystem:TagResource action. For more information, see Granting permissions to tag resources during creation.

Parameters:

  • creation_token (CreationToken) –

    A string of up to 64 ASCII characters. Amazon EFS uses this to ensure idempotent creation.

  • performance_mode (Optional[PerformanceMode], default: None ) –

    The performance mode of the file system. We recommend generalPurpose performance mode for all file systems. File systems using the maxIO performance mode can scale to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for most file operations. The performance mode can't be changed after the file system has been created. The maxIO mode is not supported on One Zone file systems.

    Due to the higher per-operation latencies with Max I/O, we recommend using General Purpose performance mode for all file systems.

    Default is generalPurpose.

  • encrypted (Optional[Encrypted], default: None ) –

    A Boolean value that, if true, creates an encrypted file system. When creating an encrypted file system, you have the option of specifying an existing Key Management Service key (KMS key). If you don't specify a KMS key, then the default KMS key for Amazon EFS, /aws/elasticfilesystem, is used to protect the encrypted file system.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The ID of the KMS key that you want to use to protect the encrypted file system. This parameter is required only if you want to use a non-default KMS key. If this parameter is not specified, the default KMS key for Amazon EFS is used. You can specify a KMS key ID using the following formats:

    • Key ID - A unique identifier of the key, for example 1234abcd-12ab-34cd-56ef-1234567890ab.

    • ARN - An Amazon Resource Name (ARN) for the key, for example arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.

    • Key alias - A previously created display name for a key, for example alias/projectKey1.

    • Key alias ARN - An ARN for a key alias, for example arn:aws:kms:us-west-2:444455556666:alias/projectKey1.

    If you use KmsKeyId, you must set the CreateFileSystemRequest$Encrypted parameter to true.

    EFS accepts only symmetric KMS keys. You cannot use asymmetric KMS keys with Amazon EFS file systems.

  • throughput_mode (Optional[ThroughputMode], default: None ) –

    Specifies the throughput mode for the file system. The mode can be bursting, provisioned, or elastic. If you set ThroughputMode to provisioned, you must also set a value for ProvisionedThroughputInMibps. After you create the file system, you can decrease your file system's Provisioned throughput or change between the throughput modes, with certain time restrictions. For more information, see Specifying throughput with provisioned mode in the Amazon EFS User Guide.

    Default is bursting.

  • provisioned_throughput_in_mibps (Optional[ProvisionedThroughputInMibps], default: None ) –

    The throughput, measured in mebibytes per second (MiBps), that you want to provision for a file system that you're creating. Required if ThroughputMode is set to provisioned. Valid values are 1-3414 MiBps, with the upper limit depending on Region. To increase this limit, contact Amazon Web Services Support. For more information, see Amazon EFS quotas that you can increase in the Amazon EFS User Guide.

  • availability_zone_name (Optional[AvailabilityZoneName], default: None ) –

    For One Zone file systems, specify the Amazon Web Services Availability Zone in which to create the file system. Use the format us-east-1a to specify the Availability Zone. For more information about One Zone file systems, see EFS file system types in the Amazon EFS User Guide.

    One Zone file systems are not available in all Availability Zones in Amazon Web Services Regions where Amazon EFS is available.

  • backup (Optional[Backup], default: None ) –

    Specifies whether automatic backups are enabled on the file system that you are creating. Set the value to true to enable automatic backups. If you are creating a One Zone file system, automatic backups are enabled by default. For more information, see Automatic backups in the Amazon EFS User Guide.

    Default is false. However, if you specify an AvailabilityZoneName, the default is true.

    Backup is not available in all Amazon Web Services Regions where Amazon EFS is available.

  • tags (Optional[Tags], default: None ) –

    Use to create one or more tags associated with the file system. Each tag is a user-defined key-value pair. Name your file system on creation by including a "Key":"Name","Value":"{value}" key-value pair. Each key must be unique. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference Guide.

Raises:

  • BadRequest –

    Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.

  • FileSystemAlreadyExists –

    Returned if the file system you are trying to create already exists, with the creation token you provided.

  • FileSystemLimitExceeded –

    Returned if the Amazon Web Services account has already created the maximum number of file systems allowed per account.

  • InsufficientThroughputCapacity –

    Returned if there's not enough capacity to provision additional throughput. This value might be returned when you try to create a file system in provisioned throughput mode, when you attempt to increase the provisioned throughput of an existing file system, or when you attempt to change an existing file system from Bursting Throughput to Provisioned Throughput mode. Try again later.

  • InternalServerError –

    Returned if an error occurred on the server side.

  • ThroughputLimitExceeded –

    Returned if the throughput mode or amount of provisioned throughput can't be changed because the throughput limit of 1024 MiB/s has been reached.

  • UnsupportedAvailabilityZone –

    Returned if the requested Amazon EFS functionality is not available in the specified Availability Zone.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_efs/_services/efs.py
def create_file_system(
    self,
    creation_token: "capo_efs.types.creation_token.CreationToken",
    *,
    config_overrides: Optional[EFSClientConfig] = None,
    performance_mode: Optional[
        "capo_efs.types.performance_mode.PerformanceMode"
    ] = None,
    encrypted: Optional["capo_efs.types.encrypted.Encrypted"] = None,
    kms_key_id: Optional["capo_efs.types.kms_key_id.KmsKeyId"] = None,
    throughput_mode: Optional[
        "capo_efs.types.throughput_mode.ThroughputMode"
    ] = None,
    provisioned_throughput_in_mibps: Optional[
        "capo_efs.types.provisioned_throughput_in_mibps.ProvisionedThroughputInMibps"
    ] = None,
    availability_zone_name: Optional[
        "capo_efs.types.availability_zone_name.AvailabilityZoneName"
    ] = None,
    backup: Optional["capo_efs.types.backup.Backup"] = None,
    tags: Optional["capo_efs.types.tags.Tags"] = None,
) -> "capo_efs.types.file_system_description.FileSystemDescription":
    """<p>Creates a new, empty file system. The operation requires a creation token in the request that Amazon EFS uses to ensure idempotent creation (calling the operation with same creation token has no effect). If a file system does not currently exist that is owned by the caller's Amazon Web Services account with the specified creation token, this operation does the following:</p> <ul> <li> <p>Creates a new, empty file system. The file system will have an Amazon EFS assigned ID, and an initial lifecycle state <code>creating</code>.</p> </li> <li> <p>Returns with the description of the created file system.</p> </li> </ul> <p>Otherwise, this operation returns a <code>FileSystemAlreadyExists</code> error with the ID of the existing file system.</p> <note> <p>For basic use cases, you can use a randomly generated UUID for the creation token.</p> </note> <p>The idempotent operation allows you to retry a <code>CreateFileSystem</code> call without risk of creating an extra file system. This can happen when an initial call fails in a way that leaves it uncertain whether or not a file system was actually created. An example might be that a transport level timeout occurred or your connection was reset. As long as you use the same creation token, if the initial call had succeeded in creating a file system, the client can learn of its existence from the <code>FileSystemAlreadyExists</code> error.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/creating-using-create-fs.html#creating-using-create-fs-part1">Creating a file system</a> in the <i>Amazon EFS User Guide</i>.</p> <note> <p>The <code>CreateFileSystem</code> call returns while the file system's lifecycle state is still <code>creating</code>. You can check the file system creation status by calling the <a>DescribeFileSystems</a> operation, which among other things returns the file system state.</p> </note> <p>This operation accepts an optional <code>PerformanceMode</code> parameter that you choose for your file system. We recommend <code>generalPurpose</code> <code>PerformanceMode</code> for all file systems. The <code>maxIO</code> mode is a previous generation performance type that is designed for highly parallelized workloads that can tolerate higher latencies than the <code>generalPurpose</code> mode. <code>MaxIO</code> mode is not supported for One Zone file systems or file systems that use Elastic throughput.</p> <p>The <code>PerformanceMode</code> can't be changed after the file system has been created. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/performance.html#performancemodes.html">Amazon EFS performance modes</a>.</p> <p>You can set the throughput mode for the file system using the <code>ThroughputMode</code> parameter.</p> <p>After the file system is fully created, Amazon EFS sets its lifecycle state to <code>available</code>, at which point you can create one or more mount targets for the file system in your VPC. For more information, see <a>CreateMountTarget</a>. You mount your Amazon EFS file system on an EC2 instances in your VPC by using the mount target. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html">Amazon EFS: How it Works</a>. </p> <p>This operation requires permissions for the <code>elasticfilesystem:CreateFileSystem</code> action. </p> <p>File systems can be tagged on creation. If tags are specified in the creation action, IAM performs additional authorization on the <code>elasticfilesystem:TagResource</code> action to verify if users have permissions to create tags. Therefore, you must grant explicit permissions to use the <code>elasticfilesystem:TagResource</code> action. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/using-tags-efs.html#supported-iam-actions-tagging.html">Granting permissions to tag resources during creation</a>.</p>

    Args:
        creation_token: <p>A string of up to 64 ASCII characters. Amazon EFS uses this to ensure idempotent creation.</p>
        performance_mode: <p>The performance mode of the file system. We recommend <code>generalPurpose</code> performance mode for all file systems. File systems using the <code>maxIO</code> performance mode can scale to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for most file operations. The performance mode can't be changed after the file system has been created. The <code>maxIO</code> mode is not supported on One Zone file systems.</p> <important> <p>Due to the higher per-operation latencies with Max I/O, we recommend using General Purpose performance mode for all file systems.</p> </important> <p>Default is <code>generalPurpose</code>.</p>
        encrypted: <p>A Boolean value that, if true, creates an encrypted file system. When creating an encrypted file system, you have the option of specifying an existing Key Management Service key (KMS key). If you don't specify a KMS key, then the default KMS key for Amazon EFS, <code>/aws/elasticfilesystem</code>, is used to protect the encrypted file system. </p>
        kms_key_id: <p>The ID of the KMS key that you want to use to protect the encrypted file system. This parameter is required only if you want to use a non-default KMS key. If this parameter is not specified, the default KMS key for Amazon EFS is used. You can specify a KMS key ID using the following formats:</p> <ul> <li> <p>Key ID - A unique identifier of the key, for example <code>1234abcd-12ab-34cd-56ef-1234567890ab</code>.</p> </li> <li> <p>ARN - An Amazon Resource Name (ARN) for the key, for example <code>arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code>.</p> </li> <li> <p>Key alias - A previously created display name for a key, for example <code>alias/projectKey1</code>.</p> </li> <li> <p>Key alias ARN - An ARN for a key alias, for example <code>arn:aws:kms:us-west-2:444455556666:alias/projectKey1</code>.</p> </li> </ul> <p>If you use <code>KmsKeyId</code>, you must set the <a>CreateFileSystemRequest$Encrypted</a> parameter to true.</p> <important> <p>EFS accepts only symmetric KMS keys. You cannot use asymmetric KMS keys with Amazon EFS file systems.</p> </important>
        throughput_mode: <p>Specifies the throughput mode for the file system. The mode can be <code>bursting</code>, <code>provisioned</code>, or <code>elastic</code>. If you set <code>ThroughputMode</code> to <code>provisioned</code>, you must also set a value for <code>ProvisionedThroughputInMibps</code>. After you create the file system, you can decrease your file system's Provisioned throughput or change between the throughput modes, with certain time restrictions. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/performance.html#provisioned-throughput">Specifying throughput with provisioned mode</a> in the <i>Amazon EFS User Guide</i>. </p> <p>Default is <code>bursting</code>.</p>
        provisioned_throughput_in_mibps: <p>The throughput, measured in mebibytes per second (MiBps), that you want to provision for a file system that you're creating. Required if <code>ThroughputMode</code> is set to <code>provisioned</code>. Valid values are 1-3414 MiBps, with the upper limit depending on Region. To increase this limit, contact Amazon Web Services Support. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/limits.html#soft-limits">Amazon EFS quotas that you can increase</a> in the <i>Amazon EFS User Guide</i>.</p>
        availability_zone_name: <p>For One Zone file systems, specify the Amazon Web Services Availability Zone in which to create the file system. Use the format <code>us-east-1a</code> to specify the Availability Zone. For more information about One Zone file systems, see <a href="https://docs.aws.amazon.com/efs/latest/ug/availability-durability.html#file-system-type">EFS file system types</a> in the <i>Amazon EFS User Guide</i>.</p> <note> <p>One Zone file systems are not available in all Availability Zones in Amazon Web Services Regions where Amazon EFS is available.</p> </note>
        backup: <p>Specifies whether automatic backups are enabled on the file system that you are creating. Set the value to <code>true</code> to enable automatic backups. If you are creating a One Zone file system, automatic backups are enabled by default. For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/awsbackup.html#automatic-backups">Automatic backups</a> in the <i>Amazon EFS User Guide</i>.</p> <p>Default is <code>false</code>. However, if you specify an <code>AvailabilityZoneName</code>, the default is <code>true</code>.</p> <note> <p>Backup is not available in all Amazon Web Services Regions where Amazon EFS is available.</p> </note>
        tags: <p>Use to create one or more tags associated with the file system. Each tag is a user-defined key-value pair. Name your file system on creation by including a <code>"Key":"Name","Value":"{value}"</code> key-value pair. Each key must be unique. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a> in the <i>Amazon Web Services General Reference Guide</i>.</p>

    Raises:
        capo_efs.errors.bad_request.BadRequest: <p>Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.</p>
        capo_efs.errors.file_system_already_exists.FileSystemAlreadyExists: <p>Returned if the file system you are trying to create already exists, with the creation token you provided.</p>
        capo_efs.errors.file_system_limit_exceeded.FileSystemLimitExceeded: <p>Returned if the Amazon Web Services account has already created the maximum number of file systems allowed per account.</p>
        capo_efs.errors.insufficient_throughput_capacity.InsufficientThroughputCapacity: <p>Returned if there's not enough capacity to provision additional throughput. This value might be returned when you try to create a file system in provisioned throughput mode, when you attempt to increase the provisioned throughput of an existing file system, or when you attempt to change an existing file system from Bursting Throughput to Provisioned Throughput mode. Try again later.</p>
        capo_efs.errors.internal_server_error.InternalServerError: <p>Returned if an error occurred on the server side.</p>
        capo_efs.errors.throughput_limit_exceeded.ThroughputLimitExceeded: <p>Returned if the throughput mode or amount of provisioned throughput can't be changed because the throughput limit of 1024 MiB/s has been reached.</p>
        capo_efs.errors.unsupported_availability_zone.UnsupportedAvailabilityZone: <p>Returned if the requested Amazon EFS functionality is not available in the specified Availability Zone.</p>
        capo_efs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_efs.types.create_file_system_request.CreateFileSystemRequest]",
    ) -> OperationResponse[
        "capo_efs.types.file_system_description.FileSystemDescription"
    ]:
        import capo_efs._operations.magnolio_api_service_v20150201.create_file_system

        output, http_response = (
            capo_efs._operations.magnolio_api_service_v20150201.create_file_system.create_file_system(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFileSystem")
    )
    input_: capo_efs.types.create_file_system_request.CreateFileSystemRequest = {
        "creation_token": creation_token
    }
    if performance_mode is not None:
        input_["performance_mode"] = performance_mode
    if encrypted is not None:
        input_["encrypted"] = encrypted
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if throughput_mode is not None:
        input_["throughput_mode"] = throughput_mode
    if provisioned_throughput_in_mibps is not None:
        input_["provisioned_throughput_in_mibps"] = provisioned_throughput_in_mibps
    if availability_zone_name is not None:
        input_["availability_zone_name"] = availability_zone_name
    if backup is not None:
        input_["backup"] = backup
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output