Desktop and Application Streaming

Cross-Region redirection with Geo Targetly and Amazon AppStream 2.0

You can setup cross-Region redirection with services like Geo Targetly to automatically redirect Amazon AppStream 2.0 users to the AppStream stacks that are closest to their current location.

If the AppStream 2.0 deployment they use for their role is tied to a specific Region, users can experience high latency when traveling far distances from the specific Region. Users can travel to different geographical locations, and still expect to access their AppStream 2.0 applications and settings.

Overview of Solution

Architecture Diagram

Walkthrough

In this blog we walk you through setting up cross-Region redirection using your Identity Provider (IdP), Geo Targetly, and Amazon AppStream 2.0. The summary steps are:

  1. Get your IdP application URLs
  2. Create a geolocation policy using Geo Targetly
  3. (optionally) Setup an Amazon S3 bucket for a custom domain name
  4. Create an DNS A Record for your AppStream users
  5. (optionally) Create cross-region replication
  6. Test the configuration

Prerequisites

This walkthrough assumes you have the following:

  • Familiarity with AppStream 2.0
  • One custom application setup with your IdP per AWS Region referencing a configured AppStream stack
  • Users are assigned to the applications with your IdP
  • A Geo Targetly account
  • (optionally) You are utilizing Route 53 for your public hosted zone
  • (optionally) A S3 bucket, and a custom domain name.

Step 1 Get identity provider application URLs

The IdP application URLs direct users to the application in the Region. Work with your IdP to get the application URLs for your applications. Common examples of this functionality are Okta Embedded links and Azure AD Direct sign-on links.

Note: The architecture covered in this blog relies on the application URLs from your IdP. If your IdP does not offer this functionality, this architecture will not provide an optimized approach for your workload.

Step 2: Create a Geolocation Link Redirection with Geo Targetly

Geo Targetly performs the geolocation of the users, and the redirection to the appropriate application URL.

  1. Login to your Geo Targetly account 
  2. In the left navigation pane, browse to Geo Link
  3. Choose “Create New“
  4. Set the location rules. For example, in the following diagram there are two location rules. One location segment is set for US-EAST, for New York. The other location rule is set for US-West for California. You can specify the locations and Regions in which your users are based, or specify states and countries, or numerous other options. Geo Targetly provides state/region targeting examples.

    Creating Geo Rules with Geo Targetly

    Creating Geo Rules with Geo Targetly

  5. Select Link URL. Enter the application URL you collected in Step 1
  6. For All Other Locations, enter a Link URL which you want to redirect users to should they not match a specified location rule. This could be one of the URLs specified above, or something else.
  7. Select Next and then select Save to generate a Geo Link URL.
  8. Choose the to link. Save that link for later.
  9. Choose Save at the top to save your application settings.

(optional) Step 3 create an Amazon S3 bucket

Amazon S3 allows you to use a custom domain name with this solution. Amazon S3’s static website capability directs the user to the Geo Targetly URL from Route 53. If you do not want to use a custom domain name, you can skip this step and use the URLs Geo Targetly provides.

If you are using another DNS provider than Route 53, review the Geo Targetly DNS Settings instructions to configure the DNS settings and skip to the Step 5: Test GeoLocation Routing.

  1. Open the S3 management console
  2. Create a new bucket that matches the customer domain name. For example, if your customer domain name is example.com, create a bucket named appstream.example.com
  3. Choose the Properties Select Static website hosting, and choose edit
  4. Choose the Enable radio button. Then select redirect requests for an object under Hosting type
  5. For the hostname, specify the Geo Targetly URL you notated from Step 2 without the http:// or https://, for Protocol, leave it as none and choose Save Changes

(optional) Step 4: Setup routing in Route 53

Use Route53 to set the URL that accesses AppStream 2.0 applications.

  1. Open the Route 53 console
  2. Open the public hosted zone for the AppStream URL
  3. Create a DNS A Record that matches the S3 bucket name you created earlier
  4. Select the Alias
  5. Under Route traffic to, choose Alias to S3 website endpoint
  6. Choose the Region you created the S3 bucket in
  7. Choose the S3 endpoint that appears in the dropdown (this will only appear if the DNS A record name and S3 bucket name match exactly)
  8. Select Create Records

Step 5: Test geolocation routing

Test the geolocation routing rules you created to ensure they are working.

  1. From a machine or VM in the first location you setup in Step 2, connect to your custom domain name or the Geo Targetly URL.
  2. Validate that the traffic was redirected to the correct AppStream 2.0 endpoint as specified in the Geo Targetly rule
  3. From a machine or VM in the second location setup in Step 2, connect to your custom domain name or the Geo Targetly URL.
  4. Validate that the traffic was redirected to the correct AppStream 2.0 endpoint as specified in the Geo Targetly rule
  5. Continue to test until you have tested all specified locations.
  6. Once you have tested all locations you configured, connect to your custom domain name or the Geo Targetly URL from a machine or VM in a location not listed.
  7. Validate that the traffic was redirected to the URL set for All Other Locations in Step 2.

Step 6: Optional – Enable Cross-Region User Application Settings Persistence

If you are using Home Folder Synchronization, or have enabled Application Settings Persistence, you can create a bidirectional replication rule between the S3 buckets behind these features. Synchronizing the buckets allows you to maintain consistent settings and home folder files when using different Regions.

Enable Cross Region Replication on the AppStream 2.0 application settings S3 Buckets

  1. Open the AppStream 2.0 console.
  2. Select your stack, choose the User Settings tab.
  3. Expand the Application settings persistence section. Select the hyperlink for the S3 Bucket. The bucket will follow the following naming context `appstream-app-settings-region-code-account-id-without-hyphens-random-identifier’.
  4. Follow the steps to configure replication for source and destination buckets owned by the same account

Test application settings synchronization between Regions

  1. Navigate to the DNS Record you created above in Step 4 from an instance in Region A’s browser.
  2. Connect to AppStream 2.0 as a user and make a change that will persist. For example, create a new browser favorite.
  3. Choose End Session or Logout in the top right of the AppStream 2.0 Session.
  4. Connect to AppStream 2.0 as the same user but from Region B’s instance.
  5. Validate the changes made have persisted.

Enable Cross Region Replication on the User Home Folder S3 Buckets

  1. Open the AppStream 2.0 console,
  2. Select your stack, choose the Storage tab.
  3. Select the S3 bucket hyperlink for Home Folders. The S3 bucket follows this naming context `appstream2-36fb080bb8-region-code-account-id-without-hyphens`.
  4. Follow the steps to configure replication for source and destination buckets owned by the same account

Test Home Folder synchronization between Regions

  1. Navigate to the DNS Record you created above in Step 4 from an instance in Region A’s browser.
  2. Connect to AppStream 2.0 as a user and save a file in the user’s home folder.
  3. Choose End Session or Logout in the top right of the AppStream 2.0 Session.
  4. Connect to AppStream 2.0 as the same user but from Region B’s instance.
  5. Validate the file appears in the home folder.

Cleaning Up

Remove the redirections created within Geo Targetly. Remove the S3 bucket. If you were not using Route53 for this public hosted zone prior to this walkthrough, remove the public hosted zone you created. Remove the AppStream 2.0 stack and then fleet.

Conclusion

In this blog we walked you through setting up cross-region redirection with Geo Targetly for AppStream 2.0. With this configuration, tour users can be directed to the geographically closest region based upon the settings configured in Geo Targetly.