Follow the step-by-step instructions below to create your REST API. Click on each step number to expand the section.

  • Step 1. Create a new RESTful API

    Amazon API Gateway enables you to create, publish, maintain, monitor, and secure your own REST and WebSocket API operations. Complete the following steps to create a new RESTful API.

    1. Open the Amazon API Gateway console at https://console.aws.amazon.com/apigateway.
    2. Under Choose an API type, for REST API, choose Build.
      Important: Ensure that you do not select REST API Private.
    3. If this is your first API, the Create your first API dialog box opens. Choose OK to close the dialog box.
    4. Under Choose the protocol, keep REST selected.
    5. Under Create new API, choose New API.
    6. Under Settings, do the following:
      •     For API name, enter examplecorp_dashboard.
      •     For Description, you can optionally enter a description.
      •     For Endpoint Type, keep Regional selected.
    7. Choose Create API.
  • Step 2. Configure API Gateway for Lambda Integration

    To configure API Gateway for Lambda integration, complete the following steps.

    1. In the navigation pane of the API Gateway console, under the examplecorp_dashboard API, choose Authorizers.
    2. Choose Create New Authorizer, and then do the following:
      •     For Name, enter examplecorp_dashboard.
      •     For Type, choose Cognito.
      •     For Cognito User Pool, select the Amazon Cognito user pool that you created from the list (examplecorp_dashboard). Then, verify that the Region where you created your user pool is selected.
      •     For Token Source, enter Authorization.
      •     Leave Token Validation empty.
    3. Choose Create.
    4. In the navigation pane, choose Resources.
    5. Choose Actions, Create Resource.
    6. Do the following:
      •     Leave the Configure as proxy resource check box clear.
      •     For Resource Name, enter the code for the Region where you created your Lambda function. For example, if you created your Lambda function in US West (Oregon), enter:
            us-west-2
            For a list of AWS Region codes, see the table in Regional endpoints, in the AWS General Reference.
      •     For Resource Path, verify that the value is /<region-code>.
      •     Select the Enable API Gateway CORS check box.
    7. Choose Create Resource.
    8. With your newly created resource /<region-code> selected in the Resources pane, choose Actions, Create Method.
    9. Under OPTIONS, choose POST, and then select the check mark to the right of the list to save your changes.
    10. In the POST Setup pane, do the following:
      •     For Integration type, keep Lambda Function selected.
      •     Select the Use Lambda Proxy integration check box.
      •     For Lambda Region, verify that the Region where you created your Lambda function is selected.
      •     For Lambda Function, enter the name of the function that you created in module 3: examplecorp_lambda_dashboard_function.
      •     Keep the Use Default Timeout check box selected.
    11. Choose Save.
    12. In the Add Permission to Lambda Function dialog box, choose OK to confirm your changes.
    13. With your new POST method selected, in the Method Execution details pane, choose the Method Request card.
    14. In the POST Method Request pane, under Settings, do the following:
      •     Choose the pencil icon to the right of the Authorization list.
      •     Choose the Amazon Cognito authorizer that you created from the list: examplecorp_dashboard.
      •     Select the check mark to the right of the list to save your changes.
      •     Keep the remaining default settings.
    15. In the Resources pane, choose the resource root, /.

      Note: If your AppStream 2.0 fleets and WorkSpaces directories and instances are located in multiple AWS Regions and you’re enabling these Regions in the EUC dashboard, verify that you created a Lambda function in each Region that you’re enabling. For more information, see Module 3, Step 3. Create a Lambda function. Then, before continuing, repeat steps 5 through 15 in this procedure for each Region in which you created a Lambda function.

    16. Choose Actions, Deploy API.
    17. In the Deploy API dialog box, do the following:
      •     For Deployment stage, choose [New Stage].
      •     For Stage name, enter dashboard.
      •     For Stage description and Deployment description, you can optionally type a description.
      •     Choose Deploy.
    18. At the top of the dashboard Stage Editor pane, the Invoke URL displays. Make a note of this URL. You will need this URL in Module 5, Step 2. Update the config.js file, when you specify a value for InvokeURL.