4
0

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 5 years have passed since last update.

GCPの備忘録

4
Last updated at Posted at 2021-02-17

備忘録

いろいろ触ってると「あれどうやんだっけ」って毎回なって中々定着しないので、覚えがてらいろいろな備忘録

VMインスタンス

Always Freeの条件

  • リージョン
    us-central1, us-west1, us-east1
  • マシンタイプ
    f1-micro
  • ブートディスク
    標準永続ディスク/30GBまで
  • イメージ
    RHEL以外選んでおけば良さそう

SSH接続

・gcp認証
% gcloud auth login
・SSH接続
% gcloud compute ssh インスタンス名 --ssh-flag="-p ポート番号"
・SSHログイン
% ssh 外部IP -i ~/.ssh/key -p 変更後ポート番号
・secureログ確認
% sudo cat /var/log/secure
・CentOSの場合はFWサービス停止

$ sudo systemctl disable firewalld
$ sudo vi /etc/selinux/config
一旦インスタンス再起動

・sshd.confの設定(バックアップ/ポート番号を変更)
% sudo sed -i -e "s/#Port 22/Port 変更後ポート番号/g" /etc/ssh/sshd_config
・sshd再起動
% sudo systemctl restart sshd

ファイアーウォール設定

インスタンスの「ネットワーク詳細の表示」
→ ファイアーウォール ルール
 → default-allow-ssh

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?