<?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: Van Hoang Kha </title>
    <description>The latest articles on Forem by Van Hoang Kha  (@vanhoangkha_2k).</description>
    <link>https://forem.com/vanhoangkha_2k</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%2F1019324%2Feb50521c-15f4-4187-8783-ca5065e9bcae.jpeg</url>
      <title>Forem: Van Hoang Kha </title>
      <link>https://forem.com/vanhoangkha_2k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vanhoangkha_2k"/>
    <language>en</language>
    <item>
      <title>Unlocking the Power of AWS GenAI: A Comprehensive Journey</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Tue, 19 Nov 2024 10:14:40 +0000</pubDate>
      <link>https://forem.com/aws-builders/unlocking-the-power-of-aws-genai-a-comprehensive-journey-4a85</link>
      <guid>https://forem.com/aws-builders/unlocking-the-power-of-aws-genai-a-comprehensive-journey-4a85</guid>
      <description>&lt;p&gt;Are you ready to harness the transformative potential of Generative AI (GenAI) but feeling overwhelmed about where to start? The AWS GenAI Journey Repository stands as your comprehensive guide, offering a structured path to implementing GenAI solutions that align perfectly with your business objectives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to AWS GenAI Journey
&lt;/h2&gt;

&lt;p&gt;The AWS GenAI Journey Repository (&lt;a href="https://github.com/aws-samples/AWS-First-GenAI-Journey" rel="noopener noreferrer"&gt;GitHub Link&lt;/a&gt;) serves as an extensive collection of practical demonstrations and use cases, designed to address common challenges in implementing GenAI solutions. Whether you're looking to integrate GenAI with your existing data infrastructure, enhance recruitment processes, or accelerate development cycles, this repository provides valuable insights and implementation guidelines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon Bedrock: The Foundation of GenAI Innovation
&lt;/h2&gt;

&lt;p&gt;At the core of this initiative lies Amazon Bedrock, a robust platform providing access to industry-leading GenAI models. Key features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Customizable Solutions&lt;/strong&gt;: Access to various models tailored for specific use cases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Optimization&lt;/strong&gt;: Flexible pricing models to balance capability with budget&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enterprise Integration&lt;/strong&gt;: Seamless connectivity with existing data platforms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security &amp;amp; Compliance&lt;/strong&gt;: Built-in features ensuring data protection and regulatory compliance&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Featured Applications and Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Intelligent Stock Market Analysis
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS GenAI Market Sage&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Real-time market data integration&lt;/li&gt;
&lt;li&gt;Advanced trend analysis and forecasting&lt;/li&gt;
&lt;li&gt;Technical and fundamental analysis capabilities&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Practical Demonstrations&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Hoa Phat Analysis&lt;/li&gt;
&lt;li&gt;Apple Technical Analysis&lt;/li&gt;
&lt;li&gt;PNJ Market Analysis&lt;/li&gt;
&lt;li&gt;Integration with Anthropic Claude and LangChain&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Virtual AI Assistants
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Educational Support&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Personalized learning content generation&lt;/li&gt;
&lt;li&gt;Student-teacher interaction enhancement&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Language Processing&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Multilingual translation with context awareness&lt;/li&gt;
&lt;li&gt;Document summarization and analysis&lt;/li&gt;
&lt;li&gt;Report and email content optimization&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Demo Reference&lt;/strong&gt;: &lt;a href="https://www.youtube.com/watch?v=5JpeWmbHMi0" rel="noopener noreferrer"&gt;Educational Assistant Demo&lt;/a&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Advanced Computer Vision Applications
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude 3 Integration&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Processing capability up to 200K tokens&lt;/li&gt;
&lt;li&gt;Comprehensive image analysis&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Key Features&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Product description generation from images&lt;/li&gt;
&lt;li&gt;PRIZM content-based analysis&lt;/li&gt;
&lt;li&gt;Content moderation for sensitive material&lt;/li&gt;
&lt;li&gt;Automated code generation (Selenium, ReactJS, Angular)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. HR Assistant Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resume Processing&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Automated resume scanning and evaluation&lt;/li&gt;
&lt;li&gt;Role-specific suitability analysis&lt;/li&gt;
&lt;li&gt;Structured candidate evaluation system&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Benefits&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Reduced manual processing time&lt;/li&gt;
&lt;li&gt;Improved candidate matching&lt;/li&gt;
&lt;li&gt;Standardized evaluation metrics&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Repository Growth and Future Potential
&lt;/h2&gt;

&lt;p&gt;The AWS GenAI Journey Repository currently hosts nearly 50 diverse demos, with regular updates and additions. This growing collection represents AWS's commitment to advancing GenAI applications across various industries and use cases.&lt;/p&gt;

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

&lt;p&gt;To begin your GenAI journey:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit the &lt;a href="https://github.com/aws-samples/AWS-First-GenAI-Journey" rel="noopener noreferrer"&gt;AWS GenAI Journey Repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Review the documentation and requirements&lt;/li&gt;
&lt;li&gt;Select a use case that aligns with your needs&lt;/li&gt;
&lt;li&gt;Follow the implementation guidelines&lt;/li&gt;
&lt;li&gt;Leverage the community support and resources&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;The AWS GenAI Journey Repository represents more than just a collection of demos – it's a comprehensive resource for organizations looking to leverage the power of GenAI. Whether you're just starting your GenAI journey or looking to expand your existing capabilities, this repository provides the tools, guidance, and practical examples needed to succeed in the rapidly evolving landscape of artificial intelligence.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Note: For the most up-to-date information and additional resources, visit the official repository at &lt;a href="https://github.com/aws-samples/AWS-First-GenAI-Journey" rel="noopener noreferrer"&gt;https://github.com/aws-samples/AWS-First-GenAI-Journey&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>genai</category>
      <category>bedrock</category>
      <category>ai</category>
      <category>aws</category>
    </item>
    <item>
      <title>Deployment of the GenAI-Educational-Assistant Streamlit App on AWS EC2 using Visual Studio Code (VSC)</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Mon, 19 Aug 2024 08:40:53 +0000</pubDate>
      <link>https://forem.com/aws-builders/production-and-deployment-of-the-genai-educational-assistant-streamlit-app-on-aws-ec2-using-visual-studio-code-vsc-19e5</link>
      <guid>https://forem.com/aws-builders/production-and-deployment-of-the-genai-educational-assistant-streamlit-app-on-aws-ec2-using-visual-studio-code-vsc-19e5</guid>
      <description>&lt;h4&gt;
  
  
  &lt;strong&gt;Introduction: The Dream of a Young Coder&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Once upon a time, in a bustling city brimming with technology enthusiasts and aspiring developers, there was a young coder named Kha. Ever since discovering the wonders of artificial intelligence (AI), Kha had been deeply fascinated by its potential to transform lives, especially in the field of education. With an insatiable curiosity, Kha dove into learning everything about AI—machine learning algorithms, natural language processing (NLP), and the vast possibilities of cloud computing. However, Kha wasn’t satisfied with merely acquiring knowledge; the true dream was to build something impactful, something that could help students worldwide learn more effectively.&lt;/p&gt;

&lt;p&gt;Kha envisioned a virtual educational assistant—powered by generative AI—that could provide personalized learning experiences, answer complex questions, and guide students through challenging topics. The idea was simple yet profound: an AI assistant that could be accessed by anyone, anywhere, providing tailored educational support. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Discovering the Power of Amazon Web Services&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;One evening, while browsing through an online forum dedicated to AI enthusiasts, Kha stumbled upon a discussion about Amazon Web Services (AWS) and its potential for deploying AI applications. Intrigued, Kha spent the next few days researching AWS services, quickly realizing that AWS was the perfect platform to bring the GenAI-Educational-Assistant to life. The scalable and flexible infrastructure of AWS, combined with its vast array of AI and machine learning services, provided everything needed to build, deploy, and manage a powerful AI-driven application.&lt;/p&gt;

&lt;p&gt;With renewed enthusiasm, Kha embarked on the journey to create the GenAI-Educational-Assistant. The first step was setting up an environment where the AI could be developed, tested, and eventually deployed. After careful consideration, Kha chose Amazon Bedrock, an AWS service designed specifically for deploying generative AI applications. Bedrock provided a comprehensive suite of tools and pre-trained models that could be customized for the educational assistant, saving valuable development time.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Setting Up the AWS Environment&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Kha began by logging into the AWS Management Console and navigating to Amazon Bedrock. The interface was user-friendly, allowing Kha to quickly select and deploy pre-trained models suitable for educational content generation. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. **Launch Bedrock and Set Up the Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha started by accessing Amazon Bedrock from the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Selected a pre-trained model from the available options tailored to NLP tasks.&lt;/li&gt;
&lt;li&gt;Created a new project within Bedrock, which would serve as the workspace for developing the GenAI-Educational-Assistant.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Configure Security and Permissions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensured that the necessary IAM roles were in place, granting the application the required permissions to access and use other AWS services.&lt;/li&gt;
&lt;li&gt;Configured security groups to restrict access to only the necessary ports and IP addresses, thereby enhancing the security of the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Deploying a Development Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using an Amazon EC2 instance, Kha set up a development environment. This instance would be used to code, test, and deploy updates to the GenAI-Educational-Assistant.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Developing the GenAI-Educational-Assistant&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;With the environment set up, Kha began the development process. The first task was to create the core logic of the educational assistant, focusing on how it would generate responses to students' queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Cloning the Project Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha cloned the project repository from GitHub, which contained the foundational code for the assistant.&lt;/li&gt;
&lt;li&gt;This included Python scripts that would handle user inputs, query the AI models hosted on Amazon Bedrock, and generate appropriate responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Customizing the Pre-trained Models:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha used Amazon Bedrock’s customization capabilities to fine-tune the pre-trained models. This involved feeding the models with educational datasets to improve their accuracy and relevance to students' needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Developing the User Interface:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For the front end, Kha chose Streamlit, a Python-based framework that allowed for quick development of interactive web applications.&lt;/li&gt;
&lt;li&gt;The Streamlit app was designed to be intuitive, with a simple interface where students could input their questions and receive detailed, AI-generated explanations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Deploying and Testing the Application&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;After weeks of development, it was time to deploy the GenAI-Educational-Assistant for testing. Kha decided to run the application on the EC2 instance to simulate real-world usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Running the Streamlit Application:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The application was started on the EC2 instance, with the Streamlit app running on port 8080. &lt;/li&gt;
&lt;li&gt;Kha accessed the application through the instance’s public IP, testing various features to ensure everything was functioning as expected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Testing and Optimization:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha tested the application by inputting various educational queries, observing how well the AI-generated responses met the needs of different educational levels.&lt;/li&gt;
&lt;li&gt;Based on feedback from initial testing, Kha made adjustments to the model parameters and optimized the Python code to improve performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4: Preparing for Production Launch&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Satisfied with the performance of the application, Kha began preparing for a public launch. This involved scaling the infrastructure to handle increased traffic and ensuring that the application was secure and reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Scaling the EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha upgraded the EC2 instance to a more powerful type to handle more simultaneous users.&lt;/li&gt;
&lt;li&gt;Configured Auto Scaling to automatically adjust the number of instances based on user demand, ensuring the application remained responsive even during peak usage times.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Implementing Security Best Practices:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To protect user data, Kha implemented SSL encryption, ensuring that all communications between users and the server were secure.&lt;/li&gt;
&lt;li&gt;Additional security measures, such as setting up a Web Application Firewall (WAF) and enabling DDoS protection, were put in place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Monitoring and Maintenance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS CloudWatch was set up to monitor the application’s performance, with alerts configured for any unusual activity.&lt;/li&gt;
&lt;li&gt;Kha also set up regular backups and implemented a disaster recovery plan to ensure the application’s availability in case of any issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5: Launch and Beyond&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The day finally arrived when Kha was ready to launch the GenAI-Educational-Assistant to the public. The application was made available to students and educators worldwide, who quickly began to benefit from its capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Initial Reception:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The response was overwhelmingly positive. Students appreciated the personalized learning experience, while educators found the tool invaluable for supplementing their teaching materials.&lt;/li&gt;
&lt;li&gt;The AI-driven assistant quickly became a trusted resource, helping students understand complex subjects with ease.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Continuous Improvement:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kha remained committed to improving the application, regularly updating the AI models with new educational content and adding new features based on user feedback.&lt;/li&gt;
&lt;li&gt;The success of the GenAI-Educational-Assistant inspired Kha to explore other potential applications of generative AI, leading to new projects and innovations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Conclusion: The Impact of a Dream Realized&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Months after the launch, Kha received numerous messages of gratitude from students and educators alike. One message, in particular, stood out—a student from a remote area, who had limited access to educational resources, shared how the GenAI-Educational-Assistant had transformed their learning experience.&lt;/p&gt;

&lt;p&gt;"Thank you for creating this assistant," the message read. "It has changed my life."&lt;/p&gt;

&lt;p&gt;Kha knew that the journey was far from over. The GenAI-Educational-Assistant would continue to grow, evolve, and impact countless lives around the world. And it all started with a dream, a passion for AI, and the powerful tools provided by Amazon Web Services.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step-by-Step Deployment Guide: Building Your Own GenAI-Educational-Assistant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now that you’ve followed Kha’s story, you might be inspired to create your own AI-driven application. Below is a detailed step-by-step guide to help you deploy the GenAI-Educational-Assistant using Amazon Bedrock and other AWS services.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account:&lt;/strong&gt; Ensure you have an active AWS account.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role/Policy:&lt;/strong&gt; Attach an appropriate IAM role with permissions for necessary AWS services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Group:&lt;/strong&gt; Ensure the security group attached to your EC2 instance allows inbound traffic on port &lt;code&gt;22&lt;/code&gt; for SSH and port &lt;code&gt;8080&lt;/code&gt; for the Streamlit app.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Launch and Connect to the EC2 Instance&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Launch EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the EC2 dashboard on AWS Management Console.&lt;/li&gt;
&lt;li&gt;Launch an EC2 instance using a Linux AMI.&lt;/li&gt;
&lt;li&gt;Choose an instance type, e.g., &lt;code&gt;t2.micro&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Configure the instance details, and attach the necessary IAM role.&lt;/li&gt;
&lt;li&gt;Configure security group settings, allowing inbound traffic on ports &lt;code&gt;22&lt;/code&gt; (SSH) and &lt;code&gt;8080&lt;/code&gt; (Streamlit).&lt;/li&gt;
&lt;li&gt;Review and launch the instance.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect to the EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use SSH to connect to your EC2 instance from your local machine:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; ssh &lt;span class="nt"&gt;-i&lt;/span&gt; /path/to/your-key.pem ec2-user@your-ec2-public-ip
&lt;/code&gt;&lt;/pre&gt;

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

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Set Up Your Environment on EC2&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Python:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure Python 3 is installed on the EC2 instance:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;python3 &lt;span class="nt"&gt;-y&lt;/span&gt;  &lt;span class="c"&gt;# For Amazon Linux&lt;/span&gt;
 &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;python3 &lt;span class="nt"&gt;-y&lt;/span&gt;  &lt;span class="c"&gt;# For Ubuntu&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set Up Python Virtual Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;code&gt;virtualenv&lt;/code&gt; and create a virtual environment:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;virtualenv
 virtualenv venv
 &lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install AWS CLI:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the AWS CLI to interact with AWS services:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; curl &lt;span class="s2"&gt;"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"awscliv2.zip"&lt;/span&gt;
 unzip awscliv2.zip
 &lt;span class="nb"&gt;sudo&lt;/span&gt; ./aws/install
 aws configure
&lt;/code&gt;&lt;/pre&gt;

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

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Clone the Repository and Install Dependencies&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clone the Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone the GenAI-Educational-Assistant repository from GitHub to your EC2 instance:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; git clone https://github.com/awsstudygroup/GenAI-Educational-Assistant.git
 &lt;span class="nb"&gt;cd &lt;/span&gt;GenAI-Educational-Assistant
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Required Python Packages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the dependencies listed in the &lt;code&gt;requirements.txt&lt;/code&gt; file:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; pip3 &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

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

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

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Run the Streamlit App:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start the Streamlit application on port &lt;code&gt;8080&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; streamlit run Home.py &lt;span class="nt"&gt;--server&lt;/span&gt;.port 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access the Application:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your browser and navigate to &lt;code&gt;http://your-ec2-public-ip:8080&lt;/code&gt; to view and interact with the Streamlit app.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5: Develop and Manage the Application using Visual Studio Code (VSC)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set Up VSC for Remote Development:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the &lt;a href="https://code.visualstudio.com/docs/remote/ssh" rel="noopener noreferrer"&gt;Remote - SSH&lt;/a&gt; extension in VSC.&lt;/li&gt;
&lt;li&gt;Connect to your EC2 instance using VSC by configuring the SSH settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Develop and Test:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can now use VSC to develop and manage the GenAI-Educational-Assistant application directly on your EC2 instance. Any changes you make can be tested by rerunning the Streamlit app.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 6: Secure and Optimize the Deployment&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security Enhancements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure the security group rules are tightened to allow only necessary traffic.&lt;/li&gt;
&lt;li&gt;Consider using an SSL certificate if deploying for production purposes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cost Optimization:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitor the EC2 instance's usage and consider using Spot Instances or setting up Auto Scaling for cost efficiency.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 7: Monitoring and Maintenance&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Monitoring:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use AWS CloudWatch to monitor the performance and logs of the EC2 instance and the Streamlit app.&lt;/li&gt;
&lt;li&gt;Set up alarms for any critical metrics.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Updates and Maintenance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Regularly pull updates from the GitHub repository and update dependencies to maintain security and functionality.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;By following these steps, you’ll be able to deploy a GenAI-Educational-Assistant using Amazon Bedrock and other AWS services, creating a scalable, secure, and impactful educational tool. Whether you're a student, educator, or developer, this application demonstrates the transformative potential of generative AI in education, paving the way for a more personalized and accessible learning experience for all.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>bedrock</category>
      <category>genai</category>
      <category>awscommunitybuilder</category>
    </item>
    <item>
      <title>Technical Analyst Stock Markets</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Sun, 18 Aug 2024 18:03:27 +0000</pubDate>
      <link>https://forem.com/aws-builders/technical-analyst-stock-markets-1oed</link>
      <guid>https://forem.com/aws-builders/technical-analyst-stock-markets-1oed</guid>
      <description>&lt;p&gt;In the fast-paced world of stock market analysis, where every tick of the clock can mean profit or loss, having the right tools at your disposal is crucial. For technical analysts, who rely heavily on data-driven insights, the "Technical Analyst Stock Markets" application can be a game-changer. However, to ensure that this application delivers real-time data and insights seamlessly, it must be deployed on a robust and scalable platform. This is where Amazon Web Services (AWS) and its Elastic Compute Cloud (EC2) service come into play.&lt;/p&gt;

&lt;p&gt;Deploying a powerful Streamlit app on AWS EC2 using Visual Studio Code (VSC) ensures that the application is not only functional but also scalable, secure, and ready for production. Let's embark on this step-by-step journey of deploying the "Technical Analyst Stock Markets" application on AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Journey Begins: Launching an EC2 Instance
&lt;/h3&gt;

&lt;p&gt;Our deployment journey begins with launching an EC2 instance, the foundation of any scalable application on AWS. Imagine yourself in the AWS Management Console, where you navigate to the EC2 dashboard with the goal of setting up a production-grade instance that will host your Streamlit app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Choose an AMI and Instance Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You start by selecting the &lt;strong&gt;Ubuntu Server 22.04 LTS&lt;/strong&gt; Amazon Machine Image (AMI). This choice is crucial as Ubuntu provides long-term support, ensuring stability and reliability for your application. Next, you choose the instance type. For initial testing, a &lt;strong&gt;t2.micro&lt;/strong&gt; instance might suffice, but anticipating the load your application will handle once live, you opt for a &lt;strong&gt;t3.medium&lt;/strong&gt; instance. This instance type provides a good balance of compute power and memory, making it ideal for handling the demands of a real-time analytics app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Configure Instance Details&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You proceed to configure the instance details, making sure to enable the Auto-assign Public IP option. This step is vital as it ensures your instance will be accessible over the internet, allowing users to interact with your app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Set Up Security Groups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security is paramount. You create a security group that opens &lt;strong&gt;port 22&lt;/strong&gt; for SSH access, which is necessary for managing your instance remotely. You also open &lt;strong&gt;port 8080&lt;/strong&gt; for the Streamlit app, allowing users to access the application via a web browser. A single misconfiguration here could expose your app to vulnerabilities, so you double-check every setting before proceeding.&lt;/p&gt;

&lt;p&gt;Satisfied with your configurations, you launch the instance and download the SSH key pair that will allow you to securely connect to the EC2 instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting the Dots: Accessing EC2 via Visual Studio Code
&lt;/h3&gt;

&lt;p&gt;With your EC2 instance up and running, the next task is to connect to it. Visual Studio Code (VSC) comes into play here, not just as an Integrated Development Environment (IDE) but as a bridge between local development and cloud deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Install the Remote - SSH Extension&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In VSC, you install the &lt;strong&gt;Remote - SSH&lt;/strong&gt; extension. This extension allows you to manage your EC2 instance directly from within VSC, streamlining the development and deployment process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Connect to EC2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You initiate a new SSH connection in VSC using the SSH key pair you downloaded earlier. The connection string is something like &lt;code&gt;ec2-user@&amp;lt;EC2_PUBLIC_IP&amp;gt;&lt;/code&gt;. Once connected, the command line interface of your EC2 instance is accessible right from VSC, making it feel like an extension of your local environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building the Foundation: Setting Up Python on EC2
&lt;/h3&gt;

&lt;p&gt;Now that you’re connected to your EC2 instance, it’s time to prepare the environment for your Streamlit app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Update and Upgrade the System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first command you run is to update and upgrade the system packages. This ensures that your instance has the latest security patches and software updates, providing a stable foundation for your deployment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7: Install Python and Virtual Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, you install Python, which is the backbone of your Streamlit app. Alongside Python, you also install &lt;code&gt;python3-venv&lt;/code&gt; to create a virtual environment that isolates your app’s dependencies from the system’s global Python environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;python3-pip python3-dev &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;python3-venv &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8: Clone the Repository and Set Up the Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With Python installed, you clone your app’s repository from GitHub. After navigating to the app’s directory, you create and activate a virtual environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/vanhoangkha/Technical-Analyst-Stock-Markets.git
&lt;span class="nb"&gt;cd &lt;/span&gt;Technical-Analyst-Stock-Markets
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv &lt;span class="nb"&gt;env
source env&lt;/span&gt;/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the virtual environment is active, you install the required Python packages listed in the &lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Moment of Truth: Deploying and Running the Streamlit App
&lt;/h3&gt;

&lt;p&gt;With the environment ready, it’s time to deploy the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 9: Run the Streamlit App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You run the Streamlit app on port 8080. This is the moment where all your preparations come together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;streamlit run Home.py &lt;span class="nt"&gt;--server&lt;/span&gt;.port 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your web browser, you enter the public IP of your EC2 instance followed by &lt;code&gt;:8080&lt;/code&gt; and press Enter. The "Technical Analyst Stock Markets" app loads, displaying a sleek interface with real-time stock market data and analytics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fortifying the Castle: Configuring EC2 for Production
&lt;/h3&gt;

&lt;p&gt;Deploying the app is only half the battle. To ensure your application is truly production-ready, you must configure the EC2 instance for long-term use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 10: Use Nohup to Keep the App Running&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You use &lt;code&gt;nohup&lt;/code&gt; to keep the Streamlit app running in the background, even after you close the SSH session.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;nohup &lt;/span&gt;streamlit run Home.py &lt;span class="nt"&gt;--server&lt;/span&gt;.port 8080 &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 11: Implement Security and Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To secure your application, you consider setting up Nginx as a reverse proxy, which will enable SSL for secure HTTPS connections. Additionally, you configure AWS CloudWatch to monitor the instance’s performance, ensuring that any issues are promptly addressed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 12: Optimize Costs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, to optimize costs, you implement a strategy to stop the EC2 instance when it’s not in use, reducing unnecessary expenses. You also explore the possibility of using Spot Instances to further cut down on costs while maintaining scalability.&lt;/p&gt;

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

&lt;p&gt;As you close your browser and reflect on the journey, you realize that deploying the "Technical Analyst Stock Markets" app was more than just a technical task. It was about building a robust, secure, and scalable environment capable of delivering real-time insights to analysts who depend on them. Every step, from launching the EC2 instance to configuring it for production, was a crucial part of the process. The app is now live, ready to help analysts navigate the complexities of the stock market, turning data into actionable insights. This journey is a testament to the power of cloud computing and the impact it can have on the financial world.&lt;/p&gt;

</description>
      <category>genai</category>
      <category>bedrock</category>
      <category>awscommunitybuilder</category>
    </item>
    <item>
      <title>Step by Step: Build a Membership Website with Amplify, Stripe, and Next.js</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Sat, 25 Mar 2023 22:29:44 +0000</pubDate>
      <link>https://forem.com/aws-builders/step-by-step-build-a-membership-website-with-amplify-stripe-and-nextjs-p4e</link>
      <guid>https://forem.com/aws-builders/step-by-step-build-a-membership-website-with-amplify-stripe-and-nextjs-p4e</guid>
      <description>&lt;h2&gt;
  
  
  Content of Table:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Introduce&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create a Copy of the Design Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create an Amplify Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Setup a Next.js Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Pull Components from Amplify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Bind Data to the Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Build the Website Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create a Checkout Flow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create User Accounts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Authenticate the Customers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Create a Copy of the Design Project
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kick off a design project using the Amplify template&lt;/li&gt;
&lt;li&gt;Theme the design to your taste&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Creating the Project Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to make a copy of this &lt;a href="https://www.figma.com/community/file/1166264876424501672" rel="noopener noreferrer"&gt;design file&lt;/a&gt; to get started. The design was created by cloning the official AWS Amplify UI template and adding a different theme.&lt;/p&gt;

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

&lt;p&gt;We can see the design was created, you can zoom to show clearly :&lt;/p&gt;

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

&lt;p&gt;Even though we’ll use the customized design file for this project, let’s also see how to use the official UI library for future projects.&lt;/p&gt;

&lt;p&gt;1.So, in &lt;a href="https://www.figma.com/community" rel="noopener noreferrer"&gt;the Figma community&lt;/a&gt;, search for &lt;strong&gt;AWS Amplify UI Kit&lt;/strong&gt; and open the kit maintained by the AWS Amplify Team.&lt;/p&gt;

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

&lt;p&gt;2.Choose figma name &lt;code&gt;AWS Amplify UI Kit&lt;/code&gt; of &lt;strong&gt;AWS Amplify&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;3.Click the &lt;code&gt;Get a copy&lt;/code&gt; button to create a copy of the AWS Amplify UI project into our Figma account.&lt;/p&gt;

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

&lt;p&gt;The AWS Amplify project contains the following pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A readme&lt;/strong&gt;: describes the UI project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Primitives&lt;/strong&gt;: like buttons and form controls that make up the component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;My Components&lt;/strong&gt;: these are reusable components composed of primitives that we can drop on our website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;: this page shows how to use the components.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Editing the Project design theme&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can change the default theme of the official UI template; to do that, we need to install the AWS Amplify theme editor from the Figma community page.&lt;/p&gt;

&lt;p&gt;1.Let's search &lt;code&gt;Amplify theme&lt;/code&gt;for the AWS Amplify and open it, click the &lt;strong&gt;plugin&lt;/strong&gt; tab and click &lt;strong&gt;try it out&lt;/strong&gt; it.&lt;/p&gt;

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

&lt;p&gt;2.Click &lt;code&gt;Primitives&lt;/code&gt; and Press the command + / keyboard keys to bring up the Figma command palette back to the Figma project. &lt;/p&gt;

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

&lt;p&gt;3.Let's click &lt;code&gt;Component&lt;/code&gt; for the AWS theme editor and open it, navigate to the components tab and search for &lt;code&gt;button.primary&lt;/code&gt;. And set up the color (you can choose like picture). Then click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;4.When save, we should see that we updated the color of the button on the primitives' page.&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amplify recommends that we don't change the primitives directly; the components' artboards are locked to prevent accidentally changing the Components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The primitives have a one-to-one mapping with the AWS Amplify React UI library, which we'll use when pulling the component into our react project. Changing the primitives will make it fall out of sync with the React UI library.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Amplify will always give us an object containing the themes we are using. We can then pass it to the React UI library to customize it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the components page, you should see that all button colors have been updated accordingly, the same thing on the example page&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The Design We'll Use&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of Official Amplify UI Kit in this project, we'll use an already &lt;a href="https://www.figma.com/file/jTMpPiejnjoLihTv663mxa/Membership-Website-for-Amplify-Learn?node-id=1330%3A11587" rel="noopener noreferrer"&gt;customized one&lt;/a&gt; that suits our membership website. The following is what was edited:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On the Primitives page&lt;/strong&gt; - the button color was changed to orange and the background color to dark blue, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Components page&lt;/strong&gt; - utilizes the customized theme and creates the following components:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Hero component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The testimony component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The story component&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Nav Component and the Footer component.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On the Examples page&lt;/strong&gt; - a complete website was built using the components. The website includes a landing page and a paywall-protected page.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you will learn how to setup an Amplify project.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create an Amplify Project
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create an Amplify project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setup authentication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add data model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generate fake data for your model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import the components from Figma&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Creating an Amplify Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Log in to the &lt;a href="https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fconsole.aws.amazon.com%2Fconsole%2Fhome%3Ffromtb%3Dtrue%26hashArgs%3D%2523%26isauthcode%3Dtrue%26nc2%3Dh_ct%26src%3Dheader-signin%26state%3DhashArgsFromTB_us-west-2_6e278d73bcc5ae1c&amp;amp;client_id=arn%3Aaws%3Asignin%3A%3A%3Aconsole%2Fcanvas&amp;amp;forceMobileApp=0&amp;amp;code_challenge=PgNDA_jabFgNlsf536dB-Iv28VbObJsEl1xOr_0-4nE&amp;amp;code_challenge_method=SHA-256" rel="noopener noreferrer"&gt;AWS&lt;/a&gt; console, or create an account &lt;a href="https://portal.aws.amazon.com/gp/aws/developer/registration/index.html?nc1=f_ct&amp;amp;src=default" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Search for &lt;code&gt;AWS Amplify&lt;/code&gt; from the search bar and select it from the list of services.&lt;/p&gt;

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

&lt;p&gt;Click &lt;strong&gt;Get Start&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Next, click on the &lt;strong&gt;Get Start&lt;/strong&gt; in item &lt;strong&gt;Build an app&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Give a name &lt;code&gt;membership-website&lt;/code&gt; to the application and click the &lt;strong&gt;Confirm deployment&lt;/strong&gt; button.&lt;/p&gt;

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

&lt;p&gt;Wait  to setting up&lt;/p&gt;

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

&lt;p&gt;After the deployment process, click on the &lt;strong&gt;Launch studio&lt;/strong&gt; button to launch a staging studio in a new tab.&lt;/p&gt;

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

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

&lt;p&gt;In the Amplify studio, we'll add authentication to the project, model a database and deploy it, add contents to the database, and import UI components from Figma using the UI builder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the &lt;strong&gt;authentication&lt;/strong&gt; tab since we need only signed-in users to access our content. The login mechanism stays the same; then, in configuring the sign-up section, click the password protection setting and make the password as strong or weak as possible.&lt;/p&gt;

&lt;p&gt;Uncheck all other checkboxes except the &lt;strong&gt;Include lowercase characters&lt;/strong&gt; checkbox and click &lt;strong&gt;Deploy&lt;/strong&gt; to deploy the authentication.&lt;/p&gt;

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

&lt;p&gt;Next click in &lt;strong&gt;Confirm deployment&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;This deployment can take a few minutes&lt;/p&gt;

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

&lt;p&gt;If successfully it will show&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Creating Data Model&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Navigate to the &lt;strong&gt;data&lt;/strong&gt; section and create the following data models:&lt;/p&gt;

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

&lt;p&gt;Testimonial - this will have the id, name, avatar, and testimony fields.&lt;/p&gt;

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

&lt;p&gt;Post - this will have the id, title, body, and description fields and also a readTime field with the type of integer.&lt;/p&gt;

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

&lt;p&gt;After creating the models and adding fields click the &lt;strong&gt;Save and Deploy&lt;/strong&gt; button to deploy the database.&lt;/p&gt;

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

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

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

&lt;p&gt;&lt;strong&gt;Adding Content to the Data Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add this page we will see&lt;/p&gt;

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

&lt;p&gt;Navigate to the &lt;strong&gt;content&lt;/strong&gt; section, select either the &lt;strong&gt;Testimonial&lt;/strong&gt; or the Post table from the select table dropdown, and click on &lt;strong&gt;Auto-generate seed data&lt;/strong&gt;.&lt;/p&gt;

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

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

&lt;p&gt;For the &lt;strong&gt;Testimonial&lt;/strong&gt; table, set rows to 6, add constraints like in the below and click the &lt;strong&gt;Generate data&lt;/strong&gt; button:&lt;/p&gt;

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

&lt;p&gt;After generating the data, we can then update the avatar fields with desired avatar URLs. &lt;/p&gt;

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

&lt;p&gt;Set the rows to 10 for the Post table, add &lt;strong&gt;constraints&lt;/strong&gt;, and click the &lt;strong&gt;Generate data&lt;/strong&gt; button to seed the table.&lt;/p&gt;

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

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

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

&lt;p&gt;&lt;strong&gt;Importing UI Components from Figma&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We'll import the customized design from Figma into Amplify Studio, grab the &lt;a href="https://www.figma.com/file/jTMpPiejnjoLihTv663mxa/Membership-Website-for-Amplify-Learn?node-id=1330%3A11587" rel="noopener noreferrer"&gt;URL&lt;/a&gt; from Figma, and navigate the &lt;strong&gt;UI Library&lt;/strong&gt; tab.&lt;/p&gt;

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

&lt;p&gt;Next, click the &lt;strong&gt;Get Started&lt;/strong&gt; button and paste the &lt;a href="https://www.figma.com/file/jTMpPiejnjoLihTv663mxa/Membership-Website-for-Amplify-Learn?node-id=1330%3A11587" rel="noopener noreferrer"&gt;Figma design URL&lt;/a&gt; in the input field and click on &lt;strong&gt;Continue&lt;/strong&gt;.&lt;/p&gt;

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

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

&lt;p&gt;After successfully importing the Figma components, click on &lt;strong&gt;Accept all changes&lt;/strong&gt;.&lt;/p&gt;

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

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

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

&lt;p&gt;Next, click on &lt;strong&gt;Accept all&lt;/strong&gt; to accept all the imported components.&lt;/p&gt;

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

&lt;p&gt;Now, we have all the components in the Amplify project the same way they are in Figma.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, we'll setup a Next.js project.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Setup a Next.js Project
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup a Next.js project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Setting Up a Next.js Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a new Next.js application, let's run the following commands in our terminal:&lt;/p&gt;

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

npx create-next-app membership-website


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

&lt;/div&gt;

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

&lt;p&gt;After creating the application, we'll navigate into the project directory with the command below:&lt;/p&gt;

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

cd membership-website


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

&lt;/div&gt;

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

&lt;p&gt;Next, install the following dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/aws-amplify" rel="noopener noreferrer"&gt;aws-amplify&lt;/a&gt; - to give us access to the amplify SDK&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@aws-amplify/ui-react" rel="noopener noreferrer"&gt;@aws-amplify/ui-react&lt;/a&gt; - this dependency has a one-to-one mapping with the primitive's page in our Figma UI design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@fontsource/inter" rel="noopener noreferrer"&gt;@fontsource/inter&lt;/a&gt; - so we can tweak the fonts of our project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The command below will install the above dependencies:&lt;/p&gt;

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

npm install aws-amplify @aws-amplify/ui-react @fontsource/inter


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

&lt;/div&gt;

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

&lt;p&gt;A few final steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;code&gt;reset.css&lt;/code&gt; file inside the &lt;strong&gt;styles&lt;/strong&gt; folder in the root directory.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Copy the &lt;code&gt;globals.css&lt;/code&gt; properties and paste it inside the &lt;strong&gt;reset.css&lt;/strong&gt; file.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Delete the styles in the &lt;strong&gt;globals.css&lt;/strong&gt; and add a background color of &lt;code&gt;#091B2A&lt;/code&gt; to the body.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, pull all the UI components and data model from Figma into the new Next.js project.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Pull Components from Amplify
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Pull components and model from Amplify&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test the components&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pulling Components from AWS Amplify&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To pull Amplify components down to the Next.js application, we should have the AWS &lt;a href="https://docs.amplify.aws/cli/" rel="noopener noreferrer"&gt;Command Line Interface&lt;/a&gt; installed in the local machine and authorized.&lt;/p&gt;

&lt;p&gt;Install the AWS CLI with the following command:&lt;/p&gt;

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

npm install -g @aws-amplify/cli


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

&lt;/div&gt;

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

&lt;p&gt;Click on &lt;strong&gt;Local setup instructions&lt;/strong&gt;, copy the pull command and run it in the terminal in the Studio.&lt;/p&gt;

&lt;p&gt;Next, authorize the Amplify CLI and follow the prompts below to pull the components, the data models, the authentication and other Amplify settings.&lt;/p&gt;

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

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

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

&lt;p&gt;AWS will add the following folders to the Next.js application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;vscode&lt;/strong&gt; - this houses some AWS to VSCode configurations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;amplify&lt;/strong&gt; - this contains AWS backend configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;models&lt;/strong&gt; - this houses the model schemas&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ui-components&lt;/strong&gt; - this is the most important for our project. It includes all of our Figma designs/components.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we'll import Amplify configurations and wrap the Next.js application with it. To do this, update the &lt;code&gt;_app.js&lt;/code&gt; file with the following snippets:&lt;/p&gt;

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

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

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;../styles/globals.css&lt;/span&gt;&lt;span class="sh"&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="n"&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;aws-amplify&lt;/span&gt;&lt;span class="sh"&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="n"&gt;studioTheme&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;../ui-components&lt;/span&gt;&lt;span class="sh"&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="n"&gt;AmplifyProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@aws-amplify/ui-react/styles.css&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@fontsource/inter&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;../styles/reset.css&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;awsconfig&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;../aws-exports&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&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="n"&gt;awsconfig&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="n"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pageProps&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&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="n"&gt;AmplifyProvider&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;studioTheme&lt;/span&gt;&lt;span class="p"&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="n"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="n"&gt;pageProps&lt;/span&gt;&lt;span class="p"&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="n"&gt;AmplifyProvider&lt;/span&gt;&lt;span class="o"&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="n"&gt;export&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt; &lt;span class="n"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported Amplify from aws-amplify, studioTheme from ui-components, and AmplifyProvider from @aws-amplify/ui-react.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Imported awsconfig from "../aws-exports" and used it to configure Amplify.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wrapped the Components with the AmplifyProvider and passed the studioTheme as the theme prop.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We've successfully connected the AWS backend environment with our Next.js application. To test things out, let's import a component from the &lt;strong&gt;ui-components&lt;/strong&gt; folder in the &lt;code&gt;index.js&lt;/code&gt; file like in the below:&lt;/p&gt;

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

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;react&lt;/span&gt;&lt;span class="sh"&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="n"&gt;Hero&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;../ui-components&lt;/span&gt;&lt;span class="sh"&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="n"&gt;View&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@aws-amplify/ui-react&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&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="n"&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="n"&gt;Hero&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="n"&gt;View&lt;/span&gt;&lt;span class="o"&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="n"&gt;export&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt; &lt;span class="n"&gt;index&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://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9gsz18fho7g60rg6659.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9gsz18fho7g60rg6659.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we imported the &lt;strong&gt;Hero&lt;/strong&gt; component and &lt;strong&gt;View&lt;/strong&gt;, like a wrapper &lt;strong&gt;div&lt;/strong&gt; that wraps elements.&lt;/p&gt;

&lt;p&gt;Next, run the following command to start the development server:&lt;/p&gt;

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

npm run dev #to start the dev server


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

&lt;/div&gt;

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

&lt;p&gt;Next.js will start a development environment at &lt;a href="http://localhost:3000/" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; in the browser; our application would look just like expected:&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you'll learn how to bind data to the components.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Bind Data to the Components
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Bind data to the components&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bind events to the components&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Binding data to Components&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To breathe life into the components, we'll be binding data and events to them in the Amplify Studio. We'll start with the &lt;strong&gt;Nav&lt;/strong&gt; component.&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;UI Library&lt;/strong&gt; tab, click on the &lt;strong&gt;Nav&lt;/strong&gt; and click on &lt;strong&gt;configure&lt;/strong&gt; button to bind data and events to the &lt;strong&gt;Nav&lt;/strong&gt; component.&lt;/p&gt;

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

&lt;p&gt;Next, in configure dialog, click on the component's root &lt;strong&gt;(Nav)&lt;/strong&gt; and click &lt;strong&gt;Add&lt;/strong&gt; prop. We'll create the following top-level props and consume them in the elements with the &lt;strong&gt;Nav&lt;/strong&gt; component.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;username&lt;/strong&gt;: this prop will receive the user names on the website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;authText&lt;/strong&gt;: this prop will display the sign-in or sign-out buttons depending on the user authorization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;avatar&lt;/strong&gt;: this will handle the user avatar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;handleAuth&lt;/strong&gt;: this will handle the authorization event.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;In the &lt;strong&gt;Nav&lt;/strong&gt; component, we want to hide the username if there's no user, so select the user element and click on the &lt;strong&gt;Set prop&lt;/strong&gt; button; beside the child properties.&lt;/p&gt;

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

&lt;p&gt;Select a &lt;code&gt;display&lt;/code&gt; from the list of props, click on the three vertical dots beside it, click on &lt;strong&gt;add conditional&lt;/strong&gt; and add conditions like in the below:&lt;/p&gt;

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

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

&lt;p&gt;For the &lt;strong&gt;avatar&lt;/strong&gt; text, select it, click on the &lt;strong&gt;Set text label&lt;/strong&gt; button and set the &lt;code&gt;label&lt;/code&gt; to the avatar, and for the user name, select it and set its label to the username.&lt;/p&gt;

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

&lt;p&gt;For the button, select it, click on &lt;strong&gt;Set an onClick action&lt;/strong&gt;, select the onClick prop and set its value to &lt;code&gt;handleAuth&lt;/code&gt;. Also, click on &lt;strong&gt;Set prop&lt;/strong&gt;, select &lt;code&gt;label&lt;/code&gt; prop, and set the value to &lt;code&gt;authText&lt;/code&gt;.&lt;/p&gt;

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

&lt;p&gt;For the &lt;strong&gt;Hero&lt;/strong&gt; component, we'll create a top-level prop &lt;code&gt;handleClick&lt;/code&gt; and set its type to an Event handler. Select the &lt;code&gt;Button&lt;/code&gt; element and set its &lt;code&gt;onClick&lt;/code&gt; prop to the &lt;code&gt;handleClick&lt;/code&gt; we created above.&lt;/p&gt;

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

&lt;p&gt;We'll create two top-level props for the &lt;strong&gt;Persuade&lt;/strong&gt; component, &lt;code&gt;handleClick&lt;/code&gt;, and &lt;code&gt;banner&lt;/code&gt;, then set their types to the Event handler and &lt;code&gt;String&lt;/code&gt;.&lt;/p&gt;

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

&lt;p&gt;Next, select the &lt;strong&gt;Button&lt;/strong&gt; element, select the &lt;code&gt;onClick&lt;/code&gt; prop and set it to the &lt;code&gt;handleClick&lt;/code&gt; we created. Select the &lt;code&gt;Banner&lt;/code&gt; element, select the &lt;code&gt;src&lt;/code&gt; prop and set it to the &lt;code&gt;banner&lt;/code&gt; prop we created.&lt;/p&gt;

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

&lt;p&gt;For the &lt;code&gt;Testimony&lt;/code&gt; component, we'll bind data a bit differently; unlike the earlier components, we'll be binding data provisioned in our database to the &lt;code&gt;Testimony&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;Click on the &lt;code&gt;Testimony&lt;/code&gt; Component and click on &lt;strong&gt;configure&lt;/strong&gt;, select the Component's root and click on &lt;strong&gt;Add prop&lt;/strong&gt;, Create a top-level prop &lt;code&gt;testimonyModel&lt;/code&gt;, and set its type to &lt;code&gt;Testimonial&lt;/code&gt; data model. All the elements of the &lt;code&gt;Testimony&lt;/code&gt; Component will have access to the rows in the Testimonial table.&lt;/p&gt;

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

&lt;p&gt;Now, let's set the &lt;strong&gt;Testimony&lt;/strong&gt; Component elements to different rows of the Testimonial data model.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the image element, click on &lt;strong&gt;Set prop,&lt;/strong&gt; select the &lt;strong&gt;src&lt;/strong&gt; prop and set it to &lt;strong&gt;testimonyModel.avatar&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Select the &lt;strong&gt;Author&lt;/strong&gt; element, click on &lt;strong&gt;Set prop,&lt;/strong&gt; select the &lt;strong&gt;label&lt;/strong&gt; prop and set it to &lt;strong&gt;testimonyModel.name&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Select the &lt;strong&gt;Testimony&lt;/strong&gt; text element, click on &lt;strong&gt;Set prop,&lt;/strong&gt; select the &lt;strong&gt;label&lt;/strong&gt; prop and set it to &lt;strong&gt;testimonyModel.testimony&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Next, click on &lt;strong&gt;Create collection&lt;/strong&gt; to generate cards for the total number of records in the Testimonial data table. Change the display to Grid on the collection page and set the column to &lt;strong&gt;three&lt;/strong&gt;.&lt;/p&gt;

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

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

&lt;p&gt;Next, navigate back to UI Library; let's repeat the process for the Story Component just like we did for the Testimony Component.&lt;/p&gt;

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

&lt;p&gt;Now, select the &lt;strong&gt;Story&lt;/strong&gt; Component, click the &lt;strong&gt;configure&lt;/strong&gt; button, select the Component's root, and click on &lt;strong&gt;Add prop.&lt;/strong&gt; Create a top-level prop &lt;strong&gt;postModel&lt;/strong&gt; and set it to the Post data model.&lt;/p&gt;

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

&lt;p&gt;To bind postModel data to the Story Component elements, we'll select:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Banner&lt;/strong&gt; element, set its &lt;strong&gt;src&lt;/strong&gt; prop to any static image.(You can choose &lt;code&gt;https://loremflickr.com/320/240?lock=212&lt;/code&gt; this image)&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;Set prop&lt;/strong&gt; and set the label prop to &lt;strong&gt;postModel.title&lt;/strong&gt; for the title element.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt; element and set its text label prop to &lt;strong&gt;postModel.description&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ReadTime&lt;/strong&gt; element and set its label prop to &lt;strong&gt;postModel.readTime&lt;/strong&gt;; also, we'll concatenate a string &lt;code&gt;mins read&lt;/code&gt;..&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Next, click the &lt;strong&gt;Create collection&lt;/strong&gt; button, name the collection &lt;code&gt;Stories&lt;/code&gt;. In the collection page, set the display to &lt;em&gt;Grid&lt;/em&gt; and the column to &lt;code&gt;3&lt;/code&gt;, then add a padding &lt;code&gt;10px&lt;/code&gt; round the box.&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you'll learn how to build the complete website using the components.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Build the Website pages
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use the components to build the website&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build the Website&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, run the following command to pull the data binding changes we made into the Next.js project.&lt;/p&gt;

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

amplify pull


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

&lt;/div&gt;

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

&lt;p&gt;Next, create a &lt;strong&gt;components&lt;/strong&gt; folder; inside it, create a &lt;strong&gt;Layout.js&lt;/strong&gt; file with the following snippets:&lt;/p&gt;

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

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

//components/Layout.js
import React from "react";
import { View } from "@aws-amplify/ui-react";
import { Nav } from "../ui-components";
function Layout({ children, authText, handleClick, username }) {
  return (
    &amp;lt;View width="1200px" marginLeft="auto" marginRight="auto"&amp;gt;
      &amp;lt;Nav
        marginTop={"20px"}
        handleAuth={handleClick}
        authText={authText}
        username={username}
        avatar={username.split("")[0].toUpperCase()}
      /&amp;gt;
      {children}
    &amp;lt;/View&amp;gt;
  );
}
export default Layout;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported View from "@aws-amplify/ui-react" and Nav from ui-components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rendered View as a wrapper div for the Nav component and the children prop.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rendered the Nav component and passed some layout props to it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, modify the index.js file like the below:&lt;/p&gt;

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

//pages/index.js
import React from "react";
import { Flex, View } from "@aws-amplify/ui-react";
import { Footer, Hero, Persuade, Testimonies } from "../ui-components";
import Layout from "../components/Layout";
function index() {
  return (
    &amp;lt;Layout handleClick={() =&amp;gt; {}} authText="Sign Up" username="none"&amp;gt;
      &amp;lt;View marginBottom="135px"&amp;gt;
        &amp;lt;Hero handleClick={() =&amp;gt; {}} /&amp;gt;
      &amp;lt;/View&amp;gt;
      &amp;lt;View&amp;gt;
        &amp;lt;Testimonies /&amp;gt;
      &amp;lt;/View&amp;gt;
      &amp;lt;Flex justifyContent={"center"}&amp;gt;
        &amp;lt;Persuade banner="https://i.imgur.com/MxbD3N4.png" /&amp;gt;
      &amp;lt;/Flex&amp;gt;
      &amp;lt;View marginTop="50px" marginBottom="50px"&amp;gt;
        &amp;lt;Footer /&amp;gt;
      &amp;lt;/View&amp;gt;
    &amp;lt;/Layout&amp;gt;
  );
}
export default index;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported Flex and View from "@aws-amplify/ui-react" and Hero, Persuade, Testimonies, and Footer components from ui-components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Imported Layout.js from the components directory, rendered it and passed handleClick, authText, and username props.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Used View and Flex and rendered our components within the Layout.js wrapper component. Notice that the username component is not visible in the Nav. That is because we passed none as to its value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, let's create a post page where we will render the Stories component; inside the pages directory, create a post.js file with the following snippets:&lt;/p&gt;

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

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

//pages/post.js
import React from "react";
import { Heading, Text, View } from "@aws-amplify/ui-react";
import Layout from "../components/Layout";
import { Footer, Stories } from "../ui-components";
function Post() {
  return (
    &amp;lt;Layout
      handleClick={() =&amp;gt; {}}
      authText="Sign Out"
      username={"christian@hotmail.com".split("@")[0]}
    &amp;gt;
      &amp;lt;View marginTop="50px" marginBottom="30px"&amp;gt;
        &amp;lt;Heading level={2}&amp;gt;Welcome to our backstage&amp;lt;/Heading&amp;gt;
        &amp;lt;Text marginTop="20px"&amp;gt;
          Discover stories,thinking, and expertise from writers on any top{" "}
        &amp;lt;/Text&amp;gt;
      &amp;lt;/View&amp;gt;
      &amp;lt;Stories /&amp;gt;
      &amp;lt;View marginTop="50px" marginBottom="50px"&amp;gt;
        &amp;lt;Footer /&amp;gt;
      &amp;lt;/View&amp;gt;
    &amp;lt;/Layout&amp;gt;
  );
}
export default Post;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported Heading and Text components to format our texts and View component to wrap the Text and other components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Imported the Layout.js components, rendered them, and implemented the post page inside it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we navigate to /post in the browser, we would see our post page with the stories component in it. To navigate to the post page from the landing page, let's update the &lt;strong&gt;index.js&lt;/strong&gt; with the below snippets:&lt;/p&gt;

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

//pages/index.js
//other imports here
import { useRouter } from "next/router";
function index() {
  const router = useRouter();
  return (
    &amp;lt;Layout
      handleClick={() =&amp;gt; {
        router.push("/post");
      }}
      authText="Sign Up"
      username="none"
    &amp;gt;
      //other components implementations here
    &amp;lt;/Layout&amp;gt;
  );
}
export default index;


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

&lt;/div&gt;

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

&lt;p&gt;Here, we imported useRouter from "next/router" and created a constant router with the useRouter() function, and then updated the handleClick. When we click on the Sign-Up button on the landing page, we'll be redirected to the post page.&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you'll learn how to create a checkout fow with Stripe.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Create a Checkout Flow
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setup stripe&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a checkout flow&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test checkout&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Creating a Checkout flow with Stripe&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, sign in to &lt;a href="https://stripe.com/?utm_campaign=paid_brand-DE_en_Search_Brand_Stripe-866170064&amp;amp;utm_medium=cpc&amp;amp;utm_source=google&amp;amp;ad_content=604263118055&amp;amp;utm_term=stripe&amp;amp;utm_matchtype=e&amp;amp;utm_adposition=&amp;amp;utm_device=c&amp;amp;gclid=CjwKCAiAl9efBhAkEiwA4TorihJI1nGhqcqYy4GLb6pNYU_aaKd3Fgyy4w1TziBqtl-XHhy7TNoYFhoCqqIQAvD_BwE" rel="noopener noreferrer"&gt;Stripe&lt;/a&gt; or create an account &lt;a href="https://dashboard.stripe.com/register" rel="noopener noreferrer"&gt;here&lt;/a&gt;; click on the Settings icon from the dashboard, click on the &lt;strong&gt;Checkout and Payment Links&lt;/strong&gt;, and create a Company name.&lt;/p&gt;

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

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

&lt;p&gt;Next, scroll down and &lt;strong&gt;Enable client-only integration&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Next, navigate to the &lt;strong&gt;Products&lt;/strong&gt; tab and create a product like in the below:&lt;/p&gt;

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

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

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

&lt;p&gt;Save the product and grab the product price id; we’ll use it later to implement the checkout.&lt;/p&gt;

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

&lt;p&gt;Next, grab the publishable key from the home page and let’s implement the checkout.&lt;/p&gt;

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

&lt;p&gt;Next, install the Stripe client SDK with the following command:&lt;/p&gt;

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

npm install @stripe/stripe-js


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

&lt;/div&gt;

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

&lt;p&gt;Now, let's implement the checkout so that when a user clicks on the &lt;strong&gt;Become a Member&lt;/strong&gt; button in the &lt;strong&gt;Hero&lt;/strong&gt; Component, we will redirect the user to the Stripe checkout page to subscribe.&lt;/p&gt;

&lt;p&gt;Let's update the &lt;strong&gt;index.js&lt;/strong&gt; file with the following snippets:&lt;/p&gt;

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

//pages/index.js
//other imports here
import { loadStripe } from "@stripe/stripe-js";
function index() {
  // router here

  async function handleClick() {
    const stripe = await loadStripe(
      "pk_test_51L4jXPKdTSV8bg8w0fz0kimSG031Xoc5jeB4gXeGCt8x7mASfkAYLQzmJSdYNTbQtNIdeHUnJin1xprNw3958ump00e9nhhn9v"
    );
    const { error } = await stripe.redirectToCheckout({
      lineItems: [{ price: "price_1L4lEGKdTSV8bg8wWWfunlGh", quantity: 1 }],
      mode: "subscription",
      successUrl: "http://localhost:3000/post",
      cancelUrl: "http://localhost:3000/cancel",
    });
  }
  return (
    &amp;lt;Layout
      //handleClick here
      authText="Sign Up"
      username="none"
    &amp;gt;
      &amp;lt;View marginBottom="135px"&amp;gt;
        &amp;lt;Hero handleClick={handleClick} /&amp;gt;
      &amp;lt;/View&amp;gt;
      //other components here
    &amp;lt;/Layout&amp;gt;
  );
}
export default index;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported loadStripe from "@stripe/stripe-js" and used the publishable key and price to implement the handleClick function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provided the success and canceled redirect URLs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Passed the handleClick function to the Hero Component.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When users click on the &lt;strong&gt;Become a Member&lt;/strong&gt; button, we'll redirect them to the Stripe checkout page.&lt;/p&gt;

&lt;p&gt;To test things out, click the button, enter the Stripe test card details, and on successful subscription, we'll be redirected to the post page, as we specified in the handleClick function.&lt;/p&gt;

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

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

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you'll learn how to create accounts for users after they make payment.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Create User Accounts
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setup a Stripe webhook&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a serverless function for the webhook&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create user accounts&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Creating a User Account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The idea here is when a user subscribes, we'll get the user details from Stripe and create an account for the user. We'll create a webhook that Stripe will call on a successful subscription to achieve this. First, run the following command and follow the prompt.&lt;/p&gt;

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

amplify add api


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

&lt;/div&gt;

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

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

&lt;p&gt;Choose the following options to complete the process:&lt;/p&gt;

&lt;p&gt;Next, navigate into the &lt;strong&gt;membershipwebsite5dcac801&lt;/strong&gt; file we created above with the following command:&lt;/p&gt;

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

cd amplify/backend/function/membershipwebsite5dcac801/src


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

&lt;/div&gt;

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

&lt;p&gt;Now, install the aws-sdk and Stripe with the command below:&lt;/p&gt;

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

npm install aws-sdk stripe


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

&lt;/div&gt;

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

&lt;p&gt;Next, navigate into this amplify/backend/function/membershipwebsite5dcac801/src directory and update the &lt;strong&gt;app.js&lt;/strong&gt; file with the following snippets:&lt;/p&gt;

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

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

const express = require("express");
const bodyParser = require("body-parser");
const awsServerlessExpressMiddleware = require("aws-serverless-express/middleware");
const aws = require("aws-sdk");
// declare a new express app
const app = express();
app.use(
  bodyParser.json({
    verify: function (res, req, buf) {
      req.rawBody = buf.toString();
    },
  })
);
app.use(awsServerlessExpressMiddleware.eventContext());
// Enable CORS for all methods
app.use(function (req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "*");
  next();
});
const getStripeKey = async () =&amp;gt; {
  const { Parameters } = await new aws.SSM()
    .getParameters({
      Names: ["stripe_key"].map((secretName) =&amp;gt; process.env[secretName]),
      WithDecryption: true,
    })
    .promise();
  return Parameters[0].Value;
};
  // post method
app.post("/webhook", async function (req, res) {
  const stripeKey = await getStripeKey();
  const stripe = require("stripe")(stripeKey);
  const customer = await stripe.customers.retrieve(
    req.body.data.object.customer
  );
  const userEmail = customer.email;
  const cognito = new aws.CognitoIdentityServiceProvider({
    apiVersion: "2016-04-18",
  });
  cognito.adminCreateUser(
    {
      UserPoolId: process.env.AUTH_MEMBERSHIPWEBSITE_USERPOOLID,
      Username: userEmail,
      DesiredDeliveryMediums: ["EMAIL"],
      UserAttributes: [
        {
          Name: "email",
          Value: userEmail,
        },
      ],
      ValidationData: [
        {
          Name: "email",
          Value: userEmail,
        },
      ],
    },
    function (err, data) {
      if (err) {
        console.log(err);
      } else {
        console.log(data);
      }
    }
  );
});
app.listen(3000, function () {
  console.log("App started");
});
module.exports = app;


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

&lt;/div&gt;

&lt;p&gt;Most snippets above were generated when we followed the amplify add api command prompts, and we added the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported the aws-sdk using the require function&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Added the verify option to the bodyParser function and set it to an anonymous function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Implemented the post route and did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created the stripeKey constant and set to the getStripeKey() function.&lt;/li&gt;
&lt;li&gt;Imported stripe using the Node.js require function and added the stripeKey.&lt;/li&gt;
&lt;li&gt;Retrieved the customer detail using the stripe instance and set the userEmail to customer email.
cognito, called the adminCreateUser() function, and created the user.&lt;/li&gt;
&lt;li&gt;We passed an anonymous function as a second parameter to the route.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;When a user subscribes again, we'll get an email with the user email as username and a generated temporal password. Also, if we inspect the Stripe webhook, we will see the user details.&lt;/p&gt;

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

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

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

&lt;p&gt;If successfully, we will see the email&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next lesson, you'll learn how to protect the website from unauthorized customers.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Authenticate the Customers
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Objectives&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this lab, you will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create UI for authentication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protect the customer area from unauthorized access&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authenticating Users&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We want to protect the post page so the only signed users can access it; let's update the &lt;strong&gt;post.js&lt;/strong&gt; file with the following snippets:&lt;/p&gt;

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

//pages/post.js
//other imports here
import {Authenticator,Flex,Heading,Text,useTheme,View,} from "@aws-amplify/ui-react";
import { Footer, Logo, Stories } from "../ui-components";
function Post() {

const authComponents = {
    Header() {
      const { tokens } = useTheme();
      return (
        &amp;lt;Flex
          justifyContent={"center"}
          direction="column"
          paddingTop={tokens.space.xxxl}
          paddingBottom={tokens.space.xxl}
        &amp;gt;
          &amp;lt;Logo /&amp;gt;
        &amp;lt;/Flex&amp;gt;
      );
    },
  };

  return (
    &amp;lt;Authenticator components={authComponents} hideSignUp={true}&amp;gt;
      {({ signOut, user }) =&amp;gt; (
        &amp;lt;Layout
          handleClick={() =&amp;gt; signOut()}
          authText="Sign Out"
          username={user.attributes.email.split("@")[0]}
        &amp;gt;
          // other components here
        &amp;lt;/Layout&amp;gt;
      )}
    &amp;lt;/Authenticator&amp;gt;
  );
}
export default Post;


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

&lt;/div&gt;

&lt;p&gt;In the snippets above, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imported Authenticator, useTheme, and Flex from "@aws-amplify/ui-react" and imported Logo from "ui-components."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Created authComponent object, created a Header() function inside it, destructured tokens from the useTheme() function, and used Flex to render the Logo component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wrapped the Layout with Authenticator and passed authComponent to its components prop.&lt;br&gt;
Passed the signOut function to the Layout handleClick event and updated the username value with the user parameter.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click &lt;strong&gt;Sign Up&lt;/strong&gt;, when the page pops up like this&lt;/p&gt;

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

&lt;p&gt;Copy &lt;strong&gt;Your temporary password&lt;/strong&gt; from your email and change your password&lt;/p&gt;

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

&lt;p&gt;When you re-enter the site, you will have to re-verify your information&lt;/p&gt;

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

&lt;p&gt;Check your email&lt;/p&gt;

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

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

&lt;p&gt;And you have done the customer authentication part.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  10. Conclusion
&lt;/h2&gt;

&lt;p&gt;In this lab, you learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Theme a design in Figma for your AWS Amplify project&lt;/li&gt;
&lt;li&gt;Create Amplify projects&lt;/li&gt;
&lt;li&gt;Convert convert components in Figam to React code&lt;/li&gt;
&lt;li&gt;Integrate Stripe with your AWS Amplify project&lt;/li&gt;
&lt;li&gt;Protect your website with authentication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're looking to learn more about Amplify, head to our &lt;a href="https://docs.amplify.aws/" rel="noopener noreferrer"&gt;docs&lt;/a&gt; and join our &lt;a href="https://discord.gg/amplify" rel="noopener noreferrer"&gt;Discord community&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>builtwithamplify</category>
      <category>builtwithappsync</category>
      <category>nextjs</category>
      <category>stripe</category>
    </item>
    <item>
      <title>Step by step: Build your first AWS Amplify and React App</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Sat, 25 Mar 2023 00:22:13 +0000</pubDate>
      <link>https://forem.com/aws-builders/step-by-step-build-your-first-aws-amplify-and-react-app-1agn</link>
      <guid>https://forem.com/aws-builders/step-by-step-build-your-first-aws-amplify-and-react-app-1agn</guid>
      <description>&lt;h2&gt;
  
  
  Full Stack for Front-End Developers: Building Your First AWS Amplify and React App Introduction
&lt;/h2&gt;

&lt;p&gt;In this course, you will learn how to build full-stack applications with AWS Amplify Studio. We will be building a note-taking app with authentication, authorization, and data features. Additionally, we will use Amplify Studio's Figma to generate code that facilitates a seamless transition from design to React components.&lt;/p&gt;

&lt;p&gt;If you are a front-end developer looking to build full-stack apps, then you have come to the right place!&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Knowledge of React, including states, event handlers, and props.&lt;/li&gt;
&lt;li&gt;Familiarity with using the command-line interface on your computer. You don't have to be an expert, though!&lt;/li&gt;
&lt;li&gt;Although not mandatory, it would be useful to learn about Figma before building your own applications with AWS Amplify Studio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Things You Will Build
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;We will build a note-taking app with the following features:&lt;/li&gt;
&lt;li&gt;All notes will be listed on the homepage.&lt;/li&gt;
&lt;li&gt;Ability to create, update, and delete notes.&lt;/li&gt;
&lt;li&gt;User accounts will be able to login, create accounts, and log out.&lt;/li&gt;
&lt;li&gt;Users will only be able to view and modify their own notes.&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%2Fsuf9rd1xlobc6ati0du9.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%2Fsuf9rd1xlobc6ati0du9.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create data model
&lt;/h2&gt;

&lt;p&gt;The first thing we need to do for our note-taking app is to create data models. We will want to store our notes in a database so that users can access them on different devices.&lt;/p&gt;

&lt;p&gt;If you don't have an AWS account, go ahead and &lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/" rel="noopener noreferrer"&gt;create one&lt;/a&gt;. You also may want to read about AWS Amplify &lt;a href="https://aws.amazon.com/amplify/pricing/" rel="noopener noreferrer"&gt;pricing&lt;/a&gt; and how to set a &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html" rel="noopener noreferrer"&gt;billing alarm&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Go to the &lt;a href="https://console.aws.amazon.com/amplify" rel="noopener noreferrer"&gt;AWS Amplify Console&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%2Fdkkjbh8p0d12mnx77bob.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%2Fdkkjbh8p0d12mnx77bob.png" alt="Image description" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Continue to &lt;strong&gt;Start&lt;/strong&gt; in &lt;strong&gt;Amplify Studio.&lt;/strong&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%2Fkysng3dqihjwwb1369li.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%2Fkysng3dqihjwwb1369li.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter Application Name: &lt;code&gt;notes&lt;/code&gt; . Select &lt;strong&gt;Confirm Development.&lt;/strong&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%2Fezmcvlgltg0bfqa2y5lo.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%2Fezmcvlgltg0bfqa2y5lo.png" alt="Image description" width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When development app is selected &lt;strong&gt;Launch studio&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Data&lt;/strong&gt; and &lt;strong&gt;Setup&lt;/strong&gt; on the left navigation&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%2F08piaz2fpboitnju8m5s.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%2F08piaz2fpboitnju8m5s.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
Data models allow us to organize and normalize data - in JavaScript it would be very difficult to do with an array of objects where each object has different keywords. Instead, we want to normalize our data so that each version has the same properties. We also want the data types to be normalized.&lt;br&gt;
For example, if you are going to create a data model for items in an online store, you will have the item name and description you want as strings. You will also have the price, float and image, which will be a URL. Normalizing your data in this way will make your interaction much easier.&lt;/p&gt;

&lt;p&gt;In Studio, create a named &lt;strong&gt;Notes&lt;/strong&gt; data model and &lt;strong&gt;add two fields&lt;/strong&gt;, &lt;strong&gt;title and text&lt;/strong&gt;. Preserve the &lt;code&gt;String&lt;/code&gt; data type.&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%2F75hng7vuy76p3m85hvyy.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%2F75hng7vuy76p3m85hvyy.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've done this, click &lt;strong&gt;Save and deploy&lt;/strong&gt; - your data will simply be mined to AWS!&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%2Fkxbbh6140wxfrcqhuwm3.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%2Fkxbbh6140wxfrcqhuwm3.png" alt="Image description" width="780" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  AWS Amplify Data Storage
&lt;/h4&gt;

&lt;p&gt;When you create a data model with AWS Amplify Studio, you are using the DataStore. DataStore stores your data both online and offline without any extra work. In the browser, it stores data in IndexedDB similar to localStorage. It will also save your data to the cloud using an Amazon DynamoDB database.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use the AWS Amplify Data Manager to Seed Data
&lt;/h2&gt;

&lt;p&gt;Go to the &lt;strong&gt;Content&lt;/strong&gt; tab in Amplify Studio.&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%2Fct5navgylrg6tbrbd4rx.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%2Fct5navgylrg6tbrbd4rx.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;Content&lt;/strong&gt; page select &lt;strong&gt;Actions&lt;/strong&gt; and select &lt;strong&gt;Auto generate data&lt;/strong&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%2F1dg0axrzl4hhkml7u5ls.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%2F1dg0axrzl4hhkml7u5ls.png" alt="Image description" width="800" height="211"&gt;&lt;/a&gt;&lt;br&gt;
Here you will be able to modify your application data. I will create 100 rows of data and add some constraints. I want my title to be 1-3 words long. I want each of my text fields to be 1-5 sentences long. Then I will click &lt;strong&gt;Generate Data&lt;/strong&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%2Fufz5q1kverq1qda25ior.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%2Fufz5q1kverq1qda25ior.png" alt="Image description" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now see 100 rows of data in the Amplify data manager.&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%2Farsh0zdhdp8t2s07a37b.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%2Farsh0zdhdp8t2s07a37b.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
You can access and edit any rows of data, create new notes, or delete them using the data manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Import Figma Designs into Amplify Studio
&lt;/h2&gt;

&lt;p&gt;Go to &lt;strong&gt;UI Library&lt;/strong&gt; in Studio. Select &lt;strong&gt;Sync with Figma&lt;/strong&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%2Fdbl45hyp80pkctg769ro.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%2Fdbl45hyp80pkctg769ro.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
For this course, I pre-created a remixed Figma file from the original Amplify UI Kit for your use. has the necessary components for the note taking application. Click &lt;strong&gt;get a copy&lt;/strong&gt; on Figma to use it. You'll be prompted to create a Figma account if you don't already have one -- this project is on their free tier.&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;My Components&lt;/strong&gt; you will see your UI components in Amplify Studio&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%2Fmr0g61zacbj3s9gmc3bi.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%2Fmr0g61zacbj3s9gmc3bi.png" alt="Image description" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the link to your Figma file and return to Amplify Studio. Paste your link into the input, then click &lt;strong&gt;Continue&lt;/strong&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%2Fn0j7ylg3c3d56fqgvgt1.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%2Fn0j7ylg3c3d56fqgvgt1.png" alt="Image description" width="784" height="625"&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%2F8n8a2bueqfyq7g1q6kee.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%2F8n8a2bueqfyq7g1q6kee.png" alt="Image description" width="571" height="646"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amplify Studio allows you to take these components and export them to human-readable React code - we'll do this in a few lessons!&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Connect Data Models to UI Components
&lt;/h2&gt;

&lt;p&gt;Go to &lt;strong&gt;UI Library&lt;/strong&gt; in Studio. Select &lt;code&gt;NoteUI&lt;/code&gt; then enter &lt;strong&gt;Configure&lt;/strong&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%2Fk0govys4gypexmku33z5.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%2Fk0govys4gypexmku33z5.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the title on the existing card that says &lt;code&gt;T-Shirt&lt;/code&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%2Fj2d086nem0akdbykl8dy.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%2Fj2d086nem0akdbykl8dy.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
On the right side of the page, Select &lt;strong&gt;Set Text Label&lt;/strong&gt;. We'll want to make this the title of the note.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the label holder: &lt;code&gt;note.title&lt;/code&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%2Fgtk15baf52otvm1df4yi.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%2Fgtk15baf52otvm1df4yi.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
You should see the t-shirt text change to one of the titles of one of the generated notes. If you click &lt;strong&gt;Shuffle Preview Data&lt;/strong&gt; you will cycle through different notes!&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%2Fbx6wfky3qql91jfobzq6.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%2Fbx6wfky3qql91jfobzq6.png" alt="Image description" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do the same for the note text - select the paragraph below the title.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the label to &lt;code&gt;note.title&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click on the trash can icon.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;onClick&lt;/code&gt; holder to &lt;code&gt;Delete&lt;/code&gt; under data. Then select &lt;code&gt;Note&lt;/code&gt; model and set ID to &lt;code&gt;note.id&lt;/code&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%2Fke03to2f1hvogw975rw9.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%2Fke03to2f1hvogw975rw9.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create a form
&lt;/h4&gt;

&lt;p&gt;Back to &lt;strong&gt;UI Library.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;code&gt;CreateNote&lt;/code&gt; form, then select &lt;strong&gt;Configure&lt;/strong&gt;. Click &lt;strong&gt;Save&lt;/strong&gt; and add&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%2F4ynuvd73ef7yi9orofh1.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%2F4ynuvd73ef7yi9orofh1.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prop: `onClick.&lt;/li&gt;
&lt;li&gt;Action: &lt;code&gt;Create new&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Model: &lt;code&gt;Note&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then select &lt;code&gt;title&lt;/code&gt; input to fill in the title model field and the like for the text.&lt;/li&gt;
&lt;li&gt;The name &lt;code&gt;TextField&lt;/code&gt; comes from Figma - you can rename the elements within it!&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%2Fguunq5sfh0nik5tq7dzj.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%2Fguunq5sfh0nik5tq7dzj.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Update form
&lt;/h4&gt;

&lt;p&gt;Back to &lt;strong&gt;UI Library.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;UpdateNote&lt;/strong&gt; , then select &lt;strong&gt;Configure&lt;/strong&gt;. Click &lt;strong&gt;Save&lt;/strong&gt; and add as shown below.&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%2Fs4pjtwkz9em16hernooz.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%2Fs4pjtwkz9em16hernooz.png" alt="Image description" width="800" height="392"&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%2F0s4c541xi3nbdvwwmh87.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%2F0s4c541xi3nbdvwwmh87.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have now linked the data we created in Amplify Studio with the UI components we created in Figma.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Create a collection view
&lt;/h2&gt;

&lt;p&gt;Go to &lt;strong&gt;UI Library&lt;/strong&gt; in Studio. Select &lt;code&gt;NoteUI&lt;/code&gt; then enter &lt;strong&gt;Configure&lt;/strong&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%2F0qw4jdhken3pp5pqmtiy.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%2F0qw4jdhken3pp5pqmtiy.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then select &lt;strong&gt;Create Collection&lt;/strong&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%2F3lckjpogzggspuwzld8o.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%2F3lckjpogzggspuwzld8o.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then change the gallery style to grid and set the number of &lt;strong&gt;columns 3&lt;/strong&gt; and set the &lt;strong&gt;page size 9&lt;/strong&gt; which will eventually &lt;strong&gt;add 10px&lt;/strong&gt; to each side of the note.&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%2Fbrny0wrk3m102ig4c3m1.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%2Fbrny0wrk3m102ig4c3m1.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can set the sort or filter conditions for your collection on the right side.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Setup a Local AWS Amplify Application
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Create a React Application
&lt;/h4&gt;

&lt;p&gt;First, create a React app using your command line interface. We will use Create React App (&lt;a href="https://create-react-app.dev/" rel="noopener noreferrer"&gt;https://create-react-app.dev/&lt;/a&gt;) to create a boilerplate React app.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;npx create-react-app notes&lt;/code&gt;. Then change to the created directory, &lt;code&gt;cd notes&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Run Amplify Pull
&lt;/h4&gt;

&lt;p&gt;We will install the AWS Amplify CLI: &lt;code&gt;npm install -g @aws-amplify/cli&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Return to Amplify Studio and click &lt;strong&gt;Local Setup Guide&lt;/strong&gt;. Here you will receive an &lt;code&gt;amplify pull&lt;/code&gt; command for your application - the application ID will be specific to your application. Copy this command by clicking on it, then run the command in your CLI.&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%2Fhh9p7vtz44fvuutqy4dj.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%2Fhh9p7vtz44fvuutqy4dj.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A screen will appear asking if you want to log in to the Amplify CLI in your browser, select &lt;strong&gt;Yes&lt;/strong&gt; and then you will be asked questions about your application in the CLI.&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%2Fbvj8mwnq1cdete9ma9er.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%2Fbvj8mwnq1cdete9ma9er.png" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press enter to answer each default question.&lt;/p&gt;

&lt;p&gt;Open the application code in your text editor. You will notice that a few folders have been created in Amplify Studio.&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%2F6u636wgg5nltyitvxpv3.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%2F6u636wgg5nltyitvxpv3.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Amplify Configure
&lt;/h4&gt;

&lt;p&gt;Install Amplify libraries and React components.&lt;br&gt;
&lt;code&gt;npm i aws-amplify @aws-amplify/ui-react&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once installed, open &lt;strong&gt;/src/index.js&lt;/strong&gt; file and add the following above the React native code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
// src/index.js&lt;br&gt;
import { Amplify } from 'aws-amplify'&lt;br&gt;
import config from './aws-exports'&lt;br&gt;
Amplify.configure(config)&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Set Up Amplify UI
&lt;/h4&gt;

&lt;p&gt;We have some setup steps to follow in order for the components to render as expected.&lt;/p&gt;

&lt;p&gt;Import the  component and the Amplify CSS file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
 // src/index.js&lt;br&gt;
 import { AmplifyProvider } from '@aws-amplify/ui-react'&lt;br&gt;
 import '@aws-amplify/ui-react/styles.css'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then set the AmplifyProvider component as the top-level component for your application according to the existing root.render method:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
// src/index.js&lt;br&gt;
root.render(&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
)
`&lt;code&gt;&lt;/code&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%2Fh1nyf2qg5pn8exuqwnfn.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%2Fh1nyf2qg5pn8exuqwnfn.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, add the &lt;code&gt;Inter&lt;/code&gt; font file to &lt;strong&gt;src/index.&lt;/strong&gt;css:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
/* src/index.css */&lt;br&gt;
     @import url('https://fonts.googleapis.com/css2?family=Inter:slnt,wght@-10..0,100..900&amp;amp;display=swap');&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fae2lrgpfgsxkdlxl2hpr.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%2Fae2lrgpfgsxkdlxl2hpr.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We've set up a React app linked to the AWS Amplify backend and configured Amplify's UI components.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Using AWS Amplify Studio Components Locally
&lt;/h2&gt;

&lt;p&gt;Run the Create React application development server through the CLI: &lt;code&gt;npm run start&lt;/code&gt;. Keep this app running in the background so you can see its changes in the browser.&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%2Fn2ky186g4q27ml7tf7tq.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%2Fn2ky186g4q27ml7tf7tq.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;/src/App.js&lt;/strong&gt; and remove the return replace boilerplate with React Fragment:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
function App() {&lt;br&gt;
      return (&lt;br&gt;
        &amp;lt;&amp;gt;&amp;lt;/&amp;gt;&lt;br&gt;
      )&lt;br&gt;
    }&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
You can also delete existing entries.&lt;/p&gt;

&lt;p&gt;Add &lt;strong&gt;NavBar&lt;/strong&gt; component to the application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
import { NavBar } from './ui-components'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then create a component instance in return&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    function App() {&lt;br&gt;
      return (&lt;br&gt;
        &amp;lt;&amp;gt;&lt;br&gt;
          &amp;lt;NavBar /&amp;gt;&lt;br&gt;
        &amp;lt;/&amp;gt;&lt;br&gt;
      )&lt;br&gt;
    }&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fichzvvoscogdykf0ejbk.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%2Fichzvvoscogdykf0ejbk.png" alt="Image description" width="726" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you view the NavBar in the browser you will notice that it doesn't span the entire page add the width=100% prop to the element:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
&amp;lt;NavBar width="100%" /&amp;gt;
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now render the collection of notes below the title:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
import { NavBar, NoteUICollection} from './ui-components'

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;NavBar width="100%" /&amp;gt;
      &amp;lt;NoteUICollection /&amp;gt;
    &amp;lt;/&amp;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%2Fp7ooxp1o5p1zkt6cfk8u.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%2Fp7ooxp1o5p1zkt6cfk8u.png" alt="Image description" width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will notice that the NavBar is really close to the notes, add a bottom margin.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
&amp;lt;NavBar width="100%" marginBottom='20px' /&amp;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%2F4uvlllpo85ibe6raw07v.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%2F4uvlllpo85ibe6raw07v.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add at the end of your &lt;strong&gt;index.css&lt;/strong&gt; file. This will be helpful to make our composition look even better!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
/* Add to the end of /src/index.css */
.modal {
  position: absolute;
  background-color: white;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  left: 0;
  right: 0;
  top: 100px;
  border: .5px solid gray;
}

.container {
  margin: 0 auto;
  max-width: 900px;
}
```
&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%2Fxc77ej9vmrdvy11tho7l.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%2Fxc77ej9vmrdvy11tho7l.png" alt="Image description" width="800" height="655"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wrap &lt;strong&gt;NoteUICollectiondiv&lt;/strong&gt; with a class container so that they are displayed in the center of the page:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;NavBar width="100%" /&amp;gt;
      &amp;lt;div className='container'&amp;gt;
        &amp;lt;NoteUICollection /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/&amp;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%2Fbnxq13866ha1c8ugbcns.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%2Fbnxq13866ha1c8ugbcns.png" alt="Image description" width="733" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the &lt;strong&gt;CreateNote&lt;/strong&gt; form (when it's not hidden) and it will add a new note to your UI!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
import { CreateNote, NavBar, NoteUICollection, UpdateNote } from './ui-components'

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;NavBar width="100%" /&amp;gt;
      &amp;lt;div className='container'&amp;gt;
        &amp;lt;NoteUICollection /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className='modal' style={{display: 'none'}}&amp;gt;
        &amp;lt;CreateNote /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className='modal' style={{display: 'none'}}&amp;gt;
        &amp;lt;UpdateNote /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/&amp;gt;
  )
}
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have now created the basic user interface for our application.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Modify AWS Amplify Studio Generated Components in Code
&lt;/h2&gt;

&lt;p&gt;First, we will create state fields to know if each modal is displayed or not. We'll also create a status field to store which notes should be updated.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
import { useState } from 'react'

function App() {
  const [showCreateModal, setShowCreateModal] = useState(false)
  const [showUpdateModal, setShowUpdateModal] = useState(false)
  const [updateNote, setUpdateNote] = useState()
...
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Open the &lt;code&gt;/src/ui-components/NavBar.js&lt;/code&gt; file. You will notice a &lt;code&gt;Button&lt;/code&gt; child component with &lt;code&gt;getOverrideProps&lt;/code&gt; inside it.&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%2F63bbm2e3y56h3lyq7cis.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%2F63bbm2e3y56h3lyq7cis.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;br&gt;
The second argument &lt;code&gt;getOverrideProps&lt;/code&gt; is the Figma key, in this case Button31632483 is .&lt;/p&gt;

&lt;p&gt;You can pass the &lt;code&gt;overrides&lt;/code&gt; prop to instances of your component, which will contain an object. Key will be the key of &lt;code&gt;subcomponent&lt;/code&gt;, value will be the property we want to override. We will add an &lt;code&gt;onClick&lt;/code&gt; button that toggles &lt;code&gt;showCreateModal&lt;/code&gt; to true.&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;NavBar&lt;br&gt;
      marginBottom='20px' width='100%'&lt;br&gt;
      overrides={{&lt;br&gt;
        Button31502513: { onClick: () =&amp;gt; setShowCreateModal(true) }&lt;br&gt;
      }}&lt;br&gt;
    /&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we will conditionally expose the &lt;code&gt;CreateNote&lt;/code&gt; method to show only when &lt;code&gt;showCreateModal&lt;/code&gt; is true. We will also override the &lt;code&gt;X&lt;/code&gt; symbol to close the modal. For accessibility, I would also make it a button.&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;div className='modal' style={{ display: showCreateModal === false &amp;amp;&amp;amp; 'none' }}&amp;gt;&lt;br&gt;
      &amp;lt;CreateNote overrides={{&lt;br&gt;
        MyIcon: {&lt;br&gt;
          as: 'button',&lt;br&gt;
          onClick: () =&amp;gt; setShowCreateModal(false)&lt;br&gt;
        }&lt;br&gt;
      }}&lt;br&gt;
      /&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fcs2kt5h9qu39kxzq5pvr.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%2Fcs2kt5h9qu39kxzq5pvr.png" alt="Image description" width="800" height="639"&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%2Fru4zyh8dcv3qnmavftt5.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%2Fru4zyh8dcv3qnmavftt5.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking the edit button on the note will show the update method and also set the version of the note we want to update/&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
      &amp;lt;NoteUICollection overrideItems={({ item, idx }) =&amp;gt; {&lt;br&gt;
      return {&lt;br&gt;
        overrides: {&lt;br&gt;
          Vector31472464: {&lt;br&gt;
            as: 'button',&lt;br&gt;
            onClick: () =&amp;gt; {&lt;br&gt;
              setShowUpdateModal(true)&lt;br&gt;
              setUpdateNote(item)&lt;br&gt;
            }&lt;br&gt;
          }&lt;br&gt;
        }&lt;br&gt;
      }&lt;br&gt;
    }}&lt;br&gt;
    /&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fgcrw6790018p95qulok5.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%2Fgcrw6790018p95qulok5.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add an override to UpdateNote to hide the update method when it closes and we will also pass the version of the note that we want to update.&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;div className='modal' style={{ display: showUpdateModal === false &amp;amp;&amp;amp; 'none' }}&amp;gt;&lt;br&gt;
      &amp;lt;UpdateNote&lt;br&gt;
        note={updateNote} overrides={{&lt;br&gt;
          MyIcon: {&lt;br&gt;
            as: 'button',&lt;br&gt;
            onClick: () =&amp;gt; setShowUpdateModal(false)&lt;br&gt;
          }&lt;br&gt;
        }}&lt;br&gt;
      /&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2F2ikcota3bp2mvjxr2ryj.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%2F2ikcota3bp2mvjxr2ryj.png" alt="Image description" width="800" height="759"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now our full UI is working as expected.&lt;br&gt;
You can use overrides to customize user interface elements created by AWS Amplify Studio in your own code.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Add Authentication to your Application
&lt;/h2&gt;

&lt;p&gt;We'll be adding authentication to our app so users can be created, logged in, and signed out.&lt;/p&gt;

&lt;p&gt;We'll be adding both authorization and authentication to this app - let's quickly define both:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization&lt;/strong&gt; - Allows users to have different actions they can take, e.g. only admins can update blog posts or only data creators can viewable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication&lt;/strong&gt; - Make sure someone is what they say, such as by asking them to enter a password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instruct
&lt;/h3&gt;

&lt;p&gt;Click &lt;strong&gt;Authentication&lt;/strong&gt; in &lt;strong&gt;Setup&lt;/strong&gt;. You can configure different login mechanisms, properties, password protection, and more. using the form provided. Select the default configuration, then click &lt;strong&gt;Deploy&lt;/strong&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%2F5o6bjfxf6n7rljt78r6n.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%2F5o6bjfxf6n7rljt78r6n.png" alt="Image description" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;After your deployment is done, run `amplify pull` in your CLI to synchronize the changes with your local application.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the &lt;strong&gt;App.js&lt;/strong&gt; component, we will use the With&lt;code&gt;Authenticator&lt;/code&gt; function to require the user to login to view the page. It will also implement the user creation process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;First, import the ingredients:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
import { withAuthenticator } from '@aws-amplify/ui-react'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then on your output line, wrap the Application component in a function:&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
export default withAuthenticator(App)&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&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%2Fk5ubh19eyvcrjbw276hz.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%2Fk5ubh19eyvcrjbw276hz.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you return to your app, you'll need to sign in to view your page.&lt;/p&gt;

&lt;p&gt;Implement the logout button! The &lt;code&gt;withAuthenticator&lt;/code&gt; function passes a signOut function (and user information) to the component it wraps as a prop. Let's destroy it:&lt;br&gt;
&lt;code&gt;function App ({ signOut })&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;NavBar&lt;/code&gt; component that runs the function when the &lt;strong&gt;Sign Out&lt;/strong&gt; button is clicked.&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;NavBar&lt;br&gt;
      marginBottom='20px' width='100%'&lt;br&gt;
      overrides={{&lt;br&gt;
        Button31502513: { onClick: () =&amp;gt; setShowCreateModal(true) },&lt;br&gt;
        Button31502517: {&lt;br&gt;
          onClick: async() =&amp;gt; {&lt;br&gt;
            signOut()&lt;br&gt;
          }&lt;br&gt;
        }&lt;br&gt;
       }}&lt;br&gt;
    /&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;We now have a full authentication flow for our application.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  10. Add owner-based authorization rule
&lt;/h2&gt;

&lt;p&gt;In AWS Amplify Studio, go to the &lt;code&gt;data&lt;/code&gt; tab under &lt;strong&gt;Setup&lt;/strong&gt;. Then click the &lt;strong&gt;Note&lt;/strong&gt; model. Enable &lt;strong&gt;Enable Owner Authorization&lt;/strong&gt;. Select all activities. Delete an existing rule.&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%2Fccz173v6ngdg8a1hcncw.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%2Fccz173v6ngdg8a1hcncw.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
Then click &lt;strong&gt;Save and Deploy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once your data updates are deployed, run &lt;code&gt;amplify pull&lt;/code&gt; in your CLI to sync your changes locally.&lt;/p&gt;

&lt;p&gt;Import the DataStore library:&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    import { DataStore } from 'aws-amplify'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
In the &lt;code&gt;NavBar&lt;/code&gt; component, add the following line of code to clear local data before logging out.&lt;br&gt;
    &lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;NavBar&lt;br&gt;
      marginBottom='20px' width='100%'&lt;br&gt;
      overrides={{&lt;br&gt;
        Button31502513: { onClick: () =&amp;gt; setShowCreateModal(true) },&lt;br&gt;
        Button31502517: {&lt;br&gt;
          onClick: async() =&amp;gt; {&lt;br&gt;
    + await DataStore.clear()&lt;br&gt;
            signOut()&lt;br&gt;
          }&lt;br&gt;
        }&lt;br&gt;
      }}&lt;br&gt;
    /&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fa9vp1m44tcycu9ulch27.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%2Fa9vp1m44tcycu9ulch27.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We now have authorization rules in our application.&lt;/p&gt;
&lt;h2&gt;
  
  
  11. Add UI Themes to your Project
&lt;/h2&gt;

&lt;p&gt;First, install the &lt;a href="https://www.figma.com/community/plugin/1040722185526429545/AWS-Amplify-Theme-Editor" rel="noopener noreferrer"&gt;AWS Amplify Theme Editor Plugin&lt;/a&gt;. Then go to your project's Figma file.&lt;br&gt;
Click the Figma icon in the navigation bar, then &lt;strong&gt;plugins&lt;/strong&gt;, then click &lt;strong&gt;AWS Amplify Theme Editor&lt;/strong&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%2Fbcuxkgbnwzx7pdbt6rsf.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%2Fbcuxkgbnwzx7pdbt6rsf.png" alt="Image description" width="555" height="950"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see an interface to change the theme of the application. Choose any color you like, then scroll to the bottom and click &lt;strong&gt;Update Theme&lt;/strong&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%2F9ibepthgt7diwwf2wyaz.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%2F9ibepthgt7diwwf2wyaz.png" alt="Image description" width="772" height="666"&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%2Fsst3xmumva4mbbsxshwu.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%2Fsst3xmumva4mbbsxshwu.png" alt="Image description" width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll see all your components in the &lt;strong&gt;My Components&lt;/strong&gt; tab updated to match the color theme. You can also do this with spacing, font size, and individual elements.&lt;/p&gt;

&lt;p&gt;To sync your changes locally, run &lt;code&gt;amplify pull&lt;/code&gt; from the command line in your project. We will need to pass the color theme to the  element in the &lt;strong&gt;index.js&lt;/strong&gt; file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter subject object:
&lt;code&gt;&lt;/code&gt;&lt;code&gt;
import { studioTheme } from './ui-components'
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then add it as a prop for &lt;code&gt;AmplifyProvider&lt;/code&gt;:
&lt;code&gt;&lt;/code&gt;&lt;code&gt;
&amp;lt;AmplifyProvider theme={studioTheme}&amp;gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;
Your color theme should now match the one you set up in Figma! You can now update themes and components in Figma and synchronize them with your local application.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  12. Hosting Your First AWS Amplify and React App UI
&lt;/h2&gt;

&lt;p&gt;First, create a GitHub repository for your app.&lt;/p&gt;

&lt;p&gt;Go to the new &lt;a href="https://github.com/new" rel="noopener noreferrer"&gt;repo page&lt;/a&gt; and add a name. Then click &lt;strong&gt;Create Repository&lt;/strong&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%2Fpizbt2c8wzso2z21983r.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%2Fpizbt2c8wzso2z21983r.png" alt="Image description" width="800" height="667"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Push your code to GitHub.&lt;br&gt;
        &lt;code&gt;&lt;/code&gt;`&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    git add .

    git commit -m "Amplify Studio tutorial"

    git remote add origin YOUR_REPO_URL

    git push -u 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%2F1ighlql94u7m254wqbjp.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%2F1ighlql94u7m254wqbjp.png" alt="Image description" width="800" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;AWS Amplify Console&lt;/strong&gt; . Select the Amplifier app you're building, then click it. Switch to &lt;strong&gt;Hosting environmentstab&lt;/strong&gt;, select &lt;strong&gt;GitHub&lt;/strong&gt;, then click &lt;strong&gt;Connect Branch&lt;/strong&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%2F0ic4bq9thj8th748n9pd.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%2F0ic4bq9thj8th748n9pd.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give GitHub permission when you are prompted.&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%2Fh0lt0qhcs6x9h9uo16tv.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%2Fh0lt0qhcs6x9h9uo16tv.png" alt="Image description" width="800" height="787"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then in the drop-down list select your repository. Also select the branch you want to deploy to. Then click "Next"&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%2Fb7vr2ayg3mdhpbmm4s19.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%2Fb7vr2ayg3mdhpbmm4s19.png" alt="Image description" width="800" height="486"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;select the "staging" backend environment. Click &lt;strong&gt;Create New Role&lt;/strong&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%2Fwzc9g7obqpxhyzvbbnmq.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%2Fwzc9g7obqpxhyzvbbnmq.png" alt="Image description" width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next tap each screen.&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%2F4v28wwsrtfxvqsz6shjd.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%2F4v28wwsrtfxvqsz6shjd.png" alt="Image description" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Create Role&lt;/strong&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%2Fs5k18gjlpo3320jc9uh0.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%2Fs5k18gjlpo3320jc9uh0.png" alt="Image description" width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then return to Amplify's Archive page and select your role Click Next.&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%2Fstlah65fyowi78oqa938.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%2Fstlah65fyowi78oqa938.png" alt="Image description" width="800" height="703"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Save and Deploy&lt;/strong&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%2Fbf1ytqb6wy9hja0z1ksq.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%2Fbf1ytqb6wy9hja0z1ksq.png" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a few minutes, you should see a checkbox that says your app is deployed!&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%2Fh5tzy0l3myw4jd5gynhw.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%2Fh5tzy0l3myw4jd5gynhw.png" alt="Image description" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can click the URL to view or share your app. From here you can add a custom domain, set up pull request previews, and control access.&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%2F1hc5nwdwpe4ti23xrb78.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%2F1hc5nwdwpe4ti23xrb78.png" alt="Image description" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, both your application frontend and backend are deployed to AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  13. Resources Delete
&lt;/h2&gt;

&lt;p&gt;First, create a GitHub repository for your app. &lt;a href="https://aws.amazon.com/amplify/pricing/" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;You can delete an Amplifier resource in two ways. The first is by running &lt;code&gt;amplify delete&lt;/code&gt; in the project's directory from your CLI.&lt;/p&gt;

&lt;p&gt;The alternative is to go to &lt;a href="https://console.aws.amazon.com/amplify" rel="noopener noreferrer"&gt;&lt;strong&gt;Amplify Console&lt;/strong&gt;&lt;/a&gt; , select your app, then in the &lt;strong&gt;Actions&lt;/strong&gt; dropdown menu , select &lt;strong&gt;Delete App&lt;/strong&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%2Fop2mgwkz97ud5nyppv6v.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%2Fop2mgwkz97ud5nyppv6v.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deleting the Amplify app in any way will remove AWS resources from your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  14. Conclusion
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Conclude
&lt;/h3&gt;

&lt;p&gt;You've now built a complete app with authentication, authorization, data, and a React UI built using AWS Amplify Studio.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next step
&lt;/h3&gt;

&lt;p&gt;To test your skills and keep learning Amplify, you can add more features to this app, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add images to your notes. Enable storage via Amplify Studio, then use &lt;a href="https://docs.amplify.aws/lib/storage/getting-started/q/platform/js/" rel="noopener noreferrer"&gt;Amplify JS Library&lt;/a&gt; to access the images in your application.&lt;/li&gt;
&lt;li&gt;Turn your app into a Next.js app, then move some of your backend logic to the side. server .&lt;/li&gt;
&lt;li&gt;Write logic and authorization rules so that notes can be shared between users (for example, you can share a to-do list with your significant other).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/vanhoangkha/amplify-notes" rel="noopener noreferrer"&gt;Git repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>aws</category>
      <category>builtwithamplify</category>
      <category>builtwithappsync</category>
    </item>
    <item>
      <title>DynamoDB Basic - Part 1: Introduction DynamoDB</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Fri, 24 Mar 2023 22:09:35 +0000</pubDate>
      <link>https://forem.com/aws-builders/dynamodb-basic-part-1-introduction-dynamodb-254h</link>
      <guid>https://forem.com/aws-builders/dynamodb-basic-part-1-introduction-dynamodb-254h</guid>
      <description>&lt;h2&gt;
  
  
  1. Core Components of Amazon DynamoDB
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Table&lt;/strong&gt;: Like other database systems, DynamoDB stores data in tables. A table is a collection of items.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Item&lt;/strong&gt;: Each table contains zero or more items. Items in DynamoDB are similar to the concept of rows in relational databases, records, or tuples in other database systems. In DynamoDB, there is no limit to the number of items that can be stored in a table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attribute&lt;/strong&gt;: Each item includes one or more attributes. An attribute is a basic data element that does not need to be broken down further. Attributes in DynamoDB are similar to columns in other database systems in many ways.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;h2&gt;
  
  
  2. Primary Key
&lt;/h2&gt;

&lt;p&gt;When creating a table, you must specify the primary key of the table in addition to the table name. The primary key uniquely identifies each item in the table, ensuring that no two items can have the same key. DynamoDB supports two different types of primary keys: &lt;strong&gt;the partition key&lt;/strong&gt; and &lt;strong&gt;the composite primary key&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The partition key&lt;/strong&gt; is a simple primary key consisting of an attribute called the partition key. DynamoDB uses the value of the partition key as input to the internal hash, and the output from the hash defines the partition (physical memory inside DynamoDB) in which the item will be stored. In a table with only a partition key, no two items can have the same partition key value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The composite primary key&lt;/strong&gt;, on the other hand, consists of the partition key and a sort key. DynamoDB uses the partition key value as input to the internal hash, and the output from the hash defines the partition (physical memory inside DynamoDB) in which the item will be stored. All items with the same partition key value are stored together, in sorted order by the sort key value. In a table with a partition key and a sort key, multiple items can have the same partition key value, but those items must have different sort key values. The composite primary key gives you more flexibility when querying data.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  3. Secondary Indexes
&lt;/h2&gt;

&lt;p&gt;You can create one or more Secondary Indexes on a table.&lt;br&gt;
Secondary Indexes allow querying data in the table with different keys from the original partition key and sorting of the table. With DynamoDB, data query operations are much faster and more cost-effective than scanning.&lt;br&gt;
Here is an example DynamoDB table:&lt;/p&gt;

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

&lt;p&gt;If we perform a data query operation, we can find data by the value of the Partition Key and Sort Key.&lt;/p&gt;

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

&lt;p&gt;If we perform a data scan operation, we will scan the entire table and then filter by any attribute. (When implementing the filter, we still have to spend the cost of scanning the entire table.)&lt;/p&gt;

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

&lt;p&gt;DynamoDB doesn't force you to use indexes, but they do give your applications more flexibility when it comes to data queries. After creating a Secondary Index on the table, you can read data from the index in the same way as reading data from the table.&lt;br&gt;
DynamoDB supports two types of indexes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global secondary indexes&lt;/strong&gt;, which have partition keys and sort keys that may be different from indexes on the table.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Local secondary indexes&lt;/strong&gt;, which have the same partition key as the table but have a different sort key.&lt;/p&gt;

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

&lt;p&gt;Each table in DynamoDB has a maximum of 20 Global secondary indexes (the default limit) and 5 Local secondary indexes.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Naming Rules and Data Types
&lt;/h2&gt;

&lt;p&gt;Tables, properties, and other objects in DynamoDB must have names. The following are the naming rules for DynamoDB:&lt;/p&gt;

&lt;p&gt;All names must be encoded with UTF-8 and be case sensitive.&lt;br&gt;
Table names and index names must be between 3 to 255 characters and can only contain the following characters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a to z&lt;/li&gt;
&lt;li&gt;A to Z&lt;/li&gt;
&lt;li&gt;0 to 9&lt;/li&gt;
&lt;li&gt;_(underscore)&lt;/li&gt;
&lt;li&gt;(hyphen)&lt;/li&gt;
&lt;li&gt;. (dot)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Attribute names&lt;/strong&gt; must be at least one character long, but no longer than 64 KB.&lt;/p&gt;

&lt;p&gt;The following are exceptions. These property names cannot be longer than 255 characters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The key name of the Secondary Index partition.&lt;/li&gt;
&lt;li&gt;Secondary Index sorts the key names.&lt;/li&gt;
&lt;li&gt;The name of any user-specified expected properties (applies only to local SecondaryIndexes).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DynamoDB supports many different data types for attributes in the table, which can be classified as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scalar types&lt;/strong&gt;: A scalar type can represent only one value. Scalar types are numeric, string, binary, Boolean, and null.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document types&lt;/strong&gt;: A document type can represent a complex structure with nested properties, such as a JSON document. The document types are list and map.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set types&lt;/strong&gt;: A set type can represent many scalar values. Set types are string set, numeric set, and binary set.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Read Consistency
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Eventually Consistent Reads&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;When you read data from a DynamoDB table, the response may not reflect the result of a recently completed write operation.&lt;/li&gt;
&lt;li&gt;Responses may include some stale data.&lt;/li&gt;
&lt;li&gt;If you repeat your read request after a short time, the response will return the latest data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;When you request &lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt;, &lt;strong&gt;DynamoDB&lt;/strong&gt; returns a response with the most up-to-date data, reflecting updates from all previous writes that were successful. However, this consistency comes with some downsides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt; may not be available if there are network problems or outages. In this scenario, &lt;strong&gt;DynamoDB&lt;/strong&gt; may return &lt;strong&gt;server error (HTTP 500)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt; may have higher latency than &lt;strong&gt;eventually consistent reads&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global secondary indexes&lt;/strong&gt; are not supported &lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strongly Consistent Reads&lt;/strong&gt; uses double throughput capacity than &lt;strong&gt;eventually consistent reads&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Read/Write Capacity Mode
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;On-Demand Mode&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DynamoDB on-demand&lt;/strong&gt; is a flexible payment option capable of serving thousands of requests per second without capacity planning. &lt;strong&gt;DynamoDB&lt;/strong&gt; on-demand offers pay-on-demand for read and write requests so you only pay for what you use.&lt;/li&gt;
&lt;li&gt;When you select on-demand mode, &lt;strong&gt;DynamoDB&lt;/strong&gt; instantly responds to your workloads as they increase or decrease to whatever traffic level was previously reached. If the workload's throughput reaches a new peak, DynamoDB adapts quickly to accommodate the workload. Tables using on-demand mode offer the same single-digit millisecond latency, service level agreement (SLA) commitment, and security that DynamoDB already provides. You can choose on demand for both new and existing tables, and you can continue to use existing &lt;strong&gt;DynamoDB&lt;/strong&gt; APIs without code changes.&lt;/li&gt;
&lt;li&gt;On-Demand mode is a good choice if any of the following are true:

&lt;ul&gt;
&lt;li&gt;You create a new board with an unknown workload.&lt;/li&gt;
&lt;li&gt;You have unpredictable application traffic.&lt;/li&gt;
&lt;li&gt;You just love the ease of paying for what you use.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Provisioned Mode&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you select provisioned mode, you specify the number of reads and writes per second that you require for your application. You can use auto-scaling to automatically adjust your table's provisioned capacity in response to changes in traffic. This helps you manage your DynamoDB usage to stay at or below the specified request rate for cost predictability.&lt;/li&gt;
&lt;li&gt;The mode provided is a good option if any of the following are true:

&lt;ul&gt;
&lt;li&gt;You have predictable application traffic.&lt;/li&gt;
&lt;li&gt;You run applications with consistent or incremental traffic.&lt;/li&gt;
&lt;li&gt;You can forecast capacity requirements to control costs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>dynamodb</category>
      <category>database</category>
      <category>nosql</category>
    </item>
    <item>
      <title>AWS Import/Export - Part 2: Export VM from AWS</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Wed, 08 Mar 2023 22:18:51 +0000</pubDate>
      <link>https://forem.com/aws-builders/aws-importexport-part-2-export-vm-from-aws-lcm</link>
      <guid>https://forem.com/aws-builders/aws-importexport-part-2-export-vm-from-aws-lcm</guid>
      <description>&lt;h4&gt;
  
  
  Table of content:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Configure S3 for exporting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Export from instance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Export from AMI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Clean up resources&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. Configure S3 for exporting
&lt;/h4&gt;

&lt;p&gt;When we export instances from AWS to virtualized environment formats, we will have to store them on the S3 bucket.&lt;/p&gt;

&lt;p&gt;This process will be performed by the default AWS user &lt;a href="mailto:vm-import-export@amazon.com"&gt;vm-import-export@amazon.com&lt;/a&gt;. Therefore, you need to assign permissions to this user on the S3 bucket via the ACL.&lt;/p&gt;

&lt;p&gt;Create an s3 bucket to store &lt;strong&gt;export&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access the Amazon S3 Management console.&lt;/li&gt;
&lt;li&gt;In the navigation bar, select Buckets.&lt;/li&gt;
&lt;li&gt;Select Create bucket to create a new S3 bucket.&lt;/li&gt;
&lt;li&gt;On the Create bucket page, set the parameters for the S3 bucket.&lt;/li&gt;
&lt;li&gt;Bucket name: Enter the bucket name. This name must be unique and not duplicate. (Ex: import-bucket-2021)&lt;/li&gt;
&lt;li&gt;Region: Select the storage region of the bucket.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Uncheck &lt;strong&gt;Block all public access&lt;/strong&gt; to allow public access. AWS will then issue a warning, and you select &lt;strong&gt;I acknowledge that the current settings might result in this bucket and the objects within becoming public&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Select &lt;strong&gt;Create bucket&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Finish creating the bucket.&lt;/p&gt;

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

&lt;p&gt;Edit &lt;strong&gt;Access control list(ACL)&lt;/strong&gt;. Select &lt;strong&gt;bucket owner enforced&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Select &lt;strong&gt;ACLs enabled&lt;/strong&gt;, select &lt;strong&gt;Save changes&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Select &lt;strong&gt;Add grantee&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Enter &lt;strong&gt;Canonical ID&lt;/strong&gt; and select &lt;strong&gt;Write&lt;/strong&gt; Objects and &lt;strong&gt;Read&lt;/strong&gt; of the &lt;strong&gt;Bucket ACL&lt;/strong&gt;. Then select &lt;strong&gt;Save changes&lt;/strong&gt;.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  Canonical ID list of user &lt;a href="mailto:vm-import-export@amazon.com"&gt;vm-import-export@amazon.com&lt;/a&gt; by Region:
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Africa (Cape Town)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Asia Pacific (Hong Kong)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Europe (Milan)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Middle East (Bahrain)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;China (Beijing)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS GovCloud (US)&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All other Regions&lt;/strong&gt;  &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  2. Export from instances
&lt;/h4&gt;

&lt;p&gt;To export virtual machines for deployment to virtualized environments, AWS supports direct export from EC2 Instance using the AWS CLI.&lt;/p&gt;

&lt;h4&gt;
  
  
  Export virtual machines from EC2 Instance.
&lt;/h4&gt;

&lt;p&gt;Please access the EC2 Management console to get the Instance ID information to export.&lt;/p&gt;

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

&lt;p&gt;Run the command aws ec2 create-instance-export-task to launch the process of exporting EC2 Instance to the desired format for your virtualized environment. You need to enter the following parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;--instance-id&lt;/strong&gt;: The Instance ID retrieved from the list of EC2 instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;--target-environment&lt;/strong&gt;: Target virtualization environment (eg microsoft)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;--export-to-s3-task&lt;/strong&gt;: Specify the exported virtual machine parameters:

&lt;ul&gt;
&lt;li&gt;Format (vhd)&lt;/li&gt;
&lt;li&gt;S3 bucket storage (export-bucket-2021)&lt;/li&gt;
&lt;li&gt;Storage path in the bucket (vms/)&lt;/li&gt;
&lt;li&gt;To minimize the possibility of incorrect input, create a file named file.json to store the parameters passed to the parameter &lt;strong&gt;--export-to-s3-task&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% raw %}

{
"ContainerFormat": "ova",
"DiskImageFormat": "VMDK",
"S3Bucket": "export-bucket-2021",
"S3Prefix": "vms/"
}


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

&lt;/div&gt;

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

&lt;p&gt;It will take some time to be able to export the instance to a VHD file used for deployment on a Hyper-V virtualized environment (or a VMDK file if you use VMWare Workstation). You can use aws ec2 describe-export-tasks command to check export progress&lt;/p&gt;

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

aws ec2 describe-export-tasks --export-task-ids &amp;lt;YourExportTaskID&amp;gt;


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

&lt;/div&gt;

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

&lt;p&gt;Once done, you will have the virtual machine's files stored in the S3 bucket.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  Deployment of exported virtual machine
&lt;/h4&gt;

&lt;p&gt;After downloading the vhd hard disk file to the on-premise system, you can try to deploy the virtual machine using this vhd file.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Export virtual machine from AMI
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Export virtual machine from EC2 AMI
&lt;/h4&gt;

&lt;p&gt;To export virtual machines for deployment to virtualized environments, AWS supports exporting from AMI through the use of the AWS CLI.&lt;/p&gt;

&lt;p&gt;Please access the EC2 Management console to get the AMI ID information to export.&lt;/p&gt;

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

&lt;p&gt;Run the command aws ec2 export-image to launch the process of exporting the AMI to the desired format for your virtualized environment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;--image-id: The AMI ID retrieved from the list of EC2 instances.&lt;/li&gt;
&lt;li&gt;--disk-image-format: Virtual machine hard disk/virtual machine file format (e.g. vmdk or vhdx)&lt;/li&gt;
&lt;li&gt;--s3-export-location: Specify the location of the exported file:&lt;/li&gt;
&lt;li&gt;S3 bucket storage (eg import-bucket-2021)&lt;/li&gt;
&lt;li&gt;Storage path in the bucket (eg export/)&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;It will take some time to be able to export the AMI to a VHD file used for deployment on a Hyper-V virtualized environment (or a VMDK file if you use VMWare Workstation). You can use the aws ec2 describe-export-image-tasks command to check the export progress.&lt;/p&gt;

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

aws ec2 describe-export-image-tasks --export-image-task-ids &amp;lt;YourExportImageTaskID&amp;gt;


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

&lt;/div&gt;

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

&lt;p&gt;Once done, you will have the virtual machine's disk file stored in the S3 bucket.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  Deployment of exported virtual machine
&lt;/h4&gt;

&lt;p&gt;After downloading the vhd hard disk file to the on-premise system, you can try to deploy the virtual machine using this vhd file.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Clean up resources
&lt;/h4&gt;

&lt;p&gt;In this section, you will clean up resources on AWS Cloud to avoid incurring costs.&lt;br&gt;
Delete the EC2 Instance created in the lab&lt;br&gt;
    - Access &lt;strong&gt;EC2 Management Console&lt;/strong&gt;&lt;br&gt;
    - On the left navigation bar, select Intances&lt;br&gt;
    - Select all EC2 Instances related to the lab.&lt;br&gt;
    - Click Actions.&lt;br&gt;
    - Click Manage Instance State.&lt;br&gt;
    - Select Terminate.&lt;br&gt;
    - Click Change State.&lt;br&gt;
Delete the Security Group created with EC2 Instance&lt;br&gt;
    - Access &lt;strong&gt;EC2 Management Console&lt;/strong&gt;&lt;br&gt;
    - On the left navigation bar, select Security Groups&lt;br&gt;
    - Select all Security Groups related to the lab.&lt;br&gt;
    - Click Actions.&lt;br&gt;
    - Click Delete security groups&lt;br&gt;
    - Click Delete&lt;br&gt;
Delete AMI&lt;br&gt;
    - Access &lt;strong&gt;EC2 Management Console&lt;/strong&gt;&lt;br&gt;
    - On the left navigation bar, select AMIs&lt;br&gt;
    - Select the AMI related to the lab.&lt;br&gt;
    - Click Actions.&lt;br&gt;
    - Click Deregister.&lt;br&gt;
    - Click Continue.&lt;br&gt;
Delete S3 Bucket&lt;br&gt;
    - Access &lt;strong&gt;S3 Management Console&lt;/strong&gt;&lt;br&gt;
    - On the left navigation bar, select Buckets&lt;br&gt;
    - Select the Bucket related to the lab and delete all the content. Or, tick the Bucket related to the card and select Empty.&lt;br&gt;
    - When you see the Empty Bucket prompt, type &lt;em&gt;permanently delete&lt;/em&gt; in the empty box.&lt;br&gt;
    - Select Exit.&lt;br&gt;
    - Tick the Bucket that has just been deleted and select Delete.&lt;br&gt;
    - When you get the Delete bucket prompt, type the name of the bucket you want to delete in the empty box.&lt;br&gt;
    - Select Delete Bucket.&lt;br&gt;
    - Repeat until all buckets related to the post are deleted.&lt;br&gt;
With the IAM Role &lt;strong&gt;vmimport&lt;/strong&gt;, you can keep it for future use.&lt;/p&gt;

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/aws-importexport-part-1-import-1kpj"&gt;AWS Import/Export - Part 1: Import&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/aws-importexport-part-2-export-vm-from-aws-lcm"&gt;AWS Import/Export - Part 2: Export VM from AWS&lt;/a&gt;&lt;/p&gt;

</description>
      <category>export</category>
      <category>aws</category>
    </item>
    <item>
      <title>AWS Import/Export - Part 1: Import</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Sat, 04 Mar 2023 21:18:00 +0000</pubDate>
      <link>https://forem.com/aws-builders/aws-importexport-part-1-import-1kpj</link>
      <guid>https://forem.com/aws-builders/aws-importexport-part-1-import-1kpj</guid>
      <description>&lt;h4&gt;
  
  
  Content of Table:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Preparing the virtual machine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Export virtual machine from On-premise&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Upload virtual machine to AWS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Import virtual machine to AWS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Deploy Instance from AMI&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h4&gt;
  
  
  VM Import/Export
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;VM Import/Export&lt;/em&gt; is a service that allows you to import virtual machines (VMs) from your virtualized environment to Amazon EC2 and vice versa. This feature allows you to migrate applications and infrastructure resources from an on-prem virtualized environment to Amazon EC2, back up your virtual machines to EC2, and create an archive of virtual machines for redundancy, and recovery after the crash.&lt;/p&gt;

&lt;p&gt;You can use VM Import/Export with no service charges (except for EC2 VMs and &lt;em&gt;S3 Bucket&lt;/em&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%2Fnvs6rkjxi65vt3vroyto.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%2Fnvs6rkjxi65vt3vroyto.png" alt=" " width="745" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  AWS Simple Storage Service (S3)
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;AWS S3&lt;/em&gt; is a large data storage service, with a &lt;em&gt;S3 bucket&lt;/em&gt; containing many &lt;em&gt;Objects&lt;/em&gt;. You can store an object up to 5TB in size and there is no limit to the number of objects stored in a bucket.&lt;/p&gt;

&lt;p&gt;In this step, you will perform the initialization of a virtual machine on your on-prem virtualization environment. The virtual machine that will be initialized is &lt;strong&gt;Ubuntu Desktop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As part of the exercise, you will deploy virtual machines in a virtualized environment &lt;strong&gt;VMWare Workstation&lt;/strong&gt; on-premise.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Prepare virtual machine in virtualized environment VMWare Workstation
&lt;/h4&gt;

&lt;p&gt;Install VMWare Workstation Pro at &lt;a href="https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html" rel="noopener noreferrer"&gt;Download WMWare Workstation Pro&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Download OS &lt;a href="https://ubuntu.com/download/desktop" rel="noopener noreferrer"&gt;Ubuntu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Access VMWare Workstation, select &lt;strong&gt;Create a New Virtual Machine&lt;/strong&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%2Fh4haqmtg9xtvj2jc1v0g.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%2Fh4haqmtg9xtvj2jc1v0g.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;Welcome to the New Virtual Machine WWizard&lt;/strong&gt;, select &lt;strong&gt;Typical (recommended)&lt;/strong&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%2Frvmcyafv1qdp9u9gtg99.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%2Frvmcyafv1qdp9u9gtg99.png" alt=" " width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Guest Operating System Insstallation&lt;/strong&gt;, select &lt;strong&gt;Image file (.iso)&lt;/strong&gt; of the latest Ubuntu desktop version. You can download this file from the [Ubuntu Release] page (&lt;a href="https://ubuntu.com/download/desktop" rel="noopener noreferrer"&gt;https://ubuntu.com/download/desktop&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%2Fygabmqd0i3bytm3cogu1.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%2Fygabmqd0i3bytm3cogu1.png" alt=" " width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;Easy Install Innformation&lt;/strong&gt; enter &lt;strong&gt;Username&lt;/strong&gt; as &lt;strong&gt;awsstudent&lt;/strong&gt; and enter &lt;strong&gt;password&lt;/strong&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%2Fkz9134mfaoxs1grmh80h.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%2Fkz9134mfaoxs1grmh80h.png" alt=" " width="800" height="420"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;Name the Virtual MMachine&lt;/strong&gt; name the virtual machine &lt;strong&gt;Ubuntu&lt;/strong&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%2Fcivq58a1pxj8exiqj50a.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%2Fcivq58a1pxj8exiqj50a.png" alt=" " width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;Specify Disk Cacity&lt;/strong&gt; enter &lt;strong&gt;20GB&lt;/strong&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%2Fp6e7p5it08kg1qwx1mvf.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%2Fp6e7p5it08kg1qwx1mvf.png" alt=" " width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Review the parameters and select Finish to proceed with the installation.&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%2Fiuqsftpc1livz4cw4ugw.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%2Fiuqsftpc1livz4cw4ugw.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete the &lt;strong&gt;Ubuntu&lt;/strong&gt; installation in VMware.&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%2F1z0ftb6nb34upyjnnbh4.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%2F1z0ftb6nb34upyjnnbh4.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;User configuration.&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%2F0jad9naanj8dfpr5i7c2.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%2F0jad9naanj8dfpr5i7c2.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the installation and configuration process is complete, you install OpenSSH Server to connect SSH to this virtual machine with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
&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%2Fl0dnqtwyl1l19y3zwdow.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%2Fl0dnqtwyl1l19y3zwdow.png" alt=" " width="800" height="421"&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%2F8ciwpb6669j882paa794.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%2F8ciwpb6669j882paa794.png" alt=" " width="800" height="430"&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%2Fay8sj07roxc5n2tbo4so.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%2Fay8sj07roxc5n2tbo4so.png" alt=" " width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Export virtual machine from On-premise
&lt;/h4&gt;

&lt;p&gt;In this step, we will export the virtual machine to use for the migration to the AWS platform.&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;VMWare Workstation&lt;/strong&gt;, select the newly created virtual machine, select &lt;strong&gt;File&lt;/strong&gt;, and select &lt;strong&gt;Export to OVF…&lt;/strong&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%2Fut4mcr5mizyj39qffmw0.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%2Fut4mcr5mizyj39qffmw0.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose the location to save the export 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%2F544f814m4mg7xu9jkfw1.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%2F544f814m4mg7xu9jkfw1.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait about 5 minutes to export.&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%2F596s4j35hxpqoiu4mo8y.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%2F596s4j35hxpqoiu4mo8y.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Access to the virtual machine export location, the file we use will be the &lt;strong&gt;.vmdk&lt;/strong&gt; 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%2F9pcpybo9uuz4ygj2atbe.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%2F9pcpybo9uuz4ygj2atbe.png" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Upload virtual machine to AWS
&lt;/h4&gt;

&lt;p&gt;In this step, we will use Amazon S3 to store the virtual machine file that has been exported from the virtualized environment.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create S3 bucket to store virtual machines
&lt;/h4&gt;

&lt;p&gt;To create an S3 bucket, we perform the following steps:&lt;/p&gt;

&lt;p&gt;Access the Amazon S3 Management console.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the navigation bar, select Buckets.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create bucket&lt;/strong&gt; to create a new S3 bucket.&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%2Fvsyv110n5i6wow8jnylc.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%2Fvsyv110n5i6wow8jnylc.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Create bucket page, set the parameters for the S3 bucket.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bucket name&lt;/strong&gt;: Enter the bucket name. This name must be unique and not duplicate. (Example: import-bucket-2023)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region&lt;/strong&gt;: Select the storage region of the bucket.&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%2Fxpua36lieoiksqgj1ahm.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%2Fxpua36lieoiksqgj1ahm.png" alt=" " width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uncheck &lt;strong&gt;Block all public access&lt;/strong&gt; to allow public access. AWS will then issue a warning, and you select &lt;strong&gt;I acknowledge that the current settings might result in this bucket and the objects within becoming public&lt;/strong&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%2Fqmxxgxku2p4uuum7geqg.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%2Fqmxxgxku2p4uuum7geqg.png" alt=" " width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Create bucket&lt;/strong&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%2Fx3qyx2o8qkxzvafbq3kq.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%2Fx3qyx2o8qkxzvafbq3kq.png" alt=" " width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Successful bucket creation&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%2Fabt26jvtbj75x5qnnk9e.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%2Fabt26jvtbj75x5qnnk9e.png" alt=" " width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Upload virtual machine to S3 Bucket
&lt;/h4&gt;

&lt;p&gt;After creating the bucket, we will proceed to upload the virtual machine file that we exported in the previous section.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to the S3 bucket you created above. (Example: import-bucket-2023)&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Objects&lt;/strong&gt; section, select &lt;strong&gt;Upload&lt;/strong&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%2F0fyobdnq1680slcldslv.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%2F0fyobdnq1680slcldslv.png" alt=" " width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drag and drop the exported virtual machine file from the on-prem virtualization environment into the window or select Add files to select the virtual machine file. Then select &lt;strong&gt;Upload&lt;/strong&gt;.&lt;br&gt;
You create a virtual machine using VMWare Workstation, the virtual machine file in the example is Ubuntu-disk1.vmdk.&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%2Fd7gbnhipp5evjzb1854e.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%2Fd7gbnhipp5evjzb1854e.png" alt=" " width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will take some time for the file to be uploaded to the S3 bucket.&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%2F8aaw7ayh3vvupcafoql1.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%2F8aaw7ayh3vvupcafoql1.png" alt=" " width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  4. Import virtual machine to AWS
&lt;/h4&gt;

&lt;p&gt;In this step, you will create a role named &lt;strong&gt;vmimport&lt;/strong&gt; and import the virtual machine that was uploaded to the S3 Bucket in the previous step into an AMI. The entire process will be handled with the AWS CLI.&lt;/p&gt;
&lt;h4&gt;
  
  
  Create vmimport role
&lt;/h4&gt;

&lt;p&gt;Before performing the Import of virtual machines into AWS. You need to check the role required for this implementation.&lt;/p&gt;

&lt;p&gt;Access the IAM Management console.&lt;br&gt;
In the navigation bar, select Roles&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%2Fbqqspci4usn9ou418xid.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%2Fbqqspci4usn9ou418xid.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you do not see the vmimport role, proceed to create the vmimport role.&lt;br&gt;
Create a file named trust-policy.json to allow the VM Import/Export service to accept your upcoming vmimport role.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Effect": "Allow",
         "Principal": { "Service": "vmie.amazonaws.com" },
         "Action": "sts:AssumeRole",
         "Condition": {
            "StringEquals":{
               "sts:Externalid": "vmimport"
            }
         }
      }
   ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the create-role command to create an IAM role named vmimport and assign &lt;strong&gt;trust-policy.json&lt;/strong&gt; to the parameter &lt;strong&gt;--assume-role-policy-document&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;replace "E:\trust-policy.json" with the path to the trust-policy.json file on your environment

aws iam create-role --role-name vmimport --assume-role-policy-document "file://E:\trust-policy.json"
&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%2F87a5la70dr2jt4vmevnk.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%2F87a5la70dr2jt4vmevnk.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the created role.&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%2F2vggijhgbzvifat0i9lt.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%2F2vggijhgbzvifat0i9lt.png" alt=" " width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See &lt;strong&gt;Trust relationships&lt;/strong&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%2F2gks7ugdc2m9fc0x6ysq.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%2F2gks7ugdc2m9fc0x6ysq.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a file role-policy.json containing the following policies to allow the IAM role to access buckets containing virtual machines to exercise the permissions in the "Action" section:. Inside:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;disk-image-file-bucket is the name of the S3 bucket used to store the exported files from onpremise (import-bucket-2023 in this example).&lt;/li&gt;
&lt;li&gt;export-bucket is the name of the S3 bucket used to export the ec2 instance that will be used for the Export VM from AWS later.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect": "Allow",
         "Action": [
            "s3:GetBucketLocation",
            "s3:GetObject",
            "s3:ListBucket" 
         ],
         "Resource": [
            "arn:aws:s3:::disk-image-file-bucket",
            "arn:aws:s3:::disk-image-file-bucket/*"
         ]
      },
      {
         "Effect": "Allow",
         "Action": [
            "s3:GetBucketLocation",
            "s3:GetObject",
            "s3:ListBucket",
            "s3:PutObject",
            "s3:GetBucketAcl"
         ],
         "Resource": [
            "arn:aws:s3:::export-bucket",
            "arn:aws:s3:::export-bucket/*"
         ]
      },
      {
         "Effect": "Allow",
         "Action": [
            "ec2:ModifySnapshotAttribute",
            "ec2:CopySnapshot",
            "ec2:RegisterImage",
            "ec2:Describe*"
         ],
         "Resource": "*"
      }
   ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use the following command to assign the roles described in the role-policy.json file to the created vmimport role
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document "file://E:\role-policy.json"
&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%2Fhkrkkbucbe31o9gfj8dl.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%2Fhkrkkbucbe31o9gfj8dl.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check permissions. You can also check to see if the vmimport role has been successfully created by going to the IAM Management Console and selecting the role. You can also edit the role policy directly by selecting Edit policy.&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%2F57r892h59g5qnwdz122b.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%2F57r892h59g5qnwdz122b.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Import virtual machine to AMI
&lt;/h4&gt;

&lt;p&gt;We will use the AWS CLI to launch the Import virtual machine to AMI process.&lt;/p&gt;

&lt;p&gt;In Terminal on Linux (or Command Prompt/Power Shell on Windows), run the command aws ec2 import-image to start importing the exported virtual machine and convert it to AMI. The following settings are relevant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;--deescription&lt;/strong&gt;: Set description for AMI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;--disk-ccontainers&lt;/strong&gt;: Contains information identifying virtual machine files such as:&lt;/li&gt;
&lt;li&gt;Format format (eg: vhdx or vmdk)&lt;/li&gt;
&lt;li&gt;Storage bucket (eg import-bucket-2023)&lt;/li&gt;
&lt;li&gt;File path (e.g. Ubuntu.vhdx or Ubuntu-disk1.vmdk)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 import-image --description "VM Image" --disk-containers Format=vhdx,UserBucket="{S3Bucket=import-bucket-2021,S3Key=Ubuntu.vhdx}"
&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%2Fb6ej5kw2d4sza3c4ijlk.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%2Fb6ej5kw2d4sza3c4ijlk.png" alt=" " width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will take 5-10 minutes depending on the size of the virtual machine for AWS to convert the virtual machine into an AMI.&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%2F22ltp3sh1rrjlhvk50uq.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%2F22ltp3sh1rrjlhvk50uq.png" alt=" " width="800" height="434"&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%2Fda5w5bouoa4wf53fidbs.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%2Fda5w5bouoa4wf53fidbs.png" alt=" " width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once completed, we will see in the AMI list there will be one more AMI with the AMI name being the task id we created above.&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%2F0e2yq5wluznhe94hppmm.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%2F0e2yq5wluznhe94hppmm.png" alt=" " width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You must check that EBS is not &lt;strong&gt;Encrypted&lt;/strong&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%2Fn0cngg11tvqhc91qgfbk.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%2Fn0cngg11tvqhc91qgfbk.png" alt=" " width="800" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Deploy Instance from AMI
&lt;/h4&gt;

&lt;p&gt;To deploy the virtual machine from the imported AMI, we perform the following steps:&lt;/p&gt;

&lt;p&gt;To deploy the virtual machine from the imported AMI, we perform the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to EC2 Management console.&lt;/li&gt;
&lt;li&gt;In the navigation bar, select AMIs.&lt;/li&gt;
&lt;li&gt;Select the AMI you just imported from the virtual machine (eg import-ami-08a9efac866dfcb04). Then select Launch.&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%2Fv8uoyxy287apay345v37.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%2Fv8uoyxy287apay345v37.png" alt=" " width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name&lt;/strong&gt;, enter &lt;strong&gt;Import-Server&lt;/strong&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%2F6fe4s3zdmo95079ajtyh.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%2F6fe4s3zdmo95079ajtyh.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep the default AMI.&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%2Frd0zcq79vhsnv1okhb8g.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%2Frd0zcq79vhsnv1okhb8g.png" alt=" " width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep &lt;strong&gt;Instance type&lt;/strong&gt; and select &lt;strong&gt;Create new key pair&lt;/strong&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%2Fudeqp3nbji5qiwc189jp.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%2Fudeqp3nbji5qiwc189jp.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in the key pair information and select &lt;strong&gt;Create key pair&lt;/strong&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%2F6z6td9diudn4rcktx0en.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%2F6z6td9diudn4rcktx0en.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Leave the default &lt;strong&gt;Network settings&lt;/strong&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%2Fk0p1e06ze34o9rvpq14q.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%2Fk0p1e06ze34o9rvpq14q.png" alt=" " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;View all instances&lt;/strong&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%2Fg2w5u7jvaba74k1rtnwo.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%2Fg2w5u7jvaba74k1rtnwo.png" alt=" " width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the created instance.&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%2Fmlvvyzog4nks0qz470pt.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%2Fmlvvyzog4nks0qz470pt.png" alt=" " width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do SSH into the instance.&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%2Fwwfh0e4vtyj0q4w4nd2p.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%2Fwwfh0e4vtyj0q4w4nd2p.png" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;SSH&lt;/strong&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%2Fwtfvm60cgkegy4n7lvaj.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%2Fwtfvm60cgkegy4n7lvaj.png" alt=" " width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete SSH credentials.&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%2Fegmsrn4k5d4gapgvzf7f.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%2Fegmsrn4k5d4gapgvzf7f.png" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the password.&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%2Fc8k94efvkhp0pmzt2q7a.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%2Fc8k94efvkhp0pmzt2q7a.png" alt=" " width="800" height="125"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete SSH.&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%2F44b9ep0no2x4qraxe9qo.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%2F44b9ep0no2x4qraxe9qo.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test ping test.&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%2Fzfrc34rpqb4jqafb38vz.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%2Fzfrc34rpqb4jqafb38vz.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/aws-importexport-part-1-import-1kpj"&gt;AWS Import/Export - Part 1: Import&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/aws-importexport-part-2-export-vm-from-aws-lcm"&gt;AWS Import/Export - Part 2: Export VM from AWS&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>docker</category>
      <category>ai</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Get started with CloudFront - Part 4: Lambda@Edge function</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Wed, 01 Mar 2023 21:05:42 +0000</pubDate>
      <link>https://forem.com/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh</link>
      <guid>https://forem.com/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh</guid>
      <description>&lt;h4&gt;
  
  
  Table of Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Create Lambda@Edge function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Deploy Lambda@Edge function to CloudFront&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Metrics and Logs&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. Create Lambda@Edge function
&lt;/h4&gt;

&lt;p&gt;In this section, we will create a Lambda@Edge function.&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%2Fb56f8kybfx69ydxbr8eu.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%2Fb56f8kybfx69ydxbr8eu.png" alt=" " width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to the AWS Console and make sure you are in the US-EAST-1 N. Virginia region.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Lambda console and select &lt;strong&gt;Create function&lt;/strong&gt;&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%2Fgrzydan2r1hu6ucl3lei.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%2Fgrzydan2r1hu6ucl3lei.png" alt=" " width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Perform configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select "Author from scratch"&lt;/li&gt;
&lt;li&gt;Select "Create function"&lt;/li&gt;
&lt;li&gt;Name: "LambdaEdgeImmersionDayLabFunction"&lt;/li&gt;
&lt;li&gt;Runtime: "Node.js 18.x"&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%2Frzuc2p065zua7nmxc0n7.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%2Frzuc2p065zua7nmxc0n7.png" alt=" " width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Role: "Create new role from AWS policy templates"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Role name: "lambda_edge_execution_role"&lt;/li&gt;
&lt;li&gt;Policy templates: "Basic Lambda@Edge permissions (for CloudFront trigger)"&lt;/li&gt;
&lt;li&gt;Click "Create function"&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%2F67i958uejje20elphw5d.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%2F67i958uejje20elphw5d.png" alt=" " width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finish creating Lambda function. You have successfully created a new IAM role, which is used to allow CloudFront to invoke Lambda and log to CloudWatch.&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%2Fgpzsv5tae4v6sk73a9a9.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%2Fgpzsv5tae4v6sk73a9a9.png" alt=" " width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select tab &lt;strong&gt;Test&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Create new test event&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Event Name : “TestEvent”&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%2F7fytvn60ahdxegnrsmwo.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%2F7fytvn60ahdxegnrsmwo.png" alt=" " width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace Hello World JSON with the following json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Records": [
      {
        "cf": {
          "config": {
            "distributionDomainName": "d123.cloudfront.net",
            "distributionId": "EDFDVBD6EXAMPLE",
            "eventType": "viewer-request",
            "requestId": "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE=="
          },
          "request": {
            "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334",
            "method": "GET",
            "querystring": "size=large",
            "uri": "/picture.jpg",
            "headers": {
              "host": [
                {
                  "key": "Host",
                  "value": "d111111abcdef8.cloudfront.net"
                }
              ],
              "user-agent": [
                {
                  "key": "User-Agent",
                  "value": "curl/7.51.0"
                }
              ]
            },
            "origin": {
              "custom": {
                "customHeaders": {
                  "my-origin-custom-header": [
                    {
                      "key": "My-Origin-Custom-Header",
                      "value": "Test"
                    }
                  ]
                },
                "domainName": "example.com",
                "keepaliveTimeout": 5,
                "path": "/custom_path",
                "port": 443,
                "protocol": "https",
                "readTimeout": 5,
                "sslProtocols": [
                  "TLSv1",
                  "TLSv1.1"
                ]
              },
              "s3": {
                "authMethod": "origin-access-identity",
                "customHeaders": {
                  "my-origin-custom-header": [
                    {
                      "key": "My-Origin-Custom-Header",
                      "value": "Test"
                    }
                  ]
                },
                "domainName": "my-bucket.s3.amazonaws.com",
                "path": "/s3_path",
                "region": "us-east-1"
              }
            }
          }
        }
      }
    ]
  }

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Create&lt;/strong&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%2F3gbaa2va8oehumj52bcb.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%2F3gbaa2va8oehumj52bcb.png" alt=" " width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to the Lambda function interface and select &lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now we will write a function to generate generated HTML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy and paste the following code into the function code window:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handler = (event, context, callback) =&amp;gt; {
    console.log("Request Event:" + JSON.stringify(event, null, 2));

    const requestHeaders = event.Records[0].cf.request.headers;

    var htmlContent;

    //Insert code to generate the html content content here.

    const response = {
        status: '200',
        statusDescription: 'OK',
        headers: {
            'cache-control': [{
                key: 'Cache-Control',
                value: 'max-age=100'
            }],
            'content-type': [{
                key: 'Content-Type',
                value: 'text/html'
            }],
            'content-encoding': [{
                key: 'Content-Encoding',
                value: 'UTF-8'
            }],
        },
        body: htmlContent,
    };

    callback(null, response);
};

module.exports.handler = handler;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Save&lt;/li&gt;
&lt;li&gt;Chọn &lt;strong&gt;Deploy&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Sau đó chọn &lt;strong&gt;Test&lt;/strong&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%2Fltoc0mjkgfpnzn4213it.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%2Fltoc0mjkgfpnzn4213it.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View &lt;strong&gt;Test&lt;/strong&gt; Results&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%2F04ot1fhm3jmuugptn4n6.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%2F04ot1fhm3jmuugptn4n6.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's see the result of the execution. Notice that the output is a JSON version of the HTTP 200 response that CloudFront will use to respond to the request. In this case, the response is still missing the body.&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%2F40coo9a9pi1qwejfnnvw.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%2F40coo9a9pi1qwejfnnvw.png" alt=" " width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Log output, we can see that the test event we configured is logged as a Request Event on the function's input. This JSON represents the properties of the request received by CloudFront, which can be read or modified. In this exercise, we will read the headers and return the result as a nice HTML table.&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%2Fhazjqeno2qg40hby5g2y.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%2Fhazjqeno2qg40hby5g2y.png" alt=" " width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace the comment with the code needed to generate the HTML body. You can use console.log to output and debug your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.handler = (event, context, callback) =&amp;gt; {
    const requestHeaders = event.Records[0].cf.request.headers;

    let str = '&amp;lt;table border="1" width="100%"&amp;gt;' +
              '&amp;lt;thead&amp;gt;' +
                '&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;h1&amp;gt;Header&amp;lt;/h1&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;h1&amp;gt;Value&amp;lt;/h1&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;' +
              '&amp;lt;/thead&amp;gt;' +
              '&amp;lt;tbody&amp;gt;';

    for (const key in requestHeaders) {
      if (requestHeaders.hasOwnProperty(key)) {
        str += '&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;' + key + '&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;' + requestHeaders[key][0].value + '&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;';
      }
    }

    str += '&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;';

    const htmlContent = `
      &amp;lt;html lang="en"&amp;gt;
        &amp;lt;body&amp;gt;
          &amp;lt;table border="1" width="100%"&amp;gt;
            &amp;lt;thead&amp;gt;
              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;h1&amp;gt;Lambda@Edge Lab&amp;lt;/h1&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
            &amp;lt;/thead&amp;gt;
            &amp;lt;tfoot&amp;gt;
              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Immersion Days - Edge Services - Module 3&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
            &amp;lt;/tfoot&amp;gt;
            &amp;lt;tbody&amp;gt;
              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Response sent by API&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
            &amp;lt;/tbody&amp;gt;
            &amp;lt;tbody&amp;gt;
              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;${str}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
            &amp;lt;/tbody&amp;gt;
          &amp;lt;/table&amp;gt;
        &amp;lt;/body&amp;gt;
      &amp;lt;/html&amp;gt;
    `;

    const response = {
      status: '200',
      statusDescription: 'OK',
      headers: {
        'cache-control': [{ key: 'Cache-Control', value: 'max-age=100' }],
        'content-type': [{ key: 'Content-Type', value: 'text/html' }],
        'content-encoding': [{ key: 'Content-Encoding', value: 'UTF-8' }],
      },
      body: htmlContent,
    };

    callback(null, response);
  };

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Save&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Deploy&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Test&lt;/strong&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%2F2e6gao0lg20hw9srofpo.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%2F2e6gao0lg20hw9srofpo.png" alt=" " width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View Test Result&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%2F7e2vaxp9mhljueigp0os.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%2F7e2vaxp9mhljueigp0os.png" alt=" " width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to Lambda function, select &lt;strong&gt;Versions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Push new version&lt;/strong&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%2Fb5ujw16j1quy7x4gyq84.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%2Fb5ujw16j1quy7x4gyq84.png" alt=" " width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;version 1&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and select &lt;strong&gt;Publish&lt;/strong&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%2Fla5y5sl4cq34nul62ups.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%2Fla5y5sl4cq34nul62ups.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete Lambda Function creation using CloudFront.&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%2Fnquo8d49qxxp6k1r659o.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%2Fnquo8d49qxxp6k1r659o.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Deploy Lambda@Edge function to CloudFront
&lt;/h4&gt;

&lt;p&gt;In this section, we will add CloudFront as a trigger for your Lambda function.&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%2Fm11w696dqrab17omg5k6.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%2Fm11w696dqrab17omg5k6.png" alt=" " width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the same lambda console, you have implemented version 1 of the Lambda function. Click the Add trigger button and select CloudFront.&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%2Fu8rgnf6crnc7iseflwg5.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%2Fu8rgnf6crnc7iseflwg5.png" alt=" " width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Deploy to Lambda@Edge.&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%2Fqufbjtgq8oe0gh5d4ibu.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%2Fqufbjtgq8oe0gh5d4ibu.png" alt=" " width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure the trigger to use the previously created CloudFront Distribution and Cache Behavior with the following settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distribution: &lt;/li&gt;
&lt;li&gt;Cache behavior: "/serverless"&lt;/li&gt;
&lt;li&gt;CloudFront event: Origin request&lt;/li&gt;
&lt;li&gt;Select "I acknowledge that on deploy a new version of this function will be published with the above trigger and replicated across all available AWS regions."&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&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%2Fgdoeqdimv6zu44uzh4dq.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%2Fgdoeqdimv6zu44uzh4dq.png" alt=" " width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deployment will take approximately 5 minutes to complete for CloudFront distribution. In some cases, you can start testing in less than 5 minutes, depending on your location.&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%2Fuaj99wziniypvenfzn4z.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%2Fuaj99wziniypvenfzn4z.png" alt=" " width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to &lt;strong&gt;Lambda&lt;/strong&gt; interface and select &lt;strong&gt;Replicas&lt;/strong&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%2Fv0xy0yrqduo0wmdtq1zo.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%2Fv0xy0yrqduo0wmdtq1zo.png" alt=" " width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now search for your Lambda function in the Lambda functions list and you will find a Lambda function Replica in us-east-1 for the Lambda function you created.&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%2Fghef90ww5v4e6ek1mnns.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%2Fghef90ww5v4e6ek1mnns.png" alt=" " width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you move to other AWS regions, you will find that there is a Lambda function replica in all regions where CloudFront has a Regional Edge Cache. These are the Lambda functions that will be called when your CloudFront distribution executes &lt;a href="mailto:Lambda@Edge"&gt;Lambda@Edge&lt;/a&gt;. Once your CloudFront distribution has been deployed, test your CloudFront distribution by accessing Distribution in a browser with a serverless path.&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%2F5nszbey86ouleedxlrte.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%2F5nszbey86ouleedxlrte.png" alt=" " width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Metrics and Logs
&lt;/h4&gt;

&lt;p&gt;To generate traffic from different geographic locations, you can use CloudShell to send HTTP requests. It is a shell environment that includes the curl tool to safely interact with your AWS resources. Send multiple requests using the curl tool to generate traffic to CloudFront from different regions.&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%2Fuqhawlyc8cdinypm2f9b.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%2Fuqhawlyc8cdinypm2f9b.png" alt=" " width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the AWS Lambda console and select an AWS region near one of the locations you selected to send requests.&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%2F62ppvb5m6a39u80g433l.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%2F62ppvb5m6a39u80g433l.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View CloudWatch Logs.&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%2Fikaybd9dk9slxbqcwjf4.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%2Fikaybd9dk9slxbqcwjf4.png" alt=" " width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View detailed Log events.&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%2Frlqu4gt8o5hkma2wwd5n.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%2Frlqu4gt8o5hkma2wwd5n.png" alt=" " width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Clean up resources
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Delete S3 bucket
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: Log in to the AWS Management Console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Select S3 service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Select the bucket you want to delete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Click the Delete bucket button at the top of the screen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 5: Enter the bucket name in the confirmation box and click Delete.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: If the bucket contains any objects, you will not be able to delete the bucket directly. You must delete all objects in the bucket before deleting the bucket. If you want to delete some specific objects, select the object and click the Delete button.&lt;/p&gt;

&lt;p&gt;Use the AWS Command Line Interface (CLI) to delete a bucket&lt;/p&gt;

&lt;p&gt;You can also use the AWS CLI to delete buckets. Here are the steps to delete a bucket using the AWS CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: Open Command Prompt or Terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Sign in to the AWS CLI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Use the following command to delete the bucket:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 rb s3://bucket-name --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where, bucket-name is the name of the bucket you want to delete. The --force option is used to confirm the deletion of the bucket.&lt;/p&gt;

&lt;p&gt;Note: If the bucket contains any objects, you will not be able to delete the bucket directly. You must delete all objects in the bucket before deleting the bucket. If you want to delete some specific objects, use aws s3 rm command to delete them.&lt;/p&gt;

&lt;p&gt;With the steps above, you can delete a bucket in AWS S3 using the user interface or the AWS CLI. Make sure you back up all your data before deleting the bucket, and do this carefully.&lt;/p&gt;

&lt;h4&gt;
  
  
  Terminate EC2
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Step 1: Login to AWS Management Console&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To delete EC2, you first need to log in to the AWS Management Console. This can be done by going to &lt;a href="https://aws.amazon.com" rel="noopener noreferrer"&gt;https://aws.amazon.com&lt;/a&gt; and logging in with your AWS account.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Step 2: Search for EC2 instance to delete&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After logging in to the AWS Management Console, you need to find the EC2 instance that you want to delete. You can use the search engines or browse the EC2 instance lists to find the instances you want to delete.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Step 3: Delete EC2 instance&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Once you find an EC2 instance to delete, you can delete it by performing the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Right click on the EC2 instance you want to delete.&lt;/li&gt;
&lt;li&gt;Select "Instance State" from the menu that appears.&lt;/li&gt;
&lt;li&gt;Select "Terminate" to delete EC2 instance.&lt;/li&gt;
&lt;li&gt;You will receive a warning to confirm the deletion of the EC2 instance. If you are sure you want to delete the EC2 instance, select "Yes, Terminate".&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Delete CloudFront Distribution
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: Access AWS Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First, you need to sign in to the AWS Console with your account at &lt;a href="https://console.aws.amazon.com/" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Select CloudFront . service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After logging in to the AWS Console, you need to select the CloudFront service by clicking the "Services" icon on the top bar and searching for CloudFront. You can enter the keyword "CloudFront" in the search box to find the service faster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Select CloudFront Distribution to delete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the CloudFront screen, you will see a list of CloudFront Distributions. Find and select the CloudFront Distribution you want to remove by clicking on its name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Delete CloudFront Distribution&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After selecting the CloudFront Distribution to delete, you need to click the "Distribution Settings" button. In the distribution settings page you will see a "Delete" button. Click this button and confirm deletion of CloudFront Distribution by entering "Yes" in the confirmation dialog.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: When deleting CloudFront Distribution, all data related to it will be deleted from the system and cannot be recovered. Therefore, make sure that you have backed up your important data before performing the delete operation.&lt;/p&gt;

&lt;h4&gt;
  
  
  Delete Lambda Function
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: Log in to your AWS account and go to the Lambda service management page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Find and select the Lambda Function you want to delete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Click the Actions button and select Delete Function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Confirm deletion by pressing Delete.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: You cannot restore a deleted Lambda Function.&lt;/p&gt;

&lt;h4&gt;
  
  
  Remove Lambda Edge
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: Log in to your AWS account and go to the Lambda service management page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Select the Functions tab and select the Lambda Function used by Lambda Edge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Find and click the Triggers tab and select Edge Association.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Click the Delete button and confirm by pressing Yes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: After removing Lambda Edge, you need to wait about 10 minutes for the changes to take effect across the CDN network.&lt;/p&gt;

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m"&gt;Get started with CloudFront - Part 1: CloudFront Distribution&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4"&gt;Get started with CloudFront - Part 2: Distribution Invalidations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e"&gt;Get started with CloudFront - Part 3: Response Headers and Cache Behavior&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh"&gt;Get started with CloudFront - Part 4: Lambda@Edge function&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Get started with CloudFront - Part 3: Response Headers and Cache Behavior</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Wed, 01 Mar 2023 20:17:21 +0000</pubDate>
      <link>https://forem.com/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e</link>
      <guid>https://forem.com/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e</guid>
      <description>&lt;h4&gt;
  
  
  Table of Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Response Headers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Cache Behavior&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. Response Headers
&lt;/h4&gt;

&lt;p&gt;In this section, you will configure the security headers in the S3 response returned by your Distribution CloudFront. You don't need to configure your origin or use Lambda@Edge or CloudFront custom functions to insert these headers. Amazon CloudFront now supports configurable response headers.&lt;/p&gt;

&lt;p&gt;Go to the AWS Management Console and select the CloudFront service.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the Distributions tab and select your Distributions ID.&lt;/li&gt;
&lt;li&gt;In the Behaviors tab, select Default(*) behavior and click the Edit button.&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%2Fzywngkyda6l6amrkszax.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%2Fzywngkyda6l6amrkszax.png" alt=" " width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the "Cache key and origin requests" section, under "Response headers policy - optional", open the drop-down list to see a list of options. Select "Security headers" and click the "Save changes" button.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This step will set up a response policy that matches the security header you added in the previous step. When requests come to CloudFront, security headers are inserted into the S3 response from your Distribution. This helps to protect your website from various attacks.&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%2F2ahvvncs1x06fq6n5j5w.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%2F2ahvvncs1x06fq6n5j5w.png" alt=" " width="800" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update the Inbound rule of the security group, change &lt;strong&gt;MyIP&lt;/strong&gt; to &lt;strong&gt;Anywhere&lt;/strong&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%2Fv55ulhvbauojlxvabpdy.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%2Fv55ulhvbauojlxvabpdy.png" alt=" " width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This Management Response Policy will add a set of security headers to all responses that CloudFront sends to viewers. For more information about these security headers, see Mozilla's web security guide.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With this response policy, CloudFront will add X-Content-Type-Options: nosniff to all responses, regardless of whether the response CloudFront receives from Origin contains this header. For all other headers in this policy, if the response CloudFront receives from Origin contains that header, CloudFront uses the header received (and its value) in its response to its viewers. , instead of using the header in this policy.&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%2Fw4v98wbdnhnrrvktoyrb.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%2Fw4v98wbdnhnrrvktoyrb.png" alt=" " width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to your site with your CloudFront URL (eg &lt;a href="http://dxxxx.cloudfront.net" rel="noopener noreferrer"&gt;http://dxxxx.cloudfront.net&lt;/a&gt;), open your browser's developer tools and check the response headers sent by CloudFront. Security headers added using the response policy that you have configured will be listed in the "Response Headers" section of the response.&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%2Fuhy76bugae47oa0rqfor.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%2Fuhy76bugae47oa0rqfor.png" alt=" " width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You learned how to create a Distribution with multiple origins and multiple behaviors to serve static content and forward dynamic content API to your origin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You learned how to set up an origin group to provide rerouting in the event of a problem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You also learned how to set up a custom error page and disable content on the fly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, you learned about some important CloudFront headers for debugging and how to add a response policy to the response.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cache Behavior
&lt;/h4&gt;

&lt;p&gt;In this section, you will create a new Cache Behavior in the CloudFront distribution you created. You will use this Cache Behavior to connect the Lambda@Edge function that you will write.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to the CloudFront dashboard and select the distribution you created in Part 1.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to "Cache Behaviors" tab and click "Create Behavior"&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%2Flueubolftkhyjlumslf8.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%2Flueubolftkhyjlumslf8.png" alt=" " width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make the following configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Path : "/serverless"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Origin: &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%2Fvajod0rl2qe62y6oetew.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%2Fvajod0rl2qe62y6oetew.png" alt=" " width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cache Policy: “Managed-CachingDisabled”&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Origin Request Policy: “Managed-AllViewer”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leave all other settings at default values.&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%2Fcgu1b6vs8j0n4bbnduw3.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%2Fcgu1b6vs8j0n4bbnduw3.png" alt=" " width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click “Create”&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%2F031csm3jca3y2qhb29ox.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%2F031csm3jca3y2qhb29ox.png" alt=" " width="800" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finish creating the new Cache Behavior.&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%2Fxgcwd65ub8znszwiie7g.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%2Fxgcwd65ub8znszwiie7g.png" alt=" " width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m"&gt;Get started with CloudFront - Part 1: CloudFront Distribution&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4"&gt;Get started with CloudFront - Part 2: Distribution Invalidations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e"&gt;Get started with CloudFront - Part 3: Response Headers and Cache Behavior&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh"&gt;Get started with CloudFront - Part 4: Lambda@Edge function&lt;/a&gt;&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>showcase</category>
      <category>writing</category>
    </item>
    <item>
      <title>Get started with CloudFront - Part 2: Distribution Invalidations</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Wed, 01 Mar 2023 19:49:08 +0000</pubDate>
      <link>https://forem.com/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4</link>
      <guid>https://forem.com/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4</guid>
      <description>&lt;h4&gt;
  
  
  Table of Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Test Distribution Invalidations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Custom Error Page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create Origin Group&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. Test Distribution Invalidations
&lt;/h4&gt;

&lt;p&gt;When using &lt;strong&gt;Amazon CloudFront&lt;/strong&gt; to distribute resources to the website, some resources will be stored in CloudFront's cache to speed up access for users. However, when you make changes to a cached resource but cannot change the URL to point to the new version, you need to perform Invalidations to discard the old version and reload the session. new version from the original server.&lt;/p&gt;

&lt;p&gt;Access the &lt;strong&gt;Invalidations tab&lt;/strong&gt; on the &lt;strong&gt;CloudFront&lt;/strong&gt; Console interface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an &lt;strong&gt;Invalidation&lt;/strong&gt; for the &lt;strong&gt;index.html&lt;/strong&gt; resource.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;You can specify / in Object paths because we have set index.html as default root object.&lt;/p&gt;

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

&lt;p&gt;Invalidations in progress&lt;/p&gt;

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

&lt;p&gt;Create successful Invalidations&lt;/p&gt;

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

&lt;p&gt;After a few seconds, retry the site using the browser developer tool, you will see that it is no longer cached by CloudFront and reload a new version from the origin server.&lt;/p&gt;

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

&lt;p&gt;Note: Invalidations may take a few minutes to complete, and during that time, users may be able to access an older version of the resource. Therefore, you need to consider and perform Invalidations at the right time to ensure the latest resources are delivered to users.&lt;/p&gt;

&lt;p&gt;The data shows that when you perform Invalidations, if a resource is already cached in CloudFront, it will be removed from the cache and a new version will be downloaded from the origin server when the user requests access. access that resource. This helps ensure that users receive the latest version of the resource without having to clear the browser cache or wait for the CloudFront cache to expire.&lt;/p&gt;

&lt;p&gt;Using Invalidations in Amazon CloudFront also saves costs and increases the performance of your website. When a resource is stored in CloudFront's cache, downloading it from the origin server consumes a lot of your time and system resources. When you use Invalidations to remove old versions, CloudFront will no longer have to reload these old versions, saving resources and reducing your website's operating costs.&lt;/p&gt;

&lt;p&gt;In short, Invalidations is an important tool that helps ensure that users receive the latest version of the resource and helps speed up the website. It also saves resources and lowers your website's operating costs.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Custom Error Page
&lt;/h4&gt;

&lt;p&gt;When testing a random URL with your CloudFront domain, you will get a 403 Forbidden response from S3 behind CloudFront because the file doesn't exist. By default, CloudFront temporarily stores this response for 10 seconds.&lt;/p&gt;

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

&lt;p&gt;Create the error.html file on your computer using a text editor with the HTML content below and upload it to your S3 bucket as you did before for the index.html file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a text editor on your computer&lt;/li&gt;
&lt;li&gt;If you use Windows, you can use Notepad or Notepad++ to edit text&lt;/li&gt;
&lt;li&gt;If you use MacOS, you can use TextEdit or other text editors to edit text&lt;/li&gt;
&lt;li&gt;Create error.html file with HTML content below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;CloudFront Lab&amp;lt;/h1&amp;gt;
    &amp;lt;strong&amp;gt;Ops, this is a nice error page!&amp;lt;/strong&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Save the error.html file with UTF-8 format and give the file an arbitrary name (eg error.html)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in to AWS Console and select the S3 . service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the S3 bucket where you want to upload the error.html . file&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Select "Upload" to upload the error.html file from your computer to the S3 bucket&lt;/p&gt;

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

&lt;p&gt;Wait for the upload to complete&lt;/p&gt;

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

&lt;p&gt;To check if the error.html file has been uploaded successfully, select it on the S3 bucket and preview its contents.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  Instructions for configuring a custom error page in CloudFront
&lt;/h4&gt;

&lt;p&gt;To configure a custom error page in CloudFront, you can do the following:&lt;/p&gt;

&lt;p&gt;Sign in to the CloudFront dashboard&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the CloudFront Distribution for which you want to configure the custom error page&lt;/li&gt;
&lt;li&gt;Select the "Error Pages" tab&lt;/li&gt;
&lt;li&gt;Find and select the "Error Pages" tab&lt;/li&gt;
&lt;li&gt;Create custom error page&lt;/li&gt;
&lt;li&gt;Click "Create custom error response" button&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;You can configure a custom error page with the following settings.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP error code &amp;gt; 403 Forbidden&lt;/li&gt;
&lt;li&gt;Error caching minimum TTL: 60&lt;/li&gt;
&lt;li&gt;Customize error response: Yes&lt;/li&gt;
&lt;li&gt;Response page path: /error.html&lt;/li&gt;
&lt;li&gt;HTTP Response code: 200 OK&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select Create custom error response&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With these settings, when your site encounters an HTTP error &amp;gt; 403 Forbidden, it will display a custom error page previously configured and cache it for at least 60 seconds. Customers visiting your website will receive a custom error response with the path /error.html and the HTTP response code 200 OK.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

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

&lt;p&gt;Create a successful custom error response.&lt;/p&gt;

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

&lt;p&gt;Test your custom error page by requesting a random page from CloudFront. It may take a few minutes for the update to deliver and propagate to the Edge locations. Make sure you use a different random value than in the previous test, or else you will get the same cached version as when you tested in the last 5 minutes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To check custom error page, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a web browser and visit a random page from CloudFront.&lt;/li&gt;
&lt;li&gt;Wait a few minutes for CloudFront to update and spread the distribution.&lt;/li&gt;
&lt;li&gt;Enter a random value different from the previous test.&lt;/li&gt;
&lt;li&gt;Get HTTP &amp;gt; 403 Forbidden error messages from CloudFront.&lt;/li&gt;
&lt;li&gt;Check if custom error page is displayed or not. If the custom error page is displayed, the configuration is successful.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;If you're still getting the default CloudFront error message, double check your custom error page configuration and make sure you've saved the changes. You should also check that your values ​​match the required settings.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

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

&lt;p&gt;Create a new custom error page to display when CloudFront cannot connect to the source. Use the following settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP error code &amp;gt; 504 Gateway Timeout&lt;/li&gt;
&lt;li&gt;Error caching minimum TTL: 5&lt;/li&gt;
&lt;li&gt;Customize error response: Yes&lt;/li&gt;
&lt;li&gt;Response page path: /error.html&lt;/li&gt;
&lt;li&gt;HTTP Response code: 200 OK&lt;/li&gt;
&lt;li&gt;Select Create custom error response&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Finish creating 2 Error pages.&lt;/p&gt;

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

&lt;p&gt;Change Inbound rule of Security group&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to EC2 Console.&lt;/li&gt;
&lt;li&gt;At the EC2 Console interface, select Security Groups in the left panel.&lt;/li&gt;
&lt;li&gt;Select Security Group containing Inbound rule to access EC2 instance running Nodejs API.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Edit Inbound rule for &lt;strong&gt;HTTP&lt;/strong&gt; from &lt;strong&gt;0.0.0.0/0&lt;/strong&gt; to &lt;strong&gt;MyIP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the Save Rules button to save the changes made.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Edit Security group successfully.&lt;/p&gt;

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

&lt;p&gt;Open a web browser and enter the CloudFront URL of the index.html page in the address bar.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press Enter to access the website.&lt;/li&gt;
&lt;li&gt;Check if the website is working properly or not.&lt;/li&gt;
&lt;li&gt;You will see the interface as shown&lt;/li&gt;
&lt;/ul&gt;

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

&lt;h4&gt;
  
  
  3. Create Origin Group
&lt;/h4&gt;

&lt;p&gt;In this section, you will configure an Origin Group to provide rerouting in the event of a problem. You can associate an Origin Group with a caching behavior so that requests are routed from the primary source to the secondary source for high availability.&lt;/p&gt;

&lt;p&gt;Go to the S3 dashboard, create a new S3 bucket in a different area&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give the S3 bucket a unique name, remember that the S3 bucket name is globally unique, so add a personalization suffix, for example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cloudfrontlab-s3bucket-secondary-&amp;lt;YourNameHere&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Select &lt;strong&gt;Create bucket&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Create a secondary-index.html file on your computer with the HTML content below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;CloudFront Lab&amp;lt;/h1&amp;gt;
    &amp;lt;strong&amp;gt;Hi, this is a page from my secondary Origin! We now support Origin group and failover!&amp;lt;/strong&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open a web browser and log in to the S3 console.

&lt;ul&gt;
&lt;li&gt;Select the name of the S3 bucket that you want to upload the file to.&lt;/li&gt;
&lt;li&gt;Click the "Upload" button in the upper right corner of the web page.&lt;/li&gt;
&lt;li&gt;Select the secondary-index.html file from your computer by clicking the "Add files" button or dragging and dropping the file into the upload area.&lt;/li&gt;
&lt;li&gt;Click the "Upload" button to upload your secondary-index.html file to S3.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

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

&lt;p&gt;Upload successful.&lt;/p&gt;

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

&lt;p&gt;Go to your AWS account and select the CloudFront service.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find and select the CloudFront Distribution for which you want to configure the origin group.&lt;/li&gt;
&lt;li&gt;Create a new origin by selecting the "Create Origin" option&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Choose your origin domain name and select the new S3 bucket containing the secondary-index.html file.&lt;/p&gt;

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

&lt;p&gt;Set up access to the S3 bucket by selecting "Yes, use OAI" and selecting "Select" to select the OAI you created earlier.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update the bucket policy by selecting "Yes, update the bucket policy".&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create origin&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Create origin successfully. Click the Create Origin Group button to create a new Origin Group.&lt;/p&gt;

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

&lt;p&gt;Make origin group configuration. Select the source from the drop-down list and click the Add button to add the source to the Origin Group.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use cloudfrontlab-s3bucket-* as primary origin&lt;/li&gt;
&lt;li&gt;And cloudfrontlab-s3bucket-secondary- as secondary origin&lt;/li&gt;
&lt;li&gt;For failover criteria, select 403 Forbidden and 404 Not Found.&lt;/li&gt;
&lt;li&gt;Click the Create origin group button to finish adding the source to the Origin Group.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Once done, you have successfully added the source to Origin Group on CloudFront. When the primary source fails, CloudFront automatically redirects to the second source to ensure service continuity.&lt;/p&gt;

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

&lt;p&gt;Edit default behavior on CloudFront to use new Origin Group&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Select the Behaviors tab
- Select Default(*) and click the Edit button to edit the default behavior of the distribution.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;Select the Origin Group created in the previous step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the Save changes button to save the changes.&lt;/li&gt;
&lt;li&gt;Once done, CloudFront will use the new Origin Group as the source when accessing the distribution. You can test failover functionality by trying to visit the website and temporarily disconnecting from the network to check if CloudFront redirects to the second source.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Once the distribution status is changed to Deployed, you can request the secondary-index.html site from CloudFront. If CloudFront is working correctly, you should see the second S3 origin serving your request.&lt;br&gt;
    - Open a web browser and access the URL of the CloudFront distribution.&lt;br&gt;
    - Change the URL from /index.html to /secondary-index.html to request the site from the second S3 origin.&lt;br&gt;
    - Check if the web page has been uploaded from the second S3 origin. If the web page is properly uploaded and displayed, it is an indication that CloudFront is working correctly and redirects to the second S3 origin when necessary.&lt;br&gt;
    - Note: If the site is not uploaded or displayed incorrectly, double check your settings to make sure it is properly configured and working as expected.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m"&gt;Get started with CloudFront - Part 1: CloudFront Distribution&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4"&gt;Get started with CloudFront - Part 2: Distribution Invalidations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e"&gt;Get started with CloudFront - Part 3: Response Headers and Cache Behavior&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh"&gt;Get started with CloudFront - Part 4: Lambda@Edge function&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudskills</category>
      <category>network</category>
      <category>community</category>
    </item>
    <item>
      <title>Get started with CloudFront - Part 1: CloudFront Distribution</title>
      <dc:creator>Van Hoang Kha </dc:creator>
      <pubDate>Tue, 28 Feb 2023 19:10:38 +0000</pubDate>
      <link>https://forem.com/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m</link>
      <guid>https://forem.com/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m</guid>
      <description>&lt;h4&gt;
  
  
  Overview
&lt;/h4&gt;

&lt;p&gt;Amazon CloudFront is the static and dynamic content delivery service of Amazon Web Services (AWS). With the ability to increase the speed and stability of your web applications, Amazon CloudFront provides a temporary storage solution for your content on Amazon Edge servers.&lt;/p&gt;

&lt;p&gt;Amazon CloudFront is customizable and flexible allowing you to configure features such as &lt;strong&gt;EC2&lt;/strong&gt; and &lt;strong&gt;S3 Origins&lt;/strong&gt;, &lt;strong&gt;CloudFront Distribution&lt;/strong&gt;, &lt;strong&gt;Custom Error Page&lt;/strong&gt;, Origin Group, Response Headers, create new cache behavior, create Lambda@Edge function and deploy Lambda@Edge function to CloudFront. This increases content availability and reduces response times.&lt;/p&gt;

&lt;p&gt;In addition, Amazon CloudFront provides features that monitor and analyze the performance of content delivered through this service. By logging in to S3 and using tools like Amazon Athena and Amazon Redshift, you can easily monitor and analyze the performance of your assets.&lt;/p&gt;

&lt;p&gt;To help you better understand Amazon CloudFront, let's look at some of its features and usage:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EC2 and S3 Origins&lt;/strong&gt;: Amazon CloudFront allows you to connect content from EC2 or S3. This increases the speed and reduces the response time of your web application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CloudFront Distribution&lt;/strong&gt;: To use Amazon CloudFront, you need to create a distribution. Distribution is a collection of Amazon's Edge servers, on which your content is temporarily stored.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom Error Page&lt;/strong&gt;: You can customize your error page to be compatible with your website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Origin Group&lt;/strong&gt;: If you have multiple Origin servers, you can configure them into a group. CloudFront will automatically switch to other servers in the pool if the origin server crashes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Response Headers&lt;/strong&gt;: You can configure HTTP response headers to customize client requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a new cache behavior&lt;/strong&gt;: If you want to create a new cache behavior, you need to configure its features on the origin server or by using Lambda@Edge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create Lambda@Edge function&lt;/strong&gt;: If you want to process a CloudFront request, you can use the Lambda@Edge function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deploy Lambda@Edge to CloudFront&lt;/strong&gt;: You can deploy your Lambda@Edge function to CloudFront using the AWS CLI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Metrics and Logs&lt;/strong&gt;: Amazon CloudFront provides features to monitor and analyze the performance of content delivered through this service. By logging in to S3 and using tools like Amazon Athena and Amazon Redshift, you can easily monitor and analyze the performance of your assets.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As such, Amazon CloudFront is a great service to increase the speed and stability of your web application. With its features and strengths, Amazon CloudFront is a reliable and flexible content delivery solution.&lt;/p&gt;

&lt;h4&gt;
  
  
  Best practice
&lt;/h4&gt;

&lt;p&gt;To get the most out of Amazon CloudFront's potential, there are a few best practices that you should follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use S3 Bucket or EC2 Instance as Origin: Using S3 Bucket or EC2 Instance as Origin for your CloudFront Distribution will increase response speed and reduce bandwidth costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use SSL/TLS Encryption: Use SSL/TLS Encryption to protect data in transit between Origin and Edge Locations. You can use a free or paid SSL certificate to ensure the security of your data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Compression: Use compression in CloudFront Distribution to reduce file size and speed up page loading.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use CloudFront Behaviors: Create CloudFront Behaviors to customize how CloudFront handles requests. For example, you can create a cache behavior to optimize performance for GET or HEAD requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Caching: Use the caching feature in CloudFront to reduce page load times and reduce bandwidth costs. You can configure the cache to cache resources temporarily and reduce the number of requests to the origin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Lambda@Edge: Use Lambda@Edge to customize and process customer requests on CloudFront. Lambda@Edge provides the ability to add, modify, or remove HTTP headers or resources on your site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use AWS WAF: Use AWS WAF to protect your applications on CloudFront. AWS WAF provides security policies, filters, and access management for your applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use CloudFront Logs: Use the logging feature in CloudFront to monitor and analyze the performance of your delivered assets. You can use data analytics tools, like Amazon Athena or Amazon Redshift, to analyze logs and make smart business decisions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Preparation steps
&lt;/h4&gt;

&lt;p&gt;To get the most out of Amazon CloudFront, you need to create origins for your content. These origins will contain data and are used by CloudFront to deliver content to end users. The two primary origins for use with Amazon CloudFront are Amazon S3 (Simple Storage Service) and Amazon EC2 (Elastic Compute Cloud).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon S3 (Simple Storage Service)&lt;/strong&gt;: If you are using Amazon S3 to store content, you can create an S3 bucket as the origin for CloudFront. An S3 bucket is a simple storage space for storing objects such as images, videos, or documents. After creating an S3 bucket, you can inject objects into it and use this S3 bucket as the origin for CloudFront.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon EC2 (Elastic Compute Cloud)&lt;/strong&gt;: If you are using Amazon EC2 to run your application, you can create an EC2 instance as the origin for CloudFront. An EC2 instance is a virtual machine running on Amazon's cloud platform. After creating an EC2 instance, you can install and configure your application on it, and then use this EC2 instance as the origin for CloudFront.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Originating your content is essential to using Amazon CloudFront effectively. If you are using Amazon S3 or Amazon EC2, it is very simple to create an origin for CloudFront. Using these sources makes it possible to quickly and securely distribute your content.&lt;/p&gt;

&lt;h4&gt;
  
  
  Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="//2.1-createec2/"&gt;Create EC2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//2.2-creates3/"&gt;Create S3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Create CloudFront Distribution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Add EC2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Test app&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Create EC2
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EC2 (Elastic Compute Cloud)&lt;/strong&gt;: If you are using Amazon EC2 to run your application, you can create an EC2 instance as the origin for CloudFront. An EC2 instance is a virtual machine running on Amazon's cloud platform. After creating an EC2 instance, you can install and configure your application on it, and then use this EC2 instance as the origin for CloudFront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Access to EC2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Instances&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Launch instances&lt;/strong&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%2Fevpvzm9ochcvit3ibu7j.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%2Fevpvzm9ochcvit3ibu7j.png" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the instance name&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%2Fs2imhi37i82cie4xy1n2.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%2Fs2imhi37i82cie4xy1n2.png" alt=" " width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;AMI&lt;/strong&gt; as &lt;strong&gt;Amazon Linux&lt;/strong&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%2Fgfq1bpfm1b0672rocake.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%2Fgfq1bpfm1b0672rocake.png" alt=" " width="800" height="708"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;t2.micro&lt;/strong&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%2F0vhnk8t3j4abguwe1i05.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%2F0vhnk8t3j4abguwe1i05.png" alt=" " width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Create new key pair&lt;/strong&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%2F5qnzuar7j78xxugc7v1k.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%2F5qnzuar7j78xxugc7v1k.png" alt=" " width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the key name and select &lt;strong&gt;Create key pair&lt;/strong&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%2Fa97sc0mn0skmtoh2xbuz.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%2Fa97sc0mn0skmtoh2xbuz.png" alt=" " width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure networking&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;VPC&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;security group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Configure security according to the picture&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%2Fhzm3an3m2hn483wzs6jq.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%2Fhzm3an3m2hn483wzs6jq.png" alt=" " width="800" height="864"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down to the &lt;strong&gt;User data&lt;/strong&gt; section, enter the following script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
#Update the system and install Node.js

yum update -y
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
yum install -y nodejs

#Install PM2 and Express
npm install pm2@latest -g
npm install express --save

#Create and configure the Express app
cat &amp;lt;&amp;lt;'EOF' &amp;gt;&amp;gt; app.js
let express = require('express');
let app = express();

app.get('/api', (req, res) =&amp;gt; {
  console.log(JSON.stringify(req.headers));
  let message = {
    timestamp: new Date().toISOString(),
    headers: req.headers,
  };
  res.json(message);
});

app.listen(80, () =&amp;gt; {
  console.log('api is up!');
});
EOF


#Start the app with PM2
sudo pm2 start ./app.js
sudo pm2 startup systemd
sudo pm2 save

#Enable PM2 to start on system boot
systemctl enable --now pm2-root.service
&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%2Fzfl51ryqcy50trqz1iwp.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%2Fzfl51ryqcy50trqz1iwp.png" alt=" " width="800" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Launch instance&lt;/strong&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%2Frpo0nhla03rv4i1oxvif.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%2Frpo0nhla03rv4i1oxvif.png" alt=" " width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Successful EC2 Creation&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%2F4tw2b4w66upchlc32mce.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%2F4tw2b4w66upchlc32mce.png" alt=" " width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View the details of the newly created EC2.&lt;/p&gt;

&lt;p&gt;Copy &lt;strong&gt;Public IPv4 DNS&lt;/strong&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%2Ftuxhjwi7yhnpani6dlvz.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%2Ftuxhjwi7yhnpani6dlvz.png" alt=" " width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;Public IPv4 DNS&lt;/strong&gt; included with &lt;strong&gt;/api&lt;/strong&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%2F5c1alot8n61188qtrcnc.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%2F5c1alot8n61188qtrcnc.png" alt=" " width="800" height="111"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create S3
&lt;/h4&gt;

&lt;p&gt;Sign in to the Amazon Web Services (AWS) S3 management page at &lt;a href="https://console.aws.amazon.com/s3/" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/s3/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Click the &lt;strong&gt;Create bucket&lt;/strong&gt; button to start the process of creating a new bucket.&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%2Fe3c2gbnd9agsi1os5n00.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%2Fe3c2gbnd9agsi1os5n00.png" alt=" " width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the bucket name. The bucket name must be unique throughout the S3 system and cannot contain spaces.&lt;/p&gt;

&lt;p&gt;Select the storage area (Region) for the bucket. The storage area will affect the access speed and hosting price. You should choose an area close to the user to optimize access speed.&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%2F9eo0f05gub9cwvxixbq1.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%2F9eo0f05gub9cwvxixbq1.png" alt=" " width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select other options as needed. AWS provides many options for configuring the bucket, such as encrypting data, sharing the bucket with other users, configuring access permissions, and more.&lt;/p&gt;

&lt;p&gt;Click the &lt;strong&gt;Create bucket&lt;/strong&gt; button to complete the bucket creation process.&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%2F4pgw02tvre35tjgfpiri.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%2F4pgw02tvre35tjgfpiri.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating the bucket, you can access the bucket and add, delete, and edit files in it. To access the bucket, you can use the browser or the AWS SDK management tools.&lt;/p&gt;

&lt;h4&gt;
  
  
  Instructions to create index.html file on Amazon S3
&lt;/h4&gt;

&lt;p&gt;Create file index.html&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a text editor on your computer and create a new file named index.html. Paste the following HTML content into this file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;table border="1" width="100%"&amp;gt;
      &amp;lt;thead&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td&amp;gt;&amp;lt;h1&amp;gt;CloudFront Lab&amp;lt;/h1&amp;gt;&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/thead&amp;gt;
      &amp;lt;tfoot&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td&amp;gt;Immersion Days - Edge Services - Module 1&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tfoot&amp;gt;
      &amp;lt;tbody&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td&amp;gt;Response sent by API&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tbody&amp;gt;
      &amp;lt;tbody&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td&amp;gt;
            &amp;lt;iframe src="/api" style="width: 100%; height: 100%"&amp;gt;&amp;lt;/iframe&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tbody&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Save the index.html file to an easy-to-remember address on your computer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Upload index.html file to Amazon S3&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the Amazon S3 console and select the bucket that was created.&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%2Fe3t4xqk4s4s94qctp7tg.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%2Fe3t4xqk4s4s94qctp7tg.png" alt=" " width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the bucket interface, click the &lt;strong&gt;Upload&lt;/strong&gt; button to upload the index.html 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%2Fndpp3kwwhcudr63d44xh.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%2Fndpp3kwwhcudr63d44xh.png" alt=" " width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next window, click the &lt;strong&gt;Add files&lt;/strong&gt; button and select the index.html file from your computer. Then, click the &lt;strong&gt;Next&lt;/strong&gt; button to go to the next page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On this page, leave all default settings and click the &lt;strong&gt;Next&lt;/strong&gt; button again. Continue to set other settings and click the &lt;strong&gt;Upload&lt;/strong&gt; button to complete the upload.&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%2F3lzughev375449s7w0b4.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%2F3lzughev375449s7w0b4.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the index.html . 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%2Fd910xbw2oed2gaqaod1z.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%2Fd910xbw2oed2gaqaod1z.png" alt=" " width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When accessing the index.html file using the Object URL provided by Amazon S3.&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%2Fp0vwvmkvry3qwurrmjhi.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%2Fp0vwvmkvry3qwurrmjhi.png" alt=" " width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see an access denied message because the file is not configured for public access.&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%2Fqdx55jav915slb4kdlbv.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%2Fqdx55jav915slb4kdlbv.png" alt=" " width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create CloudFront Distribution
&lt;/h4&gt;

&lt;p&gt;Go to CloudFront on the AWS console and click Create a CloudFront Distribution.&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%2Frdsilkkdtvt20bnpv17z.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%2Frdsilkkdtvt20bnpv17z.png" alt=" " width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure the default source for the previously created S3 bucket and grant CloudFront access to the bucket using the Origin Access Identity setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Origin domain &amp;gt; Select your S3 bucket&lt;/li&gt;
&lt;li&gt;Access S3 bucket &amp;gt; Yes using OAI (bucket can limit access only to CloudFront)&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%2Fjht56pzfjw2ukff79l6e.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%2Fjht56pzfjw2ukff79l6e.png" alt=" " width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Origin access identity&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Create new OAI&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%2F74gr8j94zu5vifirqaj3.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%2F74gr8j94zu5vifirqaj3.png" alt=" " width="796" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the displayed dialog, click Create&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%2Fdtoy168412fa8xm6rklz.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%2Fdtoy168412fa8xm6rklz.png" alt=" " width="800" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Policy bucket &amp;gt; Yes, update the bucket policy&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%2F7q89cgc0vzibb1h2aord.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%2F7q89cgc0vzibb1h2aord.png" alt=" " width="790" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure the Default Cache Behavior as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;View protocol policy &amp;gt; Redirect HTTP to HTTPS.&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%2F0skzlgxe2z5t3lf05c01.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%2F0skzlgxe2z5t3lf05c01.png" alt=" " width="800" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cache key and origin requests&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache policy and origin request policy (recommended)&lt;/li&gt;
&lt;li&gt;Cache policy &amp;gt; CachingOptimized (Recommended for S3 source)
CloudFront provides a set of managed cache policies that you can attach to any cache behavior of your distribution. With a managed cache policy, you don't need to write or maintain your own cache policy. Management policies use settings optimized for specific use cases.&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%2F87qei4zhq696vk61izmj.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%2F87qei4zhq696vk61izmj.png" alt=" " width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Settings section:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In this lab you will use a domain name provided by CloudFront, however, if you want to use your own domain name, you can configure it with Alternate Domain Names , you can add a new entry in the section Alternate domain name (CNAME) - optional.&lt;/li&gt;
&lt;li&gt;Configure the Default root object - optionally index.html- And leave all remaining values ​​as default&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%2Fhsny2794qz57w0svkvbc.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%2Fhsny2794qz57w0svkvbc.png" alt=" " width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Create distribution&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%2Fp6657je3hc03czrkzs9b.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%2Fp6657je3hc03czrkzs9b.png" alt=" " width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a successful CloudFront distribution.&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%2F0ebxqtc16qb9th01gis2.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%2F0ebxqtc16qb9th01gis2.png" alt=" " width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CloudFront starts creating the distribution and it usually takes 5 to 10 minutes to fully deliver. The status of the delivery will be In Progress. To check the status, you can click on the Distribution menu on the left sidebar.&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%2Fzgwrzqi6308f6z98wxzj.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%2Fzgwrzqi6308f6z98wxzj.png" alt=" " width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Add EC2 Origin
&lt;/h4&gt;

&lt;p&gt;Access the CloudFront distribution management page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select the distribution ID corresponding to the site you want to configure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Origins tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check existing origins. If you already have an origin, press the Create Origin button to add a new origin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At the Origins page, click the Create Origin button to create a new origin for the API.&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%2Fh2vvz1t1rdh1leyymz0z.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%2Fh2vvz1t1rdh1leyymz0z.png" alt=" " width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the DNS name of the EC2 instance in the Origin Domain Name field. Configure by setting Origin Protocol Policy to HTTP only.&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%2F813jbz1u4ss14aayxval.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%2F813jbz1u4ss14aayxval.png" alt=" " width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep defaults and select &lt;strong&gt;Additional settings&lt;/strong&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%2Fpeuemvvmu20aov2w9xrp.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%2Fpeuemvvmu20aov2w9xrp.png" alt=" " width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Increase keep alive timeout to 60 seconds.&lt;/p&gt;

&lt;p&gt;Note that although we want to serve content over HTTPS to users, we want to keep the HTTP connection to origin to minimize the overhead of TLS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Create origin&lt;/strong&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%2Fb56ychon8bhiu2eq1jpb.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%2Fb56ychon8bhiu2eq1jpb.png" alt=" " width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create origin successfully&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%2F74utfl7drgtoo81jv6kn.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%2F74utfl7drgtoo81jv6kn.png" alt=" " width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure a second Behavior cache to use EC2's origin with the following parameters to use CloudFront as a proxy and ignore any cache classes.&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%2Fjmze56rk0zywo3rj8e8g.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%2Fjmze56rk0zywo3rj8e8g.png" alt=" " width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Path pattern &amp;gt; /api&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Origin and origin groups &amp;gt; Select previously created EC2 Origin&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%2F96692kurj59s0k7p4h8h.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%2F96692kurj59s0k7p4h8h.png" alt=" " width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Viewer protocol policy &amp;gt; Redirect HTTP to HTTPS&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%2F96euv1s8nyjbnav4ksd5.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%2F96euv1s8nyjbnav4ksd5.png" alt=" " width="800" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cache key and origin requests&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache policy and origin request policy (recommended)&lt;/li&gt;
&lt;li&gt;Cache policy &amp;gt; CachingDisabled&lt;/li&gt;
&lt;li&gt;Origin request policy - options -&amp;gt; AllViewer&lt;/li&gt;
&lt;li&gt;In the above configuration, we use two types of management policy, CachingDisabled is a managed cache policy -- this policy disables cache, it is useful for dynamic content and for requests that cannot be handled cached -- and AllViewer is an origin-managed request policy -- this policy includes all values ​​(header, cookie and query string) in the viewer's request.&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%2Fh5u5ilb9fctb7jivxpkd.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%2Fh5u5ilb9fctb7jivxpkd.png" alt=" " width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Create behavior&lt;/strong&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%2Fz63tm4y1pg3a7csshess.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%2Fz63tm4y1pg3a7csshess.png" alt=" " width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create successful behavior.&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%2Fn9ngrz94q2rf9b2qw6w9.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%2Fn9ngrz94q2rf9b2qw6w9.png" alt=" " width="800" height="208"&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%2Fk6qlw8pvoatgamas2orf.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%2Fk6qlw8pvoatgamas2orf.png" alt=" " width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Check the application
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When you create a new CloudFront distribution, it will be in progress and it will take some time to spread to all the points of presence globally. However, you can check if the distribution is ready for local use by looking up its CloudFront domain with the nslookup command in the command line. When you lookup a CloudFront domain, CloudFront returns multiple IP addresses to increase application availability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the distribution has reached all points of presence, the delivery's status will change to deployed (deployed) and you can use it on your web browser using your own CloudFront URL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access to EC2&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%2Fpsyemcgdaza29cykdxiy.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%2Fpsyemcgdaza29cykdxiy.png" alt=" " width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make a connection to EC2.&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%2Fmzoaabzvoox8eo38uzqz.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%2Fmzoaabzvoox8eo38uzqz.png" alt=" " width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the distribution is complete, you can test your web page on your browser served by CloudFront using your CloudFront URL &lt;a href="http://dxxxx.cloudfront.net" rel="noopener noreferrer"&gt;http://dxxxx.cloudfront.net&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the web page, you can see the various headers that CloudFront forwarded and attached to your API endpoint:&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%2Fbi2bewxw40v7l3pmt5qp.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%2Fbi2bewxw40v7l3pmt5qp.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;x-amz-cf-id: A unique id for this request provided by CloudFront. If you refresh the site you will see that the request id changes. It's useful to log it on your web server in general. Additionally, this id will be sent back to every viewer request and sent to the CloudFront access log. If you need to debug any issue, you can open a support ticket and give them the request id.&lt;br&gt;
Notice how CloudFront redirected the request to HTTPS.&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%2F5pnl82um10l5u5hotevz.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%2F5pnl82um10l5u5hotevz.png" alt=" " width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you use your favorite web browser development tools, you can check the response headers sent by CloudFront. Three notable titles to check out:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;x-amz-cf-id: Contains the request id assigned by CloudFront.&lt;br&gt;
x-amz-cf-pop: Indicates the location of the CloudFront edge that served your request. Each edge position is identified by a three-letter code and an arbitrary number, for example, DFW3. The three-letter code usually corresponds to the International Air Transport Association airport code for an airport near the edge location.&lt;br&gt;
x-cache: Indicates whether the request was evaluated as a pass or fail. Normally for your html file you will get 'Hit from Cloudfront' value in subsequent requests, but always 'Miss from CloudFront' for /api request because caching has been disabled for this behavior.&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%2Fbnituo984d8ix9x3y4ed.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%2Fbnituo984d8ix9x3y4ed.png" alt=" " width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means that if you visit your site again, the request will be retrieved from the cache and returned with the results stored in it instead of having to reload from the original server, improving time. load pages and increase performance. However, if you make changes to your site, you may want to refresh the cache to ensure that your users see the latest 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%2F7f3zgsaebap3qx9bgq36.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%2F7f3zgsaebap3qx9bgq36.png" alt=" " width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In case you need to access the distribution from a different geographic region, you can use CloudFront's alternate domains, including domain names for each of the different geographies. This helps ensure that users in each region are served by their nearest CloudFront edge, which optimizes page load times and minimizes latency.&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%2Fzysnczoqheuwdqybzdmi.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%2Fzysnczoqheuwdqybzdmi.png" alt=" " width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you need to create a copy of an existing CloudFront distribution, you can use the clone feature to create an exact copy of the current distribution. This can be useful when you need to serve another version of your website or application at the same time, or when you need to deal with any issues with an existing distribution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you need to set up access policies to limit access to your distribution, you can use CloudFront's access management feature. This allows you to set up access policies based on IP address, domain name, HTTP method and more, helping to ensure that only authorized users can access your distribution. Friend.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, if you need assistance from the AWS technical team, you can open a support ticket and provide details about your issue, including CloudFront request IDs and other information about your issue. your distribution. The AWS technical team will try to assist you in resolving your issue as soon as possible.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The following sections
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-cloudfront-distribution-2n1m"&gt;Get started with CloudFront - Part 1: CloudFront Distribution&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-2-distribution-invalidations-2d4"&gt;Get started with CloudFront - Part 2: Distribution Invalidations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-3-response-headersand-cache-behavior-2n5e"&gt;Get started with CloudFront - Part 3: Response Headers and Cache Behavior&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/aws-builders/get-started-with-cloudfront-part-4-lambdaedge-function-4cbh"&gt;Get started with CloudFront - Part 4: Lambda@Edge function&lt;/a&gt;&lt;/p&gt;

</description>
      <category>networking</category>
      <category>selfhost</category>
    </item>
  </channel>
</rss>
