Create a web portal for a reference corporation, Example Corp. This portal lets you share a preconfigured Amazon AppStream 2.0 image with your customers, if they sign up to access the image.

  • Enable website hosting for the Example Corp. website by using Amazon Simple Storage Service (Amazon S3).
  • Set up and verify an email address identity by using Amazon Simple Email Service (SES). Amazon SES sends an email to users who sign up to access the image.
  • Make an image available to users by using AppStream 2.0.
  • Create a policy and role by using AWS Identity and Access Management (IAM). Attach the IAM policy to the IAM role that you created. This policy is required to run a function that you'll create. 
  • Create a function by using AWS Lambda. The function shares an AppStream 2.0 image with the AWS account of the requester. 
  • Create a new resource and method by using Amazon API Gateway. The resource and method are used to exchange requests between users and the Lambda function.

The application architecture uses Amazon S3, Amazon API Gateway, AWS Lambda, Amazon AppStream 2.0, and Amazon SES, as shown in the following diagram.

This project includes six modules. You must complete each module before proceeding to the next.

  1. Host a static website
  2. Customize the FROM address used for email communications with your users
  3. Build a serverless backend
  4. Deploy a RESTful API
  5. Test your setup
  6. Clean up your project resources

AWS Experience: We recommend familiarity with AppStream 2.0 and other AWS services. If you are new to AppStream 2.0, see the AppStream 2.0 Getting Started Guide. This guide describes how to:

  • Install and configure two applications. 
  • Perform foundational administrative tasks by using the AppStream 2.0 console.
  • Provision a virtual network in Amazon Virtual Private Cloud (Amazon VPC) by using a provided AWS CloudFormation template.
     

Time to complete: 1.5 hours

Cost to complete:  Some of the services used in this project are eligible for the AWS Free Tier. To identify eligible services, see AWS Free Tier. If you are outside the usage limits of the Free Tier, the total cost completing this project will vary depending on your needs and configuration (for example, the AppStream 2.0 instance type and fleet type that you use). To reduce costs, we recommend that you terminate the resources that are associated with your project after you complete it. If you choose not to terminate your resources, we recommend that you stop your fleets and image builders when you are not using them.
 
Prerequisites: To complete this tutorial, you will need:

CloudFormation Template: You can launch one of these AWS CloudFormation templates in the Region of your choice to build the resources necessary for this workshop automatically.

Region CloudFormation Template
US West (Oregon) Launch stack >
US East (N. Virginia)  Launch stack >
Asia Pacific (Mumbai) Launch stack >
Asia Pacific (Tokyo) Launch stack >
Asia Pacific (Sydney) Launch stack >
Asia Pacific (Singapore) Launch stack >
Asia Pacific (Seoul)  Launch stack >
EU (Ireland) Launch stack >
EU (Frankfurt) Launch stack >
CloudFormation Instructions

The following steps show how to use a template in AWS CloudFormation to automate the tasks described in Modules 1, 2, and 3 of this project. For a list of these tasks, see the “Tasks you’ll accomplish” section in the project Overview page.

Note
Although the CloudFormation template automates most of the tasks for this project, an existing AppStream 2.0 image is still required. The CloudFormation template does not create this resource. In addition, you must set up and verify an email address identity by using Amazon Simple Email Service (SES). For more information, see Module 2. Customize the FROM address used for email communications with your users.

1. Make sure that you are signed in to the AWS Management Console.

2. In the list of regional choices, open the Launch Stack link that is associated with the AWS Region in which you want to build your environment for this project.

3. On the Quick create stack page, the following information displays:

  • Template URL: The URL for the template
  • Stack description: A description for the CloudFormation stack.
  • Stack name: The name of the CloudFormation stack. The default name is as2-stack-003. Keep the default name or optionally, change the name to one that is meaningful to you (or example, examplecorp-cfn-stack-si).

4. Under Parameters, do the following:

  • For AppStream2ImageName, type the name of the AppStream 2.0 fleet to share.
  • For BucketName, type a globally unique name for your Amazon S3 bucket (for example, examplecorp-s3bucket-si-<yourfirstname-yourlastname>). The S3 bucket hosts your website.
  • For SESEmail, type the email address that you set up and verified by using Amazon SES (for example, sender@example.com). This address is used as a FROM address when sending email to users who sign up to access your image. 

5. Under Capabilities, you are notified that the template includes Identity and Access Management (IAM) resources that have minimum required permissions. Specifically, [AWS::IAM::Role] capabilities are required. Select the check box to acknowledge that CloudFormation might create IAM resources with custom names.

6. Choose Create stack.

7. When the creation process completes, the AWS CloudFormation console displays a status of CREATE_COMPLETE.

8. With your stack selected, choose the Outputs tab.

9. In the Outputs table, under the Key column, make a note of the values for the resources that the CloudFormation template created:

  • BucketName – The name of the S3 bucket. The name that you specified for the S3 bucket in step 4 is used. 
  • ExampleCorpApiGWInvokeUrl -- The API Gateway invoke URL. The URL follows this format: https://<code>.execute-api.<region>.amazonaws.com/dev
  • Website URL -- The Amazon S3 website endpoint for the S3 bucket. The URL follows this format: https://<S3bucketname>.s3-website-<region>.amazonaws.com.

10. Download and extract the contents of the Example Corp website assets zip file. (workshop_03_ShareImage.<GUID>.zip) to your local computer.

11. Extract the contents of the file that you downloaded on your local computer.

12. Navigate to the location where you extracted the contents of the zip file on your local computer, and open the following file in a text editor: assets/js/as2.js.

13. In the file, search for var invokeurl = to locate the invokeurl variable

14. Replace the default value with the API Gateway invoke URL that the CloudFormation template generated.

15. Save your changes and close the file.

16. Open the Amazon S3 console at https://console.aws.amazon.com/s3/.

17. In the Bucket name list, choose the name of the bucket that you specified in step 4.

18. Navigate to the location where you extracted the contents of the zip file on your local computer. Open the workshop_03_ShareImage.<GUID> folder. This folder includes the following folders and files:

  • assets
  • images
  • imageshare.html
  • index.html
  • LICENSE.TXT
  • NOTICE.TXT
  • THIRD-PARTY.TXT

19. Select all of the files and folders under the workshop_03_ShareImage.<GUID> folder. Do not select the folder itself.

20. In the Amazon S3 console window, on the Overview tab, choose Upload.

21. Drag and drop your selections into the Upload dialog box.

22. Choose Upload.

23. Wait for the upload to complete, and verify that the correct files and folders appear in the list on the Overview tab.

24. In the menu in the upper left corner of the console, choose Services.

25. In the search box, type cloudformation, and then choose CloudFormation from the search results.

26. In the Stacks list, under Stack name, choose the name of the stack that CloudFormation created.

27. On the Outputs tab, under Value, choose the URL that corresponds to the WebsiteURL key. The Example Corp website home page displays.

28. To continue testing, complete the steps in Module 5. Test your setup.