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 https://docs.amazonaws.cn/en_us/AmazonECS/latest/developerguide/windows_task_IAM_roles.html

$gateway = (Get-NetRoute | Where { $_.DestinationPrefix -eq '0.0.0.0/0' } | Sort-Object RouteMetric | Select NextHop).NextHop
$ifIndex = (Get-NetAdapter -InterfaceDescription "Hyper-V Virtual Ethernet*" | Sort-Object | Select ifIndex).ifIndex
New-NetRoute -DestinationPrefix 169.254.170.2/32 -InterfaceIndex $ifIndex -NextHop $gateway # credentials API
New-NetRoute -DestinationPrefix 169.254.169.254/32 -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

LEAVE A COMMENT