Static-analysis NAT Gateway + VPC Endpoint audit · https://github.com/aws-samples/aws-cdk-examples · Generated 2026-05-16 23:07 UTC
486 ranked AWS NAT Gateway + VPC Endpoint cost-leak findings across 363 IaC file(s) (0 Terraform, 363 CDK, 0 CloudFormation). Implementing the top 3 could save approximately $164,485/month — $1,973,820/year.
RECURRING AWS data transfer + NAT Gateway processing savings verifiable directly in AWS Cost Explorer next billing cycle. Filter: Services -> EC2-Other, then group by Usage Type — look for NatGateway-Bytes (data processing, $0.045/GB), NatGateway-Hours ($0.045/hr per gateway), and DataTransfer-Regional-Bytes (cross-AZ, $0.01-0.02/GB). All savings estimates calibrated to mid-volume workloads with conservative confidence ratings (0.55-0.85).
| # | Opportunity | Severity | $/mo saved |
|---|---|---|---|
| 1 | VPC with NAT Gateway is missing an S3 Gateway VPC Endpoint | CRITICAL | $800 |
| 2 | VPC with NAT Gateway is missing an S3 Gateway VPC Endpoint | CRITICAL | $800 |
| 3 | VPC with NAT Gateway is missing an S3 Gateway VPC Endpoint | CRITICAL | $800 |
| 4 | VPC with NAT Gateway is missing an S3 Gateway VPC Endpoint | CRITICAL | $800 |
| 5 | VPC with NAT Gateway is missing an S3 Gateway VPC Endpoint | CRITICAL | $800 |
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_24) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/application-load-balancer/app.py:17
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_17) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_14) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_16) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/classic-load-balancer/app.py:13
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_13) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_119) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_125) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_2) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_154) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ec2/instance/app.py:23
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_23) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_32) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_13) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/cluster/app.py:14
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_14) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_16) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_14) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_12) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_18) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_16) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_23) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/emr/app.py:20
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_20) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_201) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_12) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_59) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_70) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/rds/aurora/aurora.py:399
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_399) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/rds/oracle/oracle.py:222
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_222) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_17) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_14) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_24) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_29) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_110) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/application-load-balancer/index.ts:11
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_11) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_42) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_46) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_11) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_91) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_142) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_19) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_53) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/cluster/index.ts:10
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_18) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_19) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_9) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_9) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_12) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_11) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_13) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_13) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_9) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/eks/cluster/index.ts:27
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_27) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/fsx-ad/index.ts:11
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_11) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_24) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/resource-overrides/index.ts:91
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_91) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_12) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: This file declares an `aws_nat_gateway` (nat_default_for_vpc_line_15) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_10) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: This file declares an `aws_nat_gateway` (explicit_nat_at_line_71) but no Gateway-type VPC Endpoint targeting Amazon S3 (`com.amazonaws.<region>.s3`). When applications in the private subnet call S3 (PutObject, GetObject, ListBucket, etc.), every byte goes through the NAT Gateway, costing $0.045/GB processing + $0.045-0.09/GB data transfer. S3 Gateway VPC Endpoints are FREE (no per-hour charge, no per-GB charge) and keep S3 traffic on AWS's private backbone. Adding the endpoint and associating it with the private route table eliminates this charge entirely. Per AWS docs (https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html), this is the single highest-ROI VPC architecture change available for any S3-active workload. Workloads doing 100+ GB/day of S3 traffic typically recover $300-5,000/month from this fix alone.
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add an S3 Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: NAT Gateway present (nat_default_for_vpc_line_53) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: NAT Gateway present (nat_default_for_vpc_line_53) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.api`. ECR image pulls from EKS/ECS/Fargate workloads in private subnets route through NAT, paying $0.045/GB processing on every layer download. Even moderate cluster activity (5 GB images, 100 pulls/day) burns ~$675/mo per cluster. NOTE: ECR requires BOTH `ecr.api` AND `ecr.dkr` Interface endpoints — the pair works together. Interface endpoints cost ~$7.30/mo/AZ ($0.01/hr/AZ); for a 3-AZ deployment that's ~$22/mo per service — trivial vs. the $300-1000/mo NAT savings. AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add ECR API Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# IMPORTANT: also add aws_vpc_endpoint.ecr_dkr (ECR pulls need BOTH).
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no Interface VPC Endpoint for `com.amazonaws.<region>.ecr.dkr`. This is the second half of the ECR pull-through pair — without `ecr.dkr`, even if `ecr.api` is present, image-layer downloads still go through NAT. AWS explicitly requires both endpoints for full ECR private connectivity (per https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html). Layer downloads dominate NAT data charges for container workloads — base images are 200MB-2GB each, and even with image-layer caching, fresh nodes pull fully on first launch. $0.045/GB processing on 15 TB/mo of pulls (a busy EKS cluster) = $675/mo per cluster. Conservative claim $400/mo accounts for typical mid-volume environments.
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add ECR Docker Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
Where: typescript/eks/cluster/index.ts:30
What we found: `cdk_ts_eks_line_30` is an EKS resource sharing a VPC with NAT Gateway, but the VPC is missing Interface VPC Endpoint(s) for: ecr.api, ecr.dkr, logs, sts. EKS clusters in private subnets generate three large NAT charges: (1) ECR image pulls on every new pod / node spin-up, (2) CloudWatch Logs writes from every container, (3) STS calls for IRSA-based pod auth. Per AWS docs (https://docs.aws.amazon.com/eks/latest/userguide/private-clusters.html), private EKS clusters need the full endpoint set to avoid forcing critical traffic through NAT. Even a moderately-active cluster (5 GB images, 100 pulls/day + 1 GB/day logs + 50K STS calls/day) burns ~$400-1200/month on NAT processing — every dollar of which is recoverable by adding ~$30-50/month worth of Interface endpoints. Net annualized savings: $4,000-12,000/year per cluster.
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
kubectlLayer: new KubectlLayer(this, "kubectl"),
ipFamily: eks.IpFamily.IP_V4,
clusterLogging: clusterLogging,
# Terraform — add the full private-EKS endpoint set:
locals {
eks_interface_endpoints = [
"ecr.api",
"ecr.dkr",
"logs",
"sts",
"ec2",
"elasticloadbalancing",
]
}
resource "aws_vpc_endpoint" "eks_set" {
for_each = toset(local.eks_interface_endpoints)
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.${each.value}"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# Plus a free S3 Gateway endpoint (EKS uses it for image-layer storage):
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/eks/latest/userguide/private-clusters.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: NAT Gateway present (nat_default_for_vpc_line_53) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no DynamoDB Gateway VPC Endpoint (`com.amazonaws.<region>.dynamodb`). All DynamoDB SDK calls from private-subnet workloads route through NAT, paying $0.045/GB processing. DynamoDB Gateway endpoints are FREE, identical to S3 Gateway — no per-hour, no per-GB. The savings scale with workload throughput: even a moderate Lambda/ECS service hitting DDB at ~50 GB/day saves ~$70/month, conservative $300/month claim assumes mid-volume transactional workload. Reference: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add a DynamoDB Gateway VPC Endpoint (FREE):
resource "aws_vpc_endpoint" "dynamodb" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.dynamodb"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: NAT Gateway present (nat_default_for_vpc_line_53) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no Interface VPC Endpoint for `com.amazonaws.<region>.logs` (CloudWatch Logs). Applications writing logs to CloudWatch from private subnets route every PutLogEvents call through NAT, paying $0.045/GB on log payload bytes. Logging volume can be enormous (verbose app logs, audit logs, debug logs); 200 GB/mo of log traffic = $9/mo on NAT processing alone per service. For an environment with 20+ services each logging ~1 GB/day, total NAT-on-logs spend commonly hits $250-600/month. Interface endpoint cost: ~$22/mo for 3 AZs. Net savings: ~$230/mo. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add CloudWatch Logs Interface VPC Endpoint:
resource "aws_vpc_endpoint" "logs" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:71
What we found: `cdk_lambda_line_71` is an `aws_lambda_function` with `vpc_config` (it runs inside the VPC), but the VPC is missing S3 Gateway VPC Endpoint(s). Per AWS docs (https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html), VPC-attached Lambda functions have NO Internet Gateway in their subnet — ALL outbound traffic, including SDK calls to AWS services, must route through either NAT Gateway OR a VPC endpoint. Without the missing endpoint(s), every S3/DynamoDB call your Lambda makes pays NAT processing ($0.045/GB) and contributes to NAT-hour billing. For a Lambda fleet processing millions of invocations/month with S3 reads, this can easily exceed $200/mo — and the fix is FREE (Gateway endpoints have no charge). Add the missing Gateway endpoint(s) and the Lambda's S3/DDB traffic stops touching NAT entirely.
# Create the Lambda function to receive the request
api_hanlder = lambda_.Function(
self,
"ApiHandler",
function_name="apigw_handler",
runtime=lambda_.Runtime.PYTHON_3_9,
code=lambda_.Code.from_asset("lambda/apigw-handler"),
handler="index.handler",
# Add the missing Gateway VPC Endpoint(s) for any AWS service your Lambda uses:
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# Repeat for dynamodb if your Lambda uses it.
# AWS docs: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:107
What we found: `cdk_lambda_line_107` is an `aws_lambda_function` with `vpc_config` (it runs inside the VPC), but the VPC is missing S3 Gateway + DynamoDB Gateway VPC Endpoint(s). Per AWS docs (https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html), VPC-attached Lambda functions have NO Internet Gateway in their subnet — ALL outbound traffic, including SDK calls to AWS services, must route through either NAT Gateway OR a VPC endpoint. Without the missing endpoint(s), every S3/DynamoDB call your Lambda makes pays NAT processing ($0.045/GB) and contributes to NAT-hour billing. For a Lambda fleet processing millions of invocations/month with S3 reads, this can easily exceed $200/mo — and the fix is FREE (Gateway endpoints have no charge). Add the missing Gateway endpoint(s) and the Lambda's S3/DDB traffic stops touching NAT entirely.
###################################################################
# Lambda for subscription filter
subscription_filter_lambda = lambda_.Function(
self,
"StreamCTCWLtoOSSLambda",
function_name="bulk_ingest_handler",
runtime=lambda_.Runtime.PYTHON_3_9,
handler="index.handler",
vpc=vpc,
# Add the missing Gateway VPC Endpoint(s) for any AWS service your Lambda uses:
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# Repeat for dynamodb if your Lambda uses it.
# AWS docs: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:17
What we found: `cdk_ts_lambda_line_17` is an `aws_lambda_function` with `vpc_config` (it runs inside the VPC), but the VPC is missing S3 Gateway + DynamoDB Gateway VPC Endpoint(s). Per AWS docs (https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html), VPC-attached Lambda functions have NO Internet Gateway in their subnet — ALL outbound traffic, including SDK calls to AWS services, must route through either NAT Gateway OR a VPC endpoint. Without the missing endpoint(s), every S3/DynamoDB call your Lambda makes pays NAT processing ($0.045/GB) and contributes to NAT-hour billing. For a Lambda fleet processing millions of invocations/month with S3 reads, this can easily exceed $200/mo — and the fix is FREE (Gateway endpoints have no charge). Add the missing Gateway endpoint(s) and the Lambda's S3/DDB traffic stops touching NAT entirely.
const { vpc: vpcLambda } = new VpcNestedStack(this, 'nested-stack-lambda');
const lambdaFunction1 = new lambda.Function(this, 'lambda-function-1', {
runtime: lambda.Runtime.NODEJS_18_X,
vpc: vpcLambda,
vpcSubnets: {
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
},
memorySize: 128,
# Add the missing Gateway VPC Endpoint(s) for any AWS service your Lambda uses:
resource "aws_vpc_endpoint" "s3" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = [aws_route_table.private.id]
}
# Repeat for dynamodb if your Lambda uses it.
# AWS docs: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-ssm-local-zone/example-localzone-stack.ts:53
What we found: NAT Gateway present (nat_default_for_vpc_line_53) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr(VPC_CIDR),
subnetConfiguration: [
{
cidrMask: SUBNET_SIZE,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no Interface VPC Endpoint for `com.amazonaws.<region>.sts`. STS (Security Token Service) is hit on every IRSA / role-assumption / cross-account-assume call. For an EKS cluster using IRSA, every pod that assumes a role hits STS at startup AND on credential refresh (typically every ~1 hour). Even though individual STS calls are small (~1KB), the call volume is high — busy clusters can hit STS 100K+ times/day. NAT data processing on STS is real cost, plus you pay NAT-hours for the gateway sitting idle while STS is the only outbound. Interface endpoint cost: ~$22/mo for 3 AZs. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add STS Interface VPC Endpoint:
resource "aws_vpc_endpoint" "sts" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:26
What we found: This file declares 3 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 2 extra gateways that's ~$270/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
enable_dns_support=True,
max_azs=2,
nat_gateway_provider=NatProvider.gateway(),
nat_gateways=1,
subnet_configuration=[subnet1, subnet2]
)
# This will export the VPC's ID in CloudFormation under the key
# 'vpcid'
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:30
What we found: This file declares 3 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 2 extra gateways that's ~$270/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
)
],
# nat_gateway_provider=ec2.NatProvider.gateway(),
nat_gateways=2,
)
CfnOutput(self, "Output",
value=self.vpc.vpc_id)
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:17
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
vpc_name="App-Mesh-VPC",
subnet_configuration=[
ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:203
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
msk_cluster = MskBroker(self, 'MSKBroker',
vpc=vpc,
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:33
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
ec2.GatewayVpcEndpointOptions(service=ec2.GatewayVpcEndpointAwsService.S3)
},
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:48
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
subnetType: ec2.SubnetType.PUBLIC,
},
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:11
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:17
What we found: This file declares 2 `aws_nat_gateway` resources with no explicit HA justification (no `HA-required` / `high-availability` / `business-continuity` / `RTO` / `RPO` / `disaster recovery` keyword anywhere in the file). Each NAT Gateway costs $0.045/hour (~$33/month) in base charges before any data processing. For 1 extra gateways that's ~$135/mo just on the per-hour baseline. Multi-AZ NAT is only required if your SLA / RTO / RPO demands tolerance to a full-AZ outage AND your workload cannot route through a single-AZ NAT after failover. For most workloads, ONE NAT Gateway (with cross-AZ data charges if needed) is sufficient. If multi-AZ NAT is genuinely required, add a comment or tag like # HA-required: customer SLA mandates AZ isolation` so the next audit recognizes the intent. Reference: https://aws.amazon.com/vpc/pricing/
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_17_4,
# Option A — single NAT Gateway (best for most workloads):
resource "aws_nat_gateway" "single" {
allocation_id = aws_eip.nat.id
subnet_id = aws_subnet.public[0].id
# Document tradeoff: cross-AZ data charges apply if the AZ goes down.
}
# Option B — keep multi-AZ NAT with documented justification:
resource "aws_nat_gateway" "per_az" {
# HA-required: customer contract mandates RPO=0 even during AZ outage.
count = length(aws_subnet.public)
allocation_id = aws_eip.nat[count.index].id
subnet_id = aws_subnet.public[count.index].id
}
Where: python/apigw-http-api-lambda-dynamodb-python-cdk/stacks/apigw_http_api_lambda_dynamodb_python_cdk_stack.py:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(
self,
"Ingress",
cidr="10.1.0.0/16",
subnet_configuration=[
ec2.SubnetConfiguration(
name="Private-Subnet", subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/application-load-balancer/app.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a VPC for our infrastructure
vpc = ec2.Vpc(self, "VPC")
# Read and prepare user data script for EC2 instances
data = open("./httpd.sh", "rb").read()
httpd=ec2.UserData.for_linux()
httpd.add_commands(str(data,'utf-8'))
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-arm64-instance-type/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueueArm64")
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-using-fargate/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/batch/batch-with-EC2/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# This resource alone will create a private/public subnet in each AZ as well as nat/internet gateway(s)
vpc = ec2.Vpc(self, "VPC")
# To create number of Batch Compute Environment
count = 3
# Create AWS Batch Job Queue
self.batch_queue = batch.JobQueue(self, "JobQueue")
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/classic-load-balancer/app.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(app, id, **kwargs)
vpc = ec2.Vpc(self, "VPC")
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy-github-manual/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:119
What we found: NAT Gateway present (nat_default_for_vpc_line_119) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/codepipeline-build-deploy/codepipeline_build_deploy/codepipeline_build_deploy_stack.py:125
What we found: NAT Gateway present (nat_default_for_vpc_line_125) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Creates VPC for the ECS Cluster
cluster_vpc = ec2.Vpc(
self, "ClusterVpc",
ip_addresses=ec2.IpAddresses.cidr(cidr_block="10.75.0.0/16")
)
# Deploys the cluster VPC after the initial image build triggers
cluster_vpc.node.add_dependency(trigger_lambda)
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/docker-app-with-asg-alb/dockerized_app_cdk/network_stack.py:2
What we found: NAT Gateway present (explicit_nat_at_line_2) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
from aws_cdk import CfnOutput, Stack
from aws_cdk.aws_ec2 import Vpc, NatProvider, SubnetConfiguration, SubnetType
from constructs import Construct
class NetworkStack(Stack):
def __init__(self, scope: Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2-alarms-to-opsitem/ec2_alarms_to_opsitem/ec2_alarms_to_opsitem_stack.py:154
What we found: NAT Gateway present (nat_default_for_vpc_line_154) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# region=region)
vpc = ec2.Vpc(
self,"LabVpc",
cidr="10.10.0.0/24"
)
#Instance
instance = ec2.Instance(self,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ec2/instance/app.py:23
What we found: NAT Gateway present (explicit_nat_at_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC)]
)
# AMI
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-schedulescaling/schedulescaling/schedulescaling_stack.py:32
What we found: NAT Gateway present (nat_default_for_vpc_line_32) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
night_max = nightschedule[2]["max"]
vpc = ec2.Vpc(self, "ecsVpc", max_azs=2)
ecs_cluster = ecs.Cluster(
self,
id="ecscluster",
vpc=vpc,
container_insights=True,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs-serviceconnect/cdk_examples_service_connect/cdk_examples_service_connect_stack.py:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
# Creating a shared VPC with public subnets and private subnets with NAT Gateways
vpc = ec2.Vpc(self, "ServiceConnectVPC",
ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16"),
create_internet_gateway=True,
max_azs=2,
nat_gateways=2,
enable_dns_hostnames=True,
enable_dns_support=True,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/cluster/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
asg = autoscaling.AutoScalingGroup(
self, "MyFleet",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-load-balanced-service/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, *kwargs)
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-advanced-alb-config/app.py:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC with 2 Availability Zones
vpc = ec2.Vpc(
stack, "MyVpc",
max_azs=2
)
# Create ECS cluster in the VPC
cluster = ecs.Cluster(
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-networking/app.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "awsvpc-ecs-demo-cluster",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/ecs-service-with-task-placement/app.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
stack, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
stack, "EcsCluster",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-load-balanced-service/app.py:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-autoscaling/app.py:16
What we found: NAT Gateway present (nat_default_for_vpc_line_16) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create a cluster
vpc = ec2.Vpc(
self, "Vpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'fargate-service-autoscaling',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ecs/fargate-service-with-efs/app.py:23
What we found: NAT Gateway present (nat_default_for_vpc_line_23) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
VOLUME_NAME = 'cdk-ecs-sample-efs-volume'
vpc = ec2.Vpc(
self, PREFIX + 'Vpc',
max_azs=2
)
ecs_cluster = ecs.Cluster(
self, PREFIX + 'Cluster',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/emr/app.py:20
What we found: NAT Gateway present (explicit_nat_at_line_20) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
self,
"vpc",
nat_gateways=0,
subnet_configuration=[
ec2.SubnetConfiguration(
name="public", subnet_type=ec2.SubnetType.PUBLIC
)
],
)
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/iot-msk-lambda-pipeline/msk_demo/msk_demo_stack.py:201
What we found: NAT Gateway present (nat_default_for_vpc_line_201) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC in which the MSK cluster and client are located
vpc = ec2.Vpc(self, "MskVpc",
cidr="10.0.0.0/16",
nat_gateways=1,
max_azs=2,
subnet_configuration = subnets)
# MSK cluster and an EC2 Instance used to create the topics
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/new-vpc-alb-asg-mysql/cdk_vpc_ec2/cdk_vpc_stack.py:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# The code that defines your stack goes here
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/ctcwl-oss/ctcwl_oss/ctcwl_oss_stack.py:59
What we found: NAT Gateway present (nat_default_for_vpc_line_59) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "SvlCTCWLVpc")
es_sec_grp = ec2.SecurityGroup(
self,
"SvlCTCWLOpenSearchSecGrp",
vpc=vpc,
allow_all_outbound=True,
security_group_name="SvlCTCWLSecGrp",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/opensearch/os-vpc-provision/os_vpc_provision/os_vpc_provision_stack.py:70
What we found: NAT Gateway present (nat_default_for_vpc_line_70) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
################################################################################
# VPC
vpc = ec2.Vpc(self, "OpenSearch VPC", max_azs=3)
################################################################################
# Amazon OpenSearch Service domain
es_sec_grp = ec2.SecurityGroup(
self,
"OpenSearchSecGrp",
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/aurora/aurora.py:399
What we found: NAT Gateway present (nat_default_for_vpc_line_399) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "IcePlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/rds/oracle/oracle.py:222
What we found: NAT Gateway present (nat_default_for_vpc_line_222) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc(self, "LavaPlainsVpc",
cidr = "10.99.0.0/16",
max_azs = 3,
enable_dns_hostnames = True,
enable_dns_support = True,
subnet_configuration = [
ec2.SubnetConfiguration(
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/route53-failover/fargate_app_stack.py:17
What we found: NAT Gateway present (nat_default_for_vpc_line_17) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resource quotas
vpc = ec2.Vpc(
self, "MyVpc",
max_azs=2
)
cluster = ecs.Cluster(
self, 'Ec2Cluster',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/s3-eventbridge-ecs/s3_eventbridge_ecs/s3_eventbridge_ecs_stack.py:14
What we found: NAT Gateway present (nat_default_for_vpc_line_14) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super().__init__(scope, construct_id, **kwargs)
vpc = ec2.Vpc(self, "ecsVpc")
s3_bucket = s3.Bucket(
self,
"bucket",
access_control=s3.BucketAccessControl.PRIVATE,
encryption=s3.BucketEncryption.S3_MANAGED,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/servicecatalog/portfolio-with-ec2-product/portfolio_with_ec2_product/portfolio_with_ec2_product.py:24
What we found: NAT Gateway present (explicit_nat_at_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
# VPC
vpc = ec2.Vpc(self, "VPC",
nat_gateways=0,
subnet_configuration=[ec2.SubnetConfiguration(name="public",subnet_type=ec2.SubnetType.PUBLIC,cidr_mask=24)],
)
# Instance Role and SSM Managed Policy
role = iam.Role(self, "ec2Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com"))
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/ssh-into-emr-cluster/emr_pattern/emr_pattern_stack.py:31
What we found: NAT Gateway present (nat_default_for_vpc_line_31) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
)
vpc = ec2.Vpc(self, "infrastructure_vpc",
vpc_name="emr_cdk_vpc",
nat_gateways=1,
cidr= '10.0.0.0/16',
gateway_endpoints=
{
"S3":
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: python/vpc-ec2-local-zones/vpc_ec2_local_zones/vpc_ec2_local_zones_stack.py:29
What we found: NAT Gateway present (nat_default_for_vpc_line_29) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
def create_VPC(self):
vpc = ec2.Vpc(
self,
"Vpc",
ip_addresses = ec2.IpAddresses.cidr(VPC_CIDR),
subnet_configuration = [
ec2.SubnetConfiguration(
name = 'Public-Subent',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/api-gateway-parallel-step-functions/index.ts:110
What we found: NAT Gateway present (explicit_nat_at_line_110) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new ec2.Vpc(this, 'nested-stack-vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 0,
maxAzs: 3,
subnetConfiguration: [
{
name: 'public-subnet-1',
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 24,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/application-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-codepipeline-ecs-lambda/lib/stage-app-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
this.vpc = new Vpc(this, 'vpc', {
maxAzs: 3,
natGateways: 1,
enableDnsHostnames: true,
enableDnsSupport: true,
ipAddresses: IpAddresses.cidr('10.0.0.0/16'),
subnetConfiguration: [
{
cidrMask: 24,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/aws-transfer-sftp-server/aws-transfer-sftp-server.ts:42
What we found: NAT Gateway present (explicit_nat_at_line_42) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 2,
natGateways: 0,
});
// Create the required IAM role which allows the SFTP server
// to log to CloudWatch.
const cloudWatchLoggingRole = new iam.Role(this, 'CloudWatchLoggingRole', {
assumedBy: new iam.ServicePrincipal('transfer.amazonaws.com'),
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/batch-ecr-openmp/lib/aws-batch-openmp-benchmark-stack.ts:46
What we found: NAT Gateway present (nat_default_for_vpc_line_46) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC for Batch compute environment
const vpc = new ec2.Vpc(this, 'OpenMPVPC', {
maxAzs: 2,
natGateways: 1,
subnetConfiguration: [
{
cidrMask: 24,
name: 'Public',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cdkpipeline-ecs/lib/infra-stack.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', {
natGateways: 1,
});
}
}
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/classic-load-balancer/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC');
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/cloudwatch/evidently-client-side-evaluation-ecs/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create ECS resources
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts:142
What we found: NAT Gateway present (nat_default_for_vpc_line_142) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Creates VPC for the ECS Cluster
const clusterVpc = new ec2.Vpc(this, "ClusterVpc", {
ipAddresses: ec2.IpAddresses.cidr("10.50.0.0/16"),
});
// Deploys the cluster VPC after the initial image build triggers
clusterVpc.node.addDependency(triggerLambda);
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance-connect-endpoint/bin/app.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const stack = new Stack(app, 'integ-testing-eicendpoint', { env });
const vpc = new ec2.Vpc(stack, 'Vpc', { subnetConfiguration: [{ cidrMask: 24, name: 'rds', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }] });
const instance = new ec2.Instance(stack, 'instance', {
vpc,
vpcSubnets: vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.LARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ec2-instance/lib/constructs/vpc.ts:19
What we found: NAT Gateway present (explicit_nat_at_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC with public subnets in 2 AZs
this.vpc = new Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ServerPublic',
subnetType: SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cluster/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const asg = new autoscaling.AutoScalingGroup(this, 'MyFleet', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE4_GRAVITON, ec2.InstanceSize.XLARGE),
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64
}),
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/cross-stack-load-balancer/index.ts:18
What we found: NAT Gateway present (nat_default_for_vpc_line_18) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
this.cluster = new ecs.Cluster(this, 'Cluster', {
vpc: this.vpc
});
}
}
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-network-load-balanced-service/index.ts:19
What we found: NAT Gateway present (nat_default_for_vpc_line_19) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// deploy, but VPC creation is slow so we'll only have to do that once
// and can iterate quickly on consuming stacks. Not doing that for now.
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
// Instantiate ECS Service with just cluster and image
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-advanced-alb-config/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-networking/index.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create the cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'awsvpc-ecs-demo-cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO)
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/ecs-service-with-task-placement/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3_AMD, ec2.InstanceSize.MICRO)
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-application-load-balanced-service/index.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Instantiate Fargate Service with just cluster and image
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "FargateService", {
cluster,
taskImageOptions: {
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-auto-scaling/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a cluster
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'fargate-service-autoscaling', { vpc });
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-efs/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'DefaultVpc', { maxAzs: 2});
const ecsCluster = new ecs.Cluster(this, 'DefaultEcsCluster', {vpc: vpc});
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: vpc,
encrypted: true,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-local-image/index.ts:13
What we found: NAT Gateway present (nat_default_for_vpc_line_13) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// NOTE: Limit AZs to avoid reaching resource quotas
// NAT needed to pull from ECR and to push cloudwatch logs
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2, natGateways: 1 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ecs/fargate-service-with-logging/index.ts:9
What we found: NAT Gateway present (nat_default_for_vpc_line_9) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
// create a task definition with CloudWatch Logs
const logging = new ecs.AwsLogDriver({
streamPrefix: "myapp",
})
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/eks/cluster/index.ts:27
What we found: NAT Gateway present (nat_default_for_vpc_line_27) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a new VPC for our cluster
const vpc = new ec2.Vpc(this, "EKSVpc");
// Create Cluster with no default capacity (node group will be added later)
const eksCluster = new eks.Cluster(this, "EKSCluster", {
vpc: vpc,
defaultCapacity: 0,
version: kubernetesVersion,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/fsx-ad/index.ts:11
What we found: NAT Gateway present (nat_default_for_vpc_line_11) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(app, id);
const vpc = new ec2.Vpc(this, 'VPC', {});
const privateSubnets = vpc.privateSubnets.slice(0,2).map(x => x.subnetId)
const templatedSecret = new sm.Secret(this, adDnsDomainName + '_credentials', {
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: 'admin' }),
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/neptune-with-vpc/neptune-with-vpc-stack.ts:15
What we found: NAT Gateway present (explicit_nat_at_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
cidr: "10.192.0.0/16",
maxAzs: 2,
natGateways: 0,
enableDnsHostnames: true,
enableDnsSupport: true,
/**
* Each entry in this list configures a Subnet Group
*
* ISOLATED: Isolated Subnets do not route traffic to the Internet (in this VPC).
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/opensearch/os_vpc_provision/lib/common-resources.ts:24
What we found: NAT Gateway present (nat_default_for_vpc_line_24) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// VPC
const vpc = new ec2.Vpc(this, "Vpc", {
vpcName: `${Aws.STACK_NAME}-vpc`,
});
this.vpc = vpc;
// Create Cognito User Pool
const userPool = new cognito.UserPool(this, 'CognitoUserPool', {
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/postgres-lambda/lib/postgres-lambda-stack.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
// Create a VPC for our application
const vpc = new ec2.Vpc(this, 'PostgresLambdaVpc', {
maxAzs: 2,
natGateways: 1,
});
// Create a PostgreSQL Aurora Serverless v2 cluster
const dbCluster = new rds.DatabaseCluster(this, 'PostgresCluster', {
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/r53-resolver/lib/vpc.ts:10
What we found: NAT Gateway present (nat_default_for_vpc_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id);
// @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
this.vpc = new ec2.Vpc(this, "R53ResolverTestVPC", {
ipAddresses: ec2.IpAddresses.cidr("10.24.34.0/23"),
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/resource-overrides/index.ts:91
What we found: NAT Gateway present (nat_default_for_vpc_line_91) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
bucketResource.addPropertyDeletionOverride('CorsConfiguration.Bar');
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 1 });
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE),
machineImage: new ec2.AmazonLinuxImage(),
vpc
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/route53-resolver-dns-firewall/lib/route53-resolver-dns-firewall-stack.ts:12
What we found: NAT Gateway present (nat_default_for_vpc_line_12) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16')
});
const logGroup = new logs.LogGroup(
this,
'DNSFirewallLogGroup',
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/secrets-manager-rotation/index.ts:15
What we found: NAT Gateway present (nat_default_for_vpc_line_15) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const clusterId = "redis-demo-cluster";
const vpc = new ec2.Vpc(this, "Vpc", {
subnetConfiguration: [
{
cidrMask: 24,
name: "Private",
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/servicecatalog/portfolio-with-ec2-product/lib/portfolio-with-ec2-product.ts:10
What we found: NAT Gateway present (explicit_nat_at_line_10) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'VPC', {
natGateways: 0,
subnetConfiguration: [{
cidrMask: 24,
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}]
});
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
Where: typescript/ssm-document-association/lib/ssm-document-association-stack.ts:71
What we found: NAT Gateway present (explicit_nat_at_line_71) but no Interface VPC Endpoint for `com.amazonaws.<region>.ssm`. Workloads using SSM Parameter Store / SSM Agent / AWS-Systems-Manager integrations all route those calls through NAT in the absence of this endpoint. EKS/ECS apps that pull config from Parameter Store on every container start or on a periodic refresh schedule generate steady NAT data charges plus the per-hour NAT baseline. For maximal coverage, SSM endpoints typically come in a set: `ssm`, `ssmmessages`, `ec2messages`. Interface endpoint cost: ~$22/mo for 3 AZs per service. AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
const vpc = new ec2.Vpc(this, 'SSMDocumentTestVpc', {
maxAzs: 1,
natGateways: 0,
subnetConfiguration: [
{
name: 'public',
subnetType: ec2.SubnetType.PUBLIC,
}
]
# Terraform — add SSM Interface VPC Endpoint:
resource "aws_vpc_endpoint" "ssm" {
vpc_id = aws_vpc.main.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.vpce.id]
private_dns_enabled = true
}
# AWS docs: https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html
AWS NAT Gateway charges have three components, all visible in the AWS Cost Explorer under
Services -> EC2-Other:
VPC Endpoints sidestep NAT entirely for AWS-service traffic:
The fastest single-fix wins (in dollar order): add the S3 Gateway endpoint (Pattern 1), add the ECR Interface endpoint pair if you use EKS/ECS/Fargate (Patterns 3+4), add the DynamoDB Gateway endpoint (Pattern 2), then the CloudWatch Logs + STS Interface endpoints (Patterns 5+6). Verify each fix's impact in AWS Cost Explorer on the next billing cycle — the line items are itemized by Usage Type (NatGateway-Bytes drops, VpcEndpoint-Hours rises by a small fraction of the savings).
Why this matters: AWS NAT/VPC savings only materialize once the IaC changes apply to production (Terraform apply, CDK deploy, or CloudFormation update). The re-audit voucher creates an accountability loop — we can't claim "issue resolved" unless the v1 ruleset agrees on re-scan. Same deterministic engine, same file paths, same line numbers. No moving goalposts.
Verification path for customers: after applying the changes, watch AWS Cost Explorer
filtered to Services -> EC2-Other with usage type NatGateway-Bytes
over a 7-30 day window. The drop is typically visible within 48 hours of the Terraform apply
and stabilizes by day 7. We can supply the exact Cost Explorer filter URL on request.