<?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>Forem: Asif Khan</title>
    <description>The latest articles on Forem by Asif Khan (@asif_khan).</description>
    <link>https://forem.com/asif_khan</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%2F1820146%2Feba72717-d3a1-4d24-a3e4-38bac6705753.png</url>
      <title>Forem: Asif Khan</title>
      <link>https://forem.com/asif_khan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/asif_khan"/>
    <language>en</language>
    <item>
      <title>AWS Project: Building with Generative AI on AWS using PartyRock, Amazon Bedrock, and Amazon Q</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Sun, 10 Nov 2024 12:17:49 +0000</pubDate>
      <link>https://forem.com/asif_khan/aws-project-building-with-generative-ai-on-aws-using-partyrock-amazon-bedrock-and-amazon-q-19ip</link>
      <guid>https://forem.com/asif_khan/aws-project-building-with-generative-ai-on-aws-using-partyrock-amazon-bedrock-and-amazon-q-19ip</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This project explores three unique applications of &lt;strong&gt;Generative AI on AWS&lt;/strong&gt; by leveraging &lt;strong&gt;PartyRock&lt;/strong&gt;, &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;, and &lt;strong&gt;Amazon Titan&lt;/strong&gt;. Through three distinct experiments, I dive into no-code app creation, foundational AI model integration, and retrieval-augmented generation (RAG) workflows. Each showcases how to use AWS services to build powerful, scalable AI applications. From developing a book recommendation chatbot to building context-aware response systems, this project highlights a versatile approach to harnessing AI on AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PartyRock&lt;/strong&gt;: Simplifies no-code AI app development with pre-configured widgets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Bedrock&lt;/strong&gt;: Provides access to foundational models for text, chat, and image generation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt;: Chat functionality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Titan&lt;/strong&gt;: Text generation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Titan Image Generator&lt;/strong&gt;: Image creation based on prompts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FAISS&lt;/strong&gt;: Supports similarity searches and vector storage for RAG.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Titan Text Embeddings&lt;/strong&gt;: Converts text to vectorized formats, essential for building document-based AI models.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Account&lt;/strong&gt;: Required to access Bedrock, PartyRock, and Titan.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS CLI&lt;/strong&gt;: For managing resources and configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Basic AWS Knowledge&lt;/strong&gt;: Familiarity with IAM roles, Bedrock, and foundational AI models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No-Code Access&lt;/strong&gt;: PartyRock simplifies app development, so coding experience is not mandatory.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Problem Statement or Use Case
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: Accessing reliable, real-time information and creating interactive applications often requires complex backend integrations. While generative AI enables real-time information generation, context-aware responses, and image creation, integrating these features can be challenging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: This project demonstrates three distinct implementations of generative AI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No-code Book Recommendation Chatbot&lt;/strong&gt;: Built with &lt;strong&gt;PartyRock&lt;/strong&gt;, this chatbot provides personalized book recommendations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Foundation Model Integration&lt;/strong&gt;: &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; enables real-time text, chat, and image generation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document-based Retrieval-Augmented Generation (RAG)&lt;/strong&gt;: Combines &lt;strong&gt;Amazon Titan&lt;/strong&gt;, &lt;strong&gt;FAISS&lt;/strong&gt;, and &lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt; to deliver contextually relevant answers based on stored knowledge, illustrating how RAG applications can offer effective AI solutions in knowledge-heavy environments.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Real-World Relevance&lt;/strong&gt;: These approaches are directly applicable to industries like customer service, education, e-commerce, and recommendation systems. The RAG model, in particular, benefits use cases where personalized or context-driven content generation is critical — such as in customer support bots or intelligent virtual assistants.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Implementation
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Project 1: Build Generative AI Applications with PartyRock
&lt;/h2&gt;

&lt;p&gt;In this section, we’ll learn how to use PartyRock to generate AI apps without any code.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is PartyRock
&lt;/h3&gt;

&lt;p&gt;PartyRock is a shareable Generative AI app building playground, that allows you to experiment with prompt engineering in a hands-on and fun way. In just a few clicks, you can build, share, and remix apps, to get inspired while playing with Generative AI. For example, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Build an app to generate dad jokes on the topic of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create and play a virtual trivia game online with friends from around the world.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create an AI storyteller to guide your next fantasy roleplaying campaign.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fus8ueo2zd4ftw9g8gizr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fus8ueo2zd4ftw9g8gizr.png" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By building and playing with PartyRock apps, you learn about the fundamental techniques and capabilities needed to get started with Generative AI, including understanding how a foundation model responds to a given prompt, experimenting with different text-based prompts, and chaining prompts together.&lt;/p&gt;

&lt;p&gt;Any builder can experiment with PartyRock by creating a profile using a social login from Amazon.com, Apple, or Google. &lt;strong&gt;PartyRock is separate from the AWS console and does not require an AWS account to get started.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Exercise 1: Building a PartyRock Application
&lt;/h3&gt;

&lt;p&gt;To highlight the power of PartyRock we are going to build an application that can provide book recommendations based on your mood.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fs9gm7qkdwvzvosqm99df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fs9gm7qkdwvzvosqm99df.png" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;To begin head over to the &lt;a href="https://partyrock.aws/" rel="noopener noreferrer"&gt;PartyRock website &lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Login with a social login from Amazon.com, Apple, or Google&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Build your own app and enter in the following prompt Provide book recommendations based on your mood and a chat bot to talk about the books then click Generate app&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Using the app
&lt;/h3&gt;

&lt;p&gt;PartyRock was able to create the interface needed to take in a user input, provide recommendations and create a chatbot just from your prompt. Now play around with the app by entering your mood and then asking the chat bot for more information about the book. Try entering in Happy&lt;/p&gt;

&lt;p&gt;. Afterwards you can ask the chat bot Can you tell more about one of the books that was listed.&lt;/p&gt;

&lt;p&gt;You can also share your app by clicking the Make public and Share button.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating your app
&lt;/h3&gt;

&lt;p&gt;In PartyRock each UI element is a Widget, which displays content, takes in input, connects to other widgets, and creates output. Widgets that take in input allow users to interact with the app. Widgets that create output use prompts and references to other widgets to generate something like an image or text.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of widgets
&lt;/h3&gt;

&lt;p&gt;There are 3 different types of AI-powered widgets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Image generation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chatbot&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Text generation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can edit AI-powered widgets to connect them to other widgets and make their output change.&lt;/p&gt;

&lt;p&gt;There are also 3 other widgets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;User input&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Static text&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Document upload&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The user input widget allows users to change output when you connect it to AI-powered widgets. The static text widget provides a place for text descriptions.&lt;/p&gt;

&lt;p&gt;For more details check out the &lt;a href="https://partyrock.aws/guide/building" rel="noopener noreferrer"&gt;PartyRock Guide&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Exercise 2: Playtime with PartyRock
&lt;/h3&gt;

&lt;p&gt;Can you update the prompts in your app, play with settings, or chain outputs together. Be creative and explore what PartyRock can do. Try adding a widget that can draw an image from the book.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remix an application
&lt;/h3&gt;

&lt;p&gt;With PartyRock you can Remix applications, which allows you to make a copy of an app in your account. From there you can build and edit to make new changes. Remix your own apps to create new variations, or remix public apps from friends or from sample apps. Try to remix one of the apps from the &lt;a href="https://partyrock.aws/discover" rel="noopener noreferrer"&gt;PartyRock Discover page&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a snapshot
&lt;/h3&gt;

&lt;p&gt;Got a funny response from an app you’re using? You can share a snapshot with friends. Make sure the app is in public mode, then choose Snapshot in the top right corner of the app page. The URL that includes the current input and output of your app is then copied to your clipboard so you can share it with others.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrap Up
&lt;/h3&gt;

&lt;p&gt;With PartyRock, you can demo and propose ideas that leverage Generative AI. When you want to create apps for production, you can implement those ideas with Amazon Bedrock.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project 2: Use Foundation Models in Amazon Bedrock
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/bedrock/" rel="noopener noreferrer"&gt;Amazon Bedrock &lt;/a&gt;is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies like Stability AI, Anthropic, and Meta, via a single API, along with a broad set of capabilities you need to build Generative AI applications with security, privacy, and responsible AI.&lt;/p&gt;

&lt;p&gt;Since Amazon Bedrock is serverless, &lt;strong&gt;you don’t have to manage any infrastructure&lt;/strong&gt;, and you can securely integrate and deploy Generative AI capabilities into your applications using the AWS services you are already familiar with.&lt;/p&gt;

&lt;p&gt;In this module we will see how we can use Amazon Bedrock through the console and the API for generating text and images.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model Access
&lt;/h2&gt;

&lt;p&gt;Before we can start building with Bedrock, we will need to grant model access to our account.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head to the &lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/modelaccess" rel="noopener noreferrer"&gt;model access page&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Enable specific models button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the checkboxes listed below to activate the models. If running from your own account, there is no cost to activate the models — you only pay for what you use during the labs. See &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html" rel="noopener noreferrer"&gt;here &lt;/a&gt;for more information on supported models&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amazon (select Amazon to automatically select all Amazon Titan models)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Anthropic &amp;gt; Claude 3.5 Sonnet, Claude 3 Sonnet, Claude 3 Haiku&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Meta &amp;gt; Llama 3.1 405B Instruct, Llama 3.1 70B Instruct, Llama 3.1 8B Instruct&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mistral AI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stability AI &amp;gt; SDXL 1.0&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click &lt;strong&gt;Request model access&lt;/strong&gt; to activate the models in your account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fhl1vg2uhnvhzlzfowl10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fhl1vg2uhnvhzlzfowl10.png" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Monitor the model access status. It may take a few minutes for the models to move from &lt;strong&gt;In Progress&lt;/strong&gt; to &lt;strong&gt;Access granted&lt;/strong&gt; status. You can use the Refresh button to periodically check for updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify that the model access status is &lt;strong&gt;Access granted&lt;/strong&gt; for the previously selected models.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5xdsge2f13e82ot4cvhg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5xdsge2f13e82ot4cvhg.png" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the Amazon Bedrock Playground
&lt;/h2&gt;

&lt;p&gt;The Amazon Bedrock Playground provides a way to quickly experiment with different foundation models inside the AWS Console. You can compare model outputs, load example prompts, and even export API requests. Currently 3 modes are supported:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/chat-playground" rel="noopener noreferrer"&gt;**Chat &lt;/a&gt;:** Experiment on a vast range of language processing tasks in a turn-by-turn interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/text-playground" rel="noopener noreferrer"&gt;**Text &lt;/a&gt;:** Experiment using fast iterations on a vast range of language processing tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/image-playground" rel="noopener noreferrer"&gt;**Image &lt;/a&gt;:** Easily generate compelling images by providing text prompts to pre-trained models.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can access the playground from the links above or from the &lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/overview" rel="noopener noreferrer"&gt;Amazon Bedrock Console &lt;/a&gt;under the Playgrounds side menu. Take a few minutes to play around with some examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Playground Examples
&lt;/h2&gt;

&lt;p&gt;Here are some examples you can try in each playground&lt;/p&gt;

&lt;h2&gt;
  
  
  Chat
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;To start click the Select model button to open the Model Selection Popup.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From here pick Anthropic Claude 3 Sonnet&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F36sbbmv33bfxzg98x3gu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F36sbbmv33bfxzg98x3gu.png" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the Load examples button and select Advanced Q&amp;amp;A with Citations example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the example is loaded you can click Run to start the chat.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqnqnuzs6ygjxaqsrluk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqnqnuzs6ygjxaqsrluk4.png" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The sidebar has model configurations you can play with. Try changing the temperature to 1. This makes the model more creative in its responses.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Text
&lt;/h2&gt;

&lt;p&gt;In the example below we selected Amazon Titan Text G1 — Express as our model and loaded the JSON creation example. Try changing the model by selecting Change and selecting Mistral -&amp;gt; Mistral Large 2 and run the prompt again after clearing the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqssj2t1nhr9jujivio12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqssj2t1nhr9jujivio12.png" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how the output is very different. It is important to test out different foundation models to see which one fits your use case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fob4dthgqkxt3ahm8xbje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fob4dthgqkxt3ahm8xbje.png" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftmbmmrjuxk2jugsw633h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftmbmmrjuxk2jugsw633h.png" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Image
&lt;/h2&gt;

&lt;p&gt;In the example below we selected Titan Image Generator G1 as our model and loaded the Generate images from a text prompt example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0qoeavg680nbirrnaqys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0qoeavg680nbirrnaqys.png" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try changing the prompt strength to 10, and trying different prompts such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;unicorns in a magical forest. Lots of trees and animals around. The mood is bright, and there is lots of natural lighting&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Downtown City, with lots of skyscrapers. At night time, lots of lights in the buildings.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you are finished let’s see how we can bring the power of Amazon Bedrock to applications using the API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project 3: Chat with your Documents
&lt;/h2&gt;

&lt;p&gt;The ability to ingest documents and then have an LLM answer questions using relevant context is known as Retrieval Augmented Generation (RAG). This module focuses on building these popular Generative AI solutions, exploring various methods to “chat with your documents”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fpaxcbvwbainurpg09z4n.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fpaxcbvwbainurpg09z4n.gif" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieval Augmented Generation with Amazon Bedrock
&lt;/h2&gt;

&lt;p&gt;Before diving into the RAG workflow, it’s crucial to understand &lt;strong&gt;embeddings.&lt;/strong&gt; An embedding is a way of representing documents as vectors in a high-dimensional space. These vectors capture the essence of the document’s content in a form that machines can process. By converting text into embeddings, we enable the computer to ‘understand’ and compare different pieces of text based on their contextual similarities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdn57e3g2yzii629b1gh1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdn57e3g2yzii629b1gh1.png" width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Vector Databases: Organizing and Accessing Embeddings
&lt;/h2&gt;

&lt;p&gt;Once we have embeddings, the next step is to store and organize them for efficient retrieval. This is where vector databases come in. A vector database allows us to store and query embeddings, facilitating quick and relevant retrieval of documents based on their vector representations. In essence, it acts as a bridge between the raw data and the actionable insights we seek from our language models. For this module we will be using &lt;a href="https://github.com/facebookresearch/faiss" rel="noopener noreferrer"&gt;Faiss &lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leveraging Amazon Bedrock for RAG
&lt;/h2&gt;

&lt;p&gt;With the foundational knowledge of embeddings and vector databases, we’re now ready to apply these concepts using Amazon Bedrock. In this part of the module, we will demonstrate how to use these Large Langue models (LLMs) to perform the RAG workflow effectively. This involves processing input queries, retrieving relevant document embeddings from the vector database, and using the LLMs to synthesize this information into coherent and contextually relevant responses. We will also leverage &lt;a href="https://www.langchain.com/" rel="noopener noreferrer"&gt;LangChain &lt;/a&gt;which is framework designed to simplify the creation of applications using LLMs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise 1: Getting Started with RAG
&lt;/h2&gt;

&lt;p&gt;To begin open rag_examples/base_rag.py. Let’s walkthrough this code to show how the RAG works.&lt;/p&gt;

&lt;p&gt;For this example, we will be using sentences as our documents: On line 15 we have an array of sentences defined:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sentences = [
    # Pets
    "Your dog is so cute.",
    "How cute your dog is!",
    "You have such a cute dog!",
    # Cities in the US
    "New York City is the place where I work.",
    "I work in New York City.",
    # Color
    "What color do you like the most?",
    "What is your favorite color?",
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let’s take a look at the rag_with_bedrock function (line 60) and walkthrough how to perform the RAG workflow.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Setting Up Embeddings with Bedrock:&lt;/strong&gt; First, we initialize our embedding function by calling BedrockEmbeddings. We are using the Amazon Titan Text Embeddings model which will convert text into a format for similarity comparisons.&lt;/p&gt;

&lt;p&gt;embeddings = BedrockEmbeddings(&lt;br&gt;
        client=bedrock_runtime,&lt;br&gt;
        model_id="amazon.titan-embed-text-v1",&lt;br&gt;
    )&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Performing Similarity Search on the Vector Store:&lt;/strong&gt; We then initialize a local vector store using FAISS.from_texts. This function takes our sentences and uses the embedding functions to creating a searchable database of vectorized documents. With that we can then take a query, vectorize it, and then find similar documents.&lt;/p&gt;

&lt;p&gt;local_vector_store = FAISS.from_texts(sentences, embeddings)&lt;br&gt;
    docs = local_vector_store.similarity_search(query)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Calling the RAG Prompt:&lt;/strong&gt; We compile the content of the retrieved documents to form a context string. We then create a prompt that includes the context and the query. Finally, we call the call_claude function with our prompt get our answer.&lt;/p&gt;

&lt;p&gt;context = ""&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for doc in docs:
    context += doc.page_content

prompt = f"""Use the following pieces of context to answer the question at the end.

{context}

Question: {query}
Answer:"""

return call_claude_sonnet(prompt)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now try running the code by entering the following command in the Terminal and pressing enter.&lt;/p&gt;

&lt;p&gt;python3 rag_examples/base_rag.py&lt;/p&gt;

&lt;p&gt;.&lt;/p&gt;

&lt;p&gt;You can change the query on line 83. Play around to see how the model is able to use the context to answer the questions. For example try What city do I work in?&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise 2: Chat with a PDF
&lt;/h2&gt;

&lt;p&gt;There is also an example of how you chat with a PDF. Inside rag_examples/chat_with_pdf.py we have the chunk_doc_to_text function that will ingest the PDF and chunk every 1000 characters to store in the vector database. This process can take a while depending on the server, so we have already chunked the data which is stored in the folder local_index.&lt;/p&gt;

&lt;p&gt;In this example we stored all the text from the &lt;a href="https://docs.aws.amazon.com/wellarchitected/latest/framework/welcome.html" rel="noopener noreferrer"&gt;AWS Well Architected Framework &lt;/a&gt;which highlights best practices for designing and operating reliable, secure, efficient, cost-effective, and sustainable systems in the cloud.&lt;/p&gt;

&lt;p&gt;Now try running the code by entering the following command in the Terminal and pressing enter.&lt;/p&gt;

&lt;p&gt;python3 rag_examples/chat_with_pdf.py&lt;/p&gt;

&lt;p&gt;.&lt;/p&gt;

&lt;p&gt;You can change the query on line 93. Play around to see how the model is able to use the context to figure out the correct answer. For example try What are some good use cases for non-SQL databases?&lt;/p&gt;

&lt;p&gt;. You can even try off topic questions such as what are popular ice cream flavors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Now that you have gotten a taste of using Amazon Bedrock for RAG, let’s explore how we can create scalable RAG workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Amazon Bedrock Knowledge Bases
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/bedrock/knowledge-bases/" rel="noopener noreferrer"&gt;Knowledge Bases for Amazon Bedrock &lt;/a&gt;provides you a managed Retrieval Augmented Generation (RAG) service to query uploaded data. By pointing to the location of the data in Amazon S3, the service automatically fetches the documents, divides them into blocks of text, converts the text into embeddings, and stores the embeddings in a vector database. There is also an API, which allows us to build applications with the Knowledge Base.&lt;/p&gt;

&lt;p&gt;For this module we will be creating a Knowledge Base with a subset of the &lt;a href="https://docs.aws.amazon.com/wellarchitected/latest/framework/welcome.html" rel="noopener noreferrer"&gt;AWS Well-Architected Framework &lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise 1: Creating a Knowledge Base in the AWS Console
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;To begin navigate to the &lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/knowledge-bases" rel="noopener noreferrer"&gt;Knowledge Base Console&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnav2lt3m302jadifstz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnav2lt3m302jadifstz8.png" width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Select the orange Create Knowledge base button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use the default name, or enter in your own. Then, select “Next” at the bottom right of the screen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Browse S3 button and select the bucket with awsdocsbucket in its name. Then press Next.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Titan Embeddings Embeddings model, and leave the default selection for Vector store. Then, select "Next".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the next screen, scroll down and select “Create Knowledge Base”.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Creating the Knowledge Base takes a few minutes. Do not leave the page&lt;/p&gt;

&lt;h2&gt;
  
  
  Querying a Knowledge Base
&lt;/h2&gt;

&lt;p&gt;When your Knowledge Base is ready you can test it in the console.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the Sync button to start the data sync.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will take around 1 minute.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the Select Model button and choose Claude 3 Sonnet then press Apply&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From here you can enter in questions in the chat window where it says Enter your message here. For example we can Can you explain what a VPC is?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Run and the model will respond and you can see the sources in the Knowledge Base by selecting Show result details.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Frsq8n3rrg7ghmb4z8ifd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Frsq8n3rrg7ghmb4z8ifd.png" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try asking the Knowledge Base other questions!&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise 2: Using the Knowledge Base API
&lt;/h2&gt;

&lt;p&gt;You can also query the Knowledge Base through the API. There are two supported methods:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;retrieve:&lt;/strong&gt; Returns documents related to query&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;retrieve_and_generate:&lt;/strong&gt; Does RAG workflow with the model.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To try them out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head back to your IDE and open rag_examples/kb_rag.py.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update KB_ID with the id for your Knowledge Base. It is in the Knowledge base overview section for the Knowledge Base you created.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fifgty07oer4quj3cqo5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fifgty07oer4quj3cqo5l.png" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the code with python3 rag_examples/kb_rag.py.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try playing with QUERY on line 4 to see what type of responses you get.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The code is performing the RAG workflow by converting the query into an embedding and returning the relevant documents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fuwtijxku7lyltml8w536.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fuwtijxku7lyltml8w536.png" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Now that we have created a Knowledge Base, lets learn how we can embed it inside an Amazon Bedrock Agent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Lambda Functions with Amazon Q
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda &lt;/a&gt;is a serverless compute service that enables you to run applications and services without provisioning or managing servers. It automatically handles the underlying compute resources, allowing you to focus on your code and scale effortlessly.&lt;/p&gt;

&lt;p&gt;In this section, you will be updating the data_process_action AWS Lambda function with multiple intentional errors. Your goal is to use Amazon Q to debug and fix these issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Open the &lt;a href="https://us-west-2.console.aws.amazon.com/lambda/home?region=us-west-2#/functions/data_process_action?tab=code" rel="noopener noreferrer"&gt;data_process_action &lt;/a&gt;in the Lambda console.&lt;/p&gt;

&lt;p&gt;To begin, lets create a test event to invoke the Lambda Function:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the Test button to invoke the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the configure test event popup enter in an event name such as test-event.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the following test event JSON to mimic the agent calling the function&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  "agent": {&lt;br&gt;
    "alias": "TSTALIASID",&lt;br&gt;
    "name": "Agent-AWS",&lt;br&gt;
    "version": "DRAFT",&lt;br&gt;
    "id": "ADI6ICMMZZ"&lt;br&gt;
  },&lt;br&gt;
  "sessionId": "975786472213626",&lt;br&gt;
  "httpMethod": "GET",&lt;br&gt;
  "sessionAttributes": {},&lt;br&gt;
  "inputText": "Can you get the number of records in the databse",&lt;br&gt;
  "promptSessionAttributes": {},&lt;br&gt;
  "apiPath": "/get_num_records",&lt;br&gt;
  "messageVersion": "1.0",&lt;br&gt;
  "actionGroup": "agent_action_group"&lt;br&gt;
}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Test again to invoke the function.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Expect an error on this first run, as we’re missing some dependencies. But don’t worry, Amazon Q in the console is here to help:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the Q icon in the right navigation bar to chat with Amazon Q.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ask, How can I add the official prebuilt AWS pandas lambda layer to my lambda function without using the CLI?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow Q’s guidance to integrate the pandas Lambda Layer.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fxee6ygira0xcv6szjleb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxee6ygira0xcv6szjleb.png" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshoot with Amazon Q
&lt;/h2&gt;

&lt;p&gt;Amazon Q in the console window is good at answering general questions about AWS, but if we need more specific guidance we can use &lt;strong&gt;“Troubleshoot with Amazon Q”&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the Lambda console, under the Test tab, invoke the function again by pressing the Test button. We now have a different error to debug. From here click the &lt;strong&gt;Troubleshoot with Amazon Q&lt;/strong&gt; button for assistance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftluaaww5ojd306ebjr0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftluaaww5ojd306ebjr0s.png" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Help me resolve&lt;/strong&gt; button to prompt Q to provide a solution. Can you follow Q’s instructions to update the S3_OBJECT environment variable? The file is clickstream_data.csv&lt;/p&gt;

&lt;p&gt;. Can you spot and fix the other code issues with Q’s help?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj5zydsp38uqm1mlygdav.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj5zydsp38uqm1mlygdav.png" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After addressing each problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Test your Lambda function again to check if the error is resolved.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Continue using ‘Troubleshoot with Q’ for each subsequent error until all issues are fixed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Successfully running the function should result in correct data processing and no errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4d6uzl7wc0hda8we6z5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4d6uzl7wc0hda8we6z5q.png" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Need help? Here’s what to do next&lt;/p&gt;

&lt;p&gt;Here’s the full code for reference&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the Agent
&lt;/h2&gt;

&lt;p&gt;Now we can go back to the Agent and ask this again Can you help with the data processing task of getting the number of records in the production database?&lt;/p&gt;

&lt;p&gt;. This time the Agent will be able to provide the correct answer. We can inspect the trace to see how the Agent is able to “think” through on how to get the correct answer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fw7o7e1ynpfuy0l9a08k3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fw7o7e1ynpfuy0l9a08k3.png" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents API
&lt;/h2&gt;

&lt;p&gt;You can also invoke your agent through the API.&lt;/p&gt;

&lt;p&gt;To try it out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head back to the VSCode Server and open rag_examples/agent_rag.py.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update AGENT_ID with the ID for your Agent. It is in the Agent overview section for the Agent you created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the Hamburger Menu in the top left corner.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to Terminal -&amp;gt; New Terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the code with python3 rag_examples/agent_rag.py.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try playing with QUERY on line 6 to see what type of responses you get.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Clean up
&lt;/h2&gt;

&lt;p&gt;Note: If you are using AWS provided accounts, you can skip this section.&lt;/p&gt;

&lt;p&gt;To avoid incurring unnecessary charges, follow this section to delete the endpoints and resources that you created while running the exercises.&lt;/p&gt;

&lt;h2&gt;
  
  
  Delete objects in S3
&lt;/h2&gt;

&lt;p&gt;For the awsdocsbucket,openapiBucket and the dataanalysisbucket delete the objects in the buckets&lt;/p&gt;

&lt;p&gt;Follow the &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-objects.html" rel="noopener noreferrer"&gt;guidance here &lt;/a&gt;on how to delete objects. Then you can delete the buckets&lt;/p&gt;

&lt;h2&gt;
  
  
  Delete IAM Roles
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;a href="https://console.aws.amazon.com/iam/" rel="noopener noreferrer"&gt;IAM console&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the navigation pane, choose Roles, and then select the check box next to the role name that you want to delete. We created these roles:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;AmazonBedrockExecutionRoleForAgents_*&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AmazonBedrockExecutionRoleForKnowledgeBase_*&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWSServiceRoleForAmazonOpenSearchServerless&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;At the top of the page, choose Delete.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Delete Knowledge Base
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/knowledge-bases" rel="noopener noreferrer"&gt;Knowledge Base console&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Knowledge Base, then click delete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type delete to confirm&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Delete Agent
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;a href="https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/agents" rel="noopener noreferrer"&gt;Agent console&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Agent, then click delete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type delete to confirm&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Delete Vector Database
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the &lt;a href="https://us-west-2.console.aws.amazon.com/aos/home?region=us-west-2#opensearch/collections" rel="noopener noreferrer"&gt;OpenSearch Collections Console&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the collection, then click delete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type confirm to delete&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Delete the CloudFormation stack
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the AWS CloudFormation console at &lt;a href="https://console.aws.amazon.com/cloudformation" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/cloudformation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the Stacks page in the CloudFormation console, select the stack the gen-ai-workshop-cfn.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the stack details pane, choose Delete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select Delete stack when prompted.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This project demonstrated the power and flexibility of &lt;strong&gt;AWS Generative AI tools&lt;/strong&gt; to build diverse AI-driven applications. Whether you’re:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Creating No-Code Apps&lt;/strong&gt;: Using intuitive AWS services to build applications without needing to write extensive code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generating Dynamic Content&lt;/strong&gt;: Leveraging powerful models like &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; and &lt;strong&gt;Titan&lt;/strong&gt; to create responsive, context-aware content on demand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Building a Retrieval Augmented Generation (RAG) System&lt;/strong&gt;: Combining &lt;strong&gt;FAISS&lt;/strong&gt;, &lt;strong&gt;Titan embeddings&lt;/strong&gt;, and &lt;strong&gt;Claude&lt;/strong&gt; to create intelligent systems capable of answering queries based on document context.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each exercise emphasized how AWS services can enable innovative AI solutions that enhance interactive user experiences, streamline knowledge management, and drive real-time content generation.&lt;/p&gt;

&lt;p&gt;This project serves as a solid foundation for building applications that utilize &lt;strong&gt;Generative AI&lt;/strong&gt; for tasks like customer support, knowledge retrieval, and creative content generation, with scalable and efficient workflows. The capabilities of &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;, &lt;strong&gt;Faiss&lt;/strong&gt;, and &lt;strong&gt;LangChain&lt;/strong&gt; give developers the tools needed to create robust AI systems that can continuously learn and improve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Repository
&lt;/h2&gt;

&lt;p&gt;To explore and experiment with the project’s code and documentation, visit the &lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20400/4.%20Building%20with%20Generative%20AI%20on%20AWS%20using%20PartyRock,%20Amazon%20Bedrock,%20and%20Amazon%20Q" rel="noopener noreferrer"&gt;**GitHub Repository&lt;/a&gt;**. Here you can access the complete code, follow along with detailed instructions, and customize the applications to fit your own use cases.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;




</description>
    </item>
    <item>
      <title>AWS Project: Build a Serverless Web Application using Generative AI</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Fri, 08 Nov 2024 17:10:25 +0000</pubDate>
      <link>https://forem.com/asif_khan/build-a-serverless-web-application-using-generative-ai-2ceg</link>
      <guid>https://forem.com/asif_khan/build-a-serverless-web-application-using-generative-ai-2ceg</guid>
      <description>&lt;h4&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This project demonstrates the creation of a &lt;strong&gt;serverless recipe generator web application&lt;/strong&gt; using &lt;strong&gt;AWS Amplify&lt;/strong&gt; and &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;. By entering a list of ingredients, users receive unique, AI-generated recipes through a user-friendly, HTML-based interface. This app showcases the power of &lt;strong&gt;Generative AI&lt;/strong&gt; to enhance user engagement and streamline recipe generation. &lt;/p&gt;

&lt;p&gt;Using &lt;strong&gt;AWS Amplify&lt;/strong&gt; for hosting, &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; for recipe generation, &lt;strong&gt;Cognito&lt;/strong&gt; for authentication, and &lt;strong&gt;Lambda&lt;/strong&gt; for backend processing, we’ll explore a complete solution from deployment to secure, scalable operations.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Tech Stack&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Amplify&lt;/strong&gt;: Full-stack hosting and continuous deployment for the frontend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Bedrock (Claude 3 Sonnet)&lt;/strong&gt;: Provides the Generative AI capabilities for recipe generation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS AppSync&lt;/strong&gt;: Manages GraphQL APIs for real-time communication between the frontend and backend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Cognito&lt;/strong&gt;: Facilitates secure user authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda&lt;/strong&gt;: Runs serverless backend functions to process user inputs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js and npm&lt;/strong&gt;: Required for running the React app and managing dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git &amp;amp; GitHub&lt;/strong&gt;: Version control and hosting for continuous deployment via Amplify.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To follow along with this tutorial, you will need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account&lt;/strong&gt;: Requires permissions for Amplify, Cognito, Bedrock, and Lambda.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI&lt;/strong&gt;: Needed for resource management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js &amp;amp; npm&lt;/strong&gt;: For running the React app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amplify CLI&lt;/strong&gt;: For initializing and configuring the Amplify project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Basic AWS Knowledge&lt;/strong&gt;: Familiarity with Amplify, Cognito, AppSync, and Lambda services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository&lt;/strong&gt;: To enable Amplify’s continuous deployment integration.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Problem Statement or Use Case&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: Searching for suitable recipes based on available ingredients can be time-consuming, and manually sifting through results often yields non-personalized options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: This serverless recipe generator offers a &lt;strong&gt;real-time AI-powered solution&lt;/strong&gt;, allowing users to input ingredients and receive tailored recipes instantly. The use of &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; makes it possible to generate diverse, personalized recipes on demand, saving users time and enhancing their cooking experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Relevance&lt;/strong&gt;: This type of application has potential in e-commerce, cooking platforms, and smart home solutions. By integrating &lt;strong&gt;Generative AI&lt;/strong&gt; and &lt;strong&gt;serverless architecture&lt;/strong&gt;, we demonstrate a scalable, real-time solution for creating personalized recipes or content.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Architecture Diagram&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The architecture diagram below provides an overview of the components:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fppdfoxymhxa27bw6zfki.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fppdfoxymhxa27bw6zfki.gif" alt="Architecture Diagram" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Component Breakdown&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Frontend (React Application)&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
User-facing interface where users input ingredients and receive generated recipes. Hosted on &lt;strong&gt;AWS Amplify&lt;/strong&gt; with continuous deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Cognito&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Manages secure authentication for users, ensuring only authorized access to backend resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS AppSync&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Provides the GraphQL API to handle communication between the frontend and backend services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Lambda&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Serverless function that takes user input and forwards it to &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; for AI-powered recipe generation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Bedrock (Claude 3 Sonnet)&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Utilizes generative AI to create unique recipes based on input ingredients.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Step-by-Step Implementation&lt;/strong&gt;
&lt;/h3&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Task 1: Host a Static Website&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this task, you will create a React application and deploy it to the Cloud using &lt;strong&gt;AWS Amplify&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 1: Create a New React Application&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In a new terminal or command line window, run the following command to use Vite to create a React application:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm create vite@latest ai-recipe-generator &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react-ts &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Navigate to the project directory:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cd &lt;/span&gt;ai-recipe-generator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install the necessary dependencies:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the development server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will start your React application locally. You should see the Vite + React app running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fo3cg5232jkrcbdjh4i1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fo3cg5232jkrcbdjh4i1i.png" alt="React App" width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the terminal window, open the local link to view the application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7qj1cejzg9rr5kif8y4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7qj1cejzg9rr5kif8y4m.png" alt="Local Link" width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 2: Initialize a GitHub Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this step, you will create a GitHub repository and commit your code to it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to GitHub at &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new repository:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Repository name&lt;/strong&gt;, enter &lt;code&gt;ai-recipe-generator&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;Public&lt;/strong&gt; radio button.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create a new repository&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open a new terminal window, navigate to your project’s root folder (&lt;code&gt;ai-recipe-generator&lt;/code&gt;), and run the following commands to initialize Git and push the application to your GitHub repository:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git init
   git add &lt;span class="nb"&gt;.&lt;/span&gt;
   git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"first commit"&lt;/span&gt;
   git remote add origin git@github.com:&amp;lt;your-username&amp;gt;/ai-recipe-generator.git
   git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
   git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the &lt;code&gt;git@github.com:&amp;lt;your-username&amp;gt;/ai-recipe-generator.git&lt;/code&gt; with your own GitHub SSH URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbzy6481oamgjn8vavj0z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbzy6481oamgjn8vavj0z.png" alt="GitHub Commit" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 3: Install the Amplify Packages&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your app's root folder (&lt;code&gt;ai-recipe-generator&lt;/code&gt;), and run the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm create amplify@latest &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will scaffold a lightweight Amplify project in your app’s directory.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After installation, push the changes to GitHub:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git add &lt;span class="nb"&gt;.&lt;/span&gt;
   git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'installing amplify'&lt;/span&gt;
   git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fja94euu0euwt1khbnmsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fja94euu0euwt1khbnmsh.png" alt="Amplify Install" width="800" height="619"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 4: Deploy Your App with AWS Amplify&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to the &lt;strong&gt;AWS Management Console&lt;/strong&gt; and open the &lt;strong&gt;AWS Amplify&lt;/strong&gt; console at &lt;a href="https://console.aws.amazon.com/amplify/apps" rel="noopener noreferrer"&gt;AWS Amplify&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Create new app&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the &lt;strong&gt;Start building with Amplify&lt;/strong&gt; page, select &lt;strong&gt;GitHub&lt;/strong&gt; for &lt;strong&gt;Deploy your app&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authenticate with GitHub. You will be automatically redirected back to the Amplify console. Choose the repository and main branch you created earlier, then select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leave the default build settings and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review your inputs and click &lt;strong&gt;Save and deploy&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AWS Amplify will now build your source code and deploy your app at &lt;code&gt;https://...amplifyapp.com&lt;/code&gt;. Your app will automatically update with every Git push. It may take up to 5 minutes to deploy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once the build is complete, click &lt;strong&gt;Visit deployed URL&lt;/strong&gt; to see your web app live.&lt;/li&gt;
&lt;/ol&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Task 2: Manage Users&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this task, you will configure &lt;strong&gt;Amplify Auth&lt;/strong&gt; for user authentication and enable &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; foundation model access.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 1: Set up Amplify Auth&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The app uses email as the default login mechanism. When users sign up, they will receive a verification email. Customize the verification email by updating the following code in the &lt;code&gt;ai-generated-recipes/amplify/auth/resource.ts&lt;/code&gt; file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineAuth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineAuth&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="na"&gt;loginWith&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;verificationEmailStyle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CODE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="na"&gt;verificationEmailSubject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome to the AI-Powered Recipe Generator!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="na"&gt;verificationEmailBody&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createCode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
           &lt;span class="s2"&gt;`Use this code to confirm your account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nf"&gt;createCode&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8nkluiubpy8qm052hxpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8nkluiubpy8qm052hxpv.png" alt="Custom Verification Email" width="592" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image on the right shows an example of the customized verification email.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 2: Set up Amazon Bedrock Model Access&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign in to the &lt;strong&gt;AWS Management Console&lt;/strong&gt; and open the &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; console at &lt;a href="https://console.aws.amazon.com/bedrock/" rel="noopener noreferrer"&gt;AWS Amazon Bedrock&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Verify that you are in the &lt;strong&gt;N. Virginia (us-east-1)&lt;/strong&gt; region, and select &lt;strong&gt;Get started&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Foundation models&lt;/strong&gt; section, choose the &lt;strong&gt;Claude model&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to the &lt;strong&gt;Claude models&lt;/strong&gt; section, select the &lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt; tab, and click &lt;strong&gt;Request model access&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;If you already have access to some models, the button will show &lt;strong&gt;Manage model access&lt;/strong&gt; instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Base models&lt;/strong&gt; section, for &lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt;, choose &lt;strong&gt;Available to request&lt;/strong&gt;, then select &lt;strong&gt;Request model access&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the &lt;strong&gt;Edit model access&lt;/strong&gt; page, click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the &lt;strong&gt;Review and Submit&lt;/strong&gt; page, click &lt;strong&gt;Submit&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Now your application should be up and running, with user authentication and AI-powered recipe generation using &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;'s &lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's the reformatted version of &lt;strong&gt;Task 3: Build a Serverless Backend&lt;/strong&gt; and &lt;strong&gt;Task 4: Deploy the Backend API&lt;/strong&gt;, with improved structure and readability for a Medium blog post:&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Task 3: Build a Serverless Backend&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this task, you will use &lt;strong&gt;AWS Amplify&lt;/strong&gt; and &lt;strong&gt;AWS Lambda&lt;/strong&gt; to build a serverless function.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Create a Lambda Function for Handling Requests&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;On your local machine, navigate to the &lt;code&gt;ai-recipe-generator/amplify/data&lt;/code&gt; folder, and create a new file named &lt;code&gt;bedrock.js&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the file with the following code:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The code defines a request function that constructs the HTTP request to invoke the &lt;strong&gt;Claude 3 Sonnet&lt;/strong&gt; foundation model in &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;. The response function parses the response and returns the generated recipe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ingredients&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

     &lt;span class="c1"&gt;// Construct the prompt with the provided ingredients&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Suggest a recipe idea using these ingredients: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

     &lt;span class="c1"&gt;// Return the request configuration&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;resourcePath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`/model/anthropic.claude-3-sonnet-20240229-v1:0/invoke`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="p"&gt;},&lt;/span&gt;
         &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
           &lt;span class="na"&gt;anthropic_version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bedrock-2023-05-31&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
             &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
               &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                 &lt;span class="p"&gt;{&lt;/span&gt;
                   &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                   &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`\n\nHuman: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;\n\nAssistant:`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="p"&gt;},&lt;/span&gt;
               &lt;span class="p"&gt;],&lt;/span&gt;
             &lt;span class="p"&gt;},&lt;/span&gt;
           &lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="p"&gt;}),&lt;/span&gt;
       &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="p"&gt;};&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="c1"&gt;// Parse the response body&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parsedBody&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

     &lt;span class="c1"&gt;// Extract the text content from the response&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parsedBody&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="p"&gt;};&lt;/span&gt;

     &lt;span class="c1"&gt;// Return the response&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;request&lt;/code&gt; function constructs the AI prompt and sends it to Amazon Bedrock. The &lt;code&gt;response&lt;/code&gt; function parses the generated recipe from the returned JSON.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Add Amazon Bedrock as a Data Source&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;amplify/backend.ts&lt;/code&gt; file and add the following code. Save the file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The code adds an HTTP data source for &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; to your API and grants it the necessary permissions to invoke the Claude model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineBackend&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./data/resource&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PolicyStatement&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-cdk-lib/aws-iam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./auth/resource&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineBackend&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bedrockDataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;graphqlApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addHttpDataSource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bedrockDS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://bedrock-runtime.us-east-1.amazonaws.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;authorizationConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;signingRegion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;us-east-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="na"&gt;signingServiceName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bedrock&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;);&lt;/span&gt;

   &lt;span class="nx"&gt;bedrockDataSource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;grantPrincipal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addToPrincipalPolicy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PolicyStatement&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
       &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
         &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;],&lt;/span&gt;
       &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bedrock:InvokeModel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
     &lt;span class="p"&gt;})&lt;/span&gt;
   &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code integrates Amazon Bedrock into your backend, enabling the serverless app to invoke the Claude 3 Sonnet model.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Task 4: Deploy the Backend API&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Set Up Amplify Data&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;code&gt;amplify/backend.ts&lt;/code&gt; file, define the schema and backend resources as follows:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ClientSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="na"&gt;BedrockResponse&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;customType&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
       &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
       &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
     &lt;span class="p"&gt;}),&lt;/span&gt;

     &lt;span class="na"&gt;askBedrock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;BedrockResponse&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authenticated&lt;/span&gt;&lt;span class="p"&gt;()])&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
         &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./bedrock.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dataSource&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bedrockDS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
       &lt;span class="p"&gt;),&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ClientSchema&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;authorizationModes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;defaultAuthorizationMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apiKey&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="na"&gt;apiKeyAuthorizationMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;expiresInDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this step, you define a &lt;strong&gt;GraphQL&lt;/strong&gt; schema and link the &lt;code&gt;askBedrock&lt;/code&gt; query to the custom Lambda function you created earlier (&lt;code&gt;bedrock.js&lt;/code&gt;). The schema allows authenticated users to invoke the function and retrieve a recipe suggestion.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Frs3tc08p2l8eoz8bdqmv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Frs3tc08p2l8eoz8bdqmv.png" alt="Amplify Schema" width="770" height="572"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Deploy Cloud Resources&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your app's project folder (&lt;code&gt;ai-recipe-generator&lt;/code&gt;), and run the following command to deploy cloud resources into an isolated development space:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npx ampx sandbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command sets up a sandbox environment where you can quickly iterate on your changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fc4qv9mmq04j2rubgtdsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fc4qv9mmq04j2rubgtdsh.png" alt="Sandbox Deployment" width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After the sandbox has been fully deployed, you will see a confirmation message in the terminal, and an &lt;code&gt;amplify_outputs.json&lt;/code&gt; file will be generated and added to your project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnngqeowg8yujnrghraqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnngqeowg8yujnrghraqx.png" alt="Deployment Confirmation" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The deployment process is now complete, and you can begin interacting with your serverless backend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdxs5y4th00wcuusq0jt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdxs5y4th00wcuusq0jt1.png" alt="Deployment Output" width="586" height="586"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;The serverless backend is now set up and ready to handle recipe generation requests using &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;. You've created a Lambda function to handle interactions with the Claude 3 Sonnet model, integrated it with AWS Amplify, and deployed it to the cloud.&lt;/p&gt;

&lt;p&gt;Here's how you can present &lt;strong&gt;Task 5: Build the Frontend&lt;/strong&gt; and the challenges faced in the process for your blog:&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Task 5: Build the Frontend&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now that the serverless backend is set up, it's time to create the frontend. This step will guide you through building the user interface (UI) using &lt;strong&gt;AWS Amplify&lt;/strong&gt; libraries, styled components, and React. We’ll also implement authentication to ensure that only authorized users can access the app.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Install the Amplify Libraries&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To get started with integrating AWS Amplify into your frontend, you'll need to install the core Amplify libraries. The &lt;code&gt;aws-amplify&lt;/code&gt; library provides all the necessary APIs to interact with your backend, while &lt;code&gt;@aws-amplify/ui-react&lt;/code&gt; contains pre-built UI components that help you scaffold the authentication flow and other UI elements.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your project’s root folder (&lt;code&gt;ai-recipe-generator&lt;/code&gt;), and run the following command to install the libraries:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install &lt;/span&gt;aws-amplify @aws-amplify/ui-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fd176go3ct67bdigeb6o3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd176go3ct67bdigeb6o3.png" alt="Install Amplify" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Style the App UI&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Next, we’ll style the frontend to create a clean, modern interface. We'll focus on centering the layout and styling the form where users will input their ingredients.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;ai-recipe-generator/src/index.css&lt;/code&gt;, and update it with the following code to set global styles and center the UI:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;   &lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Inter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Avenir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Helvetica&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.87&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
     &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1280px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This CSS will help ensure that the app's layout is centered, the font is legible, and the UI components have a clean, consistent style.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fieqh5uzxrmiva5x1x9dc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fieqh5uzxrmiva5x1x9dc.png" alt="CSS" width="692" height="986"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, open &lt;code&gt;ai-recipe-generator/src/App.css&lt;/code&gt; and update it with the following code to style the ingredient input form:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;   &lt;span class="nc"&gt;.app-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.header-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.main-header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.25rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#1a202c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.main-header&lt;/span&gt; &lt;span class="nc"&gt;.highlight&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2563eb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.description&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.125rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;65ch&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#1a202c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.form-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.search-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.wide-input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ccc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.search-button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#007bff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.search-button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0056b3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.result-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.loader-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nc"&gt;.result&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f8f9fa&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#e9ecef&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pre-wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;word-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will ensure that the ingredients form and result display are properly styled.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fpjcna5yvnsucsp74in5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fpjcna5yvnsucsp74in5b.png" alt="Form Styles" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Implement the UI&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Now, let’s build the main React component for the app. We’ll integrate the &lt;strong&gt;AWS Amplify Authentication&lt;/strong&gt; components for user sign-up, sign-in, and password recovery.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;ai-recipe-generator/src/main.tsx&lt;/code&gt; and update it with the following code. This will use the Amplify &lt;code&gt;Authenticator&lt;/code&gt; component to wrap your app and provide a complete authentication flow:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom/client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./App.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./index.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Authenticator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StrictMode&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Authenticator&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
       &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Authenticator&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StrictMode&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Authenticator&lt;/code&gt; component will handle user authentication, including sign-up, sign-in, and MFA (Multi-Factor Authentication).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdlc5kkyu52xhakwlcx0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdlc5kkyu52xhakwlcx0s.png" alt="Authenticator" width="800" height="744"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, open &lt;code&gt;ai-recipe-generator/src/App.tsx&lt;/code&gt; and update it with the following code to implement the form for ingredient submission and the logic for querying the &lt;strong&gt;askBedrock&lt;/strong&gt; function.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Loader&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Placeholder&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Amplify&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Schema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../amplify/data/resource&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;generateClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify/data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;outputs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../amplify_outputs.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react/styles.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="nx"&gt;Amplify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;amplifyClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;generateClient&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="na"&gt;authMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;userPool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;

   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setResult&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;onSubmit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
       &lt;span class="nf"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

       &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;FormData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

         &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;amplifyClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;queries&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;askBedrock&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
           &lt;span class="na"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ingredients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)?.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="p"&gt;});&lt;/span&gt;

         &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="nf"&gt;setResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;No data returned&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`An error occurred: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="nf"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="p"&gt;};&lt;/span&gt;

     &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"app-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"header-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"main-header"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
             Meet Your Personal
             &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;br&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
             &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"highlight"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Recipe AI&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
             Simply type a few ingredients using the format ingredient1,
             ingredient2, etc., and Recipe AI will generate an all-new recipe on
             demand...
           &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onSubmit&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"form-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"search-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
             &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
               &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;
               &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"wide-input"&lt;/span&gt;
               &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"ingredients"&lt;/span&gt;
               &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"ingredients"&lt;/span&gt;
               &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Ingredient1, Ingredient2, Ingredient3,...etc"&lt;/span&gt;
             &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
             &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"search-button"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
               Generate
             &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"result-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
             &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"loader-container"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
               &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loading...&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
               &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Loader&lt;/span&gt; &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"large"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
               &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Placeholder&lt;/span&gt; &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"large"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
               &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Placeholder&lt;/span&gt; &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"large"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
               &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Placeholder&lt;/span&gt; &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"large"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
             &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
             &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"result"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The app allows users to input a list of ingredients, submits the request to the backend via &lt;strong&gt;Amplify&lt;/strong&gt; and &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;, and then displays the generated recipe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Foat3sk46j8c2f6svey5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Foat3sk46j8c2f6svey5q.png" alt="Recipe Generation UI" width="800" height="744"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4: Run and Test the App&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window and navigate to your project’s root directory (&lt;code&gt;ai-recipe-generator&lt;/code&gt;), then run:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Visit the local host URL to open the app in your browser and test it.&lt;/li&gt;
&lt;/ol&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5: Deploy the App&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Once you’ve confirmed that the app is working as expected locally, it’s time to deploy it to AWS Amplify.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the terminal, commit your changes:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git add &lt;span class="nb"&gt;.&lt;/span&gt;
   git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'connect to bedrock'&lt;/span&gt;
   git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Go to the &lt;strong&gt;AWS Amplify&lt;/strong&gt; console, and your app should automatically build and deploy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After deployment, you can access your live app at the provided Amplify URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fy3hki55r9i6tdwdid556.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fy3hki55r9i6tdwdid556.png" alt="Deployed App" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Challenges Faced and Solutions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integrating Bedrock API with Lambda&lt;/strong&gt;: The response latency from Amazon Bedrock sometimes caused delays.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Error handling and retry logic were implemented to handle API delays and ensure smoother user experiences.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Frontend and Amplify Configuration&lt;/strong&gt;: Understanding the integration of Amplify DataStore with AppSync for real-time data updates was tricky.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Amplify’s documentation and UI components helped speed up the integration process and simplified backend connectivity.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;By combining &lt;strong&gt;AWS Amplify&lt;/strong&gt; for the frontend, &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; for AI-powered recipe generation, and &lt;strong&gt;AWS Cognito&lt;/strong&gt; for secure authentication, we've built a robust, serverless application that generates personalized recipes based on user input. This project demonstrates the potential of AWS services to create scalable, AI-driven applications for various domains like e-commerce, content creation, and beyond.&lt;/p&gt;

&lt;p&gt;Explore my &lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20400/3.%20Build%20a%20Serverless%20Web%20Application%20using%20Generative%20AI" rel="noopener noreferrer"&gt;GitHub repository.&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;




</description>
    </item>
    <item>
      <title>AWS Project: Build a Basic Web Application</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 08 Oct 2024 12:05:19 +0000</pubDate>
      <link>https://forem.com/asif_khan/aws-project-build-a-basic-web-application-2eih</link>
      <guid>https://forem.com/asif_khan/aws-project-build-a-basic-web-application-2eih</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This project involves building a full-stack web application using AWS Amplify. It features a simple React frontend with user authentication, a serverless function to handle user sign-ups, and a DynamoDB database for storing user emails. The application leverages AWS’s robust and scalable cloud services to deliver a seamless user experience, allowing users to sign up, log in, and store information securely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use AWS Amplify for This Project?
&lt;/h2&gt;

&lt;p&gt;AWS Amplify simplifies the process of deploying full-stack web applications by providing ready-to-use backend services, including hosting, authentication, API management, and data storage. By using Amplify, you can focus on building the application’s functionality rather than managing infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Will Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Host:&lt;/strong&gt; Build and deploy a React application on the AWS global content delivery network (CDN).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate:&lt;/strong&gt; Add authentication to your app to enable sign-in and sign-out functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; Integrate a real-time API, database, and a serverless function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function:&lt;/strong&gt; Implement a lambda function that is triggered when a user signs up to the App.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;This project uses the following services and technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Amplify&lt;/strong&gt;: Provides end-to-end services for hosting and managing the web application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS AppSync&lt;/strong&gt;: Facilitates real-time API creation and management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda&lt;/strong&gt;: Runs serverless functions for handling user data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DynamoDB&lt;/strong&gt;: A NoSQL database for storing user emails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React&lt;/strong&gt;: The frontend framework used to build the web application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js &amp;amp; npm&lt;/strong&gt;: For managing dependencies and running the React app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git &amp;amp; GitHub&lt;/strong&gt;: Version control and repository hosting.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Before starting the project, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Basic AWS Knowledge&lt;/strong&gt;: Familiarity with services such as Amplify, Lambda, and DynamoDB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI configured&lt;/strong&gt;: With appropriate IAM permissions for managing AWS Amplify, Lambda, and DynamoDB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js and npm&lt;/strong&gt;: Installed locally for running and managing the React application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt;: For version control and integration with AWS Amplify.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Problem Statement or Use Case
&lt;/h2&gt;

&lt;p&gt;Web applications today require features like user authentication, data storage, and API integration. Setting up and managing these services can be challenging, especially for scalability and real-time capabilities. Using AWS Amplify simplifies this by offering a fully managed backend that integrates seamlessly with the frontend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: This project provides a user sign-up and sign-in system with a backend that captures and stores user data. This setup is applicable to various real-world scenarios, from building social media platforms to e-commerce websites, where user management and data storage are essential.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://media2.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%2F4mayct551eo575aydeai.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4mayct551eo575aydeai.gif" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tasks
&lt;/h3&gt;

&lt;p&gt;This tutorial is divided into six tasks. You must complete each task in order before moving on to the next one:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create Web App&lt;/strong&gt;: Deploy static resources for your web application using the AWS Amplify Console.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build Serverless Function&lt;/strong&gt;: Build a serverless function using AWS Lambda.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create Data Table&lt;/strong&gt;: Persist data in an Amazon DynamoDB table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Serverless Function to Web App&lt;/strong&gt;: Deploy your serverless function with API Gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Interactivity to Web App&lt;/strong&gt;: Modify your web app to invoke your API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean Up Resources&lt;/strong&gt;: Clean up resources used in this tutorial.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will be building this web application using the AWS Management Console accessible directly from your browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 1: Create a Web App
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;AWS Amplify offers a Git-based CI/CD workflow for building, deploying, and hosting single-page web applications or static sites with backends. When connected to a Git repository, Amplify determines the build settings for both the frontend framework and any configured backend resources and automatically deploys updates with every code commit.&lt;/p&gt;

&lt;p&gt;In this task, you will start by creating a new React application and pushing it to a GitHub repository. You will then connect the repository to AWS Amplify web hosting and deploy it to a globally available content delivery network (CDN) hosted on an &lt;code&gt;amplifyapp.com&lt;/code&gt; domain.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Concepts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React Application&lt;/strong&gt;: React is a JavaScript library that enables developers to quickly build performant single-page applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt;: Git is a version control system that allows developers to store files, maintain and update relationships between files and directories, and track versions and changes to the files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create a new React application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a new terminal or command line window, run the following command to use Vite to create a React application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create vite@latest profilesapp &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;span class="nb"&gt;cd &lt;/span&gt;profilesapp
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Ft0sajmzc7a61mljsqrir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft0sajmzc7a61mljsqrir.png" alt="Image description" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the terminal window, select and open the Local link to view the Vite + React application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6y525csrkuh72haa1jx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6y525csrkuh72haa1jx6.png" alt="Image description" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Initialize a GitHub repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this step, you will create a GitHub repository and commit your code to the repository. You will need a GitHub account to complete this step; if you do not have an account, sign up &lt;a href="https://github.com" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fotjklt5uv01211kf834p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fotjklt5uv01211kf834p.png" alt="Image description" width="412" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you have never used GitHub on your computer, follow these steps before continuing to allow connection to your account.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to GitHub at &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;https://github.com/&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the "Start a new repository" section, make the following selections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Repository name&lt;/strong&gt;, enter &lt;code&gt;profilesapp&lt;/code&gt;, and choose the &lt;strong&gt;Public&lt;/strong&gt; radio button.&lt;/li&gt;
&lt;li&gt;Then select &lt;strong&gt;Create a new repository&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fi6nzs3lk1zjenwzvgwxm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fi6nzs3lk1zjenwzvgwxm.png" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your project's root folder (&lt;code&gt;profilesapp&lt;/code&gt;), and run the following commands to initialize Git and push the application to the new GitHub repository:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"first commit"&lt;/span&gt;
git remote add origin git@github.com:&amp;lt;your-username&amp;gt;/profilesapp.git
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fmd9f3uyqd2cf25bccrr7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmd9f3uyqd2cf25bccrr7.png" alt="Image description" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Install the Amplify packages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open a new terminal window, navigate to your app's root folder (&lt;code&gt;profilesapp&lt;/code&gt;), and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create amplify@latest &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fffi0jc5ti2bja5msmndz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fffi0jc5ti2bja5msmndz.png" alt="Image description" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Running the previous command will scaffold a lightweight Amplify project in the app’s directory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdblt2ars8yvzz0agkr90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdblt2ars8yvzz0agkr90.png" alt="Image description" width="640" height="804"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your terminal window, run the following command to push the changes to GitHub:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'installing amplify'&lt;/span&gt;
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fx4to2iy2yxwyv9oc3o0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fx4to2iy2yxwyv9oc3o0s.png" alt="Image description" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Deploy your app with AWS Amplify&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to the AWS Management console in a new browser window and open the AWS Amplify console at &lt;a href="https://console.aws.amazon.com/amplify/apps" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/amplify/apps&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Create new app&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fo4unzvbc5c7nm9efbiqa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fo4unzvbc5c7nm9efbiqa.png" alt="Image description" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On the &lt;strong&gt;Start building with Amplify&lt;/strong&gt; page, for &lt;strong&gt;Deploy your app&lt;/strong&gt;, select &lt;strong&gt;GitHub&lt;/strong&gt;, and select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fc2bzvwlalcv5x6rxyb4u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fc2bzvwlalcv5x6rxyb4u.png" alt="Image description" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When prompted, authenticate with GitHub. You will be automatically redirected back to the Amplify console. Choose the repository and main branch you created earlier. Then select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fg5st31c3chq1znygkb6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fg5st31c3chq1znygkb6m.png" alt="Image description" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Leave the default build settings, and select &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5jp9b8uoe8v9y5v2z0zy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5jp9b8uoe8v9y5v2z0zy.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review the inputs selected, and choose &lt;strong&gt;Save and deploy&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AWS Amplify will now build your source code and deploy your app at &lt;code&gt;https://...amplifyapp.com&lt;/code&gt;, and on every git push, your deployment instance will update. It may take up to 5 minutes to deploy your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fsy7szb8d5w747v2g2l9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fsy7szb8d5w747v2g2l9p.png" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once the build completes, select the &lt;strong&gt;Visit deployed URL&lt;/strong&gt; button to see your web app up and running live.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fivoa8ehpozztkeypn5vm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fivoa8ehpozztkeypn5vm.png" alt="Image description" width="800" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;You have deployed a React application in the AWS Cloud by integrating with GitHub and using AWS Amplify. With AWS Amplify, you can continuously deploy your application in the Cloud and host it on a globally available CDN.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 2: Build a Serverless Function
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;Now that you have a React web app, you will use AWS Amplify and AWS Lambda to configure a serverless function. This function is invoked after a signed-up user confirms their user account. AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources, making it the fastest way to turn an idea into modern, production, serverless applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Concepts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Serverless function&lt;/strong&gt;: A piece of code that will be executed by a compute service, on demand.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Setup an Amplify Function&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your local machine, navigate to the &lt;code&gt;profilesapp/amplify/auth&lt;/code&gt; folder and create a new folder inside the &lt;code&gt;amplify/auth&lt;/code&gt; folder, naming it &lt;code&gt;post-confirmation&lt;/code&gt;, and then create the files named &lt;code&gt;resource.ts&lt;/code&gt; and &lt;code&gt;handler.ts&lt;/code&gt; inside the folder.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbogzj65o7wf99o9ukzrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbogzj65o7wf99o9ukzrj.png" alt="Image description" width="498" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update the &lt;code&gt;amplify/auth/post-confirmation/resource.ts&lt;/code&gt; file with the following code to define the &lt;code&gt;postConfirmation&lt;/code&gt; function:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineFunction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postConfirmation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineFunction&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;post-confirmation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Ffntkdnkcfsm2cfd5ne06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffntkdnkcfsm2cfd5ne06.png" alt="Image description" width="634" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update the &lt;code&gt;amplify/auth/post-confirmation/handler.ts&lt;/code&gt; file with the following code to define the function’s handler:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PostConfirmationTriggerHandler&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-lambda&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PostConfirmationTriggerHandler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fd5ksi1juwym25ibt3z55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd5ksi1juwym25ibt3z55.png" alt="Image description" width="570" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;You have defined a Lambda function using Amplify.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 3: Create a Data Table
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;In this task, you will create a data model to persist data using a GraphQL API and Amazon DynamoDB. Additionally, you will use AWS Identity and Access Management (IAM) authorization to securely give our services the required permissions to interact with each other. You will also allow the Lambda function you created in the previous task to use the GraphQL API to write to your newly created DynamoDB table using an IAM policy.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Concepts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amplify backend&lt;/strong&gt;: Amplify Gen 2 uses a full-stack TypeScript developer experience (DX) for defining backends. Simply author app requirements like data models, business logic, and auth rules in TypeScript. Amplify automatically configures the correct cloud resources and deploys them to per-developer cloud sandbox environments for fast, local iteration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Setup Amplify Data&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your local machine, navigate to the &lt;code&gt;amplify/data/resource.ts&lt;/code&gt; file and update it with the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ClientSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defineData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;postConfirmation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../auth/post-confirmation/resource&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;UserProfile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="na"&gt;profileOwner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ownerDefinedIn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;profileOwner&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="p"&gt;]),&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;postConfirmation&lt;/span&gt;&lt;span class="p"&gt;)]);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ClientSchema&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;authorizationModes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;defaultAuthorizationMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apiKey&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;apiKeyAuthorizationMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;expiresInDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2F5scoyaeu1p227is9bcz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5scoyaeu1p227is9bcz0.png" alt="Image description" width="640" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your app's root folder (&lt;code&gt;profilesapp&lt;/code&gt;), and run the following command to deploy cloud resources into an isolated development space:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ampx sandbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fiphddrjfktza2sb6y7or.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fiphddrjfktza2sb6y7or.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once the cloud sandbox has been fully deployed, your terminal will display a confirmation message, and the &lt;code&gt;amplify_outputs.json&lt;/code&gt; file will be generated and added to your project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fxt0rpvaw5xi223okiwpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxt0rpvaw5xi223okiwpl.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fzbvyemi9fd4pmsf8a459.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fzbvyemi9fd4pmsf8a459.png" alt="Image description" width="640" height="1048"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your app's root folder (&lt;code&gt;profilesapp&lt;/code&gt;), and run the following command to generate the GraphQL client code to call your data backend:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ampx generate graphql-client-code &lt;span class="nt"&gt;--out&lt;/span&gt; &amp;lt;path-to-post-confirmation-handler-dir&amp;gt;/graphql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amplify will create the folder &lt;code&gt;amplify/auth/post-confirmation/graphql&lt;/code&gt;, where you will find the client code to connect to the GraphQL API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbuff7yvjrcz18eg6j9zn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbuff7yvjrcz18eg6j9zn.png" alt="Image description" width="620" height="838"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Modify Lambda Function to Connect to the API&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your local machine, navigate to the &lt;code&gt;amplify/auth/post-confirmation/handler.ts&lt;/code&gt; file and replace the code with the following:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PostConfirmationTriggerHandler&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-lambda&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Schema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../data/resource&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Amplify&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;generateClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify/data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;$amplify/env/post-confirmation&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createUserProfile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./graphql/mutations&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Amplify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;API&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;GraphQL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AMPLIFY_DATA_GRAPHQL_ENDPOINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;region&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AWS_REGION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;defaultAuthMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;iam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;Auth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;credentialsProvider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;getCredentialsAndIdentityId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
          &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;accessKeyId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AWS_ACCESS_KEY_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;secretAccessKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AWS_SECRET_ACCESS_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;sessionToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AWS_SESSION_TOKEN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;}),&lt;/span&gt;
        &lt;span class="na"&gt;clearCredentialsAndIdentityId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="cm"&gt;/* noop */&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;generateClient&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;authMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;iam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PostConfirmationTriggerHandler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;graphql&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;createUserProfile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userAttributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;profileOwner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userAttributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sub&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;::&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fwqvkgzsmmrte36lphzy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwqvkgzsmmrte36lphzy4.png" alt="Image description" width="584" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;You have created a data table and configured a GraphQL API to persist data in an Amazon DynamoDB database. Then, you updated the Lambda function to use the API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 4: Link a Serverless Function to a Web App
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;In this task, you will update the Amplify Auth resources to use the Lambda function created in the previous module as an Amazon Cognito post-confirmation invocation. When the user completes the sign-up, the function will use the GraphQL API and capture the user’s email into the DynamoDB table.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Concepts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lambda invocation&lt;/strong&gt;: The type of event that will make a Lambda (serverless) function run. This can be another AWS service or an external input.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Setup Amplify Auth&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your local machine, navigate to the &lt;code&gt;amplify/auth/resource.ts&lt;/code&gt; file and update it with the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineAuth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@aws-amplify/backend&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;postConfirmation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./post-confirmation/resource&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineAuth&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;loginWith&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;postConfirmation&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fwvhc4cmh7yk2rygooc2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwvhc4cmh7yk2rygooc2l.png" alt="Image description" width="572" height="618"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The sandbox will automatically get updated and redeployed once the file is updated. If the sandbox is not running, you can run the following command in a new terminal window:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ampx sandbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Once the cloud sandbox has been fully deployed, your terminal will display a confirmation message, and the &lt;code&gt;amplify_outputs.json&lt;/code&gt; file will be generated/updated and added to your &lt;code&gt;profilesapp&lt;/code&gt; project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F9dwakgb67ot13p7ljfa8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9dwakgb67ot13p7ljfa8.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Flk9y6p9dqssbatfahfqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Flk9y6p9dqssbatfahfqc.png" alt="Image description" width="640" height="1048"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;You used Amplify to configure authentication and set up the Lambda function to be invoked when the user signs in to the app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 5: Add Interactivity to Your Web App
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;In this task, you will create a frontend for your app and connect it to the cloud backend you have already built. You will update the website to use the Amplify UI component library to scaffold out an entire user authentication flow, allowing users to sign up, sign in, reset their password, and invoke the GraphQL API.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Concepts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amplify libraries&lt;/strong&gt;: The Amplify libraries allow you to interact with AWS services from a web or mobile application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install the Amplify libraries&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a new terminal window, in your project's root folder (&lt;code&gt;profilesapp&lt;/code&gt;), run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;aws-amplify @aws-amplify/ui-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2F1b5f5ilu9vlb1xiabv7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F1b5f5ilu9vlb1xiabv7c.png" alt="Image description" width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Style the app UI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On your local machine, navigate to the &lt;code&gt;profilesapp/src/index.css&lt;/code&gt; file and update it with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Inter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Avenir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Helvetica&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.87&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;font-synthesis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-rendering&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;optimizeLegibility&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-font-smoothing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;antialiased&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-moz-osx-font-smoothing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grayscale&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1280px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.read-the-docs&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#888&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.box&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;3&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2F9kow792o60t4igvm2m5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9kow792o60t4igvm2m5e.png" alt="Image description" width="588" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Implement the UI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On your local machine, navigate to the &lt;code&gt;profilesapp/src/main.jsx&lt;/code&gt; file and update it with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom/client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./App.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./index.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Authenticator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StrictMode&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Authenticator&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Authenticator&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/React.StrictMode&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fai18bnuhs676tdpzgqd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fai18bnuhs676tdpzgqd4.png" alt="Image description" width="598" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;profilesapp/src/App.jsx&lt;/code&gt; file and update it with the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;Heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;Flex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;View&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;Grid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;Divider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useAuthenticator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify

/ui-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Amplify&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@aws-amplify/ui-react/styles.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;generateClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-amplify/data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;outputs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../amplify_outputs.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Amplify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generateClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;authMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;userPool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;userprofiles&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUserProfiles&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signOut&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useAuthenticator&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fetchUserProfile&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUserProfile&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;profiles&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;UserProfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nf"&gt;setUserProfiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Flex&lt;/span&gt;
      &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;justifyContent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;alignItems&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;column&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;70%&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;margin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0 auto&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Heading&lt;/span&gt; &lt;span class="nx"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;My&lt;/span&gt; &lt;span class="nx"&gt;Profile&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Heading&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Divider&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Grid&lt;/span&gt;
        &lt;span class="nx"&gt;margin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;3rem 0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;autoFlow&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;column&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;justifyContent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;gap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;alignContent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;userprofiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;userprofile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Flex&lt;/span&gt;
            &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;userprofile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;userprofile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;column&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;justifyContent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;alignItems&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;gap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;border&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1px solid #ccc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;padding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;borderRadius&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5%&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;box&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;View&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Heading&lt;/span&gt; &lt;span class="nx"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;userprofile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Heading&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/View&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Flex&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;))}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Grid&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;Out&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Flex&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fjkoqohy8ztbz27g7n8vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjkoqohy8ztbz27g7n8vw.png" alt="Image description" width="586" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Run the Application&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new terminal window, navigate to your project's root directory (&lt;code&gt;profilesapp&lt;/code&gt;), and run the following command to launch the app:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Select the Local host link to open the Vite + React application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmvff8jvy5nrij2za9oi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmvff8jvy5nrij2za9oi6.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Choose the &lt;strong&gt;Create Account&lt;/strong&gt; tab and use the authentication flow to create a new user by entering your email address and a password. Then, choose &lt;strong&gt;Create Account&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will receive a verification code sent to your email. Enter the verification code to log in to the app. When signed in, the app will display your email address.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Finraqyvmrtxy2kxmjvtj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Finraqyvmrtxy2kxmjvtj.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the open terminal window, run the following command to push the changes to GitHub:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s1"&gt;'displaying user profile'&lt;/span&gt;
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fzh8dhlofgb6iw2osax8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fzh8dhlofgb6iw2osax8h.png" alt="Image description" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to the AWS Management console in a new browser window, and open the AWS Amplify console at &lt;a href="https://console.aws.amazon.com/amplify/apps" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/amplify/apps&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS Amplify automatically builds your source code and deploys your app at &lt;code&gt;https://...amplifyapp.com&lt;/code&gt;. Select the &lt;strong&gt;Visit deployed URL&lt;/strong&gt; button to see your web app up and running live.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh7okpx5dhndnrchgravv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh7okpx5dhndnrchgravv.png" alt="Image description" width="800" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;You have successfully added interactivity to your web app, allowing users to sign up, log in, and view their profiles using AWS Amplify’s powerful UI components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task 6: Clean Up Resources
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;To finish this tutorial, you will clean up the resources created throughout. It is a best practice to delete resources you are no longer using to avoid unwanted charges.&lt;/p&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;In the Amplify console, in the left-hand navigation for the &lt;code&gt;profilesapp&lt;/code&gt;, choose &lt;strong&gt;App settings&lt;/strong&gt; and select &lt;strong&gt;General settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the General settings section, choose &lt;strong&gt;Delete app&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6ej3dr5h0pe1fqypus1r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6ej3dr5h0pe1fqypus1r.png" alt="Image description" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You have successfully created a React web app and used AWS Amplify to configure authentication and data resources. Additionally, you created a function to update the data model with user details upon sign-up. Then, you built a frontend to display the captured data. Finally, you used AWS Amplify to host the app!&lt;/p&gt;

&lt;p&gt;Feel free to explore further and expand on this project as needed. The sky's the limit with AWS Amplify!&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges Faced and Solutions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 1&lt;/strong&gt;: Configuring User Authentication&lt;br&gt;
AWS Amplify simplifies authentication setup, but customization may require configuration adjustments in the Amplify Console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 2&lt;/strong&gt;: Data Consistency&lt;br&gt;
DynamoDB may not immediately reflect changes, especially with concurrent requests. Using AppSync’s real-time updates ensures data synchronization across all instances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 3&lt;/strong&gt;: Lambda Function Limits&lt;br&gt;
AWS imposes limits on Lambda’s execution time and memory. Optimize the function code and adjust settings in the Amplify Console if needed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this project, I learned how to build and deploy a simple web application with user authentication and data storage on AWS using Amplify. The setup demonstrates a full-stack serverless application, ideal for rapid development and easy scaling. AWS Amplify offers an efficient way to manage web applications and their backend services, perfect for various use cases, from prototyping to production.&lt;/p&gt;

&lt;p&gt;Explore my &lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main" rel="noopener noreferrer"&gt;GitHub repository.&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>awsproject</category>
    </item>
    <item>
      <title>AWS Project: Creating a Cluster of Virtual Machines Using Docker Swarm</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Thu, 03 Oct 2024 15:08:09 +0000</pubDate>
      <link>https://forem.com/asif_khan/aws-project-creating-a-cluster-of-virtual-machines-using-docker-swarm-4h3c</link>
      <guid>https://forem.com/asif_khan/aws-project-creating-a-cluster-of-virtual-machines-using-docker-swarm-4h3c</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As modern applications demand high scalability and reliability, container orchestration tools like &lt;strong&gt;Docker Swarm&lt;/strong&gt; simplify managing clusters of machines and services. This project focuses on building a &lt;strong&gt;Docker Swarm&lt;/strong&gt; cluster using &lt;strong&gt;Amazon EC2&lt;/strong&gt; instances. By the end of this tutorial, you'll understand how to set up a &lt;strong&gt;manager node&lt;/strong&gt; and &lt;strong&gt;worker nodes&lt;/strong&gt; in a Docker Swarm, deploy an Nginx service to test the cluster, and scale services across multiple nodes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Docker Swarm on AWS?
&lt;/h3&gt;

&lt;p&gt;Docker Swarm enables seamless container orchestration, allowing easy deployment of services across clusters of virtual machines. Using &lt;strong&gt;AWS EC2&lt;/strong&gt; as the infrastructure provider allows for the elastic scaling of resources as demand grows. This project showcases how to combine these two powerful technologies to create a production-grade container orchestration setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  What You Will Learn
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How to configure EC2 instances to form a Docker Swarm cluster.&lt;/li&gt;
&lt;li&gt;How to deploy services (e.g., Nginx) across multiple EC2 instances using Docker Swarm.&lt;/li&gt;
&lt;li&gt;How to scale the services and manage the cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Tech Stack&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this project, the following technologies and services were used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EC2&lt;/strong&gt;: Virtual machines on AWS for running the Docker Swarm cluster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Swarm&lt;/strong&gt;: Native Docker tool for managing clusters and orchestrating containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nginx&lt;/strong&gt;: A web server used as the test service to verify the Docker Swarm setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before starting this project, ensure you have the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic AWS Knowledge&lt;/strong&gt;: Understanding how to launch and manage EC2 instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Basic Knowledge of Docker&lt;/strong&gt;: Understanding how to use Docker and its basic operations.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Problem Statement or Use Case&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Running services like web applications or APIs in production often requires multiple virtual machines to handle traffic, maintain high availability, and ensure scalability. Manually managing these machines and containers can be labor-intensive and prone to error. Docker Swarm offers an &lt;strong&gt;easy-to-use orchestration tool&lt;/strong&gt; that allows seamless container management, deployment, and scaling across clusters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Challenge
&lt;/h3&gt;

&lt;p&gt;The primary goal is to set up a Docker Swarm cluster consisting of multiple EC2 instances, deploy a service (Nginx) across the cluster, and ensure that the service scales effectively with multiple worker nodes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;In this project, you will set up a &lt;strong&gt;manager node&lt;/strong&gt; on AWS EC2 to control the Swarm, create &lt;strong&gt;worker nodes&lt;/strong&gt; that join the manager, and then deploy and scale an Nginx service to test the functionality of the cluster. This setup can be used to manage various production-grade services or web applications in a real-world scenario.&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture Diagram
&lt;/h3&gt;

&lt;p&gt;Here’s a high-level overview of the architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvdbjdupfbhuxmf0rusk9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvdbjdupfbhuxmf0rusk9.gif" alt="Architecture Diagram of a Cluster of Virtual Machines Built Using Docker Swarm" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Component Breakdown
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Manager Node&lt;/strong&gt;: Acts as the central controller for the Docker Swarm cluster, coordinating worker nodes and managing service deployments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Worker Nodes&lt;/strong&gt;: These instances run services like Nginx, based on instructions from the manager node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nginx Service&lt;/strong&gt;: A lightweight web server deployed on the worker nodes to test the functionality of Docker Swarm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Data Scripts&lt;/strong&gt;: Automates the installation of Docker and configuration of the Swarm during EC2 instance creation.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step-by-Step Implementation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Create an EC2 Instance for the Manager Node
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Launch an EC2 instance (Amazon Linux 2 or Ubuntu) to act as the Swarm manager.&lt;/li&gt;
&lt;li&gt;Use a user-data script to install Docker and initialize the Swarm:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum update
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;docker
service docker start
usermod &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-G&lt;/span&gt; docker ec2-user
chkconfig docker on
pip3 &lt;span class="nb"&gt;install &lt;/span&gt;docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the Swarm:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm init &lt;span class="nt"&gt;--advertise-addr&lt;/span&gt; &amp;lt;manager-instance-ip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;--advertise-addr&lt;/code&gt; option ensures other nodes can reach the manager using its IP address.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create Worker Nodes and Join Them to the Swarm
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Launch 2-3 more EC2 instances for worker nodes. Use the following user-data script on each instance to install Docker and join the Swarm:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm &lt;span class="nb"&gt;join&lt;/span&gt; &lt;span class="nt"&gt;--token&lt;/span&gt; &amp;lt;swarm-join-token&amp;gt; &amp;lt;manager-instance-ip&amp;gt;:2377
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Retrieve the Swarm join token from the manager node:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm join-token worker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Verify the Swarm Cluster
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;On the manager node, verify that the worker nodes have successfully joined the cluster:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker node &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the worker nodes listed as part of the Swarm cluster.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Deploy the Nginx Service
&lt;/h4&gt;

&lt;p&gt;Deploy an Nginx service across the cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service create &lt;span class="nt"&gt;--name&lt;/span&gt; web_app &lt;span class="nt"&gt;--replicas&lt;/span&gt; 1 &lt;span class="nt"&gt;--publish&lt;/span&gt; 80:80 nginxdemos/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5. Verify the Service
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Access the public IP address of any EC2 instance in the cluster. Swarm load-balances the service, so it will respond from any instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  6. Delete the Resources
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Remove the deployed service and terminate the Swarm cluster:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service &lt;span class="nb"&gt;rm &lt;/span&gt;web_app
docker swarm leave &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Terminate all EC2 instances from the AWS console or using the AWS CLI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Challenges Faced and Solutions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 1: Docker Swarm Token Expiration&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If the Swarm join token expires, generate a new token using the &lt;code&gt;docker swarm join-token worker&lt;/code&gt; command.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 2: Network Configuration&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Ensure proper security group settings for EC2 instances. Allow inbound traffic on ports 22 (SSH), 80 (HTTP), and 2377 (Docker Swarm communication).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Challenge 3: Instance Failure&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If an EC2 worker node fails, Docker Swarm automatically re-deploys services on the remaining active nodes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh3b75kt5bydnqapr0ejx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh3b75kt5bydnqapr0ejx.png" alt="Output 1" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F1qngvpvk8em99tqikmu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F1qngvpvk8em99tqikmu5.png" alt="Output 2" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This project demonstrates the power of &lt;strong&gt;Docker Swarm&lt;/strong&gt; for orchestrating containers across multiple EC2 instances on AWS. By setting up a manager node and multiple worker nodes, you’ve created a scalable and reliable environment for deploying services like &lt;strong&gt;Nginx&lt;/strong&gt;. This setup can be expanded to host various microservices and production workloads, making it an excellent solution for modern cloud-based architectures.&lt;/p&gt;

&lt;p&gt;Feel free to explore the code repository for this project in my &lt;strong&gt;&lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20300/3.%20Create%20a%20Cluster%20of%20Virtual%20Machines%20Using%20Docker%20Swarm" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Appendix&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Additional Resources&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Swarm Documentation: &lt;a href="https://docs.docker.com/engine/swarm/" rel="noopener noreferrer"&gt;Docker Swarm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AWS EC2 Best Practices: &lt;a href="https://aws.amazon.com/ec2/documentation/" rel="noopener noreferrer"&gt;AWS EC2 Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/Xaea-XnJTJU?si=9A37H1_Cg_NunZkt" rel="noopener noreferrer"&gt;Docker Swarm | Introduction | Step By Step Examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Repository&lt;/strong&gt;: &lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20300/3.%20Create%20a%20Cluster%20of%20Virtual%20Machines%20Using%20Docker%20Swarm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>awsproject</category>
      <category>careerdevelopment</category>
    </item>
    <item>
      <title>AWS Project: Deploying a VPC with Terraform</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Thu, 03 Oct 2024 13:54:28 +0000</pubDate>
      <link>https://forem.com/asif_khan/aws-project-deploying-a-vpc-with-terraform-2h9k</link>
      <guid>https://forem.com/asif_khan/aws-project-deploying-a-vpc-with-terraform-2h9k</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As cloud infrastructure becomes the backbone of modern applications, managing resources efficiently and securely is essential. This blog post details the process of provisioning a &lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt; in AWS using &lt;strong&gt;Terraform&lt;/strong&gt;, an Infrastructure as Code (IaC) tool. By the end of this post, you'll understand how to automate the deployment of a fully functional VPC environment, including public and private subnets, routing configurations, and EC2 instances, all through Terraform.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why use Terraform?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Terraform is widely used for managing cloud infrastructure because of its simplicity and flexibility. In AWS, setting up a VPC manually involves several steps and careful planning. Terraform automates this process, ensuring consistency and reducing the risk of human error. This project illustrates how to create a reliable, scalable network infrastructure in AWS that can be easily managed and modified through code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What you will learn:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How to use Terraform to create a VPC, subnets, route tables, gateways, and EC2 instances.&lt;/li&gt;
&lt;li&gt;How to manage resources with Terraform for future scalability and automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Tech Stack&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This project leverages the following technologies and services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terraform&lt;/strong&gt;: An open-source IaC tool used to define and provision infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon VPC&lt;/strong&gt;: A virtual network in AWS for isolating and managing resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EC2&lt;/strong&gt;: Virtual servers (instances) running inside the VPC for various application workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt;: Firewall configurations that control inbound and outbound traffic to EC2 instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additional services involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway&lt;/strong&gt;: Enables instances in private subnets to access the internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic IP&lt;/strong&gt;: Used for the NAT gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Tables&lt;/strong&gt;: Direct network traffic to and from subnets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before starting this project, make sure you have the following in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic knowledge of AWS&lt;/strong&gt;: Familiarity with services such as VPC, EC2, and IAM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terraform installed locally&lt;/strong&gt;: Download and install &lt;a href="https://www.terraform.io/downloads" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt; on your machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS account&lt;/strong&gt;: Ensure you have proper IAM credentials and permissions to manage AWS resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI configured&lt;/strong&gt;: Have the AWS CLI configured to verify resource deployments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text editor/IDE&lt;/strong&gt;: Tools like VS Code will help you write and manage your Terraform scripts.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Problem Statement or Use Case&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Provisioning AWS infrastructure manually through the console can be time-consuming, error-prone, and inefficient, especially when managing large, complex environments. The need for automation becomes clear when considering scalability, ease of deployment, and consistency across multiple environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Challenge&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a scalable, secure, and customizable VPC environment using Infrastructure as Code (IaC), allowing teams to spin up resources on demand while maintaining best practices for networking and security.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Solution&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This project demonstrates how to use &lt;strong&gt;Terraform&lt;/strong&gt; to automate the deployment of a VPC with both public and private subnets, NAT and internet gateways, and EC2 instances. The result is a flexible, repeatable infrastructure that can be deployed or destroyed quickly and efficiently—a critical capability for modern DevOps and cloud environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Architecture Diagram&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The architecture for this project involves several AWS components working together to create a network that securely connects private and public resources. Below is a high-level visual representation of the architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F9ap5u3fu5afn9hitdhwf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9ap5u3fu5afn9hitdhwf.gif" alt="Deploy a VPC with Terraform" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Component Breakdown&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt;: Provides a private, isolated network in AWS where resources such as EC2 instances are hosted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public and Private Subnets&lt;/strong&gt;: Segments the network, allowing specific instances (in public subnets) to communicate with the internet, while others (in private subnets) remain isolated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Tables and Route Associations&lt;/strong&gt;: Manage how traffic flows to and from the internet and between different subnets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internet Gateway&lt;/strong&gt;: Allows communication between resources in the public subnet and the internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway&lt;/strong&gt;: Enables instances in private subnets to access the internet without exposing them directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Instances&lt;/strong&gt;: Virtual machines deployed in both the public and private subnets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt;: Control inbound and outbound traffic for EC2 instances, ensuring secure access.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Implementation&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Download Terraform Binaries and Set Up Workspace
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download the Terraform binaries from the official &lt;a href="https://www.terraform.io/downloads" rel="noopener noreferrer"&gt;Terraform website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Initialize your project folder and Terraform configuration files:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Provider Configuration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;region&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
  &lt;span class="nx"&gt;access_key&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"***"&lt;/span&gt;
  &lt;span class="nx"&gt;secret_key&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"***"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Configures the AWS provider, specifying the region and credentials needed to manage resources in your AWS account.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Creating a VPC
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc"&lt;/span&gt; &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_block&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.0.0/16"&lt;/span&gt;
  &lt;span class="nx"&gt;enable_dns_support&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;enable_dns_hostnames&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"main_vpc"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Creates a Virtual Private Cloud (VPC) with a specified CIDR block and enables DNS support and hostnames.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Public Subnet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_subnet"&lt;/span&gt; &lt;span class="s2"&gt;"public"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_block&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.1.0/24"&lt;/span&gt;
  &lt;span class="nx"&gt;availability_zone&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1a"&lt;/span&gt;
  &lt;span class="nx"&gt;map_public_ip_on_launch&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"public_subnet"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Defines a public subnet within the VPC, allowing instances to have public IP addresses.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Private Subnet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_subnet"&lt;/span&gt; &lt;span class="s2"&gt;"private"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_block&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.2.0/24"&lt;/span&gt;
  &lt;span class="nx"&gt;availability_zone&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1a"&lt;/span&gt;
  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"private_subnet"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Creates a private subnet where instances do not receive public IP addresses.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Internet Gateway
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_internet_gateway"&lt;/span&gt; &lt;span class="s2"&gt;"igw"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"main_igw"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Creates an Internet Gateway to enable internet access for instances in the public subnet.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Public Route Table
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route_table"&lt;/span&gt; &lt;span class="s2"&gt;"public"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;route&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_block&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;
    &lt;span class="nx"&gt;gateway_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_internet_gateway&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;igw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"public_route_table"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; The public route table routes internet traffic from the public subnet through the Internet Gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Private Route Table
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route_table"&lt;/span&gt; &lt;span class="s2"&gt;"private"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;route&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_block&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;
    &lt;span class="nx"&gt;nat_gateway_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_nat_gateway&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ngw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"private_route_table"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; This route table directs internet-bound traffic from the private subnet to a NAT Gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Route Table Associations
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Public Subnet Association
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route_table_association"&lt;/span&gt; &lt;span class="s2"&gt;"public"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;      &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;route_table_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_route_table&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Private Subnet Association
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route_table_association"&lt;/span&gt; &lt;span class="s2"&gt;"private"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;      &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;route_table_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_route_table&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; These associations link the public and private subnets to their respective route tables.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Elastic IP for NAT Gateway
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_eip"&lt;/span&gt; &lt;span class="s2"&gt;"nat"&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Allocates an Elastic IP address for the NAT Gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  11. NAT Gateway
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_nat_gateway"&lt;/span&gt; &lt;span class="s2"&gt;"ngw"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;allocation_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_eip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;nat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"main_nat_gateway"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; The NAT Gateway enables instances in the private subnet to access the internet without exposing them directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  12. Security Group
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_security_group"&lt;/span&gt; &lt;span class="s2"&gt;"sg"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;egress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;from_port&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="nx"&gt;to_port&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"-1"&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_blocks&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;ingress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;from_port&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
    &lt;span class="nx"&gt;to_port&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_blocks&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"main_security_group"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; This security group allows all outbound traffic and SSH access (port 22) for incoming connections.&lt;/p&gt;

&lt;h3&gt;
  
  
  13. Public EC2 Instance
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"public"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0182f373e66f89c85"&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;security_groups&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"public_instance"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Creates a public EC2 instance that can be accessed over the internet.&lt;/p&gt;

&lt;h3&gt;
  
  
  14. Private EC2 Instance
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"private"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0182f373e66f89c85"&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;security_groups&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"private_instance"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; Defines a private EC2 instance, isolated from direct internet access.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Challenges Faced and Solutions&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Challenge 1: Terraform Version Conflicts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users may face version conflicts between Terraform and AWS provider versions. It’s important to specify compatible versions in the Terraform configuration.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2: EC2 Instance Access&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connecting to EC2 instances in the private subnet can be tricky. You can use a bastion host or a VPN to securely access private instances.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3: NAT Gateway Costs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NAT gateways can incur significant costs, especially in long-running environments. To mitigate this, ensure that resources are only deployed when needed, or consider alternative solutions like NAT instances for smaller use cases.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Output&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6tlxyssxez2vtnri4189.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6tlxyssxez2vtnri4189.gif" alt="Output" width="500" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This project demonstrates the power of &lt;strong&gt;Terraform&lt;/strong&gt; for provisioning and managing AWS resources in a scalable, automated manner. By automating the deployment of a VPC, EC2 instances, and associated networking components, you can achieve a highly secure, scalable, and manageable infrastructure in the cloud.&lt;/p&gt;

&lt;p&gt;Feel free to check out the full source code in my &lt;strong&gt;&lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20300/2.%20Deploy%20a%20VPC%20with%20Terraform" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Additional Resources&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Terraform Documentation: &lt;a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs" rel="noopener noreferrer"&gt;Terraform AWS Provider&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AWS VPC Best Practices: &lt;a href="https://aws.amazon.com/vpc/" rel="noopener noreferrer"&gt;VPC Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main" rel="noopener noreferrer"&gt;My GitHub Repository&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>awsproject</category>
      <category>careerdevelopment</category>
    </item>
    <item>
      <title>AWS Project: SQL Server Native Backup and Restore on Amazon RDS</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Wed, 02 Oct 2024 13:51:32 +0000</pubDate>
      <link>https://forem.com/asif_khan/aws-project-sql-server-native-backup-and-restore-on-amazon-rds-o5a</link>
      <guid>https://forem.com/asif_khan/aws-project-sql-server-native-backup-and-restore-on-amazon-rds-o5a</guid>
      <description>&lt;h4&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Effective database backup and restore management is essential for maintaining business continuity in today's cloud-driven environment. This blog post walks you through the implementation of &lt;strong&gt;SQL Server Native Backup and Restore on Amazon RDS&lt;/strong&gt;. This project demonstrates how to enable native backup and restore functionality on Amazon RDS for SQL Server, showcasing how backups can be stored in Amazon S3 and restored back to RDS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use AWS for this project?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS services such as Amazon RDS and S3 provide a highly scalable, reliable, and low-cost infrastructure platform in the cloud. By using Amazon RDS for SQL Server, we eliminate the complexities of managing a database instance manually, enabling a fully managed environment where we can focus on backup and restore processes. This project is especially valuable in real-world scenarios where disaster recovery, data migration, or database duplication are key objectives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you will learn&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to enable native backup and restore functionality in Amazon RDS for SQL Server.&lt;/li&gt;
&lt;li&gt;How to create a native SQL Server backup and upload it to Amazon S3.&lt;/li&gt;
&lt;li&gt;How to restore the backup from Amazon S3 to RDS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Tech Stack&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This project involves the following tools and AWS services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon RDS (Relational Database Service) for SQL Server&lt;/strong&gt;: Managed database hosting with support for native backup and restore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3 (Simple Storage Service)&lt;/strong&gt;: Used to store SQL Server backup files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MySQL Workbench&lt;/strong&gt;: A third-party tool used for managing databases and executing backup/restore commands.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additional AWS Services you may explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IAM (Identity and Access Management)&lt;/strong&gt;: Managing permissions and security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon CloudWatch&lt;/strong&gt;: For monitoring database performance and system logs during the backup and restore processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To follow along with this project, you will need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic AWS knowledge&lt;/strong&gt;, including experience with Amazon RDS and S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account&lt;/strong&gt;: Set up with access to Amazon RDS, S3, and IAM services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role with S3 Full Access&lt;/strong&gt;: Required to allow RDS to communicate with Amazon S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MySQL Workbench&lt;/strong&gt; (or a similar SQL client tool) installed locally for executing SQL commands.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Additionally, you will need permissions to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable native backup and restore functionality for SQL Server on RDS.&lt;/li&gt;
&lt;li&gt;Access S3 buckets for backup storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Problem Statement&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Traditional backup and restore processes for on-premises databases often require significant time and manual intervention, which can lead to delays and human errors, especially when dealing with large volumes of data. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Challenge&lt;/strong&gt;: &lt;br&gt;
The need for a seamless and efficient process to back up SQL Server databases to the cloud and restore them when needed, without the complexity of maintaining on-premises infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: &lt;br&gt;
In this project, we leverage AWS services to automate the backup and restore processes for SQL Server databases hosted on Amazon RDS. This allows for quick, reliable, and scalable backup and restore operations that can be used in production environments for disaster recovery, database migration, and testing purposes.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Architecture Diagram&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fwkgrwf7azktspmqy43tv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwkgrwf7azktspmqy43tv.gif" alt="Architecture Diagram of SQL Server Native Backup and Restore on Amazon RDS" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Component Breakdown&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon RDS for SQL Server&lt;/strong&gt;: A fully managed database service that supports SQL Server and native backup/restore functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3&lt;/strong&gt;: Acts as the storage destination for the native SQL Server backup files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role&lt;/strong&gt;: Provides Amazon RDS with the necessary permissions to store and retrieve files from Amazon S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MySQL Workbench&lt;/strong&gt;: Used to issue SQL commands that execute the backup and restore processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step-by-Step Implementation&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enable Native Backup and Restore in Amazon RDS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Amazon RDS&lt;/strong&gt;, select your SQL Server instance, and modify its settings to enable native backup and restore. Ensure that the instance is running a version that supports this feature.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create an S3 Bucket for Storing Backups&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Amazon S3&lt;/strong&gt; and create a bucket to store your backup files. Make sure you note the bucket name, as it will be referenced during the backup command.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create and Attach an IAM Role&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;IAM&lt;/strong&gt; service, create a role, and attach the &lt;strong&gt;AmazonS3FullAccess&lt;/strong&gt; policy to this role. &lt;/li&gt;
&lt;li&gt;Attach this role to the RDS instance to allow it to communicate with S3.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Perform the Native Backup&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;MySQL Workbench&lt;/strong&gt; to connect to your RDS instance. Execute the following SQL command to back up the database to your S3 bucket:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt; &lt;span class="k"&gt;exec&lt;/span&gt; &lt;span class="n"&gt;msdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rds_backup_database&lt;/span&gt; 
     &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;source_db_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'your-database-name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;s3_arn_to_backup_to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'arn:aws:s3:::your-bucket-name/backup-file.bak'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;overwrite_s3_backup_file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;This command will create a backup file of your SQL Server database and store it in the specified S3 bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Restore the Database from S3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Similarly, execute the following command in &lt;strong&gt;MySQL Workbench&lt;/strong&gt; to restore the backup from the S3 bucket:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt; &lt;span class="k"&gt;exec&lt;/span&gt; &lt;span class="n"&gt;msdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rds_restore_database&lt;/span&gt; 
     &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;restore_db_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'your-database-name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
     &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;s3_arn_to_restore_from&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'arn:aws:s3:::your-bucket-name/backup-file.bak'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Challenges Faced and Solutions&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Challenge 1: IAM Role Misconfiguration&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While creating the IAM role, incorrect permission settings might prevent RDS from accessing S3. Ensure that the role has &lt;strong&gt;S3FullAccess&lt;/strong&gt; and is properly associated with the RDS instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2: Long Backup/Restore Times&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Backup times may vary based on database size and S3 region. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3: Version Compatibility&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure that your SQL Server version on RDS supports native backup and restore operations. Some older versions may lack full functionality.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj2sfzzn3h16yx9gxxiwt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj2sfzzn3h16yx9gxxiwt.png" alt="Output" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;By leveraging Amazon RDS and S3, we can simplify the traditionally complex tasks of database backup and restore. This project demonstrates a robust solution for handling SQL Server backups in the cloud, with real-world applications ranging from disaster recovery to data migrations. The integration of IAM, RDS, and S3 ensures a scalable and secure environment for managing critical database operations in AWS.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Additional Resources&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://repost.aws/knowledge-center/native-backup-rds-sql-server" rel="noopener noreferrer"&gt;How to perform native backups of an Amazon RDS DB instance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html#SQLServer.Procedural.Importing.Native.Enabling" rel="noopener noreferrer"&gt;Setting Up for Native Backup and Restore&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html" rel="noopener noreferrer"&gt;Working With Backups&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/twOglkIFbXU" rel="noopener noreferrer"&gt;Running SQL Server Databases on Amazon RDS for SQL Server - AWS Virtual Workshop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/rds/free/" rel="noopener noreferrer"&gt;Amazon RDS Free Tier&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For all my AWS projects feel free to explore my &lt;strong&gt;&lt;a href="https://github.com/Dark-Cookie/AWS-Projects/tree/main/Level%20300/1.%20SQLServer%20Native%20Backup%20and%20Restore%20on%20RDS" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>awsproject</category>
      <category>careerdevelopment</category>
    </item>
    <item>
      <title>14 AWS Projects for Absolute Beginners</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 15:06:55 +0000</pubDate>
      <link>https://forem.com/asif_khan/14-aws-projects-for-absolute-beginners-4gno</link>
      <guid>https://forem.com/asif_khan/14-aws-projects-for-absolute-beginners-4gno</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Hello Dev readers,&lt;/p&gt;

&lt;p&gt;I am creating this blog to help someone who is absolutely new to AWS (Amazon Web Services) with little to no experience working with the AWS Console.&lt;/p&gt;

&lt;p&gt;I started my AWS journey to become a cloud engineer a few months ago. While learning Andrew Brown's &lt;strong&gt;AWS Certified Cloud Practitioner&lt;/strong&gt; course, which was 14 hours long, I encountered something known as the &lt;strong&gt;"forgetting curve."&lt;/strong&gt; This curve describes how information is lost over time if there's no attempt to retain it. Without reinforcement or practice, you tend to forget a lot of what you've learned. For someone about to attempt the AWS CCP exam, this was a significant problem.&lt;/p&gt;

&lt;p&gt;To solve it, I began searching the internet and came across people shouting, &lt;strong&gt;"PROJECTS! PROJECTS! PROJECTS!"&lt;/strong&gt; I started researching beginner-friendly projects, but the names sounded overwhelming, like "Create an Amazon RDS DB Instance," "Create a Lambda Function to Add Two Numbers," or "Deploy a CloudFormation Template from the AWS Console." I thought, &lt;strong&gt;"These projects sound hard!"&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;During that time, I came across a quote that is also my LinkedIn background: &lt;strong&gt;"The only true failure is failure to try."&lt;/strong&gt; I told myself that I couldn't label them as hard if I hadn't attempted them. So, the next day, I put my AWS CCP course on hold (only for a day, of course) and started with the first project (which is also the first project in the list below). I won't go into details, but it was so easy! When I completed it, I felt a sense of accomplishment that further boosted my confidence to tackle more projects.&lt;/p&gt;

&lt;p&gt;Now that I have completed all 14 projects listed below, I can say they were some of the easiest projects I've ever done, especially without any prior AWS Console knowledge. I believe that if I could do them, many beginners can too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Note
&lt;/h3&gt;

&lt;p&gt;I will not be posting step-by-step instructions for every project for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I believe that for learners to truly grasp the material, they should work their way around the platform. Trust me, you will find your way. (Don't worry, I'll guide you in the right direction to get you started.)&lt;/li&gt;
&lt;li&gt;AWS frequently updates its console, so the steps I list below might change a few days after this blog is published. Therefore, I don't think it's worth the effort.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, with that out of the way, here’s the list of projects below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create Three Billing Alarms&lt;/li&gt;
&lt;li&gt;Create a Cost Budget&lt;/li&gt;
&lt;li&gt;Launch a Hello World Website on the Internet&lt;/li&gt;
&lt;li&gt;Push a Docker Image to Amazon ECR Repository&lt;/li&gt;
&lt;li&gt;Create an Amazon RDS DB Instance (MS SQL Server)&lt;/li&gt;
&lt;li&gt;Create a DynamoDB Table&lt;/li&gt;
&lt;li&gt;Install &amp;amp; Configure AWS CLI, then Create an S3 Bucket&lt;/li&gt;
&lt;li&gt;Create an S3 Bucket and Store an Object in It&lt;/li&gt;
&lt;li&gt;Introduction to SNS (Simple Notification Service)&lt;/li&gt;
&lt;li&gt;Create a Lambda Function to Add Two Numbers&lt;/li&gt;
&lt;li&gt;Host a Simple Static Webpage with S3 and CloudFront&lt;/li&gt;
&lt;li&gt;Create an IAM User&lt;/li&gt;
&lt;li&gt;Use a Managed Config Rule&lt;/li&gt;
&lt;li&gt;Deploy a CloudFormation Template from the AWS Console&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Project 1: Create a Billing Alarm
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Set up three distinct billing alarms at $5, $25, and $100 in AWS to monitor and control cloud spending at different thresholds and proactively address potential cost overruns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a billing alarm for $5&lt;/li&gt;
&lt;li&gt;Create a billing alarm for $25&lt;/li&gt;
&lt;li&gt;Create a billing alarm for $100&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS CloudWatch for monitoring and creating alarms.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html" rel="noopener noreferrer"&gt;Create a billing alarm to monitor your estimated AWS charges&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You'll learn how to monitor your AWS spending in real time.&lt;/li&gt;
&lt;li&gt;You'll learn how to respond to alerts. For example, if you hit the $5 alarm, you might review your resource usage and make adjustments.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Project 2: Create a Cost Budget
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Implement an AWS Cost Budget to set and monitor financial limits for AWS resource usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a cost budget.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS Budgets for cost management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets.html" rel="noopener noreferrer"&gt;Creating a budget&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how AWS services contribute to your overall costs, helping you identify areas where you can optimize spending.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 3: Launch a Hello World Website on the Internet
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Deploy a Linux-based Amazon EC2 instance within a public subnet, configure it to serve web traffic, and verify its functionality through a simple web page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Launch a Linux-based EC2 instance in any region of your choice within a public subnet.&lt;/li&gt;
&lt;li&gt;Set up a security group that allows HTTP/HTTPS connections from the Internet and SSH from your IP address.&lt;/li&gt;
&lt;li&gt;SSH into the EC2 instance on Linux and Mac, or use PuTTY on Windows.&lt;/li&gt;
&lt;li&gt;Set up a web server on the EC2 instance.&lt;/li&gt;
&lt;li&gt;Add a simple 'Hello, World!' header to the &lt;code&gt;index.html&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Access the public IP address from a browser and confirm that the site is served.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS EC2 (Elastic Compute Cloud) for launching the instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn the basics of EC2 instances, how they work, and how to configure a web server to serve static files, as well as how to use SSH via the local CLI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; While checking the endpoint, use HTTP instead of HTTPS to obtain the output.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 4: Push a Docker Image to Amazon ECR Repository
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create a Docker image and push it to Amazon Elastic Container Registry (ECR), which is a fully managed container registry by AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create your Amazon ECR repository.&lt;/li&gt;
&lt;li&gt;Authenticate your Docker client with Amazon ECR.&lt;/li&gt;
&lt;li&gt;Tag your Docker image with the Amazon ECR repository.&lt;/li&gt;
&lt;li&gt;Push your image to Amazon ECR.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS ECR (Elastic Container Registry) for hosting and managing Docker images.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-build-and-push-docker-images-to-aws-ecr/" rel="noopener noreferrer"&gt;How to Build and Push Docker Images to AWS ECR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/get-started/" rel="noopener noreferrer"&gt;Get started with Docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll learn basic concepts of Docker, how to create and manage Docker images and containers, along with hands-on experience with the command-line interface for pushing images to ECR.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 5: Create an Amazon RDS DB Instance (MS SQL Server)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Set up a fully managed MS SQL Server database instance on Amazon RDS and connect the RDS instance from a local development environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create an MS SQL Server database instance on RDS.&lt;/li&gt;
&lt;li&gt;Connect to the RDS database instance from your local machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;Amazon RDS for database setup and management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to configure an RDS database instance and navigate through Microsoft SQL Server Management Studio (SSMS).&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 6: Create a DynamoDB Table
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create a DynamoDB table, insert data into it, and perform basic query operations on it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a DynamoDB table with provisioned capacity.&lt;/li&gt;
&lt;li&gt;Create three random items in the table.&lt;/li&gt;
&lt;li&gt;Run a scan on the table that returns all three items.&lt;/li&gt;
&lt;li&gt;Run a query on the table that returns a single item.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS DynamoDB for table creation and management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/getting-started/hands-on/create-nosql-table/" rel="noopener noreferrer"&gt;Create and Query a NoSQL Table with Amazon DynamoDB&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to create a DynamoDB table, insert items into it, and run a query on that table.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 7: Install &amp;amp; Configure AWS CLI, then Create an S3 Bucket
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Set up the AWS CLI on your local machine and create a new S3 bucket using the CLI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install the AWS CLI.&lt;/li&gt;
&lt;li&gt;Configure your AWS credentials locally: &lt;code&gt;aws configure&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create an S3 bucket: &lt;code&gt;aws s3 mb s3://&amp;lt;unique-bucket-name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Check that the bucket was created: &lt;code&gt;aws s3 ls&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Delete the bucket when you are done: &lt;code&gt;aws s3 rb s3://&amp;lt;unique-bucket-name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;Amazon S3 (Simple Storage Service) for creating and managing storage buckets.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html" rel="noopener noreferrer"&gt;Install or update to the latest version of the AWS CLI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html" rel="noopener noreferrer"&gt;Configure the AWS CLI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll learn how to install and configure the AWS CLI and how to create, list, and delete S3 buckets via the CLI.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 8: Create an S3 Bucket and Store an Object in It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create an Amazon S3 bucket using the AWS console and upload an object into it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use the console to create an S3 bucket.&lt;/li&gt;
&lt;li&gt;Upload an object (any file) into the bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;Amazon S3 for creating the bucket and storing objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingABucket.html" rel="noopener noreferrer"&gt;Step 1: Create your first S3 bucket&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn what Amazon S3 (Simple Storage Service) is and how it works as a scalable object storage service.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 9: Introduction to SNS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Set up a Simple Notification Service (SNS) topic and subscribe to it using an email address.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create an SNS topic.&lt;/li&gt;
&lt;li&gt;Subscribe to that SNS topic using your email address.&lt;/li&gt;
&lt;li&gt;Accept the subscription in the email you receive.&lt;/li&gt;
&lt;li&gt;Send a test message through the SNS topic.&lt;/li&gt;
&lt;li&gt;Ensure that you receive the message at your email address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;Amazon SNS for managing topics and sending notifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll learn how notifications are sent and managed for real-time updates in applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 10: Create a Lambda Function to Add Two Numbers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create an AWS Lambda function using Python to add two numbers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create an AWS Lambda function to add two numbers supplied as input and return the result.&lt;/li&gt;
&lt;li&gt;Print the result in the logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS Lambda for serverless computing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to create anonymous functions using Lambda.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 11: Host a Simple Static Webpage with S3 and CloudFront
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create a simple static webpage and host it on AWS S3, then set up a CloudFront distribution to serve the content securely and efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create an S3 bucket and upload a simple static webpage.&lt;/li&gt;
&lt;li&gt;Create a CloudFront distribution using the S3 bucket as the origin.&lt;/li&gt;
&lt;li&gt;Ensure that the bucket's content can be accessed only through the CloudFront endpoint.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Services Used
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 for static website hosting.&lt;/li&gt;
&lt;li&gt;Amazon CloudFront for content delivery and caching.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html" rel="noopener noreferrer"&gt;Hosting a static website using Amazon S3&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to create and configure an S3 bucket for static website hosting, along with creating and managing a CloudFront distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 12: Create an IAM User
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Create a new AWS Identity and Access Management (IAM) user with console access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new user in IAM with console access.&lt;/li&gt;
&lt;li&gt;Add the user to an Admin group.&lt;/li&gt;
&lt;li&gt;Create a new group called "Admins."&lt;/li&gt;
&lt;li&gt;Attach the &lt;code&gt;AdministratorAccess&lt;/code&gt; managed policy to the new group.&lt;/li&gt;
&lt;li&gt;Add your new user to the "Admins" group.&lt;/li&gt;
&lt;li&gt;Enable MFA for the root user.&lt;/li&gt;
&lt;li&gt;Apply an IAM password policy that adheres to security best practices.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS IAM for user, group, and permission management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to create IAM users, including setting up permissions and access methods, and gain insight into how AWS permissions work, including attaching policies to users.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 13: Use a Managed Config Rule
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Enable AWS Config in the us-east-1 region and use a managed config rule to monitor the encryption status of Amazon EBS volumes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Turn on AWS Config in the US East (N. Virginia) region.&lt;/li&gt;
&lt;li&gt;Choose the managed Config rule, such as &lt;code&gt;encrypted-volumes&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Launch an EC2 instance without an encrypted EBS volume.&lt;/li&gt;
&lt;li&gt;Monitor AWS Config until it detects that there is an unencrypted EBS volume.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Services Used
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Config for resource monitoring and compliance tracking.&lt;/li&gt;
&lt;li&gt;Amazon EC2 for testing compliance with encrypted and unencrypted EBS volumes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how AWS Config can trigger alerts or actions when a resource is found to be non-compliant.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project 14: Deploy a CloudFormation Template from the AWS Console
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Deploy a CloudFormation template from the AWS Console, which automatically provisions a DynamoDB table and an S3 bucket.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download a simple CloudFormation template.&lt;/li&gt;
&lt;li&gt;Go to the CloudFormation Console in AWS.&lt;/li&gt;
&lt;li&gt;Choose "Create stack" with new resources and use the template file from above.&lt;/li&gt;
&lt;li&gt;On the "Configure stack options" page, leave everything at the default settings.&lt;/li&gt;
&lt;li&gt;Watch as CloudFormation deploys the resources, and check the Events tab to see what is being created.&lt;/li&gt;
&lt;li&gt;Ensure that a new DynamoDB table and a new S3 bucket are deployed.&lt;/li&gt;
&lt;li&gt;Delete the stack in the CloudFormation console.&lt;/li&gt;
&lt;li&gt;Confirm that both resources have been deleted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Service Used
&lt;/h3&gt;

&lt;p&gt;AWS CloudFormation for deploying infrastructure as code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What will you learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will learn how to create, update, and delete AWS resources in a controlled manner using CloudFormation stacks.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;When you complete all 14 projects listed above, you will have gained experience with services like &lt;code&gt;CloudWatch, AWS Budgets, Amazon EC2, Amazon Elastic Container Registry (ECR), Docker, AWS CLI, Amazon Relational Database Service (RDS), Amazon DynamoDB, Amazon S3, Amazon SNS, AWS Lambda, Amazon CloudFront, AWS Identity and Access Management (IAM), AWS Config, and AWS CloudFormation.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I call all of the above projects &lt;strong&gt;'Level 100 Introductory Projects,'&lt;/strong&gt; meaning they are suitable for beginners and cover fundamental AWS concepts and basic services. &lt;/p&gt;

&lt;p&gt;I'll probably create a blog about a few more projects, but those will be &lt;strong&gt;'Level 200 Projects,'&lt;/strong&gt; designed for those who have a basic understanding of AWS and want to explore more complex scenarios.&lt;/p&gt;

&lt;p&gt;You can check out my GitHub repository for more:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Dark-Cookie/AWS-Projects" rel="noopener noreferrer"&gt;https://github.com/Dark-Cookie/AWS-Projects&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Cloud Journey — Week 15 &amp; 16: AWS Certified Cloud Practitioner Course Completed!</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 15:02:17 +0000</pubDate>
      <link>https://forem.com/asif_khan/my-cloud-journey-week-15-16-aws-certified-cloud-practitioner-course-completed-2mej</link>
      <guid>https://forem.com/asif_khan/my-cloud-journey-week-15-16-aws-certified-cloud-practitioner-course-completed-2mej</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Dev Community,&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I’m excited to share that I’ve completed my AWS Certified Cloud Practitioner course! This milestone marks the end of one chapter and the beginning of a new adventure in my journey to becoming a Cloud Engineer. Over the past two weeks, I’ve studied various topics and services fundamental to AWS cloud operations.&lt;/p&gt;

&lt;p&gt;Starting next week, I’ll be diving into hands-on projects across different skill levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Level 100&lt;/strong&gt; (Introductory)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 200&lt;/strong&gt; (Intermediate)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 300&lt;/strong&gt; (Advanced)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 400&lt;/strong&gt; (Expert)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These projects will provide practical experience and deepen my understanding of AWS services in real-world scenarios.&lt;/p&gt;




&lt;h3&gt;
  
  
  Key Topics Covered During My Learning
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Provisioning &amp;amp; Provisioning Services
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Provisioning Basics:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I learned the processes behind efficiently provisioning cloud resources, understanding their lifecycle and how to scale and manage them effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Provisioning Services:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AWS offers services to simplify and automate provisioning, helping manage resources in a scalable, cost-effective manner with minimal manual intervention.&lt;/p&gt;




&lt;h4&gt;
  
  
  AWS Elastic Beanstalk
&lt;/h4&gt;

&lt;p&gt;A major highlight was working with &lt;strong&gt;AWS Elastic Beanstalk&lt;/strong&gt;, a fully managed Platform-as-a-Service (PaaS) that simplifies deploying and managing applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automatic Scaling:&lt;/strong&gt; Automatically adjusts instances based on demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancing:&lt;/strong&gt; Distributes traffic across instances to maintain high availability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring:&lt;/strong&gt; Integrates with AWS CloudWatch to monitor health and performance.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  Introduction to Machine Learning (ML) &amp;amp; Artificial Intelligence (AI)
&lt;/h4&gt;

&lt;p&gt;I explored the fundamentals of AI and ML, understanding how these technologies shape industries through predictive analytics, recommendation engines, and natural language processing (NLP).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI &amp;amp; ML Services on AWS:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon SageMaker:&lt;/strong&gt; Build, train, and deploy ML models with ease.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS AI Services:&lt;/strong&gt; Tools like:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Rekognition&lt;/strong&gt; for image/video analysis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Comprehend&lt;/strong&gt; for NLP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Polly&lt;/strong&gt; for text-to-speech.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h4&gt;
  
  
  Big Data &amp;amp; Analytics Services
&lt;/h4&gt;

&lt;p&gt;With data growing exponentially, I studied AWS services for handling large datasets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Redshift:&lt;/strong&gt; A fully managed data warehouse for querying structured data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EMR (Elastic MapReduce):&lt;/strong&gt; Used for big data processing with frameworks like Apache Spark and Hadoop.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  Amazon QuickSight
&lt;/h4&gt;

&lt;p&gt;AWS’s business intelligence tool that creates interactive dashboards and visualizations. It was amazing to transform raw data into visual insights.&lt;/p&gt;




&lt;h4&gt;
  
  
  AWS Well-Architected Framework Overview
&lt;/h4&gt;

&lt;p&gt;The &lt;strong&gt;AWS Well-Architected Framework&lt;/strong&gt; is fundamental for designing scalable, secure, high-performing, and cost-effective systems. The five pillars of this framework are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Operational Excellence&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reliability&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance Efficiency&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cost Optimization&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Detailed Learning Insights
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Performance Efficiency
&lt;/h4&gt;

&lt;p&gt;Performance optimization is about using the right resources for the job. I explored services like &lt;strong&gt;Auto Scaling&lt;/strong&gt; and &lt;strong&gt;Elastic Load Balancing&lt;/strong&gt; to maintain efficiency as workloads change.&lt;/p&gt;




&lt;h4&gt;
  
  
  Cost Optimization
&lt;/h4&gt;

&lt;p&gt;I focused on strategies to reduce costs while maintaining performance and reliability. This included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leveraging &lt;strong&gt;Reserved Instances&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Optimizing storage.&lt;/li&gt;
&lt;li&gt;Right-sizing infrastructure based on usage.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  AWS Well-Architected Tool
&lt;/h4&gt;

&lt;p&gt;This tool helps assess existing workloads and provides recommendations for improvement.&lt;/p&gt;




&lt;h4&gt;
  
  
  Total Cost of Ownership (TCO) &amp;amp; CAPEX vs OPEX
&lt;/h4&gt;

&lt;p&gt;Understanding &lt;strong&gt;TCO&lt;/strong&gt; helps businesses assess the financial impact of cloud adoption. Additionally, I explored the shift from &lt;strong&gt;CAPEX&lt;/strong&gt; (upfront physical infrastructure) to &lt;strong&gt;OPEX&lt;/strong&gt; (ongoing operational costs) and how this model offers flexibility.&lt;/p&gt;




&lt;h4&gt;
  
  
  AWS Pricing Calculator
&lt;/h4&gt;

&lt;p&gt;I practiced estimating costs for AWS services using this tool, which offers insights into cloud budgeting and cost optimization.&lt;/p&gt;




&lt;h4&gt;
  
  
  Migration Tools
&lt;/h4&gt;

&lt;p&gt;I explored tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VM Import/Export&lt;/strong&gt; for transferring virtual machines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Database Migration Service (DMS)&lt;/strong&gt; for migrating databases with minimal downtime.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Billing and Pricing
&lt;/h3&gt;

&lt;p&gt;I explored AWS’s &lt;strong&gt;Free Tier&lt;/strong&gt; and &lt;strong&gt;Free Services&lt;/strong&gt;, as well as programs that offer &lt;strong&gt;AWS Credits&lt;/strong&gt; to help reduce costs.&lt;/p&gt;




&lt;h4&gt;
  
  
  AWS Support &amp;amp; Marketplace
&lt;/h4&gt;

&lt;p&gt;I studied the various &lt;strong&gt;AWS Support Plans&lt;/strong&gt; and the &lt;strong&gt;AWS Marketplace&lt;/strong&gt; for deploying third-party solutions.&lt;/p&gt;




&lt;h3&gt;
  
  
  Cost Management Tools
&lt;/h3&gt;

&lt;p&gt;I explored tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Budgets&lt;/strong&gt; and &lt;strong&gt;Budget Reports&lt;/strong&gt; to track costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Allocation Tags&lt;/strong&gt; for efficient tracking of spending.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Billing Alarms&lt;/strong&gt; and &lt;strong&gt;Cost Explorer&lt;/strong&gt; for monitoring expenditures.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Security Fundamentals
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Defense-In-Depth &amp;amp; CIA Triad
&lt;/h4&gt;

&lt;p&gt;Security was a major focus. I explored the &lt;strong&gt;Defense-In-Depth&lt;/strong&gt; approach and the &lt;strong&gt;CIA Triad&lt;/strong&gt; (Confidentiality, Integrity, Availability), which are essential for cloud security.&lt;/p&gt;




&lt;h4&gt;
  
  
  Encryption &amp;amp; Cryptography
&lt;/h4&gt;

&lt;p&gt;I learned about in-transit and at-rest encryption, cryptographic keys, and techniques like hashing and salting to secure sensitive data.&lt;/p&gt;




&lt;h4&gt;
  
  
  Compliance &amp;amp; Security Tools
&lt;/h4&gt;

&lt;p&gt;I examined AWS tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Inspector&lt;/strong&gt; for vulnerability scanning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Shield&lt;/strong&gt; for DDoS protection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Macie&lt;/strong&gt; for detecting sensitive data like PII.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  AWS Services: Comparative Insights
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Load Balancers
&lt;/h4&gt;

&lt;p&gt;I studied the four types of &lt;strong&gt;Elastic Load Balancers (ELBs)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Classic Load Balancer (CLB)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application Load Balancer (ALB)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network Load Balancer (NLB)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gateway Load Balancer (GWLB)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Reflecting on my AWS Cloud Practitioner journey, I’ve gained a deep understanding of AWS tools and services. From foundational topics like security and cost management to advanced services in machine learning and data analytics, I’ve built a solid foundation in cloud computing.&lt;/p&gt;

&lt;p&gt;This journey has not only sharpened my technical skills but also prepared me for the next steps in my cloud computing career. I’m excited to continue exploring, learning, and building with AWS!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Cloud Journey — Week 14: AWS Organizations, Governance &amp; Business-Centric Services!</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 14:55:49 +0000</pubDate>
      <link>https://forem.com/asif_khan/my-cloud-journey-week-14-aws-organizations-governance-business-centric-services-4ajj</link>
      <guid>https://forem.com/asif_khan/my-cloud-journey-week-14-aws-organizations-governance-business-centric-services-4ajj</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Hello Dev Community,&lt;/p&gt;

&lt;p&gt;This week, I continued my journey to becoming a Cloud Engineer by learning about &lt;strong&gt;tools for organization management, governance, and business-centric services&lt;/strong&gt;. Here’s a breakdown of my learnings:&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Organizations &amp;amp; Accounts
&lt;/h2&gt;

&lt;p&gt;I started by exploring the fundamentals of &lt;strong&gt;AWS Organizations&lt;/strong&gt; and how it enables centralized management of multiple AWS accounts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Organizational Units (OU):&lt;/strong&gt; I learned how Organizational Units help in grouping accounts to apply policies and manage permissions efficiently. This structure is crucial for maintaining control over multiple accounts in a large organization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AWS Control Tower:&lt;/strong&gt; AWS Control Tower simplifies the setup and governance of multi-account environments. I studied its key components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Landing Zone:&lt;/strong&gt; The starting point for setting up a secure, multi-account AWS environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account Factory:&lt;/strong&gt; A service that automates the creation of new AWS accounts according to predefined templates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guardrails:&lt;/strong&gt; Preconfigured governance rules that ensure compliance and best practices across accounts.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;I also learned how AWS Control Tower replaces the traditional Landing Zone by offering a more streamlined and integrated solution for managing multi-account environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Governance &amp;amp; Compliance
&lt;/h2&gt;

&lt;p&gt;Governance and compliance are critical for any organization operating in the cloud. This week, I focused on tools and strategies that help maintain control and ensure compliance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Config:&lt;/strong&gt; A service that provides continuous monitoring and change management of AWS resources. AWS Config enables compliance-as-code, ensuring that resources remain within compliance guidelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Quick Starts:&lt;/strong&gt; I explored AWS Quick Starts, which are automated, gold-standard deployments of popular solutions on AWS. These accelerate the implementation of complex environments by providing templates and best practices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tagging Strategies &amp;amp; Resource Groups:&lt;/strong&gt; I learned about the importance of tagging resources for better organization and management. By creating Resource Groups, I can apply bulk actions and manage resources more efficiently based on their tags.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Business-Centric AWS Services
&lt;/h2&gt;

&lt;p&gt;In addition to technical management and governance, AWS offers several services aimed at enhancing business operations. This week, I explored various tools designed to improve productivity and customer engagement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Connect:&lt;/strong&gt; A cloud-based contact center service that enables businesses to deliver superior customer service at scale.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon WorkSpaces:&lt;/strong&gt; A virtual desktop solution that allows employees to access their desktops from anywhere, improving flexibility and productivity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon WorkDocs:&lt;/strong&gt; A secure document collaboration service that makes it easy for teams to share and edit files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Chime:&lt;/strong&gt; An online meeting and video conferencing service that supports seamless communication within organizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon WorkMail:&lt;/strong&gt; A secure email service for business communication, integrating with existing email clients.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Pinpoint:&lt;/strong&gt; A service that helps businesses engage with customers through targeted messaging campaigns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon Simple Email Service (SES):&lt;/strong&gt; A cost-effective service for sending and receiving emails at scale.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon QuickSight:&lt;/strong&gt; A business analytics service that provides rich visualizations and insights, enabling data-driven decision-making.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Understanding these AWS tools and services is critical for effectively managing cloud environments while supporting the operational and business needs of an organization. As I build my cloud expertise, these insights will be invaluable in designing robust, scalable solutions that cater to both governance and business efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This week’s focus on &lt;strong&gt;AWS Organizations, governance, and business-centric services&lt;/strong&gt; has expanded my understanding of how to manage and optimize cloud environments from both a technical and business perspective. I’m eager to continue learning and applying these concepts to create secure, compliant, and efficient cloud solutions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Cloud Journey — Week 13: Containers &amp; Orchestration!</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 14:47:16 +0000</pubDate>
      <link>https://forem.com/asif_khan/my-cloud-journey-week-13-containers-orchestration-2do0</link>
      <guid>https://forem.com/asif_khan/my-cloud-journey-week-13-containers-orchestration-2do0</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Hello Dev Community,&lt;/p&gt;

&lt;p&gt;This week was focused on &lt;strong&gt;containers and orchestration technologies&lt;/strong&gt; as part of my journey to becoming a Cloud Engineer. These tools and concepts are becoming increasingly vital in modern cloud computing, and here’s what I learned:&lt;/p&gt;

&lt;h2&gt;
  
  
  Containerization Basics
&lt;/h2&gt;

&lt;p&gt;I started by exploring the foundational concepts of containerization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VMs vs. Containers:&lt;/strong&gt; I learned the key differences between Virtual Machines (VMs) and Containers. While VMs provide full isolation with separate OS environments, Containers share the host OS kernel, making them lighter, faster, and more efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Microservices vs. Monolithic Architecture:&lt;/strong&gt; I understood how containers support microservices architectures, where applications are broken down into smaller, manageable services that can be independently deployed and scaled, as opposed to monolithic architectures where the entire application is a single unit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Docker Ecosystem
&lt;/h2&gt;

&lt;p&gt;Next, I learned about the &lt;strong&gt;Docker Ecosystem&lt;/strong&gt;, a key player in containerization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker as a PaaS Solution:&lt;/strong&gt; Docker offers a Platform-as-a-Service (PaaS) solution that simplifies the process of developing, shipping, and running applications in containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker CLI, Dockerfile, Docker Compose:&lt;/strong&gt; I gained hands-on experience with Docker CLI for managing containers, Dockerfile for defining container images, and Docker Compose for running multi-container Docker applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Swarm and DockerHub:&lt;/strong&gt; I learned about Docker Swarm for container orchestration and DockerHub as a registry for storing and sharing container images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Container Initiative (OCI):&lt;/strong&gt; I explored the OCI standards that ensure compatibility and standardization across different container runtimes and tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Kubernetes (K8s)
&lt;/h2&gt;

&lt;p&gt;A significant part of the week was dedicated to &lt;strong&gt;Kubernetes (K8s)&lt;/strong&gt;, the leading open-source platform for automating deployment, scaling, and managing containerized applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Understanding Pods:&lt;/strong&gt; I learned that Pods are the smallest deployable units in Kubernetes, typically representing a single instance of a running process in a container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handling Microservices at Scale:&lt;/strong&gt; K8s excels at managing large-scale microservices architectures, providing features like auto-scaling, self-healing, and load balancing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Alternative Container Technologies
&lt;/h2&gt;

&lt;p&gt;In addition to Docker, I explored alternative container technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Podman:&lt;/strong&gt; A daemonless container engine that’s gaining popularity as a Docker alternative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Buildah:&lt;/strong&gt; A tool for building OCI-compliant container images from scratch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skopeo:&lt;/strong&gt; A command-line utility that facilitates various container image operations like copying, signing, and verifying images across different container registries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Container Services
&lt;/h2&gt;

&lt;p&gt;Finally, I focused on &lt;strong&gt;AWS Container Services&lt;/strong&gt;, which are essential for deploying and managing containers in the cloud:&lt;/p&gt;

&lt;h3&gt;
  
  
  Primary Services:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ECS (Elastic Container Service):&lt;/strong&gt; A highly scalable container orchestration service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Fargate:&lt;/strong&gt; A serverless compute engine for containers that allows you to run containers without managing servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EKS (Elastic Kubernetes Service):&lt;/strong&gt; A managed Kubernetes service that simplifies running Kubernetes on AWS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda:&lt;/strong&gt; While not strictly a container service, Lambda is integral to serverless architectures, executing code in response to events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Provisioning and Deployment:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Elastic Beanstalk:&lt;/strong&gt; An easy-to-use service for deploying and scaling web applications and services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App Runner:&lt;/strong&gt; A fully managed service that makes it easy for developers to quickly deploy containerized web applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Copilot CLI:&lt;/strong&gt; A command-line tool that simplifies the process of building, releasing, and operating containerized applications on ECS and Fargate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Supporting Services:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ECR (Elastic Container Registry):&lt;/strong&gt; A fully managed Docker container registry that makes it easy to store, manage, and deploy container images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;X-Ray:&lt;/strong&gt; Helps with debugging and analyzing applications, offering end-to-end views of requests as they travel through your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step Functions:&lt;/strong&gt; Coordinates multiple AWS services into serverless workflows, essential for managing complex containerized applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Containers and orchestration technologies are transforming how we deploy and scale applications in the cloud. Understanding these tools is essential for any Cloud Engineer, as they allow for the design of efficient, scalable, and maintainable cloud architectures. Mastery of containerization optimizes resource utilization and enhances application portability across different environments, making it a critical skill in today’s cloud landscape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This week’s focus on containers and orchestration has provided me with the knowledge to design and manage modern, scalable cloud applications. I’m excited to continue learning and applying these concepts in real-world scenarios.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Cloud Journey — Week 12: Application Integration!</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 14:46:47 +0000</pubDate>
      <link>https://forem.com/asif_khan/my-cloud-journey-week-12-application-integration-552</link>
      <guid>https://forem.com/asif_khan/my-cloud-journey-week-12-application-integration-552</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Hello Dev Community! As I continue my journey to becoming a Cloud Engineer, this week was dedicated to &lt;strong&gt;Application Integration&lt;/strong&gt; within cloud environments. Here’s a detailed summary of what I learned:&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Application Integration
&lt;/h2&gt;

&lt;p&gt;I began by understanding the basics of Application Integration in cloud environments, which is all about enabling different applications and services to communicate and work together seamlessly. In the cloud, this often involves integrating services distributed across various locations and environments, ensuring they work together efficiently and reliably.&lt;/p&gt;

&lt;h2&gt;
  
  
  Queuing &amp;amp; SQS (Simple Queue Service)
&lt;/h2&gt;

&lt;p&gt;One of the first services I explored was &lt;strong&gt;Amazon SQS&lt;/strong&gt;. This service is crucial for decoupling and scaling microservices, distributed systems, and serverless applications. SQS helps manage the message queue between different services, allowing them to function independently and at their own pace. I learned how to use SQS to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decouple services:&lt;/strong&gt; Ensuring that one service’s failure doesn’t impact another.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale applications:&lt;/strong&gt; Allowing components to scale independently based on demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manage workloads:&lt;/strong&gt; Through message queuing, which helps balance load and avoid system overload.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Streaming and Kinesis
&lt;/h2&gt;

&lt;p&gt;Next, I learned about &lt;strong&gt;Amazon Kinesis&lt;/strong&gt;, a service designed for real-time data streaming and analytics. Kinesis enables the processing and analysis of streaming data such as log and event data from applications or social media feeds. Key takeaways include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time data processing:&lt;/strong&gt; Capturing and analyzing streaming data in real-time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use cases:&lt;/strong&gt; Essential for scenarios like real-time dashboards, data lakes, and event-driven applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; Kinesis can scale automatically to handle varying data streams, ensuring consistent performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pub-Sub &amp;amp; SNS (Simple Notification Service)
&lt;/h2&gt;

&lt;p&gt;I then studied the &lt;strong&gt;publish-subscribe (pub-sub)&lt;/strong&gt; messaging pattern with &lt;strong&gt;Amazon SNS&lt;/strong&gt;. SNS allows sending notifications to multiple subscribers, which is vital for building responsive applications that can push updates in real-time. I learned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Message distribution:&lt;/strong&gt; How SNS can distribute messages to different endpoints, such as email, SMS, and HTTP/S.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event-driven architecture:&lt;/strong&gt; Implementing event-driven architectures where various services react to events and notifications in real-time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fanout scenarios:&lt;/strong&gt; Using SNS to fan out messages to multiple queues or applications for parallel processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  API Gateway &amp;amp; Amazon API Gateway
&lt;/h2&gt;

&lt;p&gt;One of the most exciting topics was learning about &lt;strong&gt;Amazon API Gateway&lt;/strong&gt;. This service is used to create, publish, maintain, monitor, and secure APIs at any scale. APIs are the backbone of modern web services, and with API Gateway, I learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create and deploy APIs:&lt;/strong&gt; Set up RESTful APIs and WebSocket APIs to facilitate communication between clients and backend services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; Implement security measures such as authorization and throttling to protect APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and analytics:&lt;/strong&gt; Use built-in monitoring tools to track API performance and usage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  State Machines &amp;amp; AWS Step Functions
&lt;/h2&gt;

&lt;p&gt;I also learned about &lt;strong&gt;AWS Step Functions&lt;/strong&gt;, which allow for the orchestration of microservices and distributed applications using visual workflows. Key insights include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Orchestration:&lt;/strong&gt; Managing the execution of multiple services in a sequence or based on conditions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error handling:&lt;/strong&gt; Step Functions provide robust error handling and retry mechanisms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow visualization:&lt;/strong&gt; Visualizing workflows helps in understanding and optimizing application logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Event Bus &amp;amp; AWS EventBridge
&lt;/h2&gt;

&lt;p&gt;Finally, I explored &lt;strong&gt;AWS EventBridge&lt;/strong&gt;, a service for building event-driven architectures. EventBridge enables the integration of various AWS services and third-party applications, ensuring they can react to events in real-time. I learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event-driven design:&lt;/strong&gt; Build applications that respond to events as they occur, enabling real-time processing and automation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event routing:&lt;/strong&gt; Route events from multiple sources to different targets, including AWS Lambda, SNS, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Third-party integration:&lt;/strong&gt; Connect AWS applications with third-party services for a seamless flow of data and events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Application Integration Services
&lt;/h2&gt;

&lt;p&gt;Throughout the week, I gained insights into various AWS services that facilitate application integration, such as &lt;strong&gt;AWS AppSync&lt;/strong&gt; for GraphQL APIs and &lt;strong&gt;Amazon MQ&lt;/strong&gt; for managed message brokering. These services are essential for ensuring that different parts of an application can communicate and share data efficiently, regardless of where they are hosted or developed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;In modern cloud architecture, seamless application integration is key to building scalable, responsive, and resilient systems. The services and concepts I studied this week are foundational for any Cloud Engineer aiming to design and manage cloud-based applications that are reliable, efficient, and capable of handling the complexities of distributed environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This week’s focus on application integration has equipped me with the knowledge to design more interconnected and scalable cloud solutions. Each service I studied plays a vital role in ensuring that different components of an application can work together seamlessly, making them essential tools for any Cloud Engineer.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Cloud Journey — Week 11: Identity and Security!</title>
      <dc:creator>Asif Khan</dc:creator>
      <pubDate>Tue, 01 Oct 2024 14:36:33 +0000</pubDate>
      <link>https://forem.com/asif_khan/my-cloud-journey-week-11-identity-and-security-l8g</link>
      <guid>https://forem.com/asif_khan/my-cloud-journey-week-11-identity-and-security-l8g</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;As I continue my journey through the AWS Certified Cloud Practitioner (CCP) course, Week 11 has covered crucial aspects of cloud security and identity management. Building on foundational knowledge from previous weeks, I’ve explored advanced concepts essential for any aspiring cloud professional.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero-Trust Model: Redefining Security Paradigms
&lt;/h2&gt;

&lt;p&gt;This week, I learned about the Zero-Trust security model, a concept revolutionizing our approach to cybersecurity in the cloud era.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core Concept:&lt;/strong&gt; The Zero-Trust model operates on the principle of “never trust, always verify.” This approach assumes no trust by default, even within the network perimeter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implementation on AWS:&lt;/strong&gt; AWS provides tools and services that align with the Zero-Trust model, such as AWS Identity and Access Management (IAM), AWS Control Tower, and AWS Network Firewall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Third-Party Applications:&lt;/strong&gt; Explored how the Zero-Trust model extends to interactions with third-party services, ensuring secure communication and access control across diverse cloud environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Identity Management: The Backbone of Cloud Security
&lt;/h2&gt;

&lt;p&gt;A significant portion of this week was dedicated to understanding various aspects of identity management, a critical component in securing cloud resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Directory Services and Active Directory
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Studied AWS Directory Service and its integration with Microsoft Active Directory.&lt;/li&gt;
&lt;li&gt;Learned about AD Connector for extending on-premises directories to AWS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Identity Providers and Single Sign-On (SSO)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Explored the concept of Identity Providers (IdPs) and their role in federated access.&lt;/li&gt;
&lt;li&gt;Studied AWS Single Sign-On (SSO) and its benefits for managing access across multiple AWS accounts and applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LDAP (Lightweight Directory Access Protocol)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Understood the basics of LDAP and its importance in directory services.&lt;/li&gt;
&lt;li&gt;Learned how LDAP integrates with AWS services for authentication and authorization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Multi-Factor Authentication (MFA) and Security Keys
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Studied the importance of MFA in enhancing account security.&lt;/li&gt;
&lt;li&gt;Explored various MFA options supported by AWS, including virtual MFA devices, hardware tokens, and U2F security keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Identity and Access Management (IAM): Fine-Tuning Access Control
&lt;/h2&gt;

&lt;p&gt;This week provided an in-depth look at AWS IAM, a fundamental service for managing access to AWS resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Anatomy of an IAM Policy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Dissected the structure of IAM policies, including elements like Effect, Action, Resource, and Condition.&lt;/li&gt;
&lt;li&gt;Practiced creating and interpreting IAM policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Principle of Least Privilege
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Understood the importance of granting only the permissions necessary for a task.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Account Root User Best Practices
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Studied the risks associated with using the root user account.&lt;/li&gt;
&lt;li&gt;Learned best practices for securing the root user, including enabling MFA and minimizing its use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Single Sign-On (SSO)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Explored how AWS SSO simplifies access management across multiple AWS accounts.&lt;/li&gt;
&lt;li&gt;Learned about integrating AWS SSO with enterprise identity providers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters?
&lt;/h2&gt;

&lt;p&gt;This week’s topics are crucial for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security-First Approach:&lt;/strong&gt; In an era of increasing cyber threats, understanding and implementing robust security measures like the Zero-Trust model is essential.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance and Governance:&lt;/strong&gt; Proper identity management and access control are vital for meeting regulatory requirements and maintaining good governance practices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational Efficiency:&lt;/strong&gt; Mastering IAM and SSO contributes to smoother operations, reducing the risk of security incidents and streamlining user access management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Career Relevance:&lt;/strong&gt; These skills are highly sought after in the cloud computing industry, making them valuable additions to my professional toolkit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This week’s focus on security and identity management has deepened my understanding of how to secure AWS environments effectively. These skills are critical for building and maintaining robust, secure cloud architectures, and I look forward to applying them in real-world scenarios as I continue my AWS journey.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;a href="https://www.linkedin.com/in/asif0108/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;/&lt;a href="https://x.com/asif26073" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;/&lt;a href="https://github.com/Dark-Cookie" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>careerdevelopment</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
