<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lester</title>
    <description>The latest articles on DEV Community by Lester (@ldbravo).</description>
    <link>https://dev.to/ldbravo</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%2F1611818%2F8fa8b673-7df7-4df2-9521-d263e885f2e2.jpg</url>
      <title>DEV Community: Lester</title>
      <link>https://dev.to/ldbravo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ldbravo"/>
    <language>en</language>
    <item>
      <title>Create React app and deploy it on AWS Amplify - Sep 2024 update</title>
      <dc:creator>Lester</dc:creator>
      <pubDate>Tue, 17 Sep 2024 21:18:14 +0000</pubDate>
      <link>https://dev.to/ldbravo/create-react-app-and-deploy-it-on-aws-amplify-sep-2024-update-5o3</link>
      <guid>https://dev.to/ldbravo/create-react-app-and-deploy-it-on-aws-amplify-sep-2024-update-5o3</guid>
      <description>&lt;h3&gt;
  
  
  Repository and React app setup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create repo in CodeCommit&lt;/li&gt;
&lt;li&gt;Clone repo:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone codecommit::us-east-1://my-react-app
cd my-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create react app with vite:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm create vite@latest .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select framework: React, variant: TypeScript&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install packages&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;npm run install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Commit and push app creation with vite to main branch
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .; git commit -m "App creation with vite"
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create AWS Amplify App
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Select CodeCommit, next&lt;/li&gt;
&lt;li&gt;Add repository and branch, next&lt;/li&gt;
&lt;li&gt;Review app settings: App name, Build settings (use "npm run build" for Frontend build command and "dist" for Build output directory), next&lt;/li&gt;
&lt;li&gt;Save and deploy&lt;/li&gt;
&lt;li&gt;When app fails due to repository access:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CustomerError: Unable to clone repository due to user error code: 128
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.1. Create a service role:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/amplify/latest/userguide/how-to-service-role-amplify-console.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/amplify/latest/userguide/how-to-service-role-amplify-console.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.2. After service role creation, add it to Amplify settings:&lt;/p&gt;

&lt;p&gt;Go to App settings &amp;gt; General settings &amp;gt; Edit &amp;gt; Select a "Service role" and save&lt;/p&gt;

&lt;p&gt;Go to failed deployment and select "Redeploy this version"&lt;/p&gt;

</description>
      <category>aws</category>
      <category>amplify</category>
      <category>react</category>
      <category>vitejs</category>
    </item>
    <item>
      <title>AWS Amplify Gen2 Authentication</title>
      <dc:creator>Lester</dc:creator>
      <pubDate>Tue, 11 Jun 2024 23:15:01 +0000</pubDate>
      <link>https://dev.to/ldbravo/aws-amplify-gen2-authentication-cp6</link>
      <guid>https://dev.to/ldbravo/aws-amplify-gen2-authentication-cp6</guid>
      <description>&lt;p&gt;Some times the guides does not help much and something is missing to make thinks work. In this case, this guide will help setting up a new project in AWS Amplify with Cognito Authentication.&lt;/p&gt;

&lt;p&gt;There we go with the required steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a GitHub or CodeCommit repo.&lt;/li&gt;
&lt;li&gt;Create a React App, in my case I'm using Vite.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm create vite@latest my-app-name
npm install    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add amplify to the new React app
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm create amplify@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Commit the changes to master/main branch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create Amplify app in the AWS Console, select your repository and the master/main branch.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the deployment has been completed, download the file amplify_outputs.json and put it on the root of your project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the authentication component, it can be found here: &lt;a href="https://docs.amplify.aws/react/build-a-backend/auth/set-up-auth/" rel="noopener noreferrer"&gt;https://docs.amplify.aws/react/build-a-backend/auth/set-up-auth/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And that's it, now you can use Cognito authentication in your React app. I spent some time struggling with backend deployment on Amplify but it was because I didn't follow the correct order on this steps, we need first to add the Amplify files (step 3) and then deploy the app (step 5), otherwise the backend deployment will not be there.&lt;/p&gt;

&lt;p&gt;See you in a next post!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>amplify</category>
      <category>react</category>
      <category>authentication</category>
    </item>
  </channel>
</rss>
