VPC - Internet Gateway와 Route table생성

sangwoo noh·2022년 5월 27일
0

AWS

목록 보기
15/30

사전 조건

  • vpc생성 후 public subnet과 private subnet이 생성돼있어야 한다.

InternetGateway(igw) 생성

  1. VPC검색 후 좌측 메뉴에서 Internet Gateways 클릭
  2. Create Internet Gateway클릭
  3. Internet Gateway대시보드에서 위에서 생성한 igw의 state가 Detached인것을 확인
    (Detached의 의미는 어떤 VPC에도 연결돼있지 않은 IGW라는 의미)
  4. 생성한 igw를 체크한 후 우측상단의 Actions=> Attach to VPC 클릭
  5. 연결할 VPC를 선택해 준다.

  • igw를 생성하고 vpc와 연결했지만 vpc안의 route table과 internet gateway와의 연결이 되어있지 않은 상태이다

Route Table 설정

1. 기본 Route Table

  • VPC생성시 기본적으로 설정된 Route Table이 있다.

2. Routes 설정 확인

  • 10.0.0.0/16의 요청이 들어오면 local(vpc내부)로 보내라는 설정밖에 없다.

3. Subnet associations탭

연결된 서브넷이 없다고 안내된다 하지만 하단의 내용을 보면

Subnets without explicit associations (2)
The following subnets have not been explicitly associated with any route tables and are therefore associated with the main route table:

이런 내용이 있는데, 즉 새롭게 생성된 subnet이 있지만 route talbe설정이 안돼서 기본 route로 연결돼있다는 내용이다.
하지만 public, private subnet 설정이 각각 따로 돼여야 하니 route table을 생성하고 각각 새롭게 생성한 route table로 연결한다.

4. Create route table

  • 기본으로 생성연결된 route table은 private용으로 사용한다
    (이유는 없고 그냥 또생성하기 귀찮으니깐, 굳이 지웠다가 다시 생성할 이유도 없고)

5. route table <-> subnet 연결

public route table은 public subnet에 연결하고

private route table은 private subnet에 연결한다.
(다만 private route table은 기본 route tale에 연결돼있는 상태여서 굳이 지우지 않고 이름만 변경한 기본 route table에 자동으로 연결돼어있는 상태라 연결작업을 해주지 않아도 상관없다. 연결해줘도 상관없음)

6. edit public route table

(internet gateway와 연결해주기위한 작업)
add route를 클릭 후 다음과 같이 생성된 internet gateway와 연결해 준다.
0.0.0.0/0의 의미는 설정된 CIDR을 제외한 모든 요청이란 뜻
이때 리스트의 순서대로 적용 우선순위가 있기에 우선순위를 고려하여 routes table설정을 해준다.

7. edit public route table?

  • 내부에서만 사용되어야하는 목적때문에 변경 할 내용이 없다(igw로 연결되면 안됨)

8. 결과

  • 이제 Public route table과 igw가 연결됐다.
  • 다만 그림상에선 private route table이 igw랑 연결된것으로 나오는데 잘못된 표현이고
    private route table과 igw는 끊겨있는 상태
profile
하기로 했으면 하자

0개의 댓글