Amplify Gen2 AudioGuide
-- 2024_12_10(Tue)
$ npm list -g --depth=0
/usr/local/lib
└── @aws-amplify/cli@12.12.2
$ amplify init
? Initialize the project with the above configuration? No
? 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 profile
? Please choose the profile you want to use default
Adding backend environment dev to AWS Amplify app: d16ioc7hey8eu3
Deployment completed.
Deploying root stack AmplifyAudioGuide [ ==========------------------------------ ] 1/4
amplify-amplifyaudioguide-dev… AWS::CloudFormation::Stack CREATE_IN_PROGRESS Tue Dec 10 2024 08:04:
AuthRole AWS::IAM::Role CREATE_IN_PROGRESS Tue Dec 10 2024 08:04:
UnauthRole AWS::IAM::Role CREATE_IN_PROGRESS Tue Dec 10 2024 08:04:
DeploymentBucket AWS::S3::Bucket CREATE_COMPLETE Tue Dec 10 2024 08:04:
✔ Help improve Amplify CLI by sharing non-sensitive project configurations on failures (y/N) · no
You can always opt-in by running "amplify configure --share-project-config-on"
Deployment state saved successfully.
✔ Initialized provider successfully.
✅ Initialized your environment successfully.
✅ Your project has been successfully initialized and connected to the cloud!
Some next steps:
"amplify status" will show you what you've added already and if it's locally configured or deployed
"amplify add <category>" will allow you to add features like user login or a backend API
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify console" to open the Amplify Console and view your project status
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
Pro tip:
Try "amplify add api" to create a backend API and then "amplify push" to deploy everything
認証機能の追加(Cognito)
amplify add auth
╭─────────────────────────────────────────────
│ │
│ Update available: │
│ Run amplify upgrade for the latest features and fixes! │
│ │
╰─────────────────────────────────────────────
Using service: Cognito, provided by: awscloudformation
The current configured provider is Amazon Cognito.
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? Username
Do you want to configure advanced settings? No, I am done.
✅ Successfully added auth resource amplifyaudioguide1cdcd76b locally
✅ Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
API (GraphQL) の追加
amplify add api
? Select from one of the below mentioned services: GraphQL
? Here is the GraphQL API that we will create. Select a setting to edit or continue Continue
? Choose a schema template: Single object with fields (e.g., “Todo” with ID, name, description)
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
✅ GraphQL schema compiled successfully.
Edit your schema at /home/ec2-user/environment/Amplify-AudioGuide/amplify/backend/api/amplifyaudioguide/schema.graphql or place .graphql files in a directory at /home/ec2-user/environment/Amplify-AudioGuide/amplify/backend/api/amplifyaudioguide/schema
✔ Do you want to edit the schema now? (Y/n) · no
✅ Successfully added resource amplifyaudioguide locally
✅ Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
S3ストレージを追加
amplify add storage
? Select from one of the below mentioned services: Content (Images, audio, video, etc.)
✔ Provide a friendly name for your resource that will be used to label this category in the project: · AmplifyAudioGuide
✔ Provide bucket name: · amplify-audio-guide
✔ Who should have access: · Auth and guest users
✔ What kind of access do you want for Authenticated users? · create/update, read, delete
✔ What kind of access do you want for Guest users? · read
✔ Do you want to add a Lambda Trigger for your S3 Bucket? (y/N) · no
⚠️ Specified resource configuration requires Cognito Identity Provider unauthenticated access but it is not enabled.
✅ Successfully updated auth resource locally.
✅ Successfully added resource AmplifyAudioGuide locally
⚠️ If a user is part of a user pool group, run "amplify update storage" to enable IAM group policies for CRUD operations
✅ Some next steps:
"amplify push" builds all of your local backend resources and provisions them in the cloud
"amplify publish" builds all of your local backend and front-end resources (if you added hosting category) and provisions them in the cloud
-- 2024_12_11(Wed)
Hosting の追加
$ amplify add hosting
✔ Select the plugin module to execute · Hosting with Amplify Console (Managed hosting with custom domains, Continuous deployment)
? Choose a type Manual deployment
You can now publish your app using the following command:
Command: amplify publish
Lambdaの追加
$ amplify add function
? Select which capability you want to add: Lambda function (serverless function)
? Provide an AWS Lambda function name: audioGuideAuthFunction
? Choose the runtime that you want to use: Python
⚠️ You must have pipenv installed and available on your PATH as "pipenv". It can be installed by running "pip3 install --user pipenv".
You must have virtualenv installed and available on your PATH as "venv". It can be installed by running "pip3 install venv".
Only one template found - using Hello World by default.
✅ Available advanced settings:
- Resource access permissions
- Scheduled recurring invocation
- Lambda layers configuration
- Environment variables configuration
- Secret values configuration
? Do you want to configure advanced settings? No
✔ Select the plugin module to execute · Hosting with Amplify Console (Managed hosting with custom domains, Continuous deployme? Do you want to edit the local lambda function now? No
✅ Successfully added resource audioGuideAuthFunction locally.
✅ Next steps:
Check out sample function code generated in <project-dir>/amplify/backend/function/audioGuideAuthFunction/src
"amplify function build" builds all of your functions currently in the project
"amplify mock function <functionName>" runs your function locally
To access AWS resources outside of this Amplify app, edit the /home/ec2-user/environment/Amplify-AudioGuide/amplify/backend/function/audioGuideAuthFunction/custom-policies.json
"amplify push" builds all of your local backend resources and provisions them in the cloud
"amplify publish" builds all of your local backend and front-end resources (if you added hosting category) and provisions them in the cloud