[AWS] VPC Peering

pingping·2021년 2월 26일
0

AWS

목록 보기
1/1
post-thumbnail

VPC Peering이란?

  • VPC Peering을 통해 서로 다른 리전 혹은 동일 리전의 VPC와 연결해주는 기능이다.

실습 환경

서울 리전 AWS VPC(10.0.0.0/16) <-> 미국(버지니아 북부) 리전 AWS VPC(172.31.0.0/16)

1. 사전 작업

[1] Virginia Region에서 VPC, Subnet 생성

  • VPC 생성
    172.31.0.0/16 대역으로 생성
    VPC ID는 Peering Connection할 때 필요하므로 적어놓을 것

  • dev-3tier-private-01 서브넷 생성

2. Peering Connection

Seoul 리전에서 Create Peering Connection을 진행해준다.

  • Name tag : Peering test
  • VPC ( Requester ) : 피어링을 신청하고자 할 VPC
  • Select another VPC to peer with : 피어링 커넥션을 맺고자 할 VPC를 선택

⇒ Virginia에 있는 VPC와 맺을 것이므로 Another Region 선택

⇒ 미리 적어놓은 Virginia의 VPC의 ID를 기입해준다.

  • Status : Pending Acceptance인 것을 확인할 수 있다.

  • Virginia 리전에 와서 보면 같은 상태인 것을 확인할 수 있다.

  • Virginia 리전에서 Accept Request를 클릭하면 피어링이 성공한다.

  • Active로 변함

Route Table

  • Seoul Region에서는 Routes만 변경해주면 된다.

    172.31.0.0/16 대역으로 가는 Packet들은 pcx-blahblah로 모두 보낼 것을 정의

  • Virginia Region에서는 어느 Subnet 대역을 가진 인스턴스들이 어떤 Routes로 갈 것인지를 정의

    3tier-private-rt는 아래의 172.31.1.0/24 서브넷 대역을 가진 인스턴스들에 대해 적용이 되며, 10.0.0.0/16으로 가는 Packet들의 타겟을 pcx-blahblah로 보냄을 정의해준다.

Security Group

  • Virginia에서 Security Group을 하나 생성해준 후 SSH, ICMP 타입에 대해서만 10.0.0.0/16 Source IP 대역을 허용해주었다.

Test

  • Ping Test ( Seoul Region - Private Subnet - EC2 ⇒ Virginia Region - Private Subnet - EC2 )

  • SSH Test ( Seoul Region - Private Subnet - EC2 ⇒ Virginia Region - Private Subnet - EC2 )

    첫 번째 시도에서는 버지니아 Region에서 EC2 인스턴스에 대한 Security Group을 열어주지 않아 ssh 접속이 안되는 것을 확인할 수 있다.

  • Ping 속도 Test

    Seoul Region의 Bastion Server에서 Test 진행 ( 보안 그룹 적절히 변경 후 테스트 진행함 )

    Peering Connection으로 맺어진 EC2간의 Ping 테스트를 진행해본 결과 많이 느리다...

ubuntu@bastion:~$ ping 10.0.3.220
PING 10.0.3.220 (10.0.3.220) 56(84) bytes of data.
64 bytes from 10.0.3.220: icmp_seq=1 ttl=255 time=0.499 ms
64 bytes from 10.0.3.220: icmp_seq=2 ttl=255 time=0.456 ms
64 bytes from 10.0.3.220: icmp_seq=3 ttl=255 time=0.448 ms
64 bytes from 10.0.3.220: icmp_seq=4 ttl=255 time=0.486 ms

ubuntu@bastion:~$ ping 172.31.1.10
PING 172.31.1.10 (172.31.1.10) 56(84) bytes of data.
64 bytes from 172.31.1.10: icmp_seq=1 ttl=255 time=196 ms
64 bytes from 172.31.1.10: icmp_seq=2 ttl=255 time=196 ms
64 bytes from 172.31.1.10: icmp_seq=3 ttl=255 time=196 ms
64 bytes from 172.31.1.10: icmp_seq=4 ttl=255 time=196 ms
64 bytes from 172.31.1.10: icmp_seq=5 ttl=255 time=196 ms
  • Ref

https://library.gabia.com/contents/tech/8881/

https://docs.aws.amazon.com/ko_kr/vpc/latest/peering/create-vpc-peering-connection.html

https://brunch.co.kr/@topasvga/348

https://www.joinc.co.kr/w/man/12/aws/peering

profile
Cloud Infra Engineer & interested in python, IaC, k8s

1개의 댓글

comment-user-thumbnail
2021년 10월 22일

흥미롭네요

답글 달기