0
0

More than 3 years have passed since last update.

AWS CloudShellをzsh化する

Posted at

CloudShellとは

Azureとかにはあった、Webコンソールでターミナルを使えるやつです。
簡単なコマンドを叩くだけならいちいちCloud9環境やEC2をセットアップしなくてもよくなりました。
公式の紹介記事:https://aws.amazon.com/jp/blogs/news/aws-cloudshell-command-line-access-to-aws-resources/

zsh化の手順

0..bashrc のバックアップを作成します。(バックアップファイル名は任意)

$ cp .bashrc .bashrc.org

1..bashrc を開きます。

$ vim .bashrc

2.最終行に以下を追記します。

zsh

(↓全体)

.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
complete -C '/usr/local/bin/aws_completer' aws
export AWS_EXECUTION_ENV=CloudShell

# settings for zsh
zsh

3.エディタを閉じます。

:wq

4.設定を反映します。

$ source .bashrc

以上で完了です。
あとは oh-my-zsh を導入するなど好きなようにカスタマイズします。

Tips

  • $HOME(/home/cloudshell-user)以下は永続ストレージなので、セッションタイムアウトしてもシェルの設定が保持されます。
  • ストレージはリージョンごとに異なるため、別リージョンのシェルには反映されません。
  • 操作に失敗してどうにもならなくなった時は 右上の[Actions] > [Delete AWS CloudShell home directory]からホームディレクトリを削除することで初期状態に戻せます。ただし、$HOME以下の情報は全て失われます。

参考

0
0
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
0
0