Amazon Elastic File System (EFS) used with Amazon AppStream 2.0 creates a persistent storage location often required by educational or research institutions while optimizing storage and application access. Combining these services simplifies how these institutions store their data or education materials and ensures researchers and students have access regardless of their location. Furthermore, the integration prioritizes secure data management while promoting collaboration. Adopting these technologies enhances institutions digital infrastructure, providing a responsive and accessible platform for researchers, educators and learners.
While this blog could be used in a variety of use cases the examples below focus on educational institutions as a common use case.
Why would an educational institution want to attach an EFS file share to AppStream 2.0 Linux instances? The answer lies in the collaborative nature of modern learning:
sudo yum install -y amazon-efs-utils
EFS_ENDPOINT: This is the DNS name of the EFS file system (created as part of pre requisites). It is available in EFS Filesystem page as shown below.
MOUNT_DIRECTORY: EFS file system is mounted on /mnt/efs_share. Change it as per requirements.
Paste the below sample BASH script into the file. Save the changes and exit the editor.
This sample script runs during instance launch and mounts the EFS share.
sudo vi /opt/appstream/SessionScripts/efs_mount.sh
#!/bin/bash
# Script to mount an Amazon EFS share to a specified mount point
# Constants
EFS_ENDPOINT=" fs-0caxxxxxxxda9.efs.us-west-2.amazonaws.com"
MOUNT_DIRECTORY="/mnt/efs_share"
MOUNT_OPTIONS="nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport"
# Ensure the mount point exists; if not, create it
if [ ! -d "${MOUNT_DIRECTORY}" ]; then
mkdir -p "${MOUNT_DIRECTORY}"
# Set the sticky bit to ensure only file owners can modify their respective files
# Adjust permissions as needed
chmod 1777 "${MOUNT_DIRECTORY}"
fi
# Attempt to mount the EFS share
mount -t nfs4 -o ${MOUNT_OPTIONS} "${EFS_ENDPOINT}:/" "${MOUNT_DIRECTORY}"
# Log the outcome of the mount operation
if [ $? -eq 0 ]; then
echo "$(date): Successfully mounted EFS at ${MOUNT_DIRECTORY}."
else
echo "$(date): Error mounting EFS."
fi
To save a file and exit vi editor, press Esc,
then type :wq
and press Enter
.
chmod +x /opt/appstream/SessionScripts/efs_mount.sh
sudo /opt/appstream/SessionScripts/efs_mount.sh
df -h
sudo vi /opt/appstream/SessionScripts/config.json
Modify the ‘executable’ section in the JSON to run the script created in the prior step. The modified `config.json` should resemble the structure provided.
{
"SessionStart": {
"executables": [
{
"context": "system",
"filename": "/opt/appstream/SessionScripts/efs_mount.sh",
"arguments": "",
"s3LogEnabled": true
}
],
"waitingTime": 30
},
"SessionTermination": {
"executables": [],
"waitingTime": 30
}
}
To save a file and exit vi editor, press Esc,
then type :wq
and press Enter
.
AppStreamImageAssistant create-image --name Image_name
df -h /mnt/efs_share/
Now administrators, educators, or users can stage and store shared data within the mount and begin collaborating with persistent shared storage.
You can stop your running fleet and delete your active stack to free up resources and to avoid unintended charges to your account.
Note that you cannot delete a stack with an associated fleet.
To clean up your resources
In conclusion, the integration of EFS and AppStream 2.0 plays a pivotal role in advancing the digital capabilities of educational institutions. This approach ensures that resources are stored in a persistent manner and readily accessible, promoting efficient teaching and learning. As the landscape of research and education evolves such integrations are crucial in laying the foundation for a seamless experience for students and educators.
For more information about Amazon AppStream 2.0 see What Is Amazon AppStream 2.0 and for Amazon Elastic File System see What is Amazon Elastic File System.
To get hands-on information, checkout the Getting started with AppStream 2.0 workshop.
Sudheer Manubolu is Solutions Architect with Amazon Web Services (AWS). He assists higher education customers through cloud implementations, leveraging in-depth knowledge of AWS services to design efficient solutions. Before joining AWS, he handled a broad spectrum of tasks, ranging from physical server installations to application development. | |
Grant Joslyn is a solutions architect for the US state and local government public sector team at Amazon Web Services (AWS). He specializes in end user compute and cloud automation. He provides technical and architectural guidance to customers building secure solutions on AWS. He is a subject matter expert and thought leader for strategic initiatives that help customers embrace DevOps practices. |
Grazie del tuo interesse, se desideri rimanere aggiornato iscriviti alla nostra Newsletter !