NatGateway has a pretty hefty fee for data transfer. To avoid those costs, S3 can use a custom route through a Gateway VPC Endpoint.
Best practice when sending traffic to Amazon S3 or DynamoDB in the same Region
To avoid data processing charges for NAT gateways when accessing Amazon S3 and DynamoDB that are in the same Region, set up a gateway endpoint and route the traffic through the gateway endpoint instead of the NAT gateway. There are no charges for using a gateway endpoint. For more information, see Gateway VPC endpoints.
1
Main docs for gateway endpointsNote in this case S3 does need to be same region as the ECS/Fargate instance to use. Otherwise we still have the NatGateway costs and the Cross Region costs.
Might be mitigated for now by switching to a public IP without NatGateway and VPC. This is a TODO for cases where the instance needs to run on a non-public VPC.
NatGateway has a pretty hefty fee for data transfer. To avoid those costs, S3 can use a custom route through a Gateway VPC Endpoint.
Main docs for gateway endpoints Note in this case S3 does need to be same region as the ECS/Fargate instance to use. Otherwise we still have the NatGateway costs and the Cross Region costs.
CDK has a construct GatewayVPCEndpoint