<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Subashkumar</title>
    <description>The latest articles on DEV Community by Subashkumar (@subashkumar).</description>
    <link>https://dev.to/subashkumar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1066718%2Fcd270094-ef51-4989-9cee-63d20c28ba7e.jpg</url>
      <title>DEV Community: Subashkumar</title>
      <link>https://dev.to/subashkumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/subashkumar"/>
    <language>en</language>
    <item>
      <title>Build a Serverless Web Application with AWS Lambda, API Gateway,Amplify,DynamoDB and Cognito</title>
      <dc:creator>Subashkumar</dc:creator>
      <pubDate>Mon, 07 Aug 2023 20:40:52 +0000</pubDate>
      <link>https://dev.to/subashkumar/build-a-serverless-web-application-with-aws-lambda-api-gatewayamplifydynamodb-and-cognito-1kd9</link>
      <guid>https://dev.to/subashkumar/build-a-serverless-web-application-with-aws-lambda-api-gatewayamplifydynamodb-and-cognito-1kd9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Build a serverless web application to follow step-by-step instructions to create a simple serverless web application that enables users to request unicorn rides from the &lt;a href="http://www.wildrydes.com/" rel="noopener noreferrer"&gt;Wild Rydes fleet&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS account&lt;/li&gt;
&lt;li&gt;ArcGIS &lt;a href="https://www.arcgis.com/sharing/oauth2/authorize?client_id=arcgisonline&amp;amp;response_type=code&amp;amp;state=%7B%22portalUrl%22%3A%22https%3A%2F%2Fwww.arcgis.com%22%2C%22uid%22%3A%226dL7VZOr_kNzhQvrYvtBg7nVFAYza-mXDHLcYUYa_JQ%22%2C%22useLandingPage%22%3Atrue%2C%22clientId%22%3A%22arcgisonline%22%7D&amp;amp;expiration=20160&amp;amp;locale=en-gb&amp;amp;redirect_uri=https%3A%2F%2Fwww.arcgis.com%2Fhome%2Faccountswitcher-callback.html&amp;amp;force_login=true&amp;amp;redirectToUserOrgUrl=true&amp;amp;code_challenge=D8zOAdkMArKQ08d-P_gaAhWo801fO3mCwoIhnZ-29zo&amp;amp;code_challenge_method=S256&amp;amp;display=default&amp;amp;hideCancel=true&amp;amp;showSignupOption=true&amp;amp;canHandleCrossOrgSignIn=true&amp;amp;signuptype=esri&amp;amp;allow_verification=true" rel="noopener noreferrer"&gt;Account&lt;/a&gt; to add mapping to your app&lt;/li&gt;
&lt;li&gt;Text editor (VS CODE)&lt;/li&gt;
&lt;li&gt;AWS Lambda &lt;/li&gt;
&lt;li&gt;AWS API Gateway &lt;/li&gt;
&lt;li&gt;AWS Amplify&lt;/li&gt;
&lt;li&gt;Amazon DynamoDB &lt;/li&gt;
&lt;li&gt;Amazon Cognito&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Application Architecture Diagram:
&lt;/h2&gt;

&lt;p&gt;The application architecture uses AWS Lambda, Amazon API Gateway, Amazon DynamoDB, Amazon Cognito, and AWS Amplify Console. Amplify Console provides continuous deployment and hosting of the static web resources including HTML, CSS, JavaScript, and image files which are loaded in the user's browser. JavaScript executed in the browser sends and receives data from a public backend API built using Lambda and API Gateway. Amazon Cognito provides user management and authentication functions to secure the backend API. Finally, DynamoDB provides a persistence layer where data can be stored by the API's Lambda function&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz82isx0bhoxosyg7w1ct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz82isx0bhoxosyg7w1ct.png" alt="Serverless Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Amplify:
&lt;/h2&gt;

&lt;p&gt;You will configure AWS Amplify to host the static resources for your web application with continuous deployment built in. The Amplify Console provides a git-based workflow for continuous deployment and hosting of full-stack web apps. In subsequent modules, you will add dynamic functionality to these pages using JavaScript to call remote RESTful APIs built with AWS Lambda and Amazon API Gateway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8b4yf6xkt9j0e3dcjx7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8b4yf6xkt9j0e3dcjx7x.png" alt="Amplify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow step by step to configure aws:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to AWS Console and Choose your aws region.&lt;/li&gt;
&lt;li&gt;Create a Git repository using Codecommit (free Tier) or GitHub. Open the &lt;a href="https://console.aws.amazon.com/codesuite/codecommit/repositories" rel="noopener noreferrer"&gt;AWS CodeCommit console&lt;/a&gt;
Note: I use &lt;strong&gt;AWS Codecommit&lt;/strong&gt; and &lt;strong&gt;AWS cloudshell&lt;/strong&gt; for terminal&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create Repository&lt;/strong&gt; and set the repo name to "&lt;code&gt;wildrydes-site&lt;/code&gt;"&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now that the repository is created, set up an IAM user with Git credentials in the IAM console &lt;a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam" rel="noopener noreferrer"&gt;following these instructions.&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(Recommended to use IAM user for this project)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Back in the CodeCommit console, from the Clone URL dropdown, select Clone HTTPS&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F968tdnt2qda56vzar7kz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F968tdnt2qda56vzar7kz.png" alt="git clone"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From a terminal window run git clone and the HTTPS URL of the repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone https://git-codecommit.us-east1.amazonaws.com/v1/repos/wildrydes-site
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter username and password from Git credential HTTPS connections &lt;a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html#setting-up-gc-iam" rel="noopener noreferrer"&gt;(Link to Setup)&lt;/a&gt; &lt;strong&gt;Step 3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;You appear to have cloned an empty repository.&lt;/p&gt;

&lt;p&gt;Now we have created git repository and cloned empty repository locally. Next we push the code to &lt;strong&gt;wildrydes-site&lt;/strong&gt; repo manually.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change directory into your repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd wildrydes-site
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;copy the static files from S3:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws s3 cp s3://wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website ./ --recursive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9c0rehflcvtz1q2s4y30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9c0rehflcvtz1q2s4y30.png" alt="code push"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commit the files to your Git service
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add .
$ git commit -m 'first'
$ git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dmdpoz8dyccjekv63p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dmdpoz8dyccjekv63p0.png" alt="Code commit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have pushed the code to AWS codecommit &lt;code&gt;wildrydes-site&lt;/code&gt; repository successfully.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enable web Hosting with the AWS Amplify console:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch the &lt;a href="https://console.aws.amazon.com/amplify/home" rel="noopener noreferrer"&gt;Amplify Console console page&lt;/a&gt; and Click &lt;strong&gt;Get Started&lt;/strong&gt; under Deploy with Amplify Console&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;New App&lt;/strong&gt; on the top right and choose &lt;strong&gt;Host Web App&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; Select &lt;strong&gt;CodeCommit&lt;/strong&gt; under &lt;strong&gt;Get started with Amplify Hosting&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fietmphpd690a0etgeat3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fietmphpd690a0etgeat3.png" alt="AWS Amplify Get Started"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the Repository service provider used today and select &lt;strong&gt;Next&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl0t3l46yh5f80mduuyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl0t3l46yh5f80mduuyv.png" alt="repo choose"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; On the &lt;strong&gt;Configure build settings&lt;/strong&gt; page, leave all the defaults, Select &lt;strong&gt;Allow AWS Amplify to automatically deploy all files hosted in your project root directory&lt;/strong&gt; and select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the "Review" page select &lt;strong&gt;Save and deploy&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The process takes a couple of minutes for Amplify Console to create the necessary resources and to deploy your code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fhxi4pfvdi8pb19vhns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fhxi4pfvdi8pb19vhns.png" alt="CD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Successfully Code Deployed!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmna0utnfklgtps9xmeca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmna0utnfklgtps9xmeca.png" alt="website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;User Management (Amazon Cognito):&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;You will create an Amazon Cognito user pool to manage your users accounts. You'll deploy pages that enable customers to register as a new user, verify their email address, and sign into the site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjnty6q5aept7z92rkrm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjnty6q5aept7z92rkrm.png" alt="Serverless"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When users visit your website they will first register a new user account. For the purposes of this workshop we'll only require them to provide an email address and password to register. However, you can configure Amazon Cognito to require additional attributes in your own applications.&lt;/p&gt;

&lt;p&gt;After users submit their registration, Amazon Cognito will send a confirmation email with a verification code to the address they provided. To confirm their account, users will return to your site and enter their email address and the verification code they received. You can also confirm user accounts using the Amazon Cognito console with a fake email addresses for testing.&lt;/p&gt;

&lt;p&gt;After users have a confirmed account (either using the email verification process or a manual confirmation through the console), they will be able to sign in. When users sign in, they enter their username (or email) and password. A JavaScript function then communicates with Amazon Cognito, authenticates using the Secure Remote Password protocol (SRP), and receives back a set of JSON Web Tokens (JWT). The JWTs contain claims about the identity of the user and will be used in the next module to authenticate against the RESTful API you build with Amazon API Gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create An Amazon Cognito User Pool and Integrate an App to Your User Pool:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon Cognito provides two different mechanisms for authenticating users. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Cognito User Pools&lt;/strong&gt; to add sign-up and sign-in functionality to your application &lt;/li&gt;
&lt;li&gt;Choose Create user pool. to authenticate users through social identity providers such as Facebook, Twitter, or Amazon, with SAML identity solutions, or by using your own identity system.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; We use Cognito User Pools for this authentication.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;strong&gt;Cognito&lt;/strong&gt; from AWS search bar.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Create user pool&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Configure sign-in experience&lt;/strong&gt; page, in the &lt;strong&gt;Cognito user pool sign-in options&lt;/strong&gt; section, select &lt;strong&gt;User name&lt;/strong&gt;. Keep the defaults for the other settings, such as &lt;strong&gt;Provider types&lt;/strong&gt; in the &lt;strong&gt;Authentication providers&lt;/strong&gt; section. Choose &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Configure security requirements&lt;/strong&gt; page, keep the &lt;strong&gt;Password policy mode&lt;/strong&gt; as &lt;strong&gt;Cognito defaults&lt;/strong&gt;. You can choose to configure multi-factor authentication (MFA) or choose &lt;strong&gt;No MFA&lt;/strong&gt; and keep other configurations as default. Choose &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Configure sign-up experience&lt;/strong&gt; page, keep everything as default. Choose &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Configure message delivery&lt;/strong&gt; page, for &lt;strong&gt;Email provider&lt;/strong&gt;, confirm that &lt;strong&gt;Send email with Amazon SES - Recommended&lt;/strong&gt; is selected. In the &lt;strong&gt;FROM email address&lt;/strong&gt; field, select an email address that you have verified with Amazon SES, following these &lt;a href="https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html#just-verify-email-proc" rel="noopener noreferrer"&gt;instructions from the Amazon SES Developer Guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; On the &lt;strong&gt;Integrate your app page&lt;/strong&gt;, provide a name for your user pool such as &lt;code&gt;WildRydes&lt;/code&gt;. Under &lt;strong&gt;Initial app client&lt;/strong&gt;, give the app client a name such as &lt;code&gt;WildRydesWebApp&lt;/code&gt; and keep other settings as default.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Review&lt;/strong&gt; and create page, choose &lt;strong&gt;Create user pool&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Note the &lt;strong&gt;Pool ID&lt;/strong&gt; and the App &lt;strong&gt;client ID&lt;/strong&gt; on the Pool details page of your newly created user pool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb5hvslqbzzom4s2qwev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb5hvslqbzzom4s2qwev.png" alt="user. Management"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Update the Website Config:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;/js/config.js&lt;/code&gt; file contains settings for the user pool ID, app client ID and Region. Update this file with the settings from the user pool and app you created in the previous steps and upload the file back to your bucket&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;From your local machine, open &lt;code&gt;wildryde-site/js/config.js&lt;/code&gt; in a text editor of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the cognito section with the correct values for the user pool and app you just created.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find the value for &lt;code&gt;userPoolId&lt;/code&gt; on the Pool details page of the Amazon Cognito console after you select the user pool that you created.&lt;/p&gt;

&lt;p&gt;You can find the value for &lt;code&gt;userPoolClientId&lt;/code&gt; by selecting App clients from the left navigation bar. Use the value from the App client id field for the app you created in the previous section.&lt;/p&gt;

&lt;p&gt;The value for region should be the AWS Region code where you created your user pool. E.g. &lt;code&gt;us-east-1&lt;/code&gt; for the N. Virginia Region, or &lt;code&gt;us-west-2&lt;/code&gt; for the Oregon Region. If you're not sure which code to use, you can look at the Pool ARN value on the Pool details page. The Region code is the part of the ARN immediately after &lt;code&gt;arn:aws:cognito-idp:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The updated config.js file should look like this. Note that the actual values for your file will be different:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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',
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Save the modified file and push it to your Git repository to have it automatically deploy to Amplify Console.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add .
$ git commit -m "new_config"
$ git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkjdlvjpqq5eegpgaw2r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkjdlvjpqq5eegpgaw2r.png" alt="git update"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Validate your implementation:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Visit /register.html&lt;/code&gt; under your website domain, or choose the &lt;strong&gt;Giddy Up&lt;/strong&gt;! button on the homepage of your site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hcsio3h8jxow7408d9o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hcsio3h8jxow7408d9o.png" alt="sign in"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Complete the registration form and choose &lt;strong&gt;Let's Ryde&lt;/strong&gt;. You can use your own email or enter a fake email. Make sure to choose a password that contains at least one upper-case letter, a number, and a special character. Don't forget the password you entered for later. You should see an alert that confirms that your user has been created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Confirm your new user using one of the two following methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you used an email address you control, you can complete the account verification process by visiting /verify.html under your website domain and entering the verification code that is emailed to you. Please note, the verification email may end up in your spam folder. For real deployments we recommend &lt;a href="http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-customizations.html#cognito-user-pool-settings-ses-authorization-to-send-email" rel="noopener noreferrer"&gt;configuring your user pool to use Amazon Simple Email Service&lt;/a&gt; to send emails from a domain you own.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhz4ay6czxnj0sewhom93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhz4ay6czxnj0sewhom93.png" alt="verify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you used a dummy email address, you must confirm the user manually through the Cognito console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the AWS console, click Services then select &lt;strong&gt;Cognito&lt;/strong&gt; under Security, Identity &amp;amp; Compliance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Manage your User Pools&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the &lt;code&gt;WildRydes user pool&lt;/code&gt; and click &lt;strong&gt;Users and groups&lt;/strong&gt; in the left navigation bar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose Confirm user to finalize the account creation process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After confirming the new user using either the &lt;code&gt;/verify.html&lt;/code&gt; page or the Cognito console, visit &lt;code&gt;/signin.html&lt;/code&gt; and log in using the email address and password you entered during the registration step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If successful you should be redirected to &lt;code&gt;/ride.html&lt;/code&gt;. You should see a notification that the API is not configured.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76aooelcub6ew8obtvwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76aooelcub6ew8obtvwf.png" alt="successful authenticsted"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Serverless Service Backend:&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;You will use AWS Lambda and Amazon DynamoDB to build a backend process for handling requests for your web application. The browser application that you deployed in the first module allows users to request that a unicorn be sent to a location of their choice. To fulfill those requests, the JavaScript running in the browser will need to invoke a service running in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxw1wjlzvttp0qamuz75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxw1wjlzvttp0qamuz75.png" alt="Lambda"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Create an Amazon DynaMoDB Table:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the Amazon DynamoDB console to create a new DynamoDB table. Call your table Rides and give it a partition key called RideId with type String. The table name and partition key are case sensitive. Make sure you use the exact IDs provided. Use the defaults for all other settings.&lt;/p&gt;

&lt;p&gt;After you've created the table, note the &lt;strong&gt;ARN&lt;/strong&gt; for use in the next step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From the AWS Management Console, choose &lt;strong&gt;Services&lt;/strong&gt; then select &lt;strong&gt;DynamoDB&lt;/strong&gt; under Databases.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Create table&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter &lt;em&gt;Rides&lt;/em&gt; for the &lt;strong&gt;Table name&lt;/strong&gt;. This field is case sensitive.&lt;/li&gt;
&lt;li&gt;Enter &lt;em&gt;RideId&lt;/em&gt; for the &lt;strong&gt;Partition key&lt;/strong&gt; and select &lt;strong&gt;String&lt;/strong&gt; for the key type. This field is case sensitive.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Use default settings&lt;/strong&gt; box and choose &lt;strong&gt;Create&lt;/strong&gt;. Navigate to the &lt;strong&gt;Tables&lt;/strong&gt; page in the DynamoDB console and wait for your table creation to complete. Once it is completed, select your table name.&lt;/li&gt;
&lt;li&gt;Scroll to the bottom of the &lt;strong&gt;Overview&lt;/strong&gt; section of your new table and choose &lt;strong&gt;Additional info&lt;/strong&gt;. Note the &lt;code&gt;ARN&lt;/code&gt;. You will use this in the next section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsc2eh6g1qad9x2vsqh6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsc2eh6g1qad9x2vsqh6x.png" alt="DynamoDB"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Create an IAM Role for your Lambda Function:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;From the AWS Management Console, click on &lt;strong&gt;Services&lt;/strong&gt; and then select &lt;strong&gt;IAM&lt;/strong&gt; in the Security, Identity &amp;amp; Compliance section.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Roles&lt;/strong&gt; in the left navigation pane and then choose &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Underneath &lt;strong&gt;Trusted Entity Type&lt;/strong&gt;, select AWS service. For &lt;strong&gt;Use case&lt;/strong&gt;, select &lt;strong&gt;Lambda&lt;/strong&gt;, then choose &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Begin typing &lt;code&gt;AWSLambdaBasicExecutionRole&lt;/code&gt; in the &lt;strong&gt;Filter&lt;/strong&gt; text box and check the box next to that role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Next Step&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter &lt;code&gt;WildRydesLambda&lt;/code&gt; for the &lt;strong&gt;Role Name&lt;/strong&gt;. Keep other parameters as default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type &lt;code&gt;WildRydesLambda&lt;/code&gt; into the filter box on the Roles page and choose the role you just created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the &lt;strong&gt;Permissions tab&lt;/strong&gt;, on the left under &lt;strong&gt;Add permissions&lt;/strong&gt;, choose &lt;code&gt;Create Inline Policy&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Choose a service&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Begin typing &lt;code&gt;DynamoDB&lt;/code&gt; into the search box labeled &lt;strong&gt;Find a service&lt;/strong&gt; and select &lt;strong&gt;DynamoDB&lt;/strong&gt; when it appears.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Select actions&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Begin typing &lt;em&gt;PutItem&lt;/em&gt; into the search box labeled &lt;strong&gt;Filter actions&lt;/strong&gt; and check the box next to &lt;strong&gt;PutItem&lt;/strong&gt; when it appears.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the &lt;strong&gt;Resources&lt;/strong&gt; section.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With the &lt;strong&gt;Specific&lt;/strong&gt; option selected, choose the Add ARN link in the &lt;strong&gt;table&lt;/strong&gt; section.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5o6zohkkbw7f9aqy283.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5o6zohkkbw7f9aqy283.png" alt="arn"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paste the ARN of the table you created in the previous section in the &lt;strong&gt;Specify ARN for table&lt;/strong&gt; field, and choose &lt;strong&gt;Add&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qooxt0h0pjz8d99ym8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qooxt0h0pjz8d99ym8b.png" alt="review"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Review Policy&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter &lt;code&gt;DynamoDBWriteAccess&lt;/code&gt; for the policy name and choose &lt;strong&gt;Create policy&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Create a Lambda Function for Handling Requests:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Lambda will run your code in response to events such as an HTTP request. In this step you'll build the core function that will process API requests from the web application to dispatch a unicorn. In the next module you'll use Amazon API Gateway to create a RESTful API that will expose an HTTP endpoint that can be invoked from your users' browsers. You'll then connect the Lambda function you create in this step to that API in order to create a fully functional backend for your web application.&lt;/p&gt;

&lt;p&gt;Make sure to configure your function to use the &lt;code&gt;WildRydesLambda IAM&lt;/code&gt; role you created in the previous section.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose &lt;strong&gt;Services&lt;/strong&gt; then select &lt;strong&gt;Lambda&lt;/strong&gt; in the Compute section.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create function&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Keep the default &lt;strong&gt;Author from scratch&lt;/strong&gt; card selected.&lt;/li&gt;
&lt;li&gt;Enter RequestUnicorn in the &lt;strong&gt;Name&lt;/strong&gt; field.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Node.js 16.x&lt;/strong&gt; for the &lt;strong&gt;Runtime&lt;/strong&gt; (newer versions of Node.js will not work in this tutorial)&lt;/li&gt;
&lt;li&gt;Ensure Use an &lt;strong&gt;existing role&lt;/strong&gt; is selected from the &lt;strong&gt;Change default execution role&lt;/strong&gt; 
dropdown.&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;WildRydesLambda&lt;/code&gt; from the &lt;strong&gt;Existing Role&lt;/strong&gt; dropdown.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on &lt;strong&gt;Create function&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to the &lt;strong&gt;Code source&lt;/strong&gt; section and replace the existing code in the &lt;strong&gt;index.js&lt;/strong&gt; code editor with this code.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { randomBytes } = require('crypto');
const { DynamoDBClient, PutItemCommand } = require('@aws-sdk/client-dynamodb');
const { marshall } = require('@aws-sdk/util-dynamodb');

const ddbClient = new DynamoDBClient({ region: 'us-east-1' }); // Update with your desired region

const fleet = [
  {
    Name: 'Bucephalus',
    Color: 'Golden',
    Gender: 'Male',
  },
  {
    Name: 'Shadowfax',
    Color: 'White',
    Gender: 'Male',
  },
  {
    Name: 'Rocinante',
    Color: 'Yellow',
    Gender: 'Female',
  },
];

exports.handler = async (event) =&amp;gt; {
  if (!event.requestContext.authorizer) {
    return errorResponse('Authorization not configured', event.requestContext.requestId);
  }

  const rideId = toUrlString(randomBytes(16));
  console.log('Received event (', rideId, '): ', event);

  const username = event.requestContext.authorizer.claims['cognito:username'];

  const requestBody = JSON.parse(event.body);

  const pickupLocation = requestBody.PickupLocation;

  const unicorn = findUnicorn(pickupLocation);

  try {
    await recordRide(rideId, username, unicorn);

    return {
      statusCode: 201,
      body: JSON.stringify({
        RideId: rideId,
        Unicorn: unicorn,
        UnicornName: unicorn.Name,
        Eta: '30 seconds',
        Rider: username,
      }),
      headers: {
        'Access-Control-Allow-Origin': '*',
      },
    };
  } catch (err) {
    console.error(err);

    return errorResponse(err.message, event.requestContext.requestId);
  }
};

function findUnicorn(pickupLocation) {
  console.log('Finding unicorn for ', pickupLocation.Latitude, ', ', pickupLocation.Longitude);
  return fleet[Math.floor(Math.random() * fleet.length)];
}

async function recordRide(rideId, username, unicorn) {
  const params = {
    TableName: 'Rides',
    Item: marshall({
      RideId: rideId,
      User: username,
      Unicorn: unicorn,
      UnicornName: unicorn.Name,
      RequestTime: new Date().toISOString(),
    }),
  };

  await ddbClient.send(new PutItemCommand(params));
}

function toUrlString(buffer) {
  return buffer
    .toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=/g, '');
}

function errorResponse(errorMessage, awsRequestId) {
  return {
    statusCode: 500,
    body: JSON.stringify({
      Error: errorMessage,
      Reference: awsRequestId,
    }),
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
  };
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv7ywoubat10nhnf2z9i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv7ywoubat10nhnf2z9i.png" alt="lambda code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose &lt;strong&gt;Deploy&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Validate Your Implementation:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From the main edit screen for your function, select &lt;strong&gt;Test&lt;/strong&gt; and choose &lt;strong&gt;Configure test event&lt;/strong&gt; from the dropdown.&lt;/li&gt;
&lt;li&gt;Keep &lt;strong&gt;Create new event&lt;/strong&gt; selected.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;TestRequestEvent&lt;/code&gt; in the &lt;strong&gt;Event name&lt;/strong&gt; field&lt;/li&gt;
&lt;li&gt;Copy and paste the following test event into the editor:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "path": "/ride",
    "httpMethod": "POST",
    "headers": {
        "Accept": "*/*",
        "Authorization": "eyJraWQiOiJLTzRVMWZs",
        "content-type": "application/json; charset=UTF-8"
    },
    "queryStringParameters": null,
    "pathParameters": null,
    "requestContext": {
        "authorizer": {
            "claims": {
                "cognito:username": "the_username"
            }
        }
    },
    "body": "{\"PickupLocation\":{\"Latitude\":47.6174755835663,\"Longitude\":-122.28837066650185}}"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Choose &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the main function edit screen click &lt;strong&gt;Test&lt;/strong&gt; with &lt;code&gt;TestRequestEvent&lt;/code&gt; selected in the dropdown.&lt;/li&gt;
&lt;li&gt;Scroll to the top of the page and expand the &lt;strong&gt;Details&lt;/strong&gt; section of the &lt;strong&gt;Execution result&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt; Verify that the execution succeeded and that the function result looks like the following:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "statusCode": 201,
    "body": "{\"RideId\":\"SvLnijIAtg6inAFUBRT+Fg==\",\"Unicorn\":{\"Name\":\"Rocinante\",\"Color\":\"Yellow\",\"Gender\":\"Female\"},\"Eta\":\"30 seconds\"}",
    "headers": {
        "Access-Control-Allow-Origin": "*"
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feztakpaiw2v1lvta39lc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feztakpaiw2v1lvta39lc.png" alt="execution result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;## Deploy a Restful API:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;you will use Amazon API Gateway to expose the Lambda function you built in the previous module as a RESTful API. This API will be accessible on the public Internet. It will be secured using the Amazon Cognito user pool you created in the previous module. Using this configuration, you will then turn your statically hosted website into a dynamic web application by adding client-side JavaScript that makes AJAX calls to the exposed APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faojxyhwv3j1lykt72cll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faojxyhwv3j1lykt72cll.png" alt="api gateway"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Create a New REST API:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the AWS Management Console, click &lt;strong&gt;Services&lt;/strong&gt; then select &lt;strong&gt;API Gateway&lt;/strong&gt; under Application Services&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Create API&lt;/strong&gt;. Underneath the &lt;strong&gt;Create new API&lt;/strong&gt; section, make sure &lt;strong&gt;New API&lt;/strong&gt; is selected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Build&lt;/strong&gt; under &lt;strong&gt;REST API&lt;/strong&gt; and enter &lt;code&gt;WildRydes&lt;/code&gt; for the &lt;strong&gt;API Name&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Edge optimized&lt;/strong&gt; in the &lt;strong&gt;Endpoint Type&lt;/strong&gt; dropdown. &lt;strong&gt;Note&lt;/strong&gt;: Edge optimized are best for public services being accessed from the Internet. Regional endpoints are typically used for APIs that are accessed primarily from within the same AWS Region.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Create API&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Create a New resource and method&lt;/strong&gt;:&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the left nav, click on &lt;strong&gt;Resources&lt;/strong&gt; under your WildRydes API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the &lt;strong&gt;Actions&lt;/strong&gt; dropdown select &lt;strong&gt;Create Resource.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter &lt;code&gt;ride&lt;/code&gt; as the &lt;strong&gt;Resource Name.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;d. Ensure the &lt;strong&gt;Resource Path&lt;/strong&gt; is set to ride.&lt;/p&gt;

&lt;p&gt;e. Select &lt;strong&gt;Enable API Gateway CORS&lt;/strong&gt; for the resource.&lt;/p&gt;

&lt;p&gt;f. Click &lt;strong&gt;Create Resource&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;g. With the newly created &lt;em&gt;/ride&lt;/em&gt; resource selected, from the &lt;strong&gt;Action&lt;/strong&gt; dropdown select &lt;strong&gt;Create Method&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select &lt;em&gt;POST&lt;/em&gt; from the new dropdown that appears, then &lt;strong&gt;click the checkmark&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Lambda Function&lt;/strong&gt; for the integration type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the box for &lt;strong&gt;Use Lambda Proxy integration.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Region you are using for &lt;strong&gt;Lambda Region.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the name of the function you created in the previous module, &lt;code&gt;RequestUnicorn&lt;/code&gt;, for &lt;strong&gt;Lambda Function.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8olildyjo5j0wpjii0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8olildyjo5j0wpjii0x.png" alt="api"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Save&lt;/strong&gt;. Please note, if you get an error that your function does not exist, check that the region you selected matches the one you used in the previous module.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When prompted to give Amazon API Gateway permission to invoke your function, choose &lt;strong&gt;OK&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose on the &lt;strong&gt;Method Request card&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose the pencil icon next to &lt;strong&gt;Authorization&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the WildRydes Cognito user pool authorizer from the drop-down list, and click the checkmark icon.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Deploy Your API:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the Amazon API Gateway console, choose Actions, Deploy API. You'll be prompted to create a new stage. You can use prod for the stage name.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Actions&lt;/strong&gt; drop-down list select &lt;strong&gt;Deploy API.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;[New Stage]&lt;/strong&gt; in the &lt;strong&gt;Deployment stage&lt;/strong&gt; drop-down list.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;prod&lt;/code&gt; for the &lt;strong&gt;Stage Name.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Deploy&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Note the &lt;strong&gt;Invoke URL&lt;/strong&gt;. You will use it in the next section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Update the Website Config:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Update the &lt;code&gt;/js/config.js&lt;/code&gt; file in your website deployment to include the invoke URL of the stage you just created. You should copy the invoke URL directly from the top of the stage editor page on the Amazon API Gateway console and paste it into the _config.api.invokeUrl key of your sites &lt;code&gt;/js/config.js&lt;/code&gt; file. Make sure when you update the config file it still contains the updates you made in the previous module for your Cognito user pool.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the &lt;code&gt;config.js&lt;/code&gt; file in a text editor.&lt;/li&gt;
&lt;li&gt;Update the &lt;strong&gt;invokeUrl&lt;/strong&gt; setting under the &lt;strong&gt;api&lt;/strong&gt; key in the config.js file. Set the value to the &lt;strong&gt;Invoke URL&lt;/strong&gt; for the deployment stage your created in the previous section.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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: 'https://rc7nyt4tql.execute-api.us-west-2.amazonaws.com/prod' // e.g. https://rc7nyt4tql.execute-api.us-west-2.amazonaws.com/prod, 

    } 

};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhodqdyfryi5w8ib0ye0j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhodqdyfryi5w8ib0ye0j.png" alt="invoke api"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save the modified file and push it to your Git repository to have it automatically deploy to Amplify Console.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add .
$ git commit -m "new_configuration"
$ git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;&lt;strong&gt;Validate your implementation:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It is possible that you will see a delay between updating the &lt;code&gt;config.js&lt;/code&gt; file in your S3 bucket and when the updated content is visible in your browser. You should also ensure that you clear your browser cache before executing the following steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update the ArcGIS JS version from 4.3 to 4.6 (newer versions will not work in this tutorial) in the &lt;strong&gt;ride.html&lt;/strong&gt; file as:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://js.arcgis.com/4.6/"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Save the modified file and push it to your Git repository to have it automatically deploy to Amplify Console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;/ride.html&lt;/code&gt; under your website domain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are redirected to the &lt;a href="https://www.arcgis.com/home/signin.html" rel="noopener noreferrer"&gt;ArcGIS sign-in page&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the map has loaded, click anywhere on the map to set a pickup location.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Request Unicorn&lt;/strong&gt;. You should see a notification in the right sidebar that a unicorn is on its way and then see a unicorn icon fly to your pickup local.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Terminate Resources:&lt;/u&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Delete your app in Amplify.&lt;/li&gt;
&lt;li&gt;Delete your Amazon Cognito user pool&lt;/li&gt;
&lt;li&gt;Delete your Serverless backend&lt;/li&gt;
&lt;li&gt;Delete your Rest API&lt;/li&gt;
&lt;li&gt;Delete your CloudWatch Log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have successfully  Build a Serverless Web Application with AWS Lambda, Amazon API Gateway, AWS Amplify, Amazon DynamoDB, and Amazon Cognito.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for reading. Follow and like this Post for more tech content.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>api</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Step by step to deploy and host a high-available WordPress application using AWS EC2 instance,RDS,ASG and VPC (Part-1)</title>
      <dc:creator>Subashkumar</dc:creator>
      <pubDate>Sat, 05 Aug 2023 14:14:06 +0000</pubDate>
      <link>https://dev.to/subashkumar/step-by-step-to-deploy-and-host-a-high-available-wordpress-application-using-aws-ec2-instancerdsasg-and-vpc-part-1-1hdk</link>
      <guid>https://dev.to/subashkumar/step-by-step-to-deploy-and-host-a-high-available-wordpress-application-using-aws-ec2-instancerdsasg-and-vpc-part-1-1hdk</guid>
      <description>&lt;h2&gt;
  
  
  How this post will help?
&lt;/h2&gt;

&lt;p&gt;Learn and build a WordPress application using AWS EC2 instance with Amazon RDS DB instance that is external to AWS Elastic Beanstalk, then how to configure a high-availability environment  running a WordPress website to connect to it. Then website uses Amazon EFS  as the shared storage for upload files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon RDS High Availability:
&lt;/h2&gt;

&lt;p&gt;Running a DB instance external to Elastic Beanstalk decouples the database from the lifecycle of your environment. This lets you connect to the same database from multiple environments, swap out one database for another, or perform a &lt;strong&gt;blue/green&lt;/strong&gt; deployment without affecting your database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic Elastic Beanstalk operations and Beanstalk console.&lt;/li&gt;
&lt;li&gt;Command line terminal(Linux or MacOS) or Cloudshell.&lt;/li&gt;
&lt;li&gt;Basics of aws concept.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  First, we launch a DB instance in Amazon RDS:
&lt;/h2&gt;

&lt;p&gt;Its completely independent from Elastic Beanstalk Environments and will not be terminated or monitored by Elastic Beanstalk &lt;/p&gt;

&lt;p&gt;Follow step by step to launch a database with the &lt;strong&gt;MySQL engine&lt;/strong&gt; and enable &lt;strong&gt;Multi-AZ deployment&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the AWS RDS console and click &lt;code&gt;Databases&lt;/code&gt; in side navigation pane.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;Create database&lt;/code&gt; and choose &lt;code&gt;Standard Create&lt;/code&gt; (Don't choose &lt;code&gt;Easy Create&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;In Availability and durability choose &lt;code&gt;Multi-AZ DB instance&lt;/code&gt; (Review the default settings and adjust these settings according to your specific requirements).&lt;/li&gt;
&lt;li&gt;Master &lt;strong&gt;username&lt;/strong&gt; and Master &lt;strong&gt;password&lt;/strong&gt; – The database username and password. Make a note of these settings because you will use them later.&lt;/li&gt;
&lt;li&gt;Under Additional configuration, for Initial database name, type &lt;code&gt;ebdb&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Verify the default settings for the remaining options, and then choose &lt;code&gt;Create database&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--up73wuZC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30sq6eov61ipzdqrk4bn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--up73wuZC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30sq6eov61ipzdqrk4bn.png" alt="AWS RDS" width="800" height="466"&gt;&lt;/a&gt;&lt;br&gt;
We created MySQL database in AWS RDS instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; Check whether the inbound rules on the security group that's attached to your RDS instance. If not go to inbound and attach the security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0dD9Nsls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxbob8omaqwycywtp4ht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0dD9Nsls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxbob8omaqwycywtp4ht.png" alt="SG" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Download WordPress:
&lt;/h2&gt;

&lt;p&gt;To prepare to deploy WordPress using AWS Elastic Beanstalk, you must copy the WordPress files to your computer and provide the correct configuration information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To create a WordPress project:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download WordPress from &lt;a href="https://wordpress.org/download/"&gt;wordpress.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ curl https://wordpress.org/wordpress-4.9.5.tar.gz -o wordpress.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---apYhPmk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vuestgzg5gniwjqbugqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---apYhPmk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vuestgzg5gniwjqbugqy.png" alt="WordPress Install" width="800" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the configuration files from the sample repository
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ wget https://github.com/aws-samples/eb-php-wordpress/releases/download/v1.1/eb-php-wordpress-v1.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DFUXm5_e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhw2evwdc31pkh50b500.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DFUXm5_e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhw2evwdc31pkh50b500.png" alt="CLI" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extract WordPress and change the name of the folder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ~$ tar -xvf wordpress.tar.gz
 ~$ mv wordpress wordpress-beanstalk
 ~$ cd wordpress-beanstalk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tTXhVZgx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yulvccmmrhxbmzrhe9zs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tTXhVZgx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yulvccmmrhxbmzrhe9zs.png" alt="MV file" width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extract the configuration files over the WordPress installation.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/wordpress-beanstalk$ unzip ../eb-php-wordpress-v1.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Launch an Elastic Beanstalk environment:
&lt;/h2&gt;

&lt;p&gt;Use the Elastic Beanstalk console to create an Elastic Beanstalk environment.&lt;/p&gt;

&lt;p&gt;In the following steps, you'll use the Elastic Beanstalk console to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an Elastic Beanstalk application using the managed PHP platform.&lt;/li&gt;
&lt;li&gt;Accept the default settings and sample code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;To launch an environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open ElasticBeanstalk console using &lt;a href="https://console.aws.amazon.com/elasticbeanstalk/home#/newApplication?applicationName=tutorials&amp;amp;environmentType=LoadBalanced"&gt;Pre-Link&lt;/a&gt;&lt;br&gt;
and click &lt;code&gt;Create application&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For &lt;code&gt;Platform&lt;/code&gt;, select the platform and platform branch that match the language used by your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For &lt;code&gt;Application code&lt;/code&gt;, choose &lt;code&gt;Sample application&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;code&gt;Review&lt;/code&gt; and &lt;code&gt;launch&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review the available options. Choose the available option you want to use, and when you're ready, choose &lt;code&gt;Create app&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bi4Ysu0w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8jpl2fsz7kcvu1v1384.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bi4Ysu0w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8jpl2fsz7kcvu1v1384.png" alt="Beanstalk" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We created beanstalk environment successfully.&lt;/p&gt;

&lt;p&gt;In Part-2, We will see how to confirm beanstalk environmental ,external AWS RDS and final Wordpress deployment. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow and Share for more update&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>programming</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Built a Conversational AI Chatbot Using Amazon Lex</title>
      <dc:creator>Subashkumar</dc:creator>
      <pubDate>Thu, 03 Aug 2023 19:35:07 +0000</pubDate>
      <link>https://dev.to/subashkumar/built-a-conversational-ai-chatbot-using-amazon-lex-59p4</link>
      <guid>https://dev.to/subashkumar/built-a-conversational-ai-chatbot-using-amazon-lex-59p4</guid>
      <description>&lt;h2&gt;
  
  
  First, What is Amazon Lex?
&lt;/h2&gt;

&lt;p&gt;Amazon Lex is a aws service that used to build conversational AI chatbot application using speech or text interface powered by the same technology that powers Amazon Alexa.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you will learn here?
&lt;/h2&gt;

&lt;p&gt;Learn step by step to build AI chatbot using amazon lex.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of amazon web service and aws free tier account. &lt;/li&gt;
&lt;li&gt;Fundamentals of AI and AWS concepts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Amazon lex underlying topics:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3iNBKEHA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bfj4pqaosnhcyi3vakq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3iNBKEHA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bfj4pqaosnhcyi3vakq.png" alt="Amazon Lex Topics" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Intent:&lt;/strong&gt;  An Intent is an action that the user wants to perform.&lt;br&gt;
&lt;strong&gt;Utterance:&lt;/strong&gt; Utterance are textual representation of what a user has to type or says on order to trigger an intent.&lt;br&gt;
&lt;strong&gt;Slots:&lt;/strong&gt;  Slots are input data requirement to fulfil the inputs.&lt;br&gt;
&lt;strong&gt;Fulfilment:&lt;/strong&gt; Fulfilment is to complete the users intent. &lt;/p&gt;

&lt;h2&gt;
  
  
  Let's start step by step to build conversational AI chatbot for order pizza:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Go to aws lex page and &lt;code&gt;Create Chatbot&lt;/code&gt; for OrderPizza.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HEXLpVSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee9ei5t3ennr6tlzs6bk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HEXLpVSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee9ei5t3ennr6tlzs6bk.png" alt="Create chatbot" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Fill the Intent details as &lt;code&gt;OrderPizza&lt;/code&gt;(Heading) and Utterance as &lt;code&gt;Hello,Hii&lt;/code&gt; (start).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MDN0iY60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mo470yixfh4x451j90ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MDN0iY60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mo470yixfh4x451j90ph.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Add a slot types&lt;br&gt;
            - First name (BuiltIn)&lt;br&gt;
            - PizzaType&lt;br&gt;
            - Pizza crust&lt;br&gt;
            - Appetizers&lt;br&gt;
            - Time for pizza delivery(BuildIn)&lt;br&gt;
Add more slot types as we needed.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1TbeYrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpfxeurqv9scrvuqsa0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1TbeYrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpfxeurqv9scrvuqsa0r.png" alt="Slot types" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z8a_LWva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s8qua96lj77v5wuwp3ag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z8a_LWva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s8qua96lj77v5wuwp3ag.png" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Fill the slot type value as Thin and Thick.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--piapCXEa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzvonm8ojkomd9y87dgd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--piapCXEa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzvonm8ojkomd9y87dgd.png" alt="" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Active the confirmation and type "Confirmation &lt;code&gt;{Pizzatype}&lt;/code&gt; pizza with &lt;code&gt;{Pizzacrust}&lt;/code&gt;. Appetizers &lt;code&gt;{Appetizers}&lt;/code&gt;"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; Active the closing response and type "Thank you &lt;code&gt;{Name}&lt;/code&gt;. Your order was confirmed and will be delivered by &lt;code&gt;{DeliveryTime}&lt;/code&gt;."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VdozkXjJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b17v68qxhdoi1fnta03s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VdozkXjJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b17v68qxhdoi1fnta03s.png" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt; Go to slot prompt to add a buttons in advance options.&lt;br&gt;
&lt;code&gt;Advance Option--&amp;gt;slot prompts--&amp;gt;more prompt option--&amp;gt;Add card group&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xAIHNSoj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2p9jgtksey60k8x7trx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xAIHNSoj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2p9jgtksey60k8x7trx.png" alt="Image description" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--41JVhK3G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wv3syqv4np8tfdj6gqj3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--41JVhK3G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wv3syqv4np8tfdj6gqj3.png" alt="" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; That's it. We have created a AI chatbot for OrderPizza. Click &lt;code&gt;Build and Test&lt;/code&gt; the chatbot.&lt;/p&gt;

&lt;p&gt;Here is the link for Orderpizza conversational AI chatbot demo video  : &lt;a href="https://drive.google.com/file/d/11l1BFCVx7J444lyjDCEh8EfR1xb5W4j7/view?usp=sharing"&gt;LINK&lt;/a&gt;&lt;br&gt;
We can integrate this chatbot AI with the web and mobile applications. &lt;/p&gt;

&lt;p&gt;** Thank you for reading and If this is more informative. Share with your friend and follow me **&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
