

# CreateMountSession

Creates a mount session for an S3 File System and returns a set of endpoints that you can use to mount the file system. Each endpoint includes an IP address, a port, and a mount token that a client presents when it connects to the endpoint.

## Request Syntax
<a name="API_S3Files_CreateMountSession_RequestSyntax"></a>

```
POST /file-systems/{{fileSystemId}}/mount-sessions HTTP/1.1
Content-type: application/json

{
   "networkOrigin": "{{string}}",
   "preferredAvailabilityZoneId": "{{string}}"
}
```

## URI Request Parameters
<a name="API_S3Files_CreateMountSession_RequestParameters"></a>

The request uses the following URI parameters.

 ** [fileSystemId](#API_S3Files_CreateMountSession_RequestSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-request-uri-fileSystemId"></a>
The ID of the S3 File System for which to create the mount session.  
Length Constraints: Minimum length of 0. Maximum length of 128.  
Pattern: `(arn:aws[-a-z]*:s3files:[0-9a-z-:]+:file-system/fs-[0-9a-f]{17,40}|fs-[0-9a-f]{17,40})`   
Required: Yes

## Request Body
<a name="API_S3Files_CreateMountSession_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [networkOrigin](#API_S3Files_CreateMountSession_RequestSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-request-networkOrigin"></a>
Indicates whether the client connects to the file system from within the AWS Cloud (`AWS_NETWORK`). External network (`EXTERNAL_NETWORK`) connections are not supported.  
Type: String  
Valid Values: `AWS_NETWORK | EXTERNAL_NETWORK`   
Required: No

 ** [preferredAvailabilityZoneId](#API_S3Files_CreateMountSession_RequestSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-request-preferredAvailabilityZoneId"></a>
The ID of the Availability Zone (for example, `use1-az1`) in which you prefer the returned endpoints to be located. The Availability Zone must be in the same AWS Region as the file system. This preference is best effort: if an endpoint in the preferred Availability Zone isn't available, endpoints in another Availability Zone are returned instead of failing the request. If you don't specify a value, endpoints are returned without an Availability Zone preference.  
Type: String  
Required: No

## Response Syntax
<a name="API_S3Files_CreateMountSession_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "endpoints": [ 
      { 
         "availabilityZoneId": "string",
         "ipv4Address": "string",
         "ipv6Address": "string",
         "issuedAt": number,
         "mountToken": "string",
         "port": number
      }
   ],
   "fileSystemId": "string",
   "preferredAvailabilityZoneId": "string"
}
```

## Response Elements
<a name="API_S3Files_CreateMountSession_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [endpoints](#API_S3Files_CreateMountSession_ResponseSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-response-endpoints"></a>
The endpoints that you can use to mount the file system. Each endpoint includes an IP address, a port, and a mount token.  
Type: Array of [MountSessionEndpoint](API_S3Files_MountSessionEndpoint.md) objects

 ** [fileSystemId](#API_S3Files_CreateMountSession_ResponseSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-response-fileSystemId"></a>
The ID of the S3 File System that the mount session applies to.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 128.  
Pattern: `(arn:aws[-a-z]*:s3files:[0-9a-z-:]+:file-system/fs-[0-9a-f]{17,40}|fs-[0-9a-f]{17,40})` 

 ** [preferredAvailabilityZoneId](#API_S3Files_CreateMountSession_ResponseSyntax) **   <a name="AmazonS3-S3Files_CreateMountSession-response-preferredAvailabilityZoneId"></a>
The ID of the preferred Availability Zone that was specified in the request, if any. The Availability Zone of an individual endpoint can differ from this value.  
Type: String

## Errors
<a name="API_S3Files_CreateMountSession_Errors"></a>

 ** ConflictException **   
The request conflicts with the current state of the resource. This can occur when trying to create a resource that already exists or delete a resource that is in use.    
 ** errorCode **   
The error code associated with the exception.  
 ** resourceId **   
The identifier of the resource that caused the conflict.  
 ** resourceType **   
The type of the resource that caused the conflict.
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** errorCode **   
The error code associated with the exception.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource was not found. Verify that the resource exists and that you have permission to access it.    
 ** errorCode **   
The error code associated with the exception.
HTTP Status Code: 404

 ** ThrottlingException **   
The request was throttled. Retry your request using exponential backoff.    
 ** errorCode **   
The error code associated with the exception.
HTTP Status Code: 429

 ** ValidationException **   
The input parameters are not valid. Check the parameter values and try again.    
 ** errorCode **   
The error code associated with the exception.
HTTP Status Code: 400

## See Also
<a name="API_S3Files_CreateMountSession_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/s3files-2025-05-05/CreateMountSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/s3files-2025-05-05/CreateMountSession) 