<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rushi Donga on Medium]]></title>
        <description><![CDATA[Stories by Rushi Donga on Medium]]></description>
        <link>https://medium.com/@rushidonga?source=rss-6c3379021736------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lI0FUnNPRumIHpjFUtl31w.png</url>
            <title>Stories by Rushi Donga on Medium</title>
            <link>https://medium.com/@rushidonga?source=rss-6c3379021736------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 18 May 2026 12:01:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rushidonga/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Deploying a Tasks Application Using Docker and Kubernetes]]></title>
            <link>https://aws.plainenglish.io/deploying-a-tasks-application-using-docker-and-kubernetes-0f31753226ee?source=rss-6c3379021736------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f31753226ee</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Rushi Donga]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 04:17:31 GMT</pubDate>
            <atom:updated>2024-02-27T04:17:31.493Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide on deploying Tasks-Application using Docker and Kubernetes.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0abO_y5V2nMGtCJ-IEiH6g.png" /></figure><h3>Before we begin:</h3><h4><strong>What is Docker?</strong></h4><p>Docker is a tool that lets you package your software applications and all their dependencies into a standardized unit called a container. This container can then be easily shared and run on any system that supports Docker.</p><h4><strong>What is Kubernetes?</strong></h4><p>Kubernetes is an open-source platform used to automate deploying, scaling, and managing containerized applications. It helps you manage multiple containers running across a cluster of machines, making it easier to deploy and manage complex applications at scale.</p><h4>Overview</h4><ul><li>Pre-requisite</li><li>Configuration</li><li>Output</li><li>Cleanup</li></ul><h3>Pre-requisite</h3><p>Install the below mentioned software in a windows PC.</p><ul><li>Knowledge of Docker and Kubernetes (Beginner level will work).</li><li>Docker Hub Account.</li><li>Install below mentioned software in PC.</li></ul><ol><li>Docker Desktop</li><li>Minikube (For Kubernetes)</li><li>GitBash (Recommended Terminal)</li></ol><h3>Configuration</h3><p>Clone the <a href="https://github.com/RushiDonga/Task-App-Using-Kubernetes/tree/master"><strong>Github repository</strong></a> in a Windows PC.</p><h3>Step 1 — Build Docker images.</h3><p>Open the GitBash and navigate to the cloned repository directory.</p><p>Now, we need to build docker images for 4 different services as mentioned in the application architecture.</p><ol><li><strong>Users API</strong> (Login and Sign Up)</li><li><strong>Tasks API</strong> (Add tasks and Fetch task)</li><li><strong>Auth API</strong> (Verify the user Token)</li><li><strong>Frontend App</strong></li></ol><p>In order to build docker images for these applications, we need to navigate to the application directory of every application one after the another and run the below mentioned command in GitBash:</p><blockquote><strong>NOTE:</strong> <strong>Dockerfile </strong>needs to be in the same directory where we will run the command.</blockquote><blockquote>docker build -t <strong>&lt;dockerHub-userName&gt;/&lt;repo-name&gt;:&lt;version-tag&gt;</strong> .</blockquote><blockquote><strong>NOTE: </strong>We will be pushing the images to docker hub. So we need to give an appropriate tag in the given format as mentioned above in the command.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aPSYL7XzG4b38MX_SpTZsA.png" /></figure><p>Once the Docker Images are generated, we can view the list of images using the command:</p><blockquote>docker images</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*mTukuG1IIqtYJpDWGyLUhw.png" /></figure><h3>Step 2— Push images to Docker Hub.</h3><p>Now since we have built the images, it’s time to push the them to the Docker Hub. To push the images to docker repository i.e. Docker Hub, run the below mentioned command:</p><blockquote>docker push &lt;image-name&gt;:&lt;version-tag&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*CUdN27WVgnohsM1POfw5wQ.png" /></figure><h3>Step 3— Deploy the application.</h3><p>In the given application, I have provided the configuration files that will be required to setup the application architecture. These files are available in <strong>kubernetes </strong>directory.</p><p>Before we begin. we need to make sure that Docker Desktop and Minikube are running. Moreover, we can double check if the minikube service is running or not by the below mentioned command.</p><blockquote>minikube status</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQ2AmbSpLFLVZwexbu2pTA.png" /></figure><blockquote><strong>NOTE</strong>: If the <strong>minikibe service is in stopped state</strong>, we can start the service using the below mentioned command:</blockquote><blockquote>minikube start</blockquote><p>Once, we are confirmed that both the services has been started and running, we can proceed towards deploying the architecture.</p><p>Deploying the architecture is pretty straight forward. We need to configure the architecture, by running the command that will automatically deploy the configuration written in the<strong> .yaml files</strong> in the kubernetes directory.</p><blockquote>kubectl apply -f=&lt;file-name&gt;.yaml -f=&lt;file-name&gt;.yaml …</blockquote><p>Run the above mentioned command including the names of every files present in the kubernetes directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*aloN-_sF6ztBgbmknsgNpQ.png" /></figure><p>Once, all the <strong>deployments as well as the services</strong> have been created, we can expose the <strong>User API, Tasks API, Frontend </strong>using the below mentioned command:</p><blockquote>minikube service &lt;service-name&gt;</blockquote><blockquote><strong>N</strong>OTE: Run the above mentioned command for the services with type <strong>LoadBalancer.</strong></blockquote><p>To get the list of running services:</p><blockquote>kubectl get services</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*Xj0xvSwyZ8l4i5ugvTRxKg.png" /></figure><p>To get the list of current deployments:</p><blockquote>kubectl get deployments</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*TWpBtUohqy5Xjv1GV7WOhQ.png" /></figure><h3>Output</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUIkOoQD4eSpC0b1IoczAA.png" /></figure><blockquote>The output will be automatically available after running the below command:<br>minikube service &lt;frontend-service&gt;</blockquote><h3>Cleanup</h3><ol><li>Dealing with Kubernetes services:</li></ol><p>We can delete the deployments as well as the services created using the below-mentioned command:</p><blockquote>kubectl delete <strong>deployment/&lt;deployment-name&gt;</strong><br>kubectl delete <strong>service/&lt;service-name&gt;</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*rtEehpx1zshhObxAqtP8PQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*8el3FjU3xeAw_SRtEnFoGw.png" /></figure><p>2. Dealing with Docker Images</p><p>To delete the docker images we can run the below-mentioned command:</p><blockquote>docker rmi &lt;image-id&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*-n0eLKbQBVgMRpoLVBQaXg.png" /></figure><h3>Congratulations ♥</h3><p><strong>With this, you have successfully configured and deployed the Tasks Application using Docker and Kubernetes in a local environment.</strong></p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a><strong> | </strong><a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://stackademic.com/"><strong>Stackademic</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run"><strong>Cubed</strong></a></li><li>More content at <a href="https://plainenglish.io"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f31753226ee" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/deploying-a-tasks-application-using-docker-and-kubernetes-0f31753226ee">Deploying a Tasks Application Using Docker and Kubernetes</a> was originally published in <a href="https://aws.plainenglish.io">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy a NODE AppV16.x.x on AWS EC2 Using CICD Pipeline]]></title>
            <link>https://rushidonga.medium.com/deploy-a-node-appv16-x-x-on-aws-ec2-using-cicd-pipeline-6474e012d029?source=rss-6c3379021736------2</link>
            <guid isPermaLink="false">https://medium.com/p/6474e012d029</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rushi Donga]]></dc:creator>
            <pubDate>Mon, 04 Jul 2022 12:44:43 GMT</pubDate>
            <atom:updated>2022-07-05T13:04:09.961Z</atom:updated>
            <content:encoded><![CDATA[<p>A guide on deploying a NODE Application on AWS EC2 Instance using AWS CICD Services like AWS Code Pipeline and AWS Code Deploy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPyfQ42O-XtQ5hykGwdNgA.png" /></figure><p>Configuring a CICD pipeline to deploy a NODE Application on AWS EC2 Instance is not an easy task. Just having the basic information about AWS CICD Services is not enough.</p><p>To date, i.e., 4 July 2022, <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html#linux-runtimes">AWS Code Build both Linux and Ubuntu Image</a> supports only 14.x.x version of Node. But the latest stable version of Node available is 16.x.x. As a result, we get an error while building the code using <strong>npm run build.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wBdUG-81BJtL49iqwAoaA.png" /></figure><p>Hence, while configuring a CICD Pipeline, we will only be using AWS Code Pipeline and AWS Code Deploy.</p><h3>Aim of This Guide:</h3><ul><li>Launch an AWS EC2 Instance and configure it to run a NODE 16.x.x version.</li><li>Configure CICD Pipeline to automate the deployment process.</li></ul><h3>AWS Services Used:</h3><ul><li>AWS EC2 Instance</li><li>AWS Code Pipeline</li><li>AWS Code Deploy</li></ul><h3>Configuring an AWS EC2 Instance</h3><p>Launch an AWS EC2 Linux T2.MICRO Instance using the AWS EC2 Console. SSH into the Instance.</p><blockquote><strong>NOTE: </strong>Attach an IAM Role to the Instance which allows the Code Deploy agent to communicate with AWS Code Deploy Service.</blockquote><p>Then install the 16. x.x version of Node on the EC2 Instance using the command.</p><pre>curl -sL <a href="https://rpm.nodesource.com/setup_16.x">https://rpm.nodesource.com/setup_16.x</a> | sudo -E bash -</pre><p>Install <strong>Git </strong>and then clone the GitHub repository onto the EC2 Instance.</p><pre>sudo yum install git<br>git clone &lt;git-repository-link&gt;</pre><p>Install <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-linux.html">AWS Code Deploy agent</a> on the Instance.</p><h3>Add an appspec.yml File to the Code</h3><blockquote>Link to the <a href="https://drive.google.com/file/d/1RIDTO5WGffJcL1EezQqhvM7CETlBbeFv/view?usp=sharing">appspec.yml</a> file.</blockquote><h3>Configure CICD Pipeline</h3><p>Create a Code Deploy application using the AWS Code Deploy Console.</p><ul><li><strong>Application Name</strong>: ec2-node-cicd</li><li><strong>Compute Platform</strong>: EC2/On-premises</li></ul><p>Create a Deployment Group</p><ul><li><strong>Deployment Group Name</strong>: ec2-node-cicd-DG</li><li><strong>Deployment Type</strong>: In-place</li><li><strong>Environment Configuration</strong>: Amazon-EC2 Instances</li><li><strong>Install Code Deploy agent</strong>: Only once</li><li><strong>Deployment Setting</strong>: One at a Time</li><li><strong>Load Balancer</strong>: Disable Load Balancing</li></ul><p>Create a Deployment Pipeline</p><ul><li><strong>Pipeline Name</strong>: ec2-node-cicd-pipeline</li><li><strong>Source Provider</strong>: Github Version 2</li></ul><p>Log in to GitHub and select the repository and the branch that must be deployed on EC2.</p><ul><li><strong>Output artifact format</strong>: Code Pipeline Default</li></ul><p>Skip the Build Stage</p><ul><li><strong>Deployment Provider: </strong>AWS Code Deploy</li><li><strong>Application Name</strong>: ec2-node-cicd</li><li><strong>Deployment Group: </strong>ec2-node-cicd-DG</li></ul><p>Review the configuration and create the Pipeline.</p><blockquote><strong>NOTE</strong>: Deployment Logs are available in the EC2 Instance within the directory <strong>/root/.npm/_logs/</strong></blockquote><h4>Congratulations on this! You have successfully configured a CICD Pipeline using AWS Code Deploy to deploy a Node Application V16.x.x.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6474e012d029" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy a Lambda function using AWS Cloud9]]></title>
            <link>https://rushidonga.medium.com/deploy-a-lambda-function-using-aws-cloud9-fa9480a58aba?source=rss-6c3379021736------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa9480a58aba</guid>
            <category><![CDATA[aws-cloud9]]></category>
            <category><![CDATA[aws-ec2-instance]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Rushi Donga]]></dc:creator>
            <pubDate>Tue, 29 Mar 2022 15:33:43 GMT</pubDate>
            <atom:updated>2022-03-29T15:33:43.207Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to deploy a Lambda function using AWS Cloud9.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uFcAwB8Q78rSiSq6jbx0_A.png" /></figure><h3>What is AWS Cloud9?</h3><p>AWS Cloud9 is an I<strong>ntegrated Development Environment</strong> which allows you to <strong>run</strong>, <strong>write</strong> and <strong>debug</strong> the code within a browser in the cloud.</p><p>It provides <strong>three main functionalities</strong></p><ul><li>Terminal</li><li>Code Editor</li><li>Debugger</li></ul><h3>Overview</h3><ul><li>Pre-requisite</li><li>Configuration</li><li>Output</li></ul><h3>Pre-requisite</h3><ul><li>An AWS account is required to implement the configurations.</li><li>Prior knowledge of <strong>AWS Lambda</strong> and <strong>EC2-Instance</strong>.</li></ul><h3>Configuration</h3><blockquote><strong><em>Note</em></strong><em> : Configure all the resources in the </em><strong><em>same Region</em></strong><em>.</em></blockquote><p>Log in to the AWS Management Console and search for the <strong>Cloud9</strong> in the Search Bar and select <strong>Cloud9</strong>.</p><p>You will then be redirected to the AWS Cloud9 Management Console.</p><h3>Step 1 — Create an AWS Cloud9 Environment.</h3><p>Click on <strong>Create Environment</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/0*AvHCFv7OpPYHFRog.png" /></figure><p>You will be redirected to the page which allows you to create a Cloud9 Environment.</p><p>In the Step-1 simply give a name and the description to the Cloud9 Environment and press Next Step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*vryiwZyTAGh8fmMy.png" /></figure><p>In the Step-2 i.e. Configure Settings, leave all the settings to default and click <strong>Next Step</strong>.</p><blockquote><strong><em>NOTE</em></strong><em>: Step-2 involves the configuration of the Cloud9 Environment in an EC2 Instance. Select the </em><strong><em>Environment type</em></strong><em>, </em><strong><em>Instance type</em></strong><em> and the </em><strong><em>Platform</em></strong><em> according to your requirement.</em></blockquote><p>In Step-3, review the configurations and click on <strong>Create environment</strong> button.</p><p>After clicking the Create Environment button you will be redirected to the page, which looks something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZOyKOw-AFoI1deiw.png" /></figure><p>AWS Cloud9 cloud-based Integrated Development Environment</p><h3>Step 2 — Write the code for the Lambda function.</h3><p>Now, in the terminal at the bottom, create a directory named Lambda using the command <strong>mkdir, </strong>and then move into the <strong>lambda</strong> directory using the command <strong>cd.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/0*IKlFv-TTcDz55jKR.png" /></figure><p>Now, create a Python file named <strong>lambda_function.py.</strong></p><blockquote><strong><em>NOTE</em></strong><em>: The name of the python file will be used in future, make sure you note it down before you proceed.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EitXbPKlV6OU44HO.png" /></figure><p>Open the python file in the <strong>nano or vi editor</strong> and paste the code for the function in the editor. Then close the editor by saving the file and confirming the name of the python file.</p><blockquote><em>Click on this </em><a href="https://github.com/RushiDonga/cloud9-lambda"><em>link</em></a><em>, for the sample lambda code.</em></blockquote><blockquote><strong><em>NOTE</em></strong><em>: Below are the steps to install an external dependency onto a Lambda function. Follow this if your lambda function contains an external dependency or you can skip it.</em></blockquote><p>Installing an external dependency on a Lambda function.</p><p>Here, I’m install an external dependency named <strong>requests, </strong>and below is the command to install <strong>requests </strong>external dependency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U7K388ZJUpvu3KwK.png" /></figure><blockquote><strong><em>NOTE</em></strong><em>: Here, </em><strong><em>-t . </em></strong><em>at the end of the command, indicates that this dependency will be installed only in this folder and not globally in the virtual environment.</em></blockquote><p>Now, <strong>zip</strong> all the files contents within the folder <strong>lambda, </strong>using the <strong>zip </strong>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4vTfG9enjaqRN03r.png" /></figure><blockquote><strong><em>NOTE</em></strong><em>: Here </em><strong><em>-r </em></strong><em>*</em><strong><em>, </em></strong><em>at the end of command indicates, that </em><strong><em>all</em></strong><em> </em><strong><em>content</em></strong><em> in this </em><strong><em>lambda directory</em></strong><em> will be </em><strong><em>zipped recursively </em></strong><em>i.e. one by one.</em></blockquote><h3>Step 3 — Create a Lambda function.</h3><blockquote><a href="https://docs.aws.amazon.com/cli/latest/reference/lambda/create-function.html"><em>AWS CLI for Lambda — Create function reference link</em></a></blockquote><p>Use the following <a href="https://github.com/RushiDonga/cloud9-lambda/blob/main/lambda_function.py"><strong>command</strong></a> to create a Lambda function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q21hGfurXawJFHyc.png" /></figure><h3><a href="https://github.com/RushiDonga/cloud9-lambda/blob/main/lambda_function.py">Command description</a></h3><ol><li><strong>— function-name</strong>: Name of the Lambda function.</li><li><strong>— runtime:</strong> Defines the runtime environment of the Lambda function. For us it is python3.9.</li><li><strong>— role: </strong>Give the <strong>ARN</strong> of the IAM role which you want to assign to the Lambda function. Here we have simply assigned the ARN of basic-lambda-execution role.</li><li><strong>— zip-file: </strong>Give the full path of the zip file we created in step-2. It is mandatory to start the name of the file with <strong>fileb://Path/of/the/file.zip.</strong></li><li><strong>— handler: </strong>Contains two parts with the following syntax.</li></ol><p><strong>python-file-name.function-to-be-executed-first</strong></p><p>In our case, it is <strong>lambda_function.lambda_handler.</strong></p><blockquote><strong><em>NOTE</em></strong><em>: Do not forget the </em><strong><em>dot</em></strong><em> in between the file name and the function name.</em></blockquote><h3>Congratulations ♥</h3><p><strong>With this, you have successfully configured and created a Lambda function using Cloud9.</strong></p><h3>Output</h3><p>You can now <strong>check</strong> and <strong>test</strong> the newly created Lambda function in the AWS Lambda Management Console.</p><h3>Learn More</h3><ul><li><a href="https://enlear.academy/forwarding-emails-to-your-inbox-using-amazon-ses-2d261d60e417">Forwarding Emails to Your Inbox Using Amazon SES</a></li><li><a href="https://enlear.academy/web-hosting-with-aws-53a6e9fa47b6">Web Hosting with AWS</a></li><li><a href="https://enlear.academy/deploy-a-serverless-portfolio-website-on-aws-d6bc5c2adeca">Deploy a Serverless Portfolio Website on AWS</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa9480a58aba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blue/Green Deployment of API Using AWS Lambda and API Gateway]]></title>
            <link>https://rushidonga.medium.com/blue-green-deployment-of-api-using-aws-lambda-and-api-gateway-6668fe73c5fe?source=rss-6c3379021736------2</link>
            <guid isPermaLink="false">https://medium.com/p/6668fe73c5fe</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[blue-green-deployment]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[Rushi Donga]]></dc:creator>
            <pubDate>Thu, 24 Feb 2022 16:41:08 GMT</pubDate>
            <atom:updated>2022-02-24T16:41:08.308Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deploy an API using AWS API Gateway, which triggers two AWS Lambda Versions, on the basis of the weight specified in percentage(%).</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sc2d-2s7cVTCnhqnx4NTYA.jpeg" /></figure><h3>What is Blue/Green Deployment?</h3><p>Blue/Green Deployment is a deployment strategy, in which you deploy two different, but identical environments. <strong>One environment</strong> runs the <strong>current application version</strong> and <strong>another environment</strong> runs the <strong>updated application version.</strong></p><h3>Overview</h3><ul><li>Architecture</li><li>Pre-requisite</li><li>Configuration</li><li>Output</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*peMzBi1cWoJ-_ZpK7OTBLQ.png" /></figure><h3>Pre-requisite</h3><ul><li>An AWS account is required to implement the configurations.</li><li>Prior knowledge of AWS API Gateway and AWS Lambda.</li><li>AWS CLI installed and configured on your PC.</li></ul><h3>Configuration</h3><blockquote><strong>Note</strong> : Configure all the resources in the same Region.</blockquote><p>Log in to the AWS Management Console and search for the Lambda in the Search Bar and select <strong>Lambda</strong>.</p><p>You will then be redirected to the AWS Lambda Management Console.</p><h4><strong>Step 1 - </strong>Create a Lambda Function.</h4><blockquote><strong>Note : </strong>We simply need to create a Lambda Function which returns a “Hello World” message. Below are the steps to create the same Lambda Function.</blockquote><p>Click on C<strong>reate Function </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*zglu2Jsrtf79YMsWiu_gGw.png" /></figure><p>You will be redirected to a web page that allows you to create a Lambda function.</p><p>Select <strong>Author from Scratch </strong>from the options available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6B1L14QvzCzNuC4x_d4cdg.png" /></figure><p>In the <strong>Basic Information </strong>give the name of the function as <strong>test-lambda </strong>and select the <strong>Runtime </strong>to be P<strong>ython 3.9.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EAU0_mZXi3SysQ_M9a1J4w.png" /></figure><p>Leave all the configurations to default and click on <strong>Create Function </strong>button at the bottom.</p><p>Edit the code in the Lambda function to return “<strong>Hello World from Version 1&quot; </strong>and deploy the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*DqIYzO0i5qzMhFl19X1BkQ.png" /></figure><h4><strong>Step 2 -C</strong>reate Lambda Versions</h4><p>After editing the code, click on <strong>Actions </strong>at the top and then <strong>Publish New Version.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*yB2QKpt2co8_Q4bBH6w3EQ.png" /></figure><p>Then give the Version Description if required and click on <strong>Publish</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*zvFlu_-1liU19ZW-XMo2UQ.png" /></figure><p>Now again edit the code of the Lambda function as below for deploying it as Version 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*F423mnFMPjVqyWed5b-azg.png" /></figure><p>Now, again publish a new Lambda Version repeating the same process as above by clicking on <strong>Actions, </strong>then <strong>Publish Lambda Version </strong>and finally click on <strong>Publish button,</strong> on the dialog box appeared.</p><h4><strong>Step 3 - </strong>Create Lambda <strong>Alias</strong></h4><p>To create a Lambda Alias, click on <strong>Actions</strong>, then from the drop-down choose to <strong>Create Alias.</strong></p><p>Give the name to the Alias as <strong>test-alias </strong>and choose Version any version<strong>.</strong></p><p>Then, click on the <strong>Weighted alias, </strong>choose <strong>additional-version </strong>any version from the drop-down, and specify the <strong>weight </strong>to be <strong>50%. </strong>Then click on the <strong>Save</strong> Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*xbrFFxZ3VL-YX53OgRXd8w.png" /></figure><h4><strong>Step 4 — C</strong>reate a REST API using API Gateway.</h4><p>Come to the AWS API Gateway console, by searching API Gateway in the search bar in AWS Management Console.</p><p>Choose the API type to be <strong>REST API</strong> and click on <strong>Build</strong> Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*0ZkWfvwztALL-vhzbCofwg.png" /></figure><p>Choose the protocol to be <strong>REST </strong>and choose <strong>New API </strong>in <strong>Create new API.</strong></p><p>In <strong>Settings </strong>give the name to the API as <strong>test-API.</strong></p><p>Leave all the settings to <strong>default</strong> and click on <strong>Create API.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2o54gS2xt5tMtZHQN1goSQ.png" /></figure><p>Select <strong>Actions </strong>and create a Method by clicking on Actions and selecting <strong>Create Method</strong>.</p><p>Choose the <strong>GET </strong>Method from the drop-down and click on the tick button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*GasXP6vAHNtNoaBaJpSWpQ.png" /></figure><p>Select the <strong>Integration type </strong>to be <strong>Lambda Function </strong>and then choose the Lambda function we just created i.e. <strong>test-lambda.</strong></p><blockquote><strong>Note</strong> : Below is the most Important step to point to the <strong>Lambda Alias.</strong></blockquote><p>Give the name of the Lambda Functions as below</p><h4><strong>&lt;lambda-function-name&gt;:${stageVariables.lambdaAlias}</strong></h4><blockquote><strong>Note</strong> : We will create Stage Variable named <strong>lambdaAlias</strong> in further steps.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvEy8Lp_v9MNW6g9BOm7pg.png" /></figure><p>Then click on the <strong>Save </strong>Button.</p><blockquote><strong>Note</strong> : Below is the most Important Step to give <strong>permission</strong> to API Gateway to invoke AWS Lambda Alias.</blockquote><p>A dialog box will appear, displaying the <strong>CLI command</strong>. Copy the command and paste it at a secure place for future reference. Then click on the <strong>OK </strong>button.</p><p>Now, deploy the API by clicking on <strong>Actions</strong> and choosing <strong>Deploy API.</strong></p><p>Deploy the API, by creating a new Stage, with the Stage Name as a <strong>test.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*GAY_u7Fw5RKO2dQFRoe5yg.png" /></figure><p>Now, choose <strong>Stages </strong>on the Left Navigation panel and choose <strong>Stage Variables.</strong></p><p>Click on <strong>Add Stage Variable, </strong>give the Name as <strong>lambdaAlias </strong>and the Value as <strong>test-Alias.</strong></p><blockquote><strong>Note</strong> : Here <strong>lambdaAlias</strong> in the Value is the same as we mentioned while choosing Lambda in the <strong>IntegrationType</strong> while creating GET Method.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mHjEFoZvCZt57BLBpch3zg.png" /></figure><p>Now, it’s time to run the Command, which we copied and pasted it for our future reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KchG82LvbGjyJdvBzMCAg.png" /></figure><p>Now, open the <strong>Command Prompt</strong> with AWS CLI installed and configured with the region you have deployed the Architecture.</p><p>Run the command <strong>after</strong> changing the <strong>function-name</strong> attribute in the command, by replacing <strong>${stageVariables.lambdaAlias}</strong> with the name of the Lambda Alias we created i.e. <strong>test-Alias.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*SJTglIaH2-AdqFB4Q96FKw.png" /></figure><p>You will get a response something like this in the JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYlFlgXr76JF-rVpiFKXNw.png" /></figure><h3><strong>Congratulations ♥</strong></h3><p><strong>With this, you have successfully configured the above-mentioned Architecture.</strong></p><h3><strong>Output</strong></h3><p>You can check the deployed API, by navigating to the AWS API Gateway Console, clicking on the API we just created.</p><p>Choose <strong>stages</strong> on the left navigation panel and choose the stage that we just created i.e. <strong>test.</strong></p><p>A link will be displayed beside <strong>Invoke URL</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*YZeAXM0Fp7hbSmM8b_uaJw.png" /></figure><p><strong>Open the URL in the browser and try refreshing the browser multiple times, you will find different responses from different Lambda Versions.</strong></p><h3>Learn More</h3><ul><li><a href="https://enlear.academy/complete-guide-to-aws-amplify-studio-4a14801d85e4">Complete Guide to AWS Amplify Studio</a></li><li><a href="https://enlear.academy/how-to-use-aws-parameter-store-39a123f1c57a">How to Use AWS Parameter Store</a></li><li><a href="https://enlear.academy/creating-an-aws-lambda-function-for-matplotlib-data-visualizations-a2a6a786516c">Creating an AWS Lambda Function for Matplotlib Data Visualizations</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6668fe73c5fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate API Gateway with Cognito to Serve Authenticate Users]]></title>
            <link>https://rushidonga.medium.com/how-to-integrate-api-gateway-with-cognito-to-serve-authenticate-users-ed46c2bedb28?source=rss-6c3379021736------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed46c2bedb28</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-api-gateway]]></category>
            <category><![CDATA[aws-cognito]]></category>
            <dc:creator><![CDATA[Rushi Donga]]></dc:creator>
            <pubDate>Mon, 07 Feb 2022 16:32:55 GMT</pubDate>
            <atom:updated>2022-02-07T16:32:55.699Z</atom:updated>
            <content:encoded><![CDATA[<h4>Configure API Gateway to Serve Content to Authenticated Users with AWS Cognito User Pool</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcqdQ8bwQE5IH1rpw-r_aw.jpeg" /></figure><h3><strong>Architecture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*alBLXrbe0YCHBtRuMFYcLw.png" /></figure><p>Let me explain which AWS Services have been used and for which purpose in the above Architecture.</p><ul><li><strong>API Gateway : </strong>Used to create an API and integrate with AWS Cognito and AWS Lambda.</li><li><strong>Cognito : </strong>To Authenticate the user.</li><li><strong>Lambda : </strong>To serve a fixed response to the AWS API Gateway.</li></ul><h3><strong>Pre-requisites</strong></h3><ul><li>Basic knowledge of AWS API Gateway, AWS Cognito, and AWS Lambda is required</li></ul><blockquote><strong>NOTE :</strong> Make sure, you create all of the resources in the same <strong>Region.</strong></blockquote><h3><strong>1. Configuring AWS Cognito User Pool.</strong></h3><p>Go to <a href="https://aws.amazon.com/">AWS Management Console</a>.</p><p>Here you will find the <strong>Amazon Cognito</strong> service under <strong>Security, Identity &amp; Compliance section</strong>.</p><p>Click on Manage User Pool, on the home Page of AWS Cognito.</p><p>Now click on the button <strong>Create User Pool. </strong>Now there will be different Sections to configure User Pool.</p><h4><strong>Section 1: Configure sign-in</strong></h4><p>First, you need to choose Authentication Providers. In the <strong>Providers Type, </strong>there are two options</p><ul><li><strong>Cognito User Pool</strong></li></ul><p>If you want the user to sign in using their email address, Phone Number, or User Name. You can select one or multiple Attributes which will be prompted when the user sign-up.</p><blockquote>NOTE — You will not be able to change the sign-in options once you have created the User Pool</blockquote><ul><li><strong>Federated Identity Providers</strong></li></ul><p>If you want your user to sign in with social identity providers like Facebook, Google, Amazon, or Apple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*8DmZa65u7F5FnqHtdnHjVA.png" /></figure><h4><strong>Section 2: Configure security requirements</strong></h4><p><strong>Password Policy </strong>defines the length and the complexity of the password your user can set. Contains two options.</p><ul><li><strong>Cognito Defaults — </strong>For default password length and complexity.</li><li><strong>Custom — </strong>If you want to define custom password length and complexity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*_RIQKwlWkQzli0yj3XHTOw.png" /></figure><p><strong>Multi-factor authentication </strong>for enforcing Multi-Factor Authentication MFA during the user sign-in process. Contains Three options.</p><ul><li><strong>Require MFA — </strong>Recommended to require MFA while the user sign in.</li><li><strong>Optional MFA — </strong>Opts the user to choose whether to require MFA or not.</li><li><strong>No MFA — </strong>Provisions the user to sign in with a Single Authentication Factor.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*W9L6JegX87omDjTvZEgTqQ.png" /></figure><p><strong>User account recovery </strong>configures how the user will recover their account in case the user forgets their password. For now, leave the configuration to default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*PINtua-2kFB3n5voeSE-KQ.png" /></figure><h4><strong>Section 3: Configure Self-service sign-up</strong></h4><p>This defines whether to display a sign-up link on the sign-in page in the hosted UI. When <strong>Enable self-registration </strong>checkbox is the disabled user will not be able to create a new user profile. In this case Federation or the Administrator, API needs to be used to create User Profiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*cLEBbaFq5qBw8nzPasn6xQ.png" /></figure><p><strong>Attribute verification and user account confirmation </strong>define how the user will verify their identity when they sign up. Select Cognito to automatically send messages to verify and confirm. Contains three options.</p><p><strong>i. Send SMS </strong>to verify the phone number.</p><p><strong>ii. Send Email </strong>to verify the email address.</p><p><strong>iii. Send SMS message if the phone number is available, otherwise send an email message</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*IXJE8GjnrZRKxO9OGwKAdQ.png" /></figure><p><strong>Required attributes </strong>define which attributes will be required when a new user is created. You can select multiple options among the multiple options available. For now, we will go with <strong>email </strong>only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*BLa6Uh9RX-EMyUhc48M41g.png" /></figure><p><strong>Custom attributes </strong>allow you to define any custom attributes that a user will require when a new user is created.</p><p><strong>Section 3: Configure message delivery </strong>which defines how to send a message to a new user to verify their identity. Contains two options.</p><p><strong>i. Send Email with Amazon SES </strong>to send a message to the user using AWS SES.</p><p><strong>ii. Send email with Cognito </strong>to send messages with AWS Cognito.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*cyfrwWt_ZQebPLFJhQkPSg.png" /></figure><h4><strong>Section 4: Integrate your app</strong></h4><p><strong>i. </strong>Give a name to your user Pool in <strong>User Pool Name </strong>i.e. test-userPool</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*s1j_HCbJkOFS0q2j_BkFJw.png" /></figure><p><strong>ii. Hosted authentication pages </strong>allows you to use Cognito’s Hosted UI and OAuth 2.0 servers for sign-up and sign-in purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*K6p8NVZiIpkdYX1HLb2f1g.png" /></figure><p><strong>iii. Domain </strong>allows you to configure a domain for your Hosted UI endpoint. Contains two options.</p><p><strong>Use Cognito Domain </strong>allows you to define your custom prefix to use with Amazon-owned domain.</p><blockquote>Need to use the prefix that is available</blockquote><p><strong>Use a custom domain </strong>to use your own custom domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*yE4Txl9s5fxl3hPYDR5eAg.png" /></figure><p><strong>Initial app client </strong>defines an app client in your user pool that has the permission to call unauthenticated API Operations. Contains three options</p><p><strong>i. Public Client </strong>for native, Browser, or Mobile apps. In simple words, it allows you to make Cognito API requests from the user systems which are not trusted with the client secret.</p><p><strong>ii. Confidential Client </strong>for server-side Applications.</p><p><strong>iii. Other </strong>allows you to choose your custom App.</p><ul><li>For now, we will stick to <strong>Public Client </strong>and give the client name as <strong>test-Client</strong></li><li>Client secrets are used by the server-side component of the App to authorize the API requests.</li></ul><blockquote>If you are using JavaScript SDK in your mobile/web app, select <strong>Don’t generate a client secret, </strong>because client secrets are not supported by JavaScript SDK.</blockquote><ul><li><strong>Allowed Callback URLs </strong>are the URLs, to which the users will be redirected after successful signup or sign in.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*sqeLRBaqz0SHGNYbcr0wEQ.png" /></figure><p><strong>Advanced App client setting.</strong></p><ul><li>In <strong>Authentication Flows </strong>leave it to default or Check or Uncheck as per your requirement.</li><li>Set <strong>Refresh Token, Access Token, ID Token expiration </strong>as per your requirements. In simple words, AWS will provide these tokens to your application to access AWS Resources and these token are valid for the specified time interval.</li><li>Leave Identity Providers to default.</li><li><strong>OAuth 2.0 Grant Types </strong>defines how Cognito will grant tokens to your application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*RiyOA1mZ73EQD8NHwKiKOA.png" /></figure><blockquote>Remember to select Implicit grant, so that the client will get access token and ID token .</blockquote><ul><li><strong>OpenID Connect scopes </strong>specify the attributes the app client can retrieve using the Access Token.</li><li><strong>Allowed sign-out URLs </strong>are the URLs to which the user will be redirected once the user has signed out.</li><li>In <strong>Allowed sign-out URLs, </strong>leave it to default or can define your own Read and Write permission to the Attributes.</li></ul><p><strong>Section 6: Review </strong>the configuration and click on <strong>Create User Pool.</strong></p><p>Now, since we have created User Pool, let’s create a Lambda Function which simply returns a “Hello World” when invoked.</p><h3><strong>2. Lambda Function</strong></h3><ul><li>Go to the AWS Lambda Console and click on <strong>Create Function</strong></li><li>Choose Author from Scratch and provide a name to the Lambda Function eg <strong>test-API-function.</strong></li><li>Select the run time environment you want and click on Create Function.</li></ul><blockquote>On Clicking a <strong>Create Function </strong>button, an IAM Role will be created which will provide AWS Lambda permission to send Logs to AWS Cloudwatch.</blockquote><h3><strong>3. API Gateway</strong></h3><p><strong>Create a Resource</strong></p><ul><li>Create a new REST API named <strong>test-API</strong> and the endpoint Type as Regional.</li><li>In the <strong>Resources </strong>tab choose <strong>Actions </strong>— <strong>Create Resource.</strong></li><li>Create a resource named <strong>test-API-resource.</strong></li></ul><p><strong>Create a Method</strong></p><ul><li>Now, in the Resources Tab, select the <strong>test-API-resource </strong>Resource, and click on <strong>Actions — Create Method.</strong></li><li>Create a GET Method.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*1QpiffRwrMH88Yqutb0xsw.png" /></figure><ul><li>Choose <strong>Lambda Function </strong>as the Integration type.</li><li>Choose the region of the Lambda Function.</li></ul><blockquote>NOTE : It is recommended to have the Lambda Function and the API gateway in the same Region</blockquote><ul><li>Choose the Lambda Function we just created i.e. <strong>test-API-function </strong>and click on <strong>Save.</strong></li></ul><blockquote>A dialog box will prompt, which says, by clicking <strong>OK </strong>Permission will be granted to the API Gateway to invoke the mentioned Lambda Function.</blockquote><p><strong>Create an Authorizer</strong></p><p>Choose <strong>Authorizer </strong>from the Tab and click on <strong>Create new Authorizer.</strong></p><ul><li>Name the Authorizer i.e. <strong>test-Authorizer </strong>and choose <strong>Cognito </strong>as the type.</li><li>In <strong>Cognito User Pool </strong>choose the user pool we just created i.e. <strong>test-API.</strong></li><li>Add “<strong>Authorization</strong>” as Token Source and leave Token Validation as Empty and click on Create button.</li></ul><blockquote>Here, <strong>Token Source</strong> is the key in the Header , which will be used to pass the Access Token with in the header.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*LM2iuQqD_OxBhJCyWJIrDw.png" /></figure><p>Now, since we have created <strong>Authorizer, </strong>it’s time to integrate our Authorizer with the API.</p><ul><li>Go to the <strong>Resources </strong>tab, select the <strong>GET </strong>method we just created and click on <strong>Method Request.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*XV-f_0dqXmoU3evhsoInRg.png" /></figure><ul><li>Refresh the Page once.</li><li>In <strong>Authorization, </strong>choose the <strong>Authorizer </strong>we just created i.e. <strong>test-Authorizer, </strong>and add <strong>email</strong> in <strong>OAuth Scopes.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*ujtwYP_AWrTyS8XKNfJo2w.png" /></figure><p>Now, it’s time to deploy the API.</p><ul><li>Navigate to the <strong>Resources </strong>tab, click on <strong>Actions</strong> and choose <strong>Deploy API.</strong></li><li>Create a new stage with the name <strong>test. </strong>You can add Stage Description and Deployment Description if needed and click on the <strong>Deploy </strong>button.</li></ul><h4><strong>Now that we have finished configuring our resources, It’s high time to test our resources.</strong></h4><h3>Testing</h3><p>We will be testing our APIs using <a href="https://www.postman.com/">Postman</a>.</p><p><strong>Step 1. Get the Access Token</strong></p><ul><li>Go to the AWS Cognito Console and select the User Pool we just created. i.e.<strong> test-API.</strong></li><li>Navigate to the <strong>App Integration </strong>tab and select the App Client we just created i.e. <strong>test-Client. </strong>Over here, in the <strong>Hosted UI </strong>section, click on the button named <strong>View Hosted UI.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_7WnOWceAE6pgtboVZ0Sg.png" /></figure><ul><li>It will open a Link in a New Tab.</li><li>View the opened Link carefully, and change the <strong>response_type=code </strong>to <strong>response_type=token </strong>and click <strong>enter </strong>on the keyboard.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*w_NyLHP0zGtJEeHDu_Tnow.png" /></figure><blockquote>Changing the response type = token, will grant us access token and id token after a successful sign up or sign in.</blockquote><ul><li>Create a new Account or sign in, to an existing account.</li><li>After successful signup or sign-in, you will be redirected to another page. Now copy the URL and extract the access_token from the URL.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*8CysIO8lwbLlsyd8Iej3ew.png" /></figure><p><strong>Step 2. Get the API</strong></p><p>Navigate the AWS API Gateway Console and open the API we just created i.e. <strong>test-API.</strong></p><ul><li>Click on the <strong>Stages</strong> Tab and copy the <strong>Invoke URL.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*QXN79NNYS6bbkQFuuoA90A.png" /></figure><p><strong>Step 3. Open </strong><a href="http://postman.com"><strong>postman.com</strong></a></p><p>Create a new account or log in to an existing account.</p><ul><li>Click on <strong>My Workspace.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*_fD41HXalTJ3e04_A9Ushw.png" /></figure><ul><li>Modify the URL copied from the API Gateway console to the API as mentioned in the below Image.</li><li>Also, configure the Headers section as shown in the below image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ne1Reo67wjiQgnTZLfORpA.png" /></figure><p>Mine looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yexvIHCcrhXu4ReEBTQXCg.png" /></figure><ul><li>Then click on the send button and will get the response as mentioned in the below image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*ohkZFxdcgeEcZhwrczH0dQ.png" /></figure><ul><li>If someone tries to invoke the API with the Expired Token or Invalid Token or No Token, then they will get a response like</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*jqXqmS4acSFo3aeK4MwiIQ.png" /></figure><blockquote>With this, you have successfully Configured and Tested API Gateway which serves content only to the Authenticated users in Cognito User Pool.</blockquote><h3>Learn More</h3><ul><li><a href="https://enlear.academy/amazon-api-gateway-securing-endpoints-using-cognito-user-pool-bc65e40e6d37">Amazon API Gateway: Securing Endpoints using Cognito User Pool</a></li><li><a href="https://enlear.academy/amazon-api-gateway-securing-endpoints-using-api-keys-eec1c856b327">Amazon API Gateway: Securing Endpoints using API Keys</a></li><li><a href="https://enlear.academy/complete-crud-application-with-aws-serverless-6538e9dca7c1">Complete CRUD Application with AWS Serverless</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed46c2bedb28" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>