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 Risposte
1
Risposta accettata

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
ESPERTO
con risposta un mese fa
profile picture
ESPERTO
verificato 25 giorni fa
profile picture
ESPERTO
verificato un mese fa
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
ESPERTO
Matt-B
con risposta un mese fa
profile picture
ESPERTO
verificato 25 giorni fa
profile picture
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande