Amazon Elastic File System Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 2: Line 2:
* [[Amazon Elastic File System#Subjects|Amazon Elastic File System]]
* [[Amazon Elastic File System#Subjects|Amazon Elastic File System]]


=Get Information=
==List and Describe Available EFS File Systems==
<syntaxhighlight lang='bash'>
aws efs describe-file-systems
</syntaxhighlight>
Describe just one file system:
<syntaxhighlight lang='bash'>
aws efs describe-file-systems --file-system-id fs-99999999
</syntaxhighlight>
==List Mount Targets==
<syntaxhighlight lang='bash'>
aws efs describe-mount-targets --file-system-id fs-33333333
</syntaxhighlight>
=Create a File System=
{{External|https://docs.aws.amazon.com/efs/latest/ug/gs-step-two-create-efs-resources.html}}
==From Console==
AWS Console in the correct region → EFS → Create file System.
Name: playground-efs
VPC: An EFS file system can only have [[Amazon_Elastic_File_System_Concepts#Mount_Target|mount targets]] in one VPC at a time.
Customize.
Do not enable encryption.
Mount targets. It seems there could be just [[Amazon_Elastic_File_System_Concepts#Mount_Target|one mount target per availability zone.]]
Subnet IDs
Security Groups. If the request provides SecurityGroups, the mount target's network interface is associated with those security groups. Otherwise, it belongs to the default security group for the subnet's VPC. For more details, see: {{Internal|Amazon_Elastic_File_System_Concepts#Security_Group|Elastic File System Concepts &#124; Security Group}}
==With CLI==
=Delete a File System=
==Delete a Mount Target==
First all mount targets need to be deleted:
<syntaxhighlight lang='bash'>
aws efs delete-mount-target --mount-target-id fsmt-11111111
</syntaxhighlight>
==Delete the File System==
<syntaxhighlight lang='bash'>
aws efs delete-file-system --file-system-id fs-33333333
</syntaxhighlight>
=Mount an EFS File System on an EC2 Instance=
=Mount an EFS File System on an EC2 Instance=
==Using the EFS Mount Helper==
This approach requires the presence of the EFS mount helper.


Install 'amazon-efs-utils' package:
Install 'amazon-efs-utils' package:
Line 16: Line 71:


<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo mount -t efs fs-12345678:/ /mnt/efs
sudo mount -t efs -o tls fs-99999999:/ /mnt/efs
</syntaxhighlight>
</syntaxhighlight>
More details:
More details:
{{External|https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html}}
{{External|https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html}}
==Using the NFS Client==
<syntaxhighlight lang='bash'>
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-99999999.efs.us-west-2.amazonaws.com:/ /mnt/efs
</syntaxhighlight>
==Troubleshooting Mount Issues==
First make sure the availability zone mount point is accessible: there is a route to it and there is no security group that gets in the way.
The IP address of the mount point can be obtained from the filesystem.
=Access Point Operations=
==Create an Access Point==
{{External|https://docs.aws.amazon.com/efs/latest/ug/create-access-point.html}}
==Remove an Access Point==

Latest revision as of 23:12, 30 March 2021

Internal

Get Information

List and Describe Available EFS File Systems

aws efs describe-file-systems

Describe just one file system:

aws efs describe-file-systems --file-system-id fs-99999999

List Mount Targets

aws efs describe-mount-targets --file-system-id fs-33333333

Create a File System

https://docs.aws.amazon.com/efs/latest/ug/gs-step-two-create-efs-resources.html

From Console

AWS Console in the correct region → EFS → Create file System.

Name: playground-efs

VPC: An EFS file system can only have mount targets in one VPC at a time.

Customize.

Do not enable encryption.

Mount targets. It seems there could be just one mount target per availability zone.

Subnet IDs

Security Groups. If the request provides SecurityGroups, the mount target's network interface is associated with those security groups. Otherwise, it belongs to the default security group for the subnet's VPC. For more details, see:

Elastic File System Concepts | Security Group

With CLI

Delete a File System

Delete a Mount Target

First all mount targets need to be deleted:

aws efs delete-mount-target --mount-target-id fsmt-11111111

Delete the File System

aws efs delete-file-system --file-system-id fs-33333333

Mount an EFS File System on an EC2 Instance

Using the EFS Mount Helper

This approach requires the presence of the EFS mount helper.

Install 'amazon-efs-utils' package:

sudo yum install -y amazon-efs-utils

More details:

https://docs.aws.amazon.com/efs/latest/ug/installing-amazon-efs-utils.html

Mount the file system:

sudo mount -t efs -o tls fs-99999999:/ /mnt/efs

More details:

https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html

Using the NFS Client

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-99999999.efs.us-west-2.amazonaws.com:/ /mnt/efs

Troubleshooting Mount Issues

First make sure the availability zone mount point is accessible: there is a route to it and there is no security group that gets in the way.

The IP address of the mount point can be obtained from the filesystem.

Access Point Operations

Create an Access Point

https://docs.aws.amazon.com/efs/latest/ug/create-access-point.html

Remove an Access Point