View a markdown version of this page

📢 Alert: efs/latest/ug/iam access control nfs efs.html - Latest Analysis

Using IAM to control access to file systems

You can use both IAM identity policies and resource policies to control client access to Amazon EFS resources in a way that is scalable and optimized for cloud environments. Using IAM, you can permit clients to perform specific actions on a file system, including read-only, write, and root access. An "allow" permission on an action in either an IAM identity policy or a file system resource policy allows access for that action. The permission does not need to be granted in both an identity and a resource policy.

NFS clients can identify themselves using an IAM role when connecting to an EFS file system. When a client connects to a file system, Amazon EFS evaluates the file system’s IAM resource policy, which is called a file system policy, along with any identity-based IAM policies to determine the appropriate file system access permissions to grant.

When you use IAM authorization for NFS clients, client connections and IAM authorization decisions are logged to AWS CloudTrail. For more information about how to log Amazon EFS API calls with CloudTrail, see Logging Amazon EFS API calls with AWS CloudTrail.

Important

You must use the EFS mount helper to mount your EFS file systems in order to use IAM authorization to control client access. For more information, see Mounting with IAM authorization.

Default EFS file system policy

The default EFS file system policy does not use IAM to authenticate, and grants full access to any anonymous client that can connect to the file system using a mount target. The default policy is in effect whenever a user-configured file system policy is not in effect, including at file system creation. Whenever the default file system policy is in effect, a DescribeFileSystemPolicy API operation returns a PolicyNotFound response.

The default file system policy doesn't grant access to clients that connect through EFS Endpoints from outside a VPC. For more information, see Permissions for EFS Endpoints.

EFS actions for clients

You can specify the following actions for clients accessing a file system using a file system policy. Actions in the elasticfilesystem IAM name apply to every connection that uses IAM authorization. Connections from outside a VPC through EFS Endpoints also require the matching action in the elasticfilesystem-endpoint IAM name.

Action Description Network path

elasticfilesystem:ClientMount

Provides read-only access to a file system.

Mount targets and EFS Endpoints

elasticfilesystem:ClientWrite

Provides write permissions on a file system.

Mount targets and EFS Endpoints

elasticfilesystem:ClientRootAccess

Provides use of the root user when accessing a file system.

Mount targets and EFS Endpoints

elasticfilesystem-endpoint:ClientMount

Provides read-only access to a file system through EFS Endpoints. Required in addition to elasticfilesystem:ClientMount.

EFS Endpoints

elasticfilesystem-endpoint:ClientWrite

Provides write permissions on a file system through EFS Endpoints. Required in addition to elasticfilesystem:ClientWrite.

EFS Endpoints

elasticfilesystem-endpoint:ClientRootAccess

Provides use of the root user when accessing a file system through EFS Endpoints. Required in addition to elasticfilesystem:ClientRootAccess.

EFS Endpoints

Because permissions for EFS Endpoints use a separate IAM name, policies that grant elasticfilesystem:* or elasticfilesystem:Client* allow access only through mount targets. To connect through EFS Endpoints, the mount helper also needs elasticfilesystem:CreateMountSession in the identity policy. For more information, see Permissions for EFS Endpoints.

EFS condition keys for clients

To express conditions, you use predefined condition keys. Amazon EFS has the following predefined condition keys for NFS clients. Any other condition keys are not enforced when using IAM controls to secure access to EFS file systems.

EFS Condition Key Description Operator
aws:SecureTransport

Use this key to require clients to use TLS when connecting to an EFS file system.

Boolean

aws:SourceIp Use this key to compare the requester's IP address with the IP address that you specify in the policy. The aws:SourceIp condition key can only be used for public IP address ranges. For connections through EFS Endpoints, Amazon EFS evaluates this key against the public IP address of the client. String
elasticfilesystem:AccessPointArn ARN of the EFS access point to which the client is connecting. String
elasticfilesystem:AccessedViaMountTarget Use this key to prevent access to an EFS file system by clients that are not using file system mount targets.

Boolean

elasticfilesystem:AccessedViaRegionalEndpoint Use this key to allow or deny access to an EFS file system by clients that connect through EFS Endpoints.

Boolean

The AccessedViaMountTarget and AccessedViaRegionalEndpoint condition keys apply to client actions in both the elasticfilesystem and elasticfilesystem-endpoint IAM names. They don't apply to elasticfilesystem:CreateMountSession. Connections through a mount target have AccessedViaMountTarget set to true, and connections through EFS Endpoints have AccessedViaRegionalEndpoint set to true. For access through AWS Transfer Family, both keys are false.

File system policy examples

To view examples of Amazon EFS file system policies, see Resource-based policy examples for Amazon EFS.