Traffic between AWS serverless services - Does it always stay within the AWS network?

1

I guess that in most cases traffic between AWS serverless services stays within the AWS network. But I wonder whether it's always true. Including the following example cases, is it true that traffic(API call) between AWS serverless services never leaves the AWS network?

  • An Amazon Event Bridge rule triggers a Lambda function
  • (cross account access) A CloudWatch alarm in account X publishes a message to a SNS topic in account Y
  • (Using AWS SDK) A Lambda function calls KMS decrypt API using AWS SDK
2 Answers
3
Accepted Answer

Traffic never leaves the AWS network, but will traverse the internet portion of the AWS network as opposed to the internal portions of the AWS network.

If you run a lambda function within a VPC, and provision VPC Endpoints for all of the services that your function uses then traffic will not leave your VPC via the NAT gateway and stay entirely within the 'internal' side of AWS.

It is possible to block any internet access, if all the AWS APIs that your functions call have VPC Endpoints (or you're calling 3rd-party APIs using AWS PrivateLink).

For this example, both SNS and KMS have VPC Endpoints.

To actively block internet traffic, you can do this in multiple ways:

  • Security groups let you add all your endpoints into a security group, and allow your function to only communicate with that security group and not the default 0.0.0.0/0
  • Configure AWS Network Firewall on the VPC to manage egress traffic.
  • Modify the route table for the subnets the functions are configured to use, and remove the default route from that subnet entirely

How far you go down this path will depend on your attitude to risk and regulatory requirements, and the cost/granularity tradeoff - the managed firewall option is more flexible, but costs more compared to using endpoints.

answered 2 years ago
1

Yes. All traffic between AWS services stays within the AWS network. You can find more information in the VPC FAQ.

profile pictureAWS
EXPERT
Uri
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions