Automate the creation of AppStream 2.0 resources using AWS CloudFormation - AWS Prescriptive Guidance

Automate the creation of AppStream 2.0 resources using AWS CloudFormation

Created by Ram Kandaswamy (AWS)

Summary

This pattern provides code samples and steps to automate the creation of Amazon AppStream 2.0 resources in the Amazon Web Services (AWS) Cloud by using an AWS CloudFormation template. The pattern shows you how to use an AWS CloudFormation stack to automate the creation of your AppStream 2.0 application resources, including an image builder, image, fleet instance, and stack. You can stream your AppStream 2.0 application to end users on an HTML5-compliant browser by using either the desktop or application delivery mode.

Prerequisites and limitations

Prerequisites

  • An active AWS account

  • An acceptance of AppStream 2.0 terms and conditions

  • Basic knowledge of AppStream resources, such as stacks, fleets, and image builders

Limitations

  • You can’t modify the AWS Identity and Access Management (IAM) role associated with an AppStream 2.0 instance after that instance is created.

  • You can’t modify properties (such as the subnet or security group) on the AppStream 2.0 image builder instance after that image builder is created.

Architecture

The following diagram shows you how to automate the creation of AppStream 2.0 resources by using an AWS CloudFormation template.

The diagram shows the following workflow:

Workflow for automatically creating AppStream 2.0 resources.
  1. You create an AWS CloudFormation template based on the YAML code in the Additional information section of this pattern.

  2. The AWS CloudFormation template creates an AWS CloudFormation test stack.

    1. (Optional) You create an image builder instance by using AppStream 2.0.

    2. (Optional) You create a Windows image by using your custom software.

  3. The AWS CloudFormation stack creates an AppStream 2.0 fleet instance and stack.

  4. You deploy your AppStream 2.0 resources to end users on an HTML5-compliant browser.

Technology stack

  • Amazon AppStream 2.0

  • AWS CloudFormation

Tools

  • Amazon AppStream 2.0 is a fully managed application streaming service that provides you with instant access to your desktop applications from anywhere. AppStream 2.0 manages the AWS resources required to host and run your applications, scales automatically, and provides access to your users on demand.

  • AWS CloudFormation helps you model and set up your AWS resources, provision them quickly and consistently, and manage them throughout their lifecycle. You can use a template to describe your resources and their dependencies, and launch and configure them together as a stack, instead of managing resources individually. You can manage and provision stacks across multiple AWS accounts and AWS Regions.

Epics

TaskDescriptionSkills required

Install custom software and create an image.

  1. Install the AppStream 2.0 application that you plan to deploy to your users.

  2. Use the Photon create image agent or a PowerShell script to create a new Windows image for your custom software. 

Note: Consider using the Windows AppLocker feature to further lock down the image.

AWS DevOps, Cloud architect
TaskDescriptionSkills required

Update the AWS CloudFormation template.

  1. Save the code in the Additional information section of this pattern as a YAML file.

  2. Update the YAML file with the required values for the parameters in your environment.

AWS systems administrator, Cloud administrator, Cloud architect, General AWS, AWS administrator

Create an AWS CloudFormation stack using the template.

  1. Sign in to the AWS Management Console and open the AWS CloudFormation console.

  2. On the navigation pane, choose Stacks.

  3. Choose Create stack and then choose With new resources (standard).

  4. In the Prerequisite – Prepare template section, choose Template is ready.

  5. In the Specify template section, choose Upload a template file.

  6. Choose Choose file and then choose your updated AWS CloudFormation template.

  7. Complete the rest of the steps in the wizard to create your stack.

App owner, AWS systems administrator, Windows Engineer

Related resources

References

Tutorials and videos

Additional information

The following code is an example of an AWS CloudFormation template that allows you to automatically create AppStream 2.0 resources.

AWSTemplateFormatVersion: 2010-09-09 Parameters: SubnetIds: Type: 'List<AWS::EC2::Subnet::Id>' testSecurityGroup: Type: 'AWS::EC2::SecurityGroup::Id' ImageName: Type: String Resources: AppStreamFleet: Type: 'AWS::AppStream::Fleet' Properties: ComputeCapacity: DesiredInstances: 5 InstanceType: stream.standard.medium Name: appstream-test-fleet DisconnectTimeoutInSeconds: 1200 FleetType: ON_DEMAND IdleDisconnectTimeoutInSeconds: 1200 ImageName: !Ref ImageName MaxUserDurationInSeconds: 345600 VpcConfig: SecurityGroupIds: - !Ref testSecurityGroup SubnetIds: !Ref SubnetIds AppStreamStack: Type: 'AWS::AppStream::Stack' Properties: Description: AppStream stack for test DisplayName: AppStream test Stack Name: appstream-test-stack StorageConnectors: - ConnectorType: HOMEFOLDERS UserSettings: - Action: CLIPBOARD_COPY_FROM_LOCAL_DEVICE Permission: ENABLED - Action: CLIPBOARD_COPY_TO_LOCAL_DEVICE Permission: ENABLED - Action: FILE_DOWNLOAD Permission: ENABLED - Action: PRINTING_TO_LOCAL_DEVICE Permission: ENABLED AppStreamFleetAssociation: Type: 'AWS::AppStream::StackFleetAssociation' Properties: FleetName: appstream-test-fleet StackName: appstream-test-stack DependsOn: - AppStreamFleet - AppStreamStack