ECS服务使用“awslogs”驱动程序将日志推送到CloudWatch时是否使用NAT?

huangapple go评论105阅读模式
英文:

Does ECS service with "awslogs" driver use NAT for pushing logs to cloudwatch?

问题

我有一个启用了 awslogs 的 ECS 服务。虽然它正常运行,但我想了解日志是通过 NAT/互联网网关还是本地网络传输的。验证这一点的最佳方法是什么?我希望日志不要通过互联网流动,以节省一些数据传输费用。

我的VPC路由配置如下:
ECS服务使用“awslogs”驱动程序将日志推送到CloudWatch时是否使用NAT?

路由配置如下:
ECS服务使用“awslogs”驱动程序将日志推送到CloudWatch时是否使用NAT?

FYI:ECS任务正在运行于私有子网中。

英文:

I have an ECS service with awslogs turned on. While its working fine, I wanted to understand if the logs are transmitted via NAT/ internet-gw or local network.
What is the best way to validate it as well ? I would want logs not to be flowing through internet to save some money on data transfer.

My VPC routing configurations looks as like below
ECS服务使用“awslogs”驱动程序将日志推送到CloudWatch时是否使用NAT?

and routes configured as below

ECS服务使用“awslogs”驱动程序将日志推送到CloudWatch时是否使用NAT?

FYI: the ecs task is running in private subnet.

答案1

得分: 1

根据AWS知识中心上的文章,您应该为CloudWatch Logs创建一个Amazon VPC接口端点。

如果您的Amazon虚拟私有云(Amazon VPC)没有互联网网关,并且您的任务使用awslogs日志驱动程序将日志信息发送到CloudWatch Logs,请确保您创建了一个Amazon VPC接口端点以用于CloudWatch Logs。有关更多信息,请参阅使用接口VPC端点与CloudWatch Logs。

现在,如果您同时拥有Internet Gateway/NAT Gateway/NAT Instance和VPC Endpoint,那么VPC Endpoint将根据此链接vantage.sh优先级更高。

在同一子网中可以同时使用NAT网关和VPC端点。VPC端点流量将优先,因为它具有更具体的地址范围。

文档says

如果存在一个将所有互联网流量(0.0.0.0/0)发送到互联网网关的路由,端点路由将优先考虑。

英文:

As per why are my Amazon ECS container logs not delivered to Amazon CloudWatch Logs post on AWS Knowledge Center, you should create an interface Amazon VPC endpoint for CloudWatch Logs.

> If your Amazon Virtual Private Cloud (Amazon VPC) doesn't have an internet gateway, and your tasks use the awslogs log driver to send log information to CloudWatch Logs, then be sure that you created an interface Amazon VPC endpoint for CloudWatch Logs. For more information, see Using CloudWatch Logs with interface VPC endpoints.

Now, if you have both Internet Gateway/NAT Gateway/NAT Instance and VPC Endpoint, then VPC Endpoint takes the priority as per this link vantage.sh.

> It is possible to use a NAT Gateway and a VPC Endpoint in the same subnet. The VPC endpoint traffic will take priority since it is a more specific address range.

Docs says:
> If there is a route that sends all internet traffic (0.0.0.0/0) to an internet gateway, the endpoint route takes precedence.

huangapple
  • 本文由 发表于 2023年6月8日 15:06:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76429371.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定