Create a web portal for a reference corporation, Example Corp. This example corporation lets interested customers create an account and sign up for an online software trial.
- 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 email to users who sign up for the online software trial.
- Make the streaming applications available to users who sign up for the software trial by using Amazon 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 handles website requests by generating a streaming URL when requested.
- Create a new resource and method by using API Gateway. The resource and method are used for exchanging 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.
- Host a static website
- Customize the FROM address used for email communications with your users
- Build a serverless backend
- Deploy a RESTful API
- Test your setup
- 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
- An AWS account: This lets you begin using AppStream 2.0 and other AWS services. For more information, see How do I create and activate a new Amazon Web Services account?
- An AppStream 2.0 environment: An AppStream 2.0 image, fleet, and stack are required to complete this project. For information about how to create these resources, see the following topics in the AppStream 2.0 Developer Guide:
- Email accounts: Have access to at least one test user email address to complete the configuration described in this project.
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 > |
The following steps show how to use a template in AWS CloudFormation to automate the tasks described in Modules 1, 3, and 4 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, fleet, and stack are still required. The CloudFormation template does not create these resources. 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-001. Keep the default name or optionally, change the name to one that is meaningful to you (for example, examplecorp-cfn-stack-tin).
4. Under Parameters, do the following:
- For AppStream2FleetName, type the name of the AppStream 2.0 fleet to use.
- For AppStreamSStackName, type the name of the AppStream 2.0 stack to use.
- For S3BucketName, type a globally unique name for your Amazon S3 bucket (for example, examplecorp-s3bucket-tin-<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 for your online trial.
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 for 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 the contents of the Example Corp website assets zip file (workshop_01_OnlineTrials.<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 S3 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_01_OnlineTrials.<GUID> folder. This folder includes the following folders and files:
- assets
- images
- index.html
- LICENSE.TXT
- NOTICE.TXT
- THIRD-PARTY.TXT
- tryitnow.html
19. Select all of the files and folders under the workshop_01_OnlineTrials.<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. In the website address bar, append the URL with /tryitnow.html
The Example Corp Free trial registration page displays.
29. To continue testing, perform the steps starting with step 2 in Module 5. Test Your Setup.