반응형
Amplify cli 설치
Amplify cli설치를 위해서는 12.x버전 이상의 node와 6.x버전 이상의 npm이 설치되어 있어야 합니다.
npm install -g @aws-amplify/cli
IAM 사용자 생성
amplify configure
생성한 액세스 키를 잘 저장해 둡니다.
이미 IAM 사용자라면 이 단계를 건너뛰어도 됩니다.
Amplify 프로젝트 초기화
amplify init
자신의 프로젝트에 맞게 설정합니다.
nextjs의 경우 Distribution Directory Path를 .next로 변경합니다.
자식의 액세스 키를 사용하여 인증하면 됩니다.
작업 폴더 내에 amplify폴더와 aws-exports.js 파일이 생성됩니다.
AWS Amplify에서 생성한 앱을 확인 할 수 있습니다.
사용자 인증 추가
amplify add auth
이전 생성한 사용자 풀을 사용하려면 amplify import auth 명령어를 사용하면 됩니다.
Amplify 프로젝트 리소스 업데이트
amplify push auth
aws-amplify 패키지 설치
npm i aws-amplify
import { Amplify } from "aws-amplify";
import awsmobile from "@/aws-exports";
Amplify.configure(awsmobile);
amplify의 기능들을 사용 할 수 있도록 코드에 입력해줍니다.
헤당 사이트의 필요한 기능들을 사용하여 기능을 구현해줍니다.
https://docs.amplify.aws/nextjs/build-a-backend/auth/connect-your-frontend/sign-up/
Sign-up - AWS Amplify Gen 2 Documentation
Learn how to sign up AWS Amplify Documentation
docs.amplify.aws
반응형