Creating an EC2 instance with an AWS FSX mounted isn't showing files

614 views Asked by At

I have created an FSX for Lustre service in AWS, with a Data Repository Association to an S3 bucket. I am looking to create an EC2 instance that has the FSX file share mounted and contains the files that are in the S3 bucket as locally mounted files.

I am creating the EC2 instance from a launch template (shown below), and I do see the FSX folder present, however, I do not see any files within the folder.

My FSX AWS resource is:

enter image description here

My launch template user-data is:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==
Content-Type: text/cloud-config; charset="us-ascii"

runcmd:
- region=us-west-2
- amazon-linux-extras install -y lustre2.10
- mkdir -p /data/fsx
- mount -t lustre fs-xxxxxx.fsx.us-west-2.amazonaws.com@tcp:fsx" /data/fsx

--==MYBOUNDARY==--

When I ssh into the EC2 instance created with the launch template I see an empty folder under where my FSX file share should be mounted:

$ ls -lah /data/fsx/
total 0
drwxr-xr-x 2 root root  6 Jan 13 21:40 .
drwxr-xr-x 3 root root 17 Jan 13 21:40 ..

Does anyone have any pointers as to why my /data/fsx folder is empty, and how I can get it populated with the data in my FSX data repository path S3 bucket?

2

There are 2 answers

1
morkot On

From what you've described it might be multiple issues related to AWS configuration and OS and/or lustre configuration. I would follow the next troubleshooting steps:

  1. When you sshed to the instance, check if you can list or get files from the bucket. For that, you can use aws s3 commands. Like this:

    aws s3 ls s3://<bucket-name>/

    aws s3 cp s3://<bucket-name>/<some-file> ./

  2. If you have permission denied, check if you have needed permissions assigned to an EC2 instance's IAM profile. See for more info https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#attach-iam-role

  3. If s3 permissions are settled up correctly, then check luster logs and folder permissions.

0
Marko Eskola On

User data commands run only during the initial boot by default. If you have rebooted the instance, the mount command in the user data did not run. In order to mount the file system after every reboot, you should add a row to the /etc/fstab file.

There could be also some configuration settings mentioned in the official guide which help to get the file system mounted (networking): https://docs.aws.amazon.com/fsx/latest/LustreGuide/mount-fs-auto-mount-onreboot.html