Skip to content

Commit 53a4b33

Browse files
committed
add nat gateway to handle no public ip for batch pool nodes
1 parent 2e5f260 commit 53a4b33

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/scripts/env_deployer.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,35 @@ create_anf_storage() {
352352
update_progress "created ANF storage"
353353
}
354354

355+
create_nat_gateway_subnet() {
356+
357+
echo "Creating NAT gateway subnet"
358+
359+
NATGATEWAYNAME="natgateway"$(get_random_code)
360+
BATCHNATIP="batchnatip"$(get_random_code)
361+
BATCHNATNAME="batchnat"$(get_random_code)
362+
363+
az network public-ip create \
364+
--resource-group "$RG" \
365+
--name "$BATCHNATIP" \
366+
--sku Standard \
367+
--allocation-method static
368+
369+
az network nat gateway create \
370+
--resource-group "$RG" \
371+
--name "$BATCHNATNAME" \
372+
--public-ip-addresses "$BATCHNATIP" \
373+
--idle-timeout 10
374+
375+
az network vnet subnet update \
376+
--resource-group "$RG" \
377+
--vnet-name "$VNETNAME" \
378+
--name "$VSUBNETNAME" \
379+
--nat-gateway "$BATCHNATNAME"
380+
381+
update_progress "created NAT gateway subnet"
382+
}
383+
355384
main() {
356385

357386
if [ $# -ne 1 ]; then
@@ -380,6 +409,7 @@ main() {
380409

381410
create_batch_account_with_usersubscription
382411
# login_batch_with_usersubcription
412+
create_nat_gateway_subnet
383413
update_progress "environment created"
384414
echo "Environment deployer execution completed: $RG"
385415
}

0 commit comments

Comments
 (0)