๐Ÿ“‚ AWS

[AWS/CLI] create-route

dhyuck 2021. 10. 27. 21:42
๋ฐ˜์‘ํ˜•

Creates a route in a route table within a VPC.
VPC ๋‚ด์˜ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”์— ๋ผ์šฐํŒ…์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

๋ผ์šฐํŒ… ๋Œ€์ƒ์œผ๋กœ ์•„๋ž˜์˜ ๋Œ€์ƒ ์ค‘ 1๊ฐœ๋ฅผ ์ง€์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

  • Internet Gateway
  • Virtual Private Wateway
  • Transit Gateway
  • NAT Gateway
  • NAT instance
  • VPC Peering Connection
  • Network Interface
  • Egress-only Internet Gateway

๋ผ์šฐํŒ… ๊ฒฝ๋กœ๊ฐ€ ๊ฒฐ์ •๋˜๋Š” ๋ฐฉ๋ฒ•

๋ผ์šฐํŒ… ๊ฒฝ๋กœ๋Š” ๊ฐ€์žฅ ๊ตฌ์ฒด์ ์ธ ๊ฒฝ๋กœ๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด 192.0.2.3์— ๋Œ€ํ•˜์—ฌ ๋ผ์šฐํŒ… ๊ฒฝ๋กœ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š”๋ฐ 1)192.0.2.0/24์™€ 2)192.0.0.2.0/28์ด ์žˆ๋‹ค๋ฉด 2)๊ฐ€ ๋” ์ ์€ IP ์ฃผ์†Œ ๋Œ€์—ญ์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฏ€๋กœ ๋” ๊ตฌ์ฒด์ ์ด๋ผ๊ณ  ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋ฏ€๋กœ 2)192.0.2.0/28์˜ ๋ชฉ์ ์ง€๋กœ ๋ผ์šฐํŒ…๋ฉ๋‹ˆ๋‹ค.


  • ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”์— ๋ชจ๋“  IPv4 ํŠธ๋ž˜ํ”ฝ(0.0.0.0/0)์„ IGW๋กœ ๋ณด๋‚ด๋Š” ๋ผ์šฐํŒ… ๊ฒฝ๋กœ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

      aws ec2 create-route \
      --profile {PROFILE_NAME} \
      --route-table-id {RoutingTable_ID} \
      --destination-cidr-block 0.0.0.0/0 \
      --gateway-id {IGW_ID}
  • --destination-cidr-block : ๋ชฉ์ ์ง€ ๋งค์นญ์— ์‚ฌ์šฉ ๋  IPv4 CIDR ๋ธ”๋ก ์ฃผ์†Œ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --route-table-id : ๋ผ์šฐํŒ…์„ ์ถ”๊ฐ€ํ•  ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”์˜ ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --gateway-id : IGW ๋˜๋Š” VGW์˜ ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --transit-gateway-id : TGW ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --nat-gateway-id : NAT GW ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --instance-id : NAT Instance ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • --vpc-peering-connection-id : VPC peering connection์˜ ID๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.


๋ฐ˜์‘ํ˜•

'๐Ÿ“‚ AWS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[AWS/CLI] describe-security-groups  (0) 2021.11.15
[AWS/CLI] start-instances / stop-instances  (0) 2021.10.27
[AWS/CLI] authorize-security-group-ingress  (0) 2021.10.20
[AWS] Backup  (0) 2021.10.20
[AWS] RDS  (0) 2021.10.15