Open6

AWS Cloud9

marchanmarchan

ハードディスクの容量増

  1. EC2インスタンスのボリューム容量を変更

  2. パーティションに容量を割り当て

$ sudo lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 100G 0 disk
├─nvme0n1p1 259:1 0 10G 0 part /
├─nvme0n1p127 259:2 0 1M 0 part
└─nvme0n1p128 259:3 0 10M 0 part /boot/efi

$ sudo growpart /dev/nvme0n1 1

CHANGED: partition=1 start=24576 old: size=20946911 end=20971487 new: size=209690591 end=209715167

$ sudo lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 100G 0 disk
├─nvme0n1p1 259:1 0 100G 0 part /
├─nvme0n1p127 259:2 0 1M 0 part
└─nvme0n1p128 259:3 0 10M 0 part /boot/efi

marchanmarchan

Cloud9とGitHubの連携

2023.11.25
https://zenn.dev/robes/articles/13d57a15c893b5

$ git config --global user.name  YAMADA taro
$ git config --global user.name
$ git config --global user.email  ********@gmail.com
$ git config --global user.email
$ ssh-keygen -t ed25519 -C  *******@***.com
$ cat ~/.ssh/id_ed25519.pub
$ ssh -T git@github.com

You've successfully authenticated, but GitHub does not provide shell access.

marchanmarchan

Pythonの環境構築

●2023.12.10
https://qiita.com/Haruki-N/items/184bc0be9ba4949cf046

2023.11.25
https://zenn.dev/robes/articles/13d57a15c893b5

2023.11.01
https://blog.serverworks.co.jp/cloud9-python-verup

  1. pyenv インストール
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Cloning into '/home/ec2-user/.pyenv'...
remote: Enumerating objects: 23793, done.
remote: Counting objects: 100% (2304/2304), done.
remote: Compressing objects: 100% (347/347), done.
remote: Total 23793 (delta 2026), reused 2127 (delta 1921), pack-reused 21489
Receiving objects: 100% (23793/23793), 4.76 MiB | 20.40 MiB/s, done.
Resolving deltas: 100% (16140/16140), done.

$ echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ tail ~/.bashrc

PS1='[\033[01;32m](_cloud9_prompt_user)\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\](__git_ps1 " (%s)" 2>/dev/null) $ 'fi
[[ -s "HOME/.rvm/environments/default" ]] && source "HOME/.rvm/environments/default"
[ -s "NVM_DIR/bash_completion" ] && \. "NVM_DIR/bash_completion" # This loads nvm bash_completion
Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="PATH:HOME/.rvm/bin"
export PATH="HOME/.pyenv/bin:PATH"
eval "$(pyenv init -)"

$ source ~/.bashrc
$ pyenv --version

pyenv 2.3.35-10-g2374260e

  1. Python のインストール
$ source ~/.bashrc
$ pyenv --version
$ pyenv install -l
$ pyenv install --list | grep 3.10.0
$ sudo yum -y install bzip2-devel
$ sudo yum -y install readline xz
$ sudo yum -y install lzma
$ sudo yum remove -y openssl-devel
$ sudo yum install openssl11 openssl11-devel
$ pyenv install 3.10.0
marchanmarchan

AWS Amplify の構築

  • Amplify CLI をグローバルにインストール
$ npm install -g @aws-amplify/cli

added 33 packages in 20s
7 packages are looking for funding
  run `npm fund` for details
$ amplify configure

Follow these steps to set up access to your AWS account:
Sign in to your AWS administrator account:
https: // console.aws.amazon.com/ 
Press Enter to continue
Unable to open https: // console.aws.amazon.com/: spawn xdg-open ENOENT
Have you installed `xdg-utils` on your machine?
Specify the AWS Region
? region:  ap-northeast-1 【選択】
Follow the instructions at https: // docs.amplify.aws/cli/start/install/#configure-the-amplify-cli
  • AWS コンソール画面 IAM ユーザを作成する。
     ・アクセス権限を設定
     ・アクセスキーとシークレットアクセスキーをメモする。
to complete the user creation in the AWS console
https: // console.aws.amazon.com/iamv2/home#/users/create
Press Enter to continue
Unable to open https : // docs.amplify.aws/cli/start/install/#configure-the-amplify-cli: spawn xdg-open ENOENT
Have you installed `xdg-utils` on your machine?
Unable to open https: // console.aws.amazon.com/iamv2/home#/users/create: spawn xdg-open ENOENT
Have you installed `xdg-utils` on your machine?
Enter the access key of the newly created user:
? accessKeyId:  ********************
? secretAccessKey:  ****************************************
This would update/create the AWS Profile in your local machine
? Profile Name:  default ←【リターン】
Successfully set up the new user.
  • Cloud9 AWS setttings 「AWS managed temporary credentials」 をOFFにする
    ・AWS Settingにおいて「AWS managed temporary credentials」を非アクティブとする。
marchanmarchan

React 環境の構築

  • Node.js のインストール有無とバージョンを確認
$ node -v

v20.11.0
  • npm のインストール有無とバージョンを確認
$ npm -v

10.3.0
  • create-react-app のインストール有無を確認
$ npm list -g create-react-app

/home/ec2-user/.nvm/versions/node/v20.11.0/lib
└── (empty)
  • yarnをインストール
$ yarn -v
bash: yarn: command not found

$ npm install -g yarn
added 1 package in 1s

$ yarn -v
1.22.21
  • npx のインストール有無とバージョンを確認
$ create-react-app --version

bash: create-react-app: command not found