3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Amazon Linux 2 AMIにAmplifyを導入

Posted at

環境

  • Amazon Linux 2 AMI

作業内容

  • Node.jsの導入
  • Amplifyの導入

Node.jsの導入

ノードバージョンマネージャー (nvm) をインストール

# インストール
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

# 有効化
$ . ~/.nvm/nvm.sh

Node.js の最新バージョンをインストール

# インストール
$ nvm install node

# 確認
$ node -e "console.log('Running Node.js ' + process.version)"

Node.jsのバージョン切り替え

# インストール可能なバージョンを確認
$ nvm ls-remote

# 指定したバージョンをインストール
$ nvm install 14.15.0

# 使用するバージョンを切り替える
$ nvm use 14.15.0

# バージョンを確認する
$ node -v

Amplifyの導入

AmplifyCLIをインストール

$ npm install -g @aws-amplify/cli

PATHを通す(Node.jsのバージョン切り替えを行った時に必要な対応)

$ vi .bash_profile

下記を追加

# Amplify
export PATH=$HOME/.nvm/versions/node/v14.15.0/bin:$PATH

動作確認

$ amplify


| Category      |
| ------------- |
| notifications |
| analytics     |
| api           |
| auth          |
| function      |
| hosting       |
| interactions  |
| predictions   |
| storage       |
| xr            |

 █████╗ ███╗   ███╗██████╗ ██╗     ██╗███████╗██╗   ██╗    ███████╗██████╗  █████╗ ███╗   ███╗███████╗██╗    ██╗ ██████╗ ██████╗ ██╗  ██╗
██╔══██╗████╗ ████║██╔══██╗██║     ██║██╔════╝╚██╗ ██╔╝    ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║    ██║██╔═══██╗██╔══██╗██║ ██╔╝
███████║██╔████╔██║██████╔╝██║     ██║█████╗   ╚████╔╝     █████╗  ██████╔╝███████║██╔████╔██║█████╗  ██║ █╗ ██║██║   ██║██████╔╝█████╔╝ 
██╔══██║██║╚██╔╝██║██╔═══╝ ██║     ██║██╔══╝    ╚██╔╝      ██╔══╝  ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝  ██║███╗██║██║   ██║██╔══██╗██╔═██╗ 
██║  ██║██║ ╚═╝ ██║██║     ███████╗██║██║        ██║       ██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║  ██║██║  ██╗
╚═╝  ╚═╝╚═╝     ╚═╝╚═╝     ╚══════╝╚═╝╚═╝        ╚═╝       ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝ ╚══╝╚══╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝
                                                                                                                                         
amplify <command> <subcommand>

  init                Initializes a new project, sets up deployment resources in the cloud, and makes your project ready for Amplify.                              
  configure           Configures the attributes of your project for amplify-cli, such as switching front-end framework and adding/removing cloud-provider plugins. 
  push                Provisions cloud resources with the latest local developments.                                                                               
  pull                Fetch upstream backend environment definition changes from the cloud and updates the local environment to match that definition.             
  publish             Executes amplify push, and then builds and publishes client-side application for hosting.                                                    
  serve               Executes amplify push, and then executes the project's start command to test run the client-side application locally.                        
  status              Shows the state of local resources not yet pushed to the cloud (Create/Update/Delete).                                                       
  delete              Deletes all of the resources tied to the project from the cloud.                                                                             
  <category> add      Adds a resource for an Amplify category in your local backend                                                                                
  <category> update   Update resource for an Amplify category in your local backend.                                                                               
  <category> push     Provisions all cloud resources in a category with the latest local developments.                                                             
  <category> remove   Removes a resource for an Amplify category in your local backend.                                                                            
  <category>          Displays subcommands of the specified Amplify category.                                                                                      
  mock                Run mock server for testing categories locally.                                                                                              
  codegen             Generates GraphQL statements(queries, mutations and eventHandlers) and type annotations.                                                     
  env                 Displays and manages environment related information for your Amplify project.                                                               
  console             Opens the web console for the selected cloud resource. 
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?