AWS ECS Optimized Windows 20H2

  amazon-ecs, windows

We are testing on migrating from Windows 2016/2019 to Windows 20H2 ECS Optimized containers
In our windows application startup script, we have (based upon

$gateway = (Get-NetRoute | Where { $_.DestinationPrefix -eq '' } | Sort-Object RouteMetric | Select NextHop).NextHop
$ifIndex = (Get-NetAdapter -InterfaceDescription "Hyper-V Virtual Ethernet*" | Sort-Object | Select ifIndex).ifIndex
New-NetRoute -DestinationPrefix -InterfaceIndex $ifIndex -NextHop $gateway # credentials API
New-NetRoute -DestinationPrefix -InterfaceIndex $ifIndex -NextHop $gateway # metadata API

We are getting access denied on the New-NetRoute command.

Is there a different way to configure credentials and metadata routes on Windows 20H2?

Source: Windows Questions