How to Build a Serverless Web Application - Part A
Tags: lambda, webapp, dynamodb, cognito
Published: 2024-02-26 12:07:21

<!-- wp:heading -->
<h2 class="wp-block-heading">Overview</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this guide, we will create a serverless web application. The purpose of this application includes allowing the users to make a request for unicorn rides from the Wild Rydes fleet. Moreover, this application will present an interface (HTML-based) to the users for informing about the location where they would like to be picked up. It will also communicate with the RESTful web services for submitting the request and dispatching a nearby unicorn. Lastly, the users will have to register or perform a login before requesting rides.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Prerequisites</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Following prerequisites must be considered to move forward in this tutorial.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>AWS account</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>AWS CLI</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><a href="https://doc.arcgis.com/en/arcgis-online/get-started/create-account.htm">ArcGIS account</a> (to add mapping)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Text Editor</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Web Browser</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Application Architecture</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>This web application will make use of the following AWS services.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li><a href="https://aws.amazon.com/pm/lambda/?gclid=CjwKCAiA8sauBhB3EiwAruTRJiOHUdY_hJVhbpBQLYTI0VqhJnoflB70R0D-sK1xXilp1zrg9OZTYxoCtgkQAvD_BwE&amp;trk=cc9d3bb4-0a21-43d0-8236-0f2deaffe082&amp;sc_channel=ps&amp;ef_id=CjwKCAiA8sauBhB3EiwAruTRJiOHUdY_hJVhbpBQLYTI0VqhJnoflB70R0D-sK1xXilp1zrg9OZTYxoCtgkQAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!651510255294!e!!g!!aws%20lambda!19828212645!149982299751">AWS Lambda</a></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><a href="https://aws.amazon.com/api-gateway/">Amazon API Gateway</a></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><a href="https://aws.amazon.com/dynamodb/">Amazon DynamoDB</a></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><a href="https://aws.amazon.com/pm/cognito/?gclid=CjwKCAiA8sauBhB3EiwAruTRJhJZfB4HZkIeYsf5Z7ruueF4OZI_iuZXj7VL3Ebget5JDXNJsv0Q0xoCuj8QAvD_BwE&amp;trk=f30f83fb-9c61-4f1e-b44b-2924dc93ec8d&amp;sc_channel=ps&amp;ef_id=CjwKCAiA8sauBhB3EiwAruTRJhJZfB4HZkIeYsf5Z7ruueF4OZI_iuZXj7VL3Ebget5JDXNJsv0Q0xoCuj8QAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!651510255306!e!!g!!amazon%20cognito!19828212708!153893110024">Amazon Cognito</a></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><a href="https://aws.amazon.com/amplify/?gclid=CjwKCAiA8sauBhB3EiwAruTRJtpR1HBDaP7dDz37udHggHsP7avomsThDUKHznb7rtEHbDbuqJVBRhoC9H4QAvD_BwE&amp;trk=27a2247d-3723-4d60-96c5-ac1d66981aa2&amp;sc_channel=ps&amp;ef_id=CjwKCAiA8sauBhB3EiwAruTRJtpR1HBDaP7dDz37udHggHsP7avomsThDUKHznb7rtEHbDbuqJVBRhoC9H4QAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!647301910288!e!!g!!aws%20amplify%20console!19621316587!146396661300">AWS Amplify Console</a></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Although each and every service holds its own importance but let us continue the discussion with AWS Amplify Console. So what actually Amplify console does? Well, it provides continuous deployment and hosting of the static web resources. This includes HTML, CSS, JS and image files to be loaded in the browser.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Lambda and API Gateway helps in building a public backend API which will be used by JavaScript (the one executed in the browser) to send and receive data. As far as Amazon Cognito is concerned, it will mostly deal with user management and authentication to secure the backend API. At last, DynamoDB will be used to store data.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":33920,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://sudoconsultants.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-33920"/></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Modules</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>This tutorial is divided into 5 modules which are as follows.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Host a Static Website</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Manage Users</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Build a Serverless Backend</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Deploy a RESTful API</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Terminate Resources</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Module 1 – Host a Static Website</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Overview</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this particular module, you will use AWS Amplify for hosting static resources for your application with continuous deployment (built-in). The continuous deployment and hosting of web apps is made possible because Amplify Console provides users with a git-based workflow. In other modules, you will be allowed to add dynamic functionality to the pages.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Architecture Overview</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>There is nothing too complex when it comes to the architecture of this module. All the static web content of your application will be fully managed by Amplify Console. It will expose a public URL which will be used by the users for accessing your site. There is no need to run additional services or web servers to ensure the availability of your site. In case of real applications you will want to use a custom domain for hosting your site. If you want it then you can follow the procedure of setting a custom domain on Amplify.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Implementation</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Follow the implementation steps carefully to avoid any inconvenience.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Select a Region</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The important thing to note here is that your web application will be deployed only in that AWS region which shows support for all services used in this application. For this purpose, you can consider the <a href="https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/">AWS Regional Services List</a>. Some of the supported regions are:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>US East (N. Virginia)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>US East (Ohio)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>US West (Oregon)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>EU (Frankfurt)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>EU (Ireland)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>EU (London)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Asia Pacific (Tokyo)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Asia Pacific (Seoul)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Asia Pacific (Sydney)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Asia Pacific (Mumbai)</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You can select your region from the dropdown menu present in the upper right corner of AWS Management Console.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Create a Git Repository</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You will be provided with two options for managing the source code; AWS CodeCommit or GitHub. In this particular tutorial, we will use CodeCommit to store the application code.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Start by configuring the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html">AWS CLI</a> on your machine. You will need a terminal window for installing AWS CLI. The installation instructions for every operating system will be different. If you have already configured the CLI then move to the next step.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Navigate and open AWS CodeCommit console.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Choose “Create Repository” option.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Write “wildrydes-site” as the repository name and choose “Create” option.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Now set up IAM user with Git credentials in the IAM console. Navigate to the page: <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-account">Setup for HTTPS users using Git credentials</a> and keep following the instructions mentioned in step 1 to step 3.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Create access keys in the “Security Credentials” tab and save them or download them in a secure location. Along with this, generate <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam">HTTPS Git credentials for AWS CodeCommit</a>.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Open the terminal window that you used for the installation of AWS CLI and type the following command: aws configure</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Enter the Secret Access Key and AWS Access Key ID that you created in step 6.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Enter the region name that you initially selected to create the CodeCommit repository in.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Leave the output format blank and hit Enter.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You will see the following code block in your terminal window:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>% aws configure

AWS Access Key ID &#91;****************]: #####################

AWS Secret Access Key &#91;****************]: ###################

Default region name &#91;us-east-1]: us-east-1

Default output format &#91;None]:</code></pre>
<!-- /wp:code -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>It is time to set up the git config credential helper in the terminal window.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>For Linux, macOS or UNIX, go through <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unixes.html#setting-up-https-unixes-credential-helper">step 3: Setting up the credential helper</a> instructions.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>For Windows go through <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html#setting-up-https-windows-credential-helper">step 3: Setting up the credential helper</a> instruction.</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:code -->
<pre class="wp-block-code"><code>git config --global credential.helper '!aws codecommit credential-helper $@'

git config --global credential.UseHttpPath true</code></pre>
<!-- /wp:code -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Select the wildrydes-site repository by navigating back to the AWS CodeCommit console.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Expand the Clone URL dropdown menu and select Clone HTTPS.&nbsp; Copy the HTTPS URL.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Go back to your terminal window and run “git clone” and also paste the HTTPS URL that you just copied in the previous step.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You will see the following code block in your terminal window.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site

Cloning into ‘wildrydes-site’...</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Username for ‘https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site’: Enter the HTTPS Git credentials for AWS CodeCommit username you generated in steps above</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Password for ‘https://username@git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site’: Enter the HTTPS Git credentials for AWS CodeCommit password you generated in steps above</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>warning: You appear to have cloned an empty repository.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It is expected that you might receive a warning saying that you have cloned an empty repository. To deal with such common errors, visit the following guide.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-ch.html#troubleshooting-macoshttps">Troubleshooting the credential helper and HTTPS connections to AWS CodeCommit</a></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Populate the Git Repository</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>After successfully creating your Git repository (either by GitHub or AWS CodeCommit) and cloning it locally you now need to add the content to your repository by copying them from an existing and publicly accessible S3 bucket.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Navigate to your repository by changing the directory. Copy the static files from S3 bucket with the help of the following commands.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:list {"ordered":true} -->
<ol></ol>
<!-- /wp:list -->

<!-- wp:code -->
<pre class="wp-block-code"><code>cd wildrydes-site

aws s3 cp s3://wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website ./ --recursive</code></pre>
<!-- /wp:code -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Add, commit and push the Git files.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ git add .

$ git commit -m "new files"

$ git push</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>You will see the following code block in your terminal window.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>Counting objects: 95, done.

Compressing objects: 100% (94/94), done.

Writing objects: 100% (95/95), 9.44 MiB | 14.87 MiB/s, done.

Total 95 (delta 2), reused 0 (delta 0)

To https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site

* &#91;new branch] master -> master</code></pre>
<!-- /wp:code -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Enable Web Hosting with the AWS Amplify Console</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The next step is the deployment step. You will deploy the website by using AWS Amplify Console. For this you need to follow the following steps.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Open AWS Amplify console.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Click on the option “Get Started”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Look for “Amplify Hosting Host your Web App” Header and choose the option “Get Started”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Choose “AWS CodeCommit” and select “Continue” option.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Now comes the add repository branch step. Here you need to select the repository having the name “wildrydes-site”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Authorize AWS Amplify to your GitHub account in case you are using GitHub.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Select the “master” branch from the branch dropdown menu and choose “Next”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Leave all the options to default when you come on the Build Settings page. Select “Allow AWS Amplify to automatically deploy all files hosted in your project root directory” and then choose “Next”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>As soon as you land on Review page, select “Save and Deploy”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Wait for a few minutes to allow Amplify Console to create necessary resources and deploy the code.</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>To launch your very own Wild Rydes site, either select the site image or click on the link present underneath the thumbnail.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Modify your Site</strong><strong></strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As soon as AWS Amplify console detects changes to the connected repository, it will rebuild and redeploy the web app. To test it out, make a change to the main page.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>By staying on your local machine, visit the wildrydes-site folder and open the index.html file in any text editor.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Modify the title by changing it to “Wild Rydes – Rydes of the Future!”</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Save the file after making the changes.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Through your terminal window, you now need to add and commit the changes and then push the change to the repository. Amplify Console will rebuild the site after this change has been detected.</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You will see the following code block in your terminal window.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ git add index.html

$ git commit -m "updated title"

&#91;master dfec2e5] updated title

 1 file changed, 1 insertion(+), 1 deletion(-)

$ git push

Counting objects: 3, done.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 315 bytes | 315.00 KiB/s, done.

Total 3 (delta 2), reused 0 (delta 0)

remote: processing

To https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site

   2e9f540..dfec2e5  master -> master</code></pre>
<!-- /wp:code -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>After the redeployment process has successfully completed, open the site again and see the change for yourself.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Module 2 – Manage Users</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Overview</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>This module is related to the user management. You will create a user pool by using Amazon Cognito to manage the accounts. Pages like sign up and sign in will be deployed as well.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Architecture Overview</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The first thing that users need to do when they visit your website is to create a user account by providing email and password. If you want to include additional attributes in your application then you can use Amazon Cognito for this. After submitting their registration, the users will receive a confirmation email (on the provided email) containing verification code. Users will have to navigate back to the site and enter their email along with the verification code. The users should be able to perform a sign in after confirming their account. Users will have to provide email and password whenever they want to perform a sign in. During this process, a JavaScript function communicates with Amazon Cognito for authentication. It uses SRP – Secure Remote Password Protocol and receives a set of JWT – JSON Web Tokens. These web tokens will play a great role in maintaining the identity of the users.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Implementation</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Follow the implementation steps carefully to avoid any inconvenience.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Create an Amazon Cognito User Pool and Integrate an app with your User Pool</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>There are two mechanisms that Amazon Cognito provides for the authentication purpose. You can either use Cognito User Pools to include sign in and sign up functionality to the application or you can also use Cognito Identity Pools for authenticating the users through social identity providers. We will be using a user pool for this module.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Go to Amazon Cognito console and select “Create User Pool” option.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>In the sign-in options section of Cognito user pool, select the username. Leave all other options to default and select “Next”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>You will see Password policy mode on the “Configure security requirements page”, keep the mode as Cognito defaults. You can also choose multi-factor authentication or No MFA while keeping other configurations as default. Then choose “Next”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>On the “Configure sign-up experience page”, leave all the things to be default and select “Next”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Next, on the “Configure Message Delivery Page” confirm that “Send email with Amazon SES – Recommended” is selected for email provider. Similarly, in the “FROM” email address field, use that email address which you have already verified with Amazon SES by following the instructions in <a href="https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html#just-verify-email-proc">Verifying an email address identity</a> in <a href="https://docs.aws.amazon.com/ses/latest/dg/Welcome.html">Amazon Simple Email Service Developer Guide</a>.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>On the integration page, name your user pool to be “WildRydes”. Along with this, name the app client to be “WildRydesWebApp” while leaving other settings to default.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Choose “Create User Pool” option on the “Review and Create Page”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>On the “User Pools Page”, copy the User Pool ID and save it locally on your machine.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Navigate to “App Integration” tab, copy and save the Client ID.</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Update the Website Config File</strong></h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want to access the settings of pool ID, app client ID and region then you can see js/config.js file. Update this file with the settings of user pool and app that you just created in the previous steps. After doing this, upload the file back to the bucket.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Open the file “wildryde-site/js/config.js” in any text editor.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Update the Cognito section present in the file with the values of User Pool ID and App Client ID that you saved in the previous section.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>AWS Region code (where you created the user pool) should be the value for region.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>The updated code in the config.js file will look like this.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>window._config = {

    cognito: {

        userPoolId: 'us-west-2_uXboG5pAb', // e.g. us-east-2_uXboG5pAb

        userPoolClientId: '25ddkmj4v6hfsfvruhpfi7n4hv', // e.g. 25ddkmj4v6hfsfvruhpfi7n4hv

        region: 'us-west-2' // e.g. us-east-2

    },

    api: {

        invokeUrl: '' // e.g. https://rc7nyt4tql.execute-api.us-west-2.amazonaws.com/prod',

    }

};</code></pre>
<!-- /wp:code -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Save the file.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>In your terminal window, add and commit the changes and push the file to your repository.</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You will see the following code block in your terminal window.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ git add .

$ git commit -m "new_config"

$ git push</code></pre>
<!-- /wp:code -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading"><strong>Validate your Implementation</strong></h4>
<!-- /wp:heading -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Navigate to the “wildrydes-site” folder that you copied on your machine.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Open “/register.html”.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>After completing the registration form choose “Let’s Ryde”. Either use your own email or a fake one, it is up to you. The password you choose should have a number, special character and at least one upper-case letter. Make sure to remember this password.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>You can confirm the user by following one of the methods.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>If you have used your own email then you can verify your account by visiting “/verify.html” present under website domain and entering the verification code. It is must to check the spam folder because the verification mail might end up there.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>In case you have used a fake email, you will need to confirm the user manually using Cognito console.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Select “WildRydes” user pool in the Amazon Cognito console.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Go to the “Users” tab and choose the username to come across user detail page.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>In the dropdown menu of “Actions”, select the option “Confirm Account” to complete the creation process.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Choose “Confirm” in the user pop-up as well.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>After confirming the user successfully, visit “/signin.html” page and use the email address and password you entered during the account creation step to perform a login.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>You will be redirected to “/ride.html” page in case of success.</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this guide, we have completed our work with just two modules i.e. hosting a static website and managing users. In depth details and steps have been demonstrated for your ease. Follow each and every step with proper understanding so the errors could be minimized. In the next guide, we will work on the remaining modules as well.</p>
<!-- /wp:paragraph -->