Open3

AWS Amplify

なかむら@AWSを使うなかむら@AWSを使う

AWS Amplify CLIインストール

npm install -g @aws-amplify/cli

command not foundになった

amplify -v

解決方法はこちら

React App作成

以下参照:
https://zenn.dev/nakam_aws/scraps/1bd420b03e364a

amplify configure

amplify configure
  • AWSコンソール ログイン画面に遷移するので、ログインする
  • IAMユーザー作成に誘導されるので、流れに身を任せる。。。。
amplify init

以下、しつもんぜめにあう。


? Enter a name for the project [そのままEnter]

? Initialize the project with the above configuration? [yesでもいいけど、noで1つづつ確認]
? Enter a name for the environment dev
? Choose your default editor: Visual Studio Code
? Choose the type of app that you're building javascript
Please tell us about your project
? What javascript framework are you using react
? Source Directory Path:  src
? Distribution Directory Path: build
? Build Command:  npm run-script build
? Start Command: npm run-script start
Using default provider  awscloudformation
? Select the authentication method you want to use: AWS access keys
? accessKeyId:  ********************
? secretAccessKey:  ****************************************
? region:  ap-northeast-1

import './App.css';

function App() {
  return (
    <div className="App">
      {/* ここの中を全部削除 */}
    </div>
  );
}

export default App;
npm install --save aws-amplify @aws-amplify/ui-react

authモジュール追加

amplify add auth

以下、質問

 Do you want to use the default authentication and security configuration? Default configuration
 Warning: you will not be able to edit these selections. 
 How do you want users to be able to sign in? Email
 Do you want to configure advanced settings? No, I am done.

authモジュールをawsにプッシュ

amplify push

これで進めるけど、ほんまにええんか?

? Are you sure you want to continue? Yes

プログラムは割愛したけど、ここまでで認証画面が出せるか確認。

npm run start

参考

https://www.udemy.com/course/aws-amplify-react-authentication/

なかむら@AWSを使うなかむら@AWSを使う

amplify -v command not foundエラー

インストール

npm install -g @aws-amplify/cli

インストール出来たか確認するも、command not found

amplify -v
-bash: amplify: command not found

amplifyのパスを確認

which amplify
/Users/mac/.anyenv/envs/nodenv/shims/amplify

確認したパスを登録する

export PATH=$HOME/.anyenv/envs/nodenv/shims/amplify:$PATH

再確認 OK

amplify -v
7.6.11