맥(Mac)에서 구글 클라우드 플랫폼(GCP) 연동하는 방법
들어가며
- 맥에서 간편하게 GCP를 터미널에 연동하여 사용할 수 있다.
방법
Here's how I solved it:
Open a terminal on your workstation and use the ssh-keygen command to generate a new key. Specify the -C flag to add a comment with your username.
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
In my case it was:
ssh-keygen -t rsa -f ~/.ssh/kubernetes-trial -C promisepreston
Navigate into the .ssh directory:
cd ~/.ssh
Restrict access to your private key so that only you can read it and nobody can write to it.
chmod 400 [KEY_FILENAME]
In my case it was:
chmod 400 kubernetes-trial
Double click on kubernetes-trial.pub to open it OR print it on the console using the cat command:
sudo cat kubernetes-trial.pub
The public SHH key should be of this format:
ssh-rsa [KEY_VALUE] [USERNAME]
OR
ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}
In my case it was:
ssh-rsa AAAAB3MzaC1yc2EAAAADAQABAAABAQDdLjLb2b97m9NSK5Z8+j6U8awAwIx1Sbn9o4cEpYT2USYlFhJPRckgnmCQ+Eaim/sgL40V2v3Jwt6HVAY0L9bl84jmvox9QP4FOY7+LM02ZqfRB6LaEukM1tGdObVr+HBvhOwrxGCI06GFjnD3vVzW4jEsK75Y7MPzXd5YSpebGvU+7ZOuEcuSKp/R9dJcJn4kdXeaqor4gh8uTKQ43PGPTEvyoNlCWLkwSgy8khbo2BpoChLA7B53pVEhviMvVVIbmwpc6V2AIhRYY7ppR8oBzklLgh8CtTBPXtQRYiahLOIhds6ORf7wGNFI+A4sbBqwEL3J6av5fE1+zkUBhAHX promisepreston
Copy its contents and paste in the SSH Section of your instance under the Metadata section Adding or removing instance-level public SSH keys
In a local terminal, navigate to the directory where you have the private SSH key file, use the ssh command along with your private SSH key file, the username, and the external IP address of the instance to connect. For example:
ssh -i private-key username@external-ip-of-the-virtual-instance
In my case it was:
ssh -i kubernetes-trial promisepreston@52.174.274.72
After you connect, run commands on your instance using this terminal. When you finish, disconnect from the instance by running the exit command.
참고 사이트
'Information > MacOS' 카테고리의 다른 글
[MacOS] 윈도우 가상 데스크톱(Virtual Desktop)과 맥 미션 컨트롤(Mission Control) (비교, 단축키 정리) (2) | 2023.09.22 |
---|---|
[MacOS] M1 / M2 맥에서 MinGW 설치하는 방법 (0) | 2023.02.05 |
[MacOS] MinGW로 C++ 컴파일 할 때 "warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]" 오류가 뜰 경우 해결 방법 (0) | 2023.02.05 |
[MacOS] 맥(Mac) 로그인 화면 비밀번호 없애기 (자동 로그인) (0) | 2023.01.17 |
[MacOS] 이모지 쉽게 사용하는 방법 (0) | 2022.12.12 |
[MacOS] 아이폰/아이패드 백업 파일 지우는 방법 (0) | 2022.12.12 |
[MacOS] 아이폰의 사진/영상을 외장 하드로 옮기는 방법 (0) | 2022.12.10 |
[MacOS] 맥에서 gcc/g++ 설치하기 (brew 패키지 이용) (0) | 2022.10.17 |