当前位置:网站首页>AWS VPC
AWS VPC
2022-07-03 04:24:00 【Blue summer】
1 VPC
VPC(Virtual Private Cloud),即虚拟私有云,是一个逻辑上独立的数据中心,公有云服务提供商基于overlay网络(比如VXLAN和GRE),将网络分割为一个个独立的个体,提供给不同租户。租户则可以在这个独立的网络中部署自己的应用和资源而不受其他用户干扰。同时再配合一些加密和隧道协议,保证用户数据和通信安全,这就是云服务商提供的虚拟网络。
2 Amazon VPC
aws的VPC有两种类型,default VPC和nondefault VPC,
- default VPC,默认的VPC(172.31.0.0/16),无需自己创建,在该VPC创建的EC2会自带公网ip
- nondefault VPC,也就是用户自己创建设置的VPC,可以根据实际需求设置ip网段和其他属性,在该VPC创建的EC默认使用私网ip
3 Amazon VPC 网段
- 网段大小只能介于/16和/28之间,也就是16-65,536个ip地址
- 网段设定后无法修改,扩大和缩小都不行,可以删除重建或者添加另一个网段
- 同一个VPC可以有多个网段,但是有一定限制,比如不能和原来的重叠,也不能跨A,B,C类地址,比如原来是10.网段的私网地址,新加的网段就不能是172.16或者192.168
4 Amazon VPC DNS
- VPC内默认DNS地址是网段+2,比如网段是10.0.0.0/16, 那这个VPC的dns地址就是10.0.0.2,如果有多个网段,以主网段为准
- DNS查询有速率限制,每个网络接口每秒最多能发送1024个查询报文,限制不可调整,超过限制后,查询请求会被拒绝
5 Amazon VPC 访问限制
主要有两种方式,security groups和network ACLs,主要差别如下,
| Security group | Network ACL |
|---|---|
| 适用于实例级别 | 适用于网段级别 |
| 只支持allow规则 | 支持allow和deny规则 |
| 有状态,比如返程流量自动放行 | 无状态,双向流量必须显式放行 |
| 考虑所有规则后决定流量是否放行 | 按规则顺序匹配,匹配到就执行,和iptables规则类似 |
| 必须显式关联到具体实例才会生效 | 自动应用于关联的子网内实例 |
但是,这两者对于以下AWS自家服务访问均不限制(自己搭建的服务还是会限制的),
- AWS DNS服务
- AWS DHCP服务
- AWS EC2实例元数据
- AWS Windows 证书激活
- AWS 时间同步服务
- default VPC router的保留IP地址
6 Amazon VPC通信
6.1 连接到公网
- 如果VPC内实例有公网ip,可以直接关联Internet gateway,就能访问公网
- 对于私网ip,可以通过关联Elastic IP来使用公网ip,从而访问公网,但是这个需要手动关联,而且同时只能有一个实例使用这个Elastic IP。为了提高效率,可以使用NAT gateway。
6.2 连接到其他VPC
- VPC peering,通过peering,可以使用私有ip和其他VPC,以及不同账号的VPC,甚至其他region的VPC通信,但是这两个VPC的ip段不能重叠
VPC peering并不是一个gateway也不是VPN连接, 不依赖于其他单独的硬件,同时它还没有单点故障以及带宽限制。但是它需要保存对端VPC的路由信息,因此当VPC很多时,维护会比较麻烦,此时可以考虑使用transit gateway
- Transit Gateway,可以看成一个三层路由设备,在多个VPC间既可以充当中心路由器,也可以用作隔离。
6.3 连接到本地网络
- Transit Gateway,通过transit gateway可以将本地SD-WAN网络连接到AWS,达到扩展的目的。同时支持路由VPN连接以及AWS Direct Connect gateways。能连接多个VPC
- AWS VPN,包括AWS Site-to-Site VPN,AWS Client VPN,AWS VPN CloudHub以及其他第三方VPN软件,只能连接到单个VPC
6.4 使用AWS PrivateLink连接AWS服务
除了以上方式,还可以使用AWS PrivateLink的方式,让VPC内的实例可以连接到其他AWS服务,AWS PrivateLink通过将VPC内的应用或者服务配置为endpoint,从而让对端VPC能够连接过来。
服务提供者(可以是本地服务)在自己的region内创建一个endpoint service,同时需要创建一个load balancer服务用于接收和路由请求。
服务消费者需要在自己的region内创建一个VPC endpoint,然后才能去连接服务,也就是endpoint service。默认情况下endpoint service是无法被外部用户访问,需要开启对应权限。
对于VPC endpoint,有以下三种类型,
- Interface, interface endpoint通过NLB来分发流量,目的地址通过DNS解析,只支持TCP流量,支持AWS Direct Connect的私有连接,因此本地服务也能连接到AWS VPC内的服务,服务本身需收费。
- GatewayLoadBalancer,服务消费者通过路由将流量导向它,Gateway Load Balancer将流量分发给使用私有ip的虚拟网络设备,可以按需扩容
- Gateway,比较特殊,不使用AWS PrivateLink,而且只能用于连接S3和DynamoDB,服务本身不收费
S3同时支持gateway endpoints和interface endpoints,不过有以下不同,
- gateway方式使用S3的公网ip,interface使用的是私网地址,但流量都是在AWS内部
- gateway方式不允许本地流量
- gateway方式不允许跨region连接,interface可以通过VPC peering或者AWS Transit Gateway二次连接
- gateway方式不收费,interface本身开通需要收费
绝大部分AWS服务都支持通过AWS PrivateLink访问,具体支持列表可以查看https://docs.aws.amazon.com/vpc/latest/privatelink/aws-services-privatelink-support.html
参考文档:
- https://docs.aws.amazon.com/vpc/latest/userguide/how-it-works.html
- https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html#add-cidr-block-restrictions
- https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html
- https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Security.html#VPC_Security_Comparison
- https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html
- https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
- https://aws.amazon.com/privatelink/features/
- https://docs.aws.amazon.com/vpc/latest/privatelink/aws-services-privatelink-support.html
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html#types-of-vpc-endpoints-for-s3
10.https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html
边栏推荐
- How to choose cross-border e-commerce multi merchant system
- MySQL create table
- js实现在可视区内,文字图片动画效果
- 解决bp中文乱码
- Database management tool, querious direct download
- [set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
- Mila、渥太华大学 | 用SE(3)不变去噪距离匹配进行分子几何预训练
- Arthas watch grabs a field / attribute of the input parameter
- [free completion] development of course guidance platform (source code +lunwen)
- Dive into deep learning - 2.1 data operation & Exercise
猜你喜欢

Five elements of user experience

CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes

Database management tool, querious direct download

使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found

A outsourcing boy's mid-2022 summary

使用BENCHMARKSQL工具对KingbaseES预热数据时执行:select sys_prewarm(‘NDX_OORDER_2 ‘)报错

因果AI,下一代可信AI的产业升级新范式?

X-ray normal based contour rendering

Bugku CTF daily question baby_ flag. txt

Introduction of pointer variables in function parameters
随机推荐
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
js实现在可视区内,文字图片动画效果
Feature_selection
Jincang KFS data bidirectional synchronization scenario deployment
Competitive product analysis and writing
2022-07-02: what is the output of the following go language code? A: Compilation error; B:Panic; C:NaN。 package main import “fmt“ func main() { var a =
Sklearn data preprocessing
mysql字段userid逗号分开保存按userid查询
PostgreSQL database high availability Patroni source code learning - etcd class
When using the benchmarksql tool to preheat data for kingbasees, execute: select sys_ Prewarm ('ndx_oorder_2 ') error
How to connect WiFi with raspberry pie
Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg
金仓KFS数据双向同步场景部署
2022-02-12 (338. Bit count)
P35-P41 fourth_ context
xrandr修改分辨率與刷新率
Xrandr modify resolution and refresh rate
因果AI,下一代可信AI的产业升级新范式?
GFS distributed file system (it's nice to meet it alone)