0
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 1 year has passed since last update.

今更Amazon Linux 2018.03でGoogle Cloud CLIを使う

Posted at

EC2セットアップ

2023年4月現在、公式の Amazon Linux 2018.03 はサポート期限切れのため、ありません。
マシンイメージ選択時に「amzn-ami-hvm-2018.03」で検索して、AWS Marketplace AMIかコミュニティAMIの中から選びましょう。
image.png

Python 3.6 のセットアップ

Amazon Linux 2018.03のPythonは 2.7.18 が入っています。
Google Cloud CLIの利用には3.5〜3.9が必要です。
元から入っているPython2系を抜くことなく、Python3.6をインストールします。

export CLOUDSDK_PYTHON=python3
sudo yum -y install python36-devel python36-libs python36-setuptools
python3 -V
sudo python3 -m ensurepip --upgrade
python3 -V

上記URLに従って、 Python 3.6 をインストールします。

Google Cloud CLIのセットアップ

curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-426.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-cli-426.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh

ここでログインし直し

./google-cloud-sdk/bin/gcloud init

接続テスト

Google Cloud Platform の方で、プロジェクトを作っておきます。

gcloud network-management connectivity-tests create my-test --source-instance=projects/my-project/zones/us-west-1/instances/my-instance --destination-ip-address=10.142.0.2 --destination-network=projects/my-project/global/networks/peering-network --project aaaaaa-bbbbbb-000000
gcloud network-management connectivity-tests list --project aaaaaa-bbbbbb-000000

NAME     PROTOCOL SRC_PROJECT SRC_IP SRC_VM DST_PROJECT  DST_IP DST_VM DST_PORT UPDATED LABELS
my-test                              pr(略)              10(略)                  202(略)

確認

Google Cloudのアクティビティで確認できれば完了。

image.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?