Skip to content

create_data_repository_association

create_data_repository_association(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    file_system_id: Optional[FileSystemId] = None,
    file_system_path: Optional[Namespace] = None,
    data_repository_path: Optional[ArchivePath] = None,
    batch_import_meta_data_on_create: Optional[BatchImportMetaDataOnCreate] = None,
    imported_file_chunk_size: Optional[Megabytes] = None,
    s3: Optional[S3DataRepositoryConfiguration] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    tags: Optional[Tags] = None,
) -> CreateDataRepositoryAssociationResponse

Creates an Amazon FSx for Lustre data repository association (DRA). A data repository association is a link between a directory on the file system and an Amazon S3 bucket or prefix. You can have a maximum of 8 data repository associations on a file system. Data repository associations are supported on all FSx for Lustre 2.12 and 2.15 file systems, excluding scratch_1 deployment type.

Each data repository association must have a unique Amazon FSx file system directory and a unique S3 bucket or prefix associated with it. You can configure a data repository association for automatic import only, for automatic export only, or for both. To learn more about linking a data repository to your file system, see Linking your file system to an S3 bucket.

CreateDataRepositoryAssociation isn't supported on Amazon File Cache resources. To create a DRA on Amazon File Cache, use the CreateFileCache operation.

Parameters:

  • file_system_path (Optional[Namespace], default: None ) –

    A path on the file system that points to a high-level directory (such as /ns1/) or subdirectory (such as /ns1/subdir/) that will be mapped 1-1 with DataRepositoryPath. The leading forward slash in the name is required. Two data repository associations cannot have overlapping file system paths. For example, if a data repository is associated with file system path /ns1/, then you cannot link another data repository with file system path /ns1/ns2.

    This path specifies where in your file system files will be exported from or imported to. This file system directory can be linked to only one Amazon S3 bucket, and no other S3 bucket can be linked to the directory.

    If you specify only a forward slash (/) as the file system path, you can link only one data repository to the file system. You can only specify "/" as the file system path for the first data repository associated with a file system.

  • data_repository_path (Optional[ArchivePath], default: None ) –

    The path to the Amazon S3 data repository that will be linked to the file system. The path can be an S3 bucket or prefix in the format s3://bucket-name/prefix/ (where prefix is optional). This path specifies where in the S3 data repository files will be imported from or exported to.

  • batch_import_meta_data_on_create (Optional[BatchImportMetaDataOnCreate], default: None ) –

    Set to true to run an import data repository task to import metadata from the data repository to the file system after the data repository association is created. Default is false.

  • imported_file_chunk_size (Optional[Megabytes], default: None ) –

    For files imported from a data repository, this value determines the stripe count and maximum amount of data per file (in MiB) stored on a single physical disk. The maximum number of disks that a single file can be striped across is limited by the total number of disks that make up the file system.

    The default chunk size is 1,024 MiB (1 GiB) and can go as high as 512,000 MiB (500 GiB). Amazon S3 objects have a maximum size of 5 TB.

  • s3 (Optional[S3DataRepositoryConfiguration], default: None ) –

    The configuration for an Amazon S3 data repository linked to an Amazon FSx Lustre file system with a data repository association. The configuration defines which file events (new, changed, or deleted files or directories) are automatically imported from the linked data repository to the file system or automatically exported from the file system to the data repository.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • FileSystemNotFound –

    No Amazon FSx file systems were found based upon supplied parameters.

  • IncompatibleParameterError –

    The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • ServiceLimitExceeded –

    An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.

  • UnsupportedOperation –

    The requested operation is not supported for this resource or API.

  • UnknownServiceError –

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

Source code in docs_src/capo_fsx/_services/f_sx.py
def create_data_repository_association(
    self,
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    file_system_id: Optional["capo_fsx.types.file_system_id.FileSystemId"] = None,
    file_system_path: Optional["capo_fsx.types.namespace.Namespace"] = None,
    data_repository_path: Optional[
        "capo_fsx.types.archive_path.ArchivePath"
    ] = None,
    batch_import_meta_data_on_create: Optional[
        "capo_fsx.types.batch_import_meta_data_on_create.BatchImportMetaDataOnCreate"
    ] = None,
    imported_file_chunk_size: Optional["capo_fsx.types.megabytes.Megabytes"] = None,
    s3: Optional[
        "capo_fsx.types.s3_data_repository_configuration.S3DataRepositoryConfiguration"
    ] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
) -> "capo_fsx.types.create_data_repository_association_response.CreateDataRepositoryAssociationResponse":
    """<p>Creates an Amazon FSx for Lustre data repository association (DRA). A data repository association is a link between a directory on the file system and an Amazon S3 bucket or prefix. You can have a maximum of 8 data repository associations on a file system. Data repository associations are supported on all FSx for Lustre 2.12 and 2.15 file systems, excluding <code>scratch_1</code> deployment type.</p> <p>Each data repository association must have a unique Amazon FSx file system directory and a unique S3 bucket or prefix associated with it. You can configure a data repository association for automatic import only, for automatic export only, or for both. To learn more about linking a data repository to your file system, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/create-dra-linked-data-repo.html">Linking your file system to an S3 bucket</a>.</p> <note> <p> <code>CreateDataRepositoryAssociation</code> isn't supported on Amazon File Cache resources. To create a DRA on Amazon File Cache, use the <code>CreateFileCache</code> operation.</p> </note>

    Args:
        file_system_path: <p>A path on the file system that points to a high-level directory (such as <code>/ns1/</code>) or subdirectory (such as <code>/ns1/subdir/</code>) that will be mapped 1-1 with <code>DataRepositoryPath</code>. The leading forward slash in the name is required. Two data repository associations cannot have overlapping file system paths. For example, if a data repository is associated with file system path <code>/ns1/</code>, then you cannot link another data repository with file system path <code>/ns1/ns2</code>.</p> <p>This path specifies where in your file system files will be exported from or imported to. This file system directory can be linked to only one Amazon S3 bucket, and no other S3 bucket can be linked to the directory.</p> <note> <p>If you specify only a forward slash (<code>/</code>) as the file system path, you can link only one data repository to the file system. You can only specify "/" as the file system path for the first data repository associated with a file system.</p> </note>
        data_repository_path: <p>The path to the Amazon S3 data repository that will be linked to the file system. The path can be an S3 bucket or prefix in the format <code>s3://bucket-name/prefix/</code> (where <code>prefix</code> is optional). This path specifies where in the S3 data repository files will be imported from or exported to.</p>
        batch_import_meta_data_on_create: <p>Set to <code>true</code> to run an import data repository task to import metadata from the data repository to the file system after the data repository association is created. Default is <code>false</code>.</p>
        imported_file_chunk_size: <p>For files imported from a data repository, this value determines the stripe count and maximum amount of data per file (in MiB) stored on a single physical disk. The maximum number of disks that a single file can be striped across is limited by the total number of disks that make up the file system.</p> <p>The default chunk size is 1,024 MiB (1 GiB) and can go as high as 512,000 MiB (500 GiB). Amazon S3 objects have a maximum size of 5 TB.</p>
        s3: <p>The configuration for an Amazon S3 data repository linked to an Amazon FSx Lustre file system with a data repository association. The configuration defines which file events (new, changed, or deleted files or directories) are automatically imported from the linked data repository to the file system or automatically exported from the file system to the data repository.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.file_system_not_found.FileSystemNotFound: <p>No Amazon FSx file systems were found based upon supplied parameters.</p>
        capo_fsx.errors.incompatible_parameter_error.IncompatibleParameterError: <p>The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.service_limit_exceeded.ServiceLimitExceeded: <p>An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.</p>
        capo_fsx.errors.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.create_data_repository_association_request.CreateDataRepositoryAssociationRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.create_data_repository_association_response.CreateDataRepositoryAssociationResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_data_repository_association

        output, http_response = (
            capo_fsx._operations.aws_simba_api_service_v20180301.create_data_repository_association.create_data_repository_association(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataRepositoryAssociation")
    )
    input_: capo_fsx.types.create_data_repository_association_request.CreateDataRepositoryAssociationRequest = {}
    if file_system_id is not None:
        input_["file_system_id"] = file_system_id
    if file_system_path is not None:
        input_["file_system_path"] = file_system_path
    if data_repository_path is not None:
        input_["data_repository_path"] = data_repository_path
    if batch_import_meta_data_on_create is not None:
        input_["batch_import_meta_data_on_create"] = (
            batch_import_meta_data_on_create
        )
    if imported_file_chunk_size is not None:
        input_["imported_file_chunk_size"] = imported_file_chunk_size
    if s3 is not None:
        input_["s3"] = s3
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    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