惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Forbes - Security
Forbes - Security
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
Recent Commits to openclaw:main
Recent Commits to openclaw:main
WordPress大学
WordPress大学
Webroot Blog
Webroot Blog
Jina AI
Jina AI
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
T
Troy Hunt's Blog
TaoSecurity Blog
TaoSecurity Blog
AI
AI
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Help Net Security
Help Net Security
美团技术团队
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗
P
Privacy International News Feed
A
Arctic Wolf
IT之家
IT之家
云风的 BLOG
云风的 BLOG
S
Security Affairs
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 司徒正美
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
K
Kaspersky official blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
N
News and Events Feed by Topic
S
Schneier on Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
PCI Perspectives
PCI Perspectives
F
Fortinet All Blogs
T
Tenable Blog
Spread Privacy
Spread Privacy
T
The Blog of Author Tim Ferriss
S
Securelist
L
LangChain Blog
Latest news
Latest news
Cloudbric
Cloudbric
博客园 - 三生石上(FineUI控件)

博客园 - Bo Schwarzstein

发布关于PostGIS对于USD格式的拓展 紫微斗数之自化禄真的是损耗嘛? 紫微斗数个人经验之三合或者四化看哪个 A Practical Methodology, HSM, Handler,Service,Model, for Golang Backend Development 问ChatGPT玄学问题,看来命理师还是不会被取代的 Compile Sqlite3 Executable, Static Library, and Shared Library on Linux Benchmark JuiceFS at AWS 2 Benchmark JuiceFS on AWS 1 Far & Unifield Field Augmented Reality 紫微斗数是否对外国人有用 Create CloudFront Signed URL in 1 Minute 2022壬寅年天干四化 《中有成就秘笈》之中央密严刹土 IPFS与般若文海 Moira果老星宗七政四余排盘软件下载 Play Old Diablo 2 on macOS Catalina Use Go Micro Web with HTTP Handler 视频平台设计思路大灌顶 Unity Input System教程
Work with AWS VPC, Lambda and Internet
Bo Schwarzstein · 2022-10-21 · via 博客园 - Bo Schwarzstein

AWS VPC means a VLAN for a user, the all potential network resource might allocated within this VLAN with private IP addresses, such as EC2, EFS etc.

There is a list(https://docs.aws.amazon.com/lambda/latest/operatorguide/networking-vpc.html) on AWS services which need VPC configuration or not.

By default

Amazon API Gateway // Amazon CloudFront // Amazon CloudWatch // Amazon Comprehend // Amazon DynamoDB // Amazon EventBridge // Amazon Kinesis // Amazon Lex // Amazon Pinpoint // Amazon Polly // Amazon Rekognition // Amazon S3 // Amazon SNS // Amazon SQS // AWS Step Functions // Amazon Textract // Amazon Transcribe // Amazon Translate

Requires VPC

Amazon ECS // Amazon EFS // Amazon ElastiCache // Amazon Elasticsearch Service // Amazon MSK // Amazon MQ // Amazon RDS // Amazon Redshift

If you didn't assign any VPC to your Lambda, each Lambda would have its own local IP address starting with 169.254, not your typical standard 172.16. It means the Lambda instance was allocated within yet another LAN, as Docker does. If you're familiar with network configuration, you would know that in order to establish communication between 2 different LANs, a route/gateway/NAT would be needed, and there might be extra limits for the network access.

The problem is, sometimes the Lambda might have to use RDS, EFS or ElasticCache, it has to work with VPC. In the meantime, if this Lambda has to access the Internet too, you would have to create a VPC NAT as the link here, which involves extra cost.

 

How to solve this problem ? You should consider your architecture based on these questions

  1. Which part service really needs Internet access ?
  2. Is that possible to decouple Internet access from AWS service ?

In terms of cost, Lambda is significantly less expensive than EC2 instances. When your service is going to heavily use Lambda, you will have to split the functionalities into different Lambda functions, and Lambda will invoke the dependent Lambda during the execution. It means if a Lambda has to use VPC service, it should be isolated from Internet. As this chart.

There are 3 Lambda functions which are represented as microservices and only communicate with the resources they have to deal with. This hybrid architecture work for nearly all the possible cases, but it requires a good design for micro services.

There is another solution, which is to use EC2+Kubernetes completely.

All EC2 instances are staying in VPC, and they could access Internet, it means you would have to manage all the resources and software stack by yourself, without benefit from stock AWS services.

The good thing is that this architecture is compatible everywhere even for different cloud service providers. All K8s Pods could access both K8s cluster and Internet, and the K8s clusterwould be benefit from EC2 Spot Instance a lot, as Horizontal Pod Autoscaling, to execute the non-persistent service over the EC2 Spot Instance as DaemonSet.

I hope this helps you with AWS development.