Under Choose an API type, for REST API, choose Build. Important: Ensure that you do not select REST API Private.
If this is your first API, the Create your first API dialog box opens. Choose OK to close the dialog box.
Under Choose the protocol, keep REST selected.
Under Create new API, choose New API.
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.
Choose Create API.
Step 2. Configure API Gateway for Lambda Integration
To configure API Gateway for Lambda integration, complete the following steps.
In the navigation pane of the API Gateway console, under the examplecorp_dashboard API, choose Authorizers.
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.
In the navigation pane, choose Resources.
Choose Actions, Create Resource.
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.
Choose Create Resource.
With your newly created resource /<region-code> selected in the Resources pane, choose Actions, Create Method.
Under OPTIONS, choose POST, and then select the check mark to the right of the list to save your changes.
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.
In the Add Permission to Lambda Function dialog box, choose OK to confirm your changes.
With your new POST method selected, in the Method Execution details pane, choose the Method Request card.
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.
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.
Choose Actions, Deploy API.
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.
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.