- Added authentication to your app allowing users to sign up, sign in, and manage their account
- Scalable GraphQL API configured with an Amazon DynamoDB database allowing users to create and delete notes
- Added file storage using Amazon S3 allowing users to upload images and view them in their app
Create a React application and deploy it to the cloud using AWS Amplify web hosting service
AWS Amplify provides a Git-based CI/CD workflow for building, deploying, and hosting single page web applications or static sites with serverless backends.
- Create a React application by using command
npx create-react-app amplifyapp
- Initialize GitHub repository, initialize git and push the application to the new GitHub
- Connect the GitHub repository to the AWS Amplify service!
install and configure Amplify CLI
Amplify CLI is a unified toolchain to create, manage, and remove AWS services directly from our terminal.
- Install Amplify CLI by using command
npm install -g @aws-amplify/cli
- Configure Amplify CLI by using command
amplify configure
and follow this tutorial video. Amazon IAM(Identity and Access Management) enables us to manage users permissions in AWS. - Initialize the app (Deploy a back end and initialize the backend environmental locally)
Use Amplify CLI and libraries to configure and add authentication to the app
- Install Amplify libraries by using the command
npm install aws-amplify @aws-amplify/ui-react
- aws-amplify library contains all the client-side APIs for interacting with the various AWS services
- @aws-amplify/ui-react library contains framework-specific UI components.
- Create the authentication service by using
amplify add auth
- Deploy the authentication service by using
amplify push --y
- Configure the React project with Amplify resources, add imports in index.js
- Add the authentication flow in App.js by using withAuthenticator component. This component will scaffold an entire user authentication flow allowing users to sign up, sign in and reset their password, and confirm sign in for multifactor authentication(MFA)
- Set up CI/CD if the front end and backend.
Use Amplify CLI and libraries to configure and add a GraphQL API to app GraphQL API leverages AWS AppSync (a managed GraphQL service) which is backed by Amazon DynamoDB (a NoSQL database)
- Create a GraphQL API and database
amplify add api
- Open the schema.graphql and add the following schema:
type Note @model { id: ID! name: String! description: String }
- Deploy API
amplify push --y
. This will do three things:- Create the AppSync API
- Create a DynamoDB table
- Create the local GraphQL operations in a folder located at src/graphql that can be used to query the api
- Write frond-end code to interact with the API. Saved in src/App.js
Add storage and the ability to associate an image with the notes in the app Use Amplify CLI and libraries to create a storage service leveraging Amazon S3.
- Create the storage service
amplify add storage
- Update the GraphQL schema, add one line:
image: String
in schema.graphql - Deploy storage service and API updates
amplify push --y
- Update React app in App.js file
- Add storage class
import { API, Storage} from 'aws-amplify'
- Create a new onChange function
- Update the fetchNotes function to fetch an image
- Update the createNote function to add the image to the local image array
- Add additional input to the form in the return block
- Render an image if it exists
- Add storage class
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify