Desktop and Application Streaming
Connect Amazon FSx for NetApp ONTAP to Amazon AppStream 2.0 Linux instances
Customers use Amazon AppStream 2.0 to deploy fleets of virtualized desktops and applications to their end customers, and supports a myriad of persistent storage solutions. AppStream 2.0 provides out-of-box functionality with many common storage options for users of your organization such as Amazon Simple Storage Service (S3), Amazon WorkDocs, Google Drive for G Suite, and OneDrive for Business. When working within these storage solutions, AppStream 2.0 downloads files at the start of a user session, and synchronizes them back with the storage provider at the end of the session. These services are optimized for most desktop workloads, and remain the de facto approach for typical system requirements.
Some AppStream 2.0 customers have more stringent demands to work with enhanced storage requirements such as large datasets, hundreds-to-millions of files, and continuous synchronization with the backend storage provider. For example, large development teams working on AppStream 2.0 fleet instances may need to collaborate and compile thousands of files to build large software applications. For these use cases, the fleet can be integrated with AWS storage services such as the Amazon FSx family of managed storage options. Pairing with FSx for ONTAP, for example, give the fleet a robust solution that leverages unique NetApp ONTAP storage features with customizable IOPS, throughput, and caching capabilities running within your VPCs. As a managed service, Amazon FSx maintains the availability, durability, patching, and visibility that relieves customers from managing their own storage solution.
This blog demonstrates how to deploy an Amazon AppStream 2.0 Linux-based fleet with the Amazon FSx family of storage share drives to deliver highly-performant storage. This solution is useful for teams that need the Amazon FSx managed features of caching, performance, and extensible storage all provided on the AWS network backbone. For Windows-based users, a previous blog is available as a how-to for setup a similar Windows solution.
Time to read | 10 minutes |
Time to complete | 30 minutes |
Learning level | Advanced (300) |
Cost to complete (estimated) | You only pay for the allocated FSx storage plus the AppStream 2.0 image builder instance time to configure the updated fleet. For more information, see the Amazon AppStream 2.0 pricing and Amazon FSx for NetApp ONTAP pricing. |
Services used |
Pre-requisites
The following prerequisites are required:
- An AWS account
- AWS IAM roles and policies with necessary permissions
- Amazon Virtual Private Cloud (VPC) with two or more private subnets
- An AppStream 2.0 fleet, stack and image builder – See Getting Started with Amazon AppStream 2.0 for more details on setup.
- An Amazon FSx for NetApp ONTAP file system – See Getting Started with Amazon FSx for more details on setup. Note down the FSxN share point for the new file system.
For example:<<svm>>.<<fileshare>>.fsx.<<region>>.com:/<<volume>>
Solution Overview
To use Amazon AppStream 2.0 together with Amazon FSx storage, an image builder must be configured to mount the FSx storage at session startup. This approach can be used for either mounting storage per user as home folders, or as common file shares.
The following diagram illustrates the different AppStream 2.0 and Amazon FSx for NetApp ONTAP components and their deployment.
Implementation
To create a custom image, begin by creating an image builder instance:
- From the AppStream 2.0 management console, select Images. Choose the Image builder tab and select Launch image builder.
- Select a Linux image by using the filter to search for an available Linux image and select
- Provide a name for your image and select an available instance type. We will leave the IAM roles and VPC Endpoints section untouched for this example. Select Next
- Select a VPC, an available subnet and a security group. Note: the VPC security groups must allow access to your Amazon FSx file system.
- Select Launch Image builder
The following options demonstrate combining your Amazon AppStream 2.0 Linux-based fleet with FSx for ONTAP persistent storage:
Option 1) Providing a Home Folder Drive for Every User
You can use Amazon FSx to provide an attached folder per user. This data is mounted using the Network File System (NFS) protocol to provide continuously synchronized network storage directly attached to the user’s AppStream 2.0 instance.
Steps
- From the AppStream 2.0 management console, select Images. Select the Image builder tab, select the radio button next to your Image builder and select Connect.
- Mount the FSx file system onto the image builder instance using your previously noted FSx volume share, and build the directories for each user.
sudo mkdir /fsx sudo mount -t nfs "<<svm>>.<<fileshare>>.fsx.<<region>>.amazonaws.com:/<<volume>>" /fsx # repeat below for each user sudo mkdir /fsx/<<username>> sudo chown 1002:1004 /fsx/<<username>>
- Update and insert an entry into /opt/appstream/SessionScripts/config.json under the SessionStart executables to run the mount script at startup.
{ "SessionStart": { "executables": [ …, { "Context": "system", "Filename": "/opt/appstream/SessionScripts/system-start-fsx-user.sh", "Arguments": "", "S3LogEnabled": true } ], "waitingTime": 60 }, … }
- Create a new mount script file for /opt/appstream/SessionScripts/system-start-fsx-user.sh to mount a per user FSx share. Update the NFS_SHARE variable with your previously noted FSx share. This script will auto-append the appstream_user_sh environment variable $AppStream_UserName to uniquely mount only the Linux user’s mount directory on the volume.
#!/bin/bash NFS_SHARE="<<svm>>.<<fileshare>>.fsx.<<region>>.amazonaws.com:/<<volume>>" HOMEFOLDER_BASE="$HOME/MyFiles/HomeFolder" # Load the appstream user variables if [ -f /etc/profile.d/appstream_user_vars.sh ]; then . /etc/profile.d/appstream_user_vars.sh fi # Mount FSX Storage for user session, create new directory if HomeFolder already exists (e.g. if S3 storage is already mounted) INDEX=”” while [ -d "$HOMEFOLDER_BASE$INDEX" ]; do ((INDEX++)) done HOMEFOLDER="$HOMEFOLDER_BASE$INDEX" mkdir "$HOMEFOLDER" chown as2-streaming-user:as2-streaming-user "$HOMEFOLDER" sudo mount -t nfs "$NFS_SHARE/$AppStream_UserName" "$HOMEFOLDER"
- Change the script file permission to executable.
sudo chmod 755 /opt/appstream/SessionScripts/system-start-fsx-user.sh
- Launch the Image assistant and create a new image.
- Update your AppStream 2.0 fleet with the newly created image. Stop and start your fleet.
- Launch an AppStream 2.0 user session. The FSx network storage will appear in the user’s MyFiles/HomeFolder2 directory until you turn off the S3 or similar-backed storage, giving teams an opportunity to migrate files over as needed into FSx storage. If desired, you can turn off previous storage, and the FSx storage should appear as MyFiles/HomeFolder. Both FSx and AppStream 2.0 built-in storage methods can coexist if desired.
Option 2) Providing File Shares Across Users
You can use FSx to provide a shared folder location for users in your organization to collaborate on common files needed by all users. The process is similar to Option 1, but mounted and shared at a common point across all fleet user instances.
Steps
- From the AppStream 2.0 management console, select Images. Select the Image builder tab, select the radio button next to your Image builder and select Connect.
- Mount the FSx file system onto the image builder instance using your FSx volume share, and build a common directory for shared use.
sudo mkdir /fsx sudo mount -t nfs "<<svm>>.<<fileshare>>.fsx.<<region>>.amazonaws.com:/<<volume" /fsx sudo mkdir /fsx/common sudo chown 1002:1004 /fsx/common
- Update and insert an entry into /opt/appstream/SessionScripts/config.json under the SessionStart executables to run the mount script at startup.
{ "SessionStart": { "executables": [ …, { "Context": "system", "Filename": "/opt/appstream/SessionScripts/system-start-fsx-common.sh", "Arguments": "", "S3LogEnabled": true } ], "waitingTime": 60 }, … }
- Create a new mount script file for /opt/appstream/SessionScripts/system-start-fsx-common.sh to mount a common share across users. Update the NFS_SHARE variable with your previously noted FSx share:
#!/bin/bash NFS_SHARE="<<svm>>.<<fileshare>>.fsx.<<region>>.amazonaws.com:/<<volume>>/common" COMMONFOLDER_BASE="/fsx/common" # Mount FSX Storage for common storage sudo mount -t nfs "$NFS_SHARE" "$COMMONFOLDER_BASE"
- Change the file permission to executable.
sudo chmod 755 /opt/appstream/SessionScripts/system-start-fsx-common.sh
- Launch the Image assistant and create a new image.
- Update your AppStream 2.0 fleet with the newly created image.
- Stop and start your fleet.
- Launch an AppStream 2.0 user session. Amazon FSx shared storage will now appear for users to share data under /fsx/common.
Cleanup
To avoid ongoing charges in your AWS account, delete all newly created AWS resources. Log into the AWS Management Console to delete the resources you may have created as part of this deployment such as the fleet, image builder and FSx file system. For information on deleting images see the AppStream 2.0 Administration Guide. For information on deleting FSx storage see the Clean up resources ONTAP Getting Started User Guide.
Conclusion
With Amazon AppStream 2.0 and Amazon FSx, customers can build virtualized desktops that can meet high-performance storage use cases with continuous synchronization of thousands-to-millions of files. This example has been used with customers for high-end collaborative development that requires enhanced storage capabilities.
For further information on selecting the right FSx storage service, see this overview on Choosing the Right FSx File System.
For further information on advanced performance tuning, see Amazon FSx for NetApp ONTAP performance.
Ron Kolwitz is a senior solutions architect supporting US Federal Government Sciences customers. He partners with customers to provide technical guidance on enterprise cloud adoption and strategy, and helps with building well-architected solutions. He is especially passionate about aerospace as well as quantum-based computing. In his free time, he enjoys spending time with his family of avid water-skiers, and can typically be found enjoying the great outdoors. | |
Roy Tokeshi is a skilled tech enthusiast with over a quarter of a century of experience in IT consulting, teaching, and architecture design. His love for technology shows his dedication to exploring new trends and building inclusive communities. He simplifies complex concepts and makes tech accessible to all professionals. Roy enjoys making and building with AWS services, CNC, laser engravers, and IoT. While he is terrible at chess, he loves to encourage people of all ages and from all walks of life to play chess over the board and on-line. | |
Robert Fountain is a Sr. EUC Specialist Solutions Architect based out of Pennsylvania. Robert has been with AWS since 2020 and currently holds six AWS Certifications. Outside of the office, Robert is a member of the National Ski Patrol and enjoys spending time with his wife, 2 boys, and his dog, Daisy. |