-
Notifications
You must be signed in to change notification settings - Fork 248
/
on-start.sh
41 lines (31 loc) · 1.5 KB
/
on-start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
# OVERVIEW
# This script mounts a FSx for Lustre file system to the Notebook Instance at the /fsx directory based off
# the DNS and Mount name parameters.
#
# This script assumes the following:
# 1. There's an FSx for Lustre file system created and running
# 2. The FSx for Lustre file system is accessible from the Notebook Instance
# - The Notebook Instance has to be created on the same VPN as the FSx for Lustre file system
# - The subnets and security groups have to be properly set up. Same values for file system and notebook.
# 3. Set the FSX_DNS_NAME parameter below to the DNS name of the FSx for Lustre file system.
# 4. Set the FSX_MOUNT_NAME parameter below to the Mount name of the FSx for Lustre file system. It's not the name you appointed at creation.
#sudo -u ec2-user -i <<'EOF'
# PARAMETERS
FSX_DNS_NAME=fs-your-fs-id.fsx.your-region.amazonaws.com
FSX_MOUNT_NAME=your-mount-name
# First, we need to install the lustre libraries
# this command is dependent on current running Amazon Linux and JupyterLab versions
CURR_VERSION=$(cat /etc/os-release)
if [[ $CURR_VERSION == *$"http://aws.amazon.com/amazon-linux-ami/"* ]]; then
sudo yum install -y lustre-client
else
sudo amazon-linux-extras install -y lustre
fi
# Now we can create the mount point and mount the file system
sudo mkdir -p /fsx
sudo mount -t lustre -o noatime,flock $FSX_DNS_NAME@tcp:/$FSX_MOUNT_NAME /fsx
# Let's make sure we have the appropriate access to the directory
sudo chmod go+rw /fsx
#EOF