<p>This is possible, by creating two lambda function , one to check if the NAT getaway is available, if not, handles the provisioning of a new gateway and the creation of the required routes. And the second lambda to check if the lambda is still required and if not, it can deactivate.</p>
<p>Please refer this blog for Code and explanation.</p>
<p><a href="https://adamsnotes.medium.com/a-simple-on-demand-nat-gateway-for-aws-97d4d4b388f3" rel="nofollow noreferrer">https://adamsnotes.medium.com/a-simple-on-demand-nat-gateway-for-aws-97d4d4b388f3</a></p>

CC BY-SA 4.0
2022-04-15T13:26:33.523Z
2022-04-15T13:26:33.523Z
krishna dutt Panchagnula
<p>I'm new to aws cloud service. I have to create a parallel cluster in aws. So, I'm using aws parallel cluster. But the problem is, when creating a cluster the NAT gateway billing me when I'm not using it. So, the cost increases. Is there any way I can minimize or automate the NAT gateway process so that it will cost me less??</p>
<p>PS:If there is any project which gives me on demand NAT gateway hour or Nat gateway instances in parallel cluster that would be very nice.</p>

<amazon-web-services><amazon-ec2>
Cost minimization in aws parallel cluster
Shafayet Rahat
# Cost minimization in aws parallel cluster

(Asked by: username_0 on 2021-03-16)

I'm new to aws cloud service. I have to create a parallel cluster in aws. So, I'm using aws parallel cluster. But the problem is, when creating a cluster the NAT gateway billing me when I'm not using it. So, the cost increases. Is there any way I can minimize or automate the NAT gateway process so that it will cost me less??

PS:If there is any project which gives me on demand NAT gateway hour or Nat gateway instances in parallel cluster that would be very nice.

**Tags:** amazon-web-services, amazon-ec2


---

## 1 answers

### Answer by username_1 on 2022-04-15. Score: 0

This is possible, by creating two lambda function , one to check if the NAT getaway is available, if not, handles the provisioning of a new gateway and the creation of the required routes. And the second lambda to check if the lambda is still required and if not, it can deactivate.

Please refer this blog for Code and explanation.

<https://adamsnotes.medium.com/a-simple-on-demand-nat-gateway-for-aws-97d4d4b388f3>


---

