[AWS, Golang] EC2에서 ssh로 Hello World에 로그인

3231 단어 AWSEC2golangtech
1: VPC 제작
2: 서브넷 생성
3: 보안 그룹 생성
다음 EC2 인스턴스를 작성할 때
SSH, TCP, 22, 내 IP
4: EC2 인스턴스 생성
방금 만든 VPC 및 서브넷을 선택하여 "공용 IP 자동 할당"을 사용
공용 IP 자동 할당
5: SSH 연결
ssh-keygen -t rsa

(aaaの部分は自分のPC名になるはず)
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/aaa/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/aaa/.ssh/id_rsa
Your public key has been saved in /Users/aaa/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:yGsrzqjk5P0uIETSJiUZI6SdVsVdFr10ZJ9M9TZBMm0 [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|**. .o.. .+o +=+o|
|*=oo  . ..  o.*E+|
|+o+        . o.++|
| o   . .    .  ..|
|.     o S        |
|..     .         |
|.o.   o          |
|= .+.. .         |
|.+.o*+.          |
+----[SHA256]-----+
mv ~/Downloads/sample2.pem ~/.ssh/sample2.pem 
ls

id_rsa		id_rsa.pub	sample2.pem
chmod 600 ~/.ssh/sample2.pem

기본 User는 "ec2-user"입니다.
ssh -i ~/.ssh/개인 키 사용자 이름 @54.199.20.230
ssh -i ~/.ssh/sample2.pem [email protected]


       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-10-0-4-131 ~]$ 


go version
go version go1.15.14 linux/amd64

git clone https://github.com/kazuki-shimura/go_hello.git
ls
go_hello
cd go_hello
go run main.go
もしくは
go build ./
./main
amazon-linux-extras list | grep golang

sudo amazon-linux-extras install golang1.11
Installing golang~~~
exit

ログアウト
Connection to 54.199.20.230 closed.
더 이상 사용하지 않으면 삭제
참고 자료
https://dev.classmethod.jp/articles/creation_vpc_ec2_for_beginner_1/#toc-4
https://dev.classmethod.jp/articles/creation_vpc_ec2_for_beginner_2/
https://qiita.com/takuma-jpn/items/b2c04b7a271a4472a900
https://qiita.com/wakahara3/items/52094d476774f3a2f619
https://qiita.com/gurensouen/items/7382c2d14763436466d2
https://qiita.com/yuta_vamdemic/items/3e16d16c63f4a76a43cc

좋은 웹페이지 즐겨찾기