Use Amazon EFS with Amazon EC2
Amazon EFS provides scalable file storage for use with Amazon EC2. You can use an EFS file system as
a common data source for workloads and applications running on multiple instances. For more
information, see the Amazon Elastic File System product page
For a tutorial on how to create a file system using the Amazon EFS console, see Getting started with Amazon Elastic File System in the Amazon Elastic File System User Guide.
Amazon EFS is not supported on Windows instances.
Test the EFS file system
You can connect to your instance and verify that the file system is mounted to the directory that you specified (for example, /mnt/efs).
To verify that the file system is mounted
-
Connect to your instance. For more information, see Connect to your Linux instance.
-
From the terminal window for the instance, run the df -T command to verify that the EFS file system is mounted.
$
df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/xvda1 ext4 8123812 1949800 6073764 25% / devtmpfs devtmpfs 4078468 56 4078412 1% /dev tmpfs tmpfs 4089312 0 4089312 0% /dev/shm
efs-dns
nfs4 9007199254740992 0 9007199254740992 0%/mnt/efs
Note that the name of the file system, shown in the example output as
efs-dns
, has the following form.file-system-id
.efs.aws-region
.amazonaws.com:/ -
(Optional) Create a file in the file system from the instance, and then verify that you can view the file from another instance.
-
From the instance, run the following command to create the file.
$
sudo touch
/mnt/efs
/test-file.txt -
From the other instance, run the following command to view the file.
$
ls
/mnt/efs
test-file.txt
-
Delete the EFS file system
If you no longer need your file system, you can delete it.
To delete the file system
-
Open the Amazon Elastic File System console at https://console.amazonaws.cn/efs/
. -
Select the file system to delete.
-
Choose Actions, Delete file system.
-
When prompted for confirmation, enter the file system ID and choose Delete file system.