Optimize VPC Endpoints costs for development environment

0

Hello,

I recently set up 5 VPC Endpoints to avoid using NAT Gateway with my ECS tasks (2 for ECR, 1 for S3, 1 for Cloudwatch Logs and 1 for Secret Manager), each endpoint is linked to only one AZ. At the end, the VPC Endpoint Hours cost the same as the NAT Gateway.

As the documentation says "Pricing per VPC endpoint per AZ ($/hour)", could I detach my VPC Endpoint from all my subnets outside the working hours to avoid VPC Endpoint Hours costs ? Will the costs of endpoints be 0 or just decreased ?

2 個答案
1
已接受的答案

Hello.

How about using Lambda and EventBridge to create a script that deletes a VPC endpoint after business hours?
There is no function to detach VPC endpoints, so I think you can reduce costs by deleting them outside of business hours.
Also, since there is no charge for the S3 gateway VPC endpoint, I think you only need to delete the interface endpoint.
You can create a Lambda function to delete VPC endpoints by using the "delete_vpc_endpoints" API.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2/client/delete_vpc_endpoints.html

You can also create a VPC endpoint using the "create_vpc_endpoint" API.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2/client/create_vpc_endpoint.html

profile picture
專家
已回答 1 個月前
profile picture
專家
已審閱 25 天前
profile picture
專家
已審閱 1 個月前
1

Hi There

Another option would be to run your own NAT Instance on an EC2 instance and stop it when you are not using it.

https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html

profile pictureAWS
專家
Matt-B
已回答 1 個月前
profile picture
專家
已審閱 25 天前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南