

# Permissions for S3 Files Endpoints

IAM permissions control access through S3 Files Endpoints to an S3 file system. Access through S3 Files Endpoints is denied by default, and a principal can connect through S3 Files Endpoints only when its identity or file system policy explicitly allows the S3 Files Endpoint actions. To connect through a VPC mount target, a principal needs only the existing client actions. For more information about how Amazon S3 Files evaluates identity policies and file system policies together, see [How S3 Files works with IAM](s3-files-security-iam.md).

## The s3files-endpoint IAM name
<a name="s3-files-networking-endpoint-permissions-prefix"></a>

S3 Files Endpoint actions use a separate IAM name, `s3files-endpoint`, so you control access through S3 Files Endpoints independently of your existing Amazon S3 Files permissions. This IAM name contains the same three client actions as the `s3files` IAM name: `ClientMount`, `ClientWrite`, and `ClientRootAccess`.

For a connection through S3 Files Endpoints, Amazon S3 Files authorizes each client action under both IAM names, and both must be allowed. For example, to read data through S3 Files Endpoints, a principal needs both `s3files:ClientMount` and `s3files-endpoint:ClientMount`.

## Required IAM actions
<a name="s3-files-networking-endpoint-permissions-actions"></a>

An S3 Files Endpoint connection is authorized at two points. The mount helper first calls the `CreateMountSession` API to get connection information for your file system. The client then connects to the file system, and Amazon S3 Files authorizes the client actions for the connection. The following table lists the actions each step requires.


**Required IAM actions for S3 Files Endpoints**  

| Step | Required actions | 
| --- | --- | 
| Get connection information (CreateMountSession) | s3files:CreateMountSession | 
| Connect and read | s3files:ClientMount and s3files-endpoint:ClientMount | 
| Write | s3files:ClientWrite and s3files-endpoint:ClientWrite | 
| Root access | s3files:ClientRootAccess and s3files-endpoint:ClientRootAccess | 

The mount helper calls `CreateMountSession` automatically, so you don't need to call this API directly. A principal that has only `s3files:CreateMountSession` can get connection information, but can't connect to the file system.

## Condition keys for network path
<a name="s3-files-networking-endpoint-permissions-condition-keys"></a>

You can use the following condition keys in identity policies, file system policies, and service control policies (SCPs) to allow or deny access based on how a client connects. Both keys apply to client actions in the `s3files` and `s3files-endpoint` IAM names, so you can group all client actions in a single statement. The keys don't apply to `s3files:CreateMountSession`.


**Condition keys for network path**  

| Network path | `s3files:AccessedViaMountTarget` | `s3files:AccessedViaRegionalEndpoint` | 
| --- | --- | --- | 
| VPC mount target | true | false | 
| S3 Files Endpoints | false | true | 

To restrict a file system to VPC-based access only (mount targets only), deny all `s3files-endpoint` actions. This approach requires one statement with no condition keys. You can also deny the `s3files` client actions with the condition `"Bool": {"s3files:AccessedViaRegionalEndpoint": "true"}`. For examples, see [Policy examples for network access](s3-files-networking-policy-examples.md).

## AWS managed policies
<a name="s3-files-networking-endpoint-permissions-managed-policies"></a>

Amazon S3 Files provides AWS managed policies that bundle the actions required for each access tier. Each S3 Files Endpoint policy also grants VPC mount target access at the same tier, so you can attach one policy for both paths. For more information, see [AWS managed policies for Amazon S3 Files](s3-files-security-iam-awsmanpol.md).


**AWS managed policies for S3 Files Endpoints**  

| Managed policy | Grants | 
| --- | --- | 
| AmazonS3FilesEndpointClientFullAccess | Read, write, and root access through VPC mount targets and S3 Files Endpoints | 
| AmazonS3FilesEndpointClientReadWriteAccess | Read and write access through VPC mount targets and S3 Files Endpoints | 
| AmazonS3FilesEndpointClientReadOnlyAccess | Read access through VPC mount targets and S3 Files Endpoints | 

The existing `AmazonS3FilesClientFullAccess`, `AmazonS3FilesClientReadWriteAccess`, and `AmazonS3FilesClientReadOnlyAccess` policies don't grant access through S3 Files Endpoints. Principals that use these policies continue to connect only through VPC mount targets.

## Revoking access through S3 Files Endpoints
<a name="s3-files-networking-endpoint-permissions-revoking"></a>

When you add a policy that denies access through S3 Files Endpoints, Amazon S3 Files rejects new S3 Files Endpoint connections immediately. Clients that are already connected through S3 Files Endpoints continue operating until their next reauthentication, which occurs every 5 minutes. At that point, the connection fails. Connections through VPC-based mount targets aren't affected.

## Logging
<a name="s3-files-networking-endpoint-permissions-logging"></a>

AWS CloudTrail records each `CreateMountSession` call, including the calling principal and source IP address. You can use these events to audit which principals connect to your file system through S3 Files Endpoints. The mount helper also logs each mount attempt and the network path used, locally and to Amazon CloudWatch Logs when enabled. For more information, see [Logging with CloudTrail for S3 Files](s3-files-logging-cloudtrail.md).