Can't install windows nvidia driver from AWS administered S3 Bucket: ec2-windows-nvidia-drivers

1

Hi, We are trying to install the latest windows NVIDIA windows driver for our custom AMI. We are doing this via packer which is running a powershell script. This is using the guidelines recommended here in option 4. When the script runs on the ec2 instance, we're getting a 404. But when we check that url on our own machines, it's fine. The bucket in question is supposed to be publicly accessible, and I can download it from plenty of other machines.

Here's the log from packer:

Downloading https://ec2-windows-nvidia-drivers.s3.amazonaws.com/latest/537.13_grid_win10_win11_server2019_server2022_dch_64bit_international_aws_swl.exe latest/537.70_grid_win10_win11_server2019_server2022_dch_64bit_international_aws_swl.exe to C:\Users\Administrator\Downloads\NVIDIA\installer.exe

 Directory: C:\Users\Administrator\Downloads


 Mode                LastWriteTime         Length Name
----                -------------         ------ ----
 d-----        11/1/2023  11:47 AM                NVIDIA
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."

This is the code:

$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'

Write-Output "Beginning Nvidia driver installation"
$wc = New-Object net.webclient

$Bucket = "ec2-windows-nvidia-drivers"
$KeyPrefix = "latest"
$LocalDirectory = "$home\Downloads\NVIDIA"
$LocalInstallerPath = "$LocalDirectory\installer.exe"

$Objects = aws s3api list-objects --bucket $Bucket --prefix $KeyPrefix --no-sign --output json | ConvertFrom-Json
$InstallerExeKey = ($Objects.Contents | Where-Object { $_.Key -like "*.exe" }).Key
$InstallerUrl = "https://$Bucket.s3.amazonaws.com/$InstallerExeKey"

Write-Output "Downloading $InstallerUrl to $LocalInstallerPath"

New-Item -ItemType Directory -Path "$LocalDirectory" -Force
$wc.DownloadFile("$InstallerUrl", "$LocalInstallerPath")

Any idea what the issue might be?

We've made sure our Iam role has s3 access, etc (even though we're downloading via http).

profile picture
ede
질문됨 6달 전381회 조회
1개 답변
0
수락된 답변

Looks like the script above does not support multiple "latest" entries being returned. As logged, the identified url to download is actually two urls:

https://ec2-windows-nvidia-drivers.s3.amazonaws.com/latest/537.13_grid_win10_win11_server2019_server2022_dch_64bit_international_aws_swl.exe
<space>
latest/537.70_grid_win10_win11_server2019_server2022_dch_64bit_international_aws_swl.exe

The fix is to use something like

$InstallerExeKey = ($Objects.Contents | Where-Object { $_.Key -like "*.exe" } | Sort-Object -Property LastModified -Descending | Select-Object -First 1).Key

to select only the most recent driver URL.

답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠