首页 > 其他分享 >关于AWS-VPC中的公有子网与私有子网-Public and private subnets

关于AWS-VPC中的公有子网与私有子网-Public and private subnets

时间:2023-05-27 09:13:51浏览次数:48  
标签:subnet 子网 subnets IP route AWS your internet public

关于AWS-VPC中的公有子网与私有子网的详细说明

可以参考我们可以参考官网文档 Amazon VPC / User Guide 中有如下说明:

Public and private subnets

If a subnet is associated with a route table that has a route to an internet gateway,it's known as a public subnet.

If a subnet is associated with a route table that does not have a route to an internet gateway, it's known as a private subnet.

In your public subnet's route table, you can specify a route for the internet gateway to all destinations not explicitly known

to the route table (0.0.0.0/0 for IPv4 or ::/0 for IPv6). Alternatively, you can scope the route to a narrower range of IP addresses;

for example, the public IPv4 addresses of your company’s public endpoints outside of AWS, or the Elastic IP addresses of other Amazon EC2 instances outside your VPC.

 

IP addresses and NAT

To enable communication over the internet for IPv4, your instance must have a public IPv4 address.

You can either configure your VPC to automatically assign public IPv4 addresses to your instances, or you can assign Elastic IP addresses to your instances.

Your instance is only aware of the private (internal) IP address space defined within the VPC and subnet.

// 因此如果实例的网络接口上配置有公有IP地址,我们在操作系统OS里面,也能只查询到私有IP地址,公有IP在外面的网络接口上才能看到

The internet gateway logically provides the one-to-one NAT on behalf of your instance, so that when traffic leaves your VPC subnet and goes to the internet,

the reply address field is set to the public IPv4 address or Elastic IP address of your instance, and not its private IP address.

Conversely, traffic that's destined for the public IPv4 address or Elastic IP address of your instance has its destination address

translated into the instance's private IPv4 address before the traffic is delivered to the VPC.

To enable communication over the internet for IPv6, your VPC and subnet must have an associated IPv6 CIDR block,

and your instance must be assigned an IPv6 address from the range of the subnet. IPv6 addresses are globally unique, and therefore public by default.

In the following diagram, the subnet in Availability Zone A is a public subnet.

The route table for this subnet has a route that sends all internet-bound IPv4 traffic to the internet gateway.

The instances in the public subnet must have public IP addresses or Elastic IP addresses to enable communication with the internet over the internet gateway.

For comparison, the subnet in Availability Zone B is a private subnet because its route table does not have a route to the internet gateway.

Instances in the private subnet can't communicate with the internet over the internet gateway, even if they have public IP addresses.

To provide your instances with internet access without assigning them public IP addresses, you can use a NAT device instead.

A NAT device enables instances in a private subnet to connect to the internet, but prevents hosts on the internet from initiating connections with the instances.

For more information, see Connect to the internet or other networks using NAT devices.

 

标签:subnet,子网,subnets,IP,route,AWS,your,internet,public
From: https://www.cnblogs.com/5201351/p/17436244.html

相关文章

  • 关于AWS中VPC下的IGW-internet gateway的创建与说明
    关于AWS中VPC下有一个资源叫做 Internetgateways,也就是我们常说的IGW关于IGW,我们可以参考官网文档 AmazonVPC/ UserGuide中有如下说明:Aninternetgatewayisahorizontallyscaled,redundant,andhighlyavailableVPCcomponentthatallowscommunicationbetw......
  • 部署aws命令配置管理机以及部署eksctl管理eks
    AWS命令部署curl"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"-o"awscliv2.zip"unzipawscliv2.zipsudo./aws/installaws--versionawsconfigurecurl-Ohttps://s3.us-west-2.amazonaws.com/amazon-eks/1.26.2/2023-03-17/bin/linu......
  • AWS
    InstallJDKYounowneedadditionalstepstogetthefile,asOraclerequiresyoutoacceptthelicence:a)GotodownloadpageusingFirefox,clickaccepttermsb)UseExportCookiesadd-on,tosaveacookies.txtfilec)Uploadcookies.txttoyourinstanced)......
  • RocketChip RISC-V 内核+ 亚马逊 AWS EC2 F1实例=FireSim云基硬件/软件协同开发环境
    https://docs.fires.im/en/stable/filesim文档网络电子商务巨头亚马逊已经广泛的将多个赛灵思公司的基于16nmFinFET工艺的VirtexUltraScaleVU9PFPGA部署到亚马逊弹性计算云(EC2)F1实例上。EC2是亚马逊云计算的基本平台,由于网络通信量复杂且随时变化,用户对计算能力的需求也在随着......
  • 关于购买AWS-EC2-RI-Reserved Instances的一些说明以及折扣后Reserved Instance ID的
    关于在AWS上,如果一台EC2机器需要长时间使用、都是建议购买ReservedInstances,即一种预付费的方式,建议是选择AllUpfront,预付全部的费用,则可以享受到最大的折扣,在购买时需要主意如下几个选项只有当上面的选项与EC2的对应的属性相匹配时,才能免除其运行时产生的费用 另外每......
  • 创建AWS EC2实例
    创建AWSEC2实例前提条件创建EC2步骤前提条件需要自行到AWS官网先注册AWS账号。本文不叙述注册账号过程!创建EC2步骤根据自己的需求选择系统镜像AMI,如果仅需免费套餐可以勾选仅免费套餐,如下图所示。如果不仅限于免费套餐,点击社区AMI,你可以看到琳琅满目的系统镜像,可根据自己需求选择......
  • 参加AWS技术峰会的收获与思考
    7月31日,我参加了AWS技术峰会2019北京站的会议。从厦门到帝都,奔赴千里,只为一场技术盛宴,我想记录一些收获和思考,才能不负此行。大会议程全天,上午是主题演讲和行业解决方案展示,下午是技术分论坛。我们一直都知道,企业上云,首先要解决的是安全问题。在上午的主题演讲中,我们看到AWS将安全......
  • LabVIEW 网口通讯西门子网络通讯C#VS开源协议库西门子S7200300400SMART网口TCP通讯支
    LabVIEW网口通讯西门子网络通讯C#VS开源协议库西门子S7200300400SMART网口TCP通讯支持VSLABVIEW全系列西门子PLC通讯S7200S7300S7400SMART品种齐全ID:5899668797293613......
  • Gdiplus::Graphics::DrawString绘制文字
     Gdiplus::FontFamilyfontfm(_T("微软雅黑"));Gdiplus::Fontfont(&fontfm,24,Gdiplus::FontStyleBold,Gdiplus::UnitPixel);/*参数1:FontFamilyfamily字体,如我们常见的“宋体”、“仿宋”、“微软雅黑”、“Arial”等参数2:floatemSize......
  • AWS Transfer Family创建新用户
    第一步:在客户端机器先创建sshkey,登陆机器,然后输入命令:ssh-keygen找到publickey,稍后添加用户时需要。第二步:进入AWSConsole,IAM,创建Role具体json如下:{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service&......