Install-AWSToolsModule AWS.Tools.EC2 issue

0

Hi, I try Install-AWSToolsModule AWS.Tools.EC2 has issue. I have rebuild OS but cant solved

" PS C:\Windows\System32> Install-Module -Name AWS.Tools.Installer

PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp

Confirm Are you sure you want to perform this action? Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.1.92.0". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\eihkbeqr.cf4\AWS.Tools.EC2.4.1.92.0.nupkg'."

PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3

Confirm Are you sure you want to perform this action? Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.1.92.0". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\de4ooqxp.evb\AWS.Tools.EC2.4.1.92.0.nupkg'."

PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -Force Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\yetrrcal.skx\AWS.Tools.EC2.4.1.92.0.nupkg'."

PS C:\Windows\System32> Install-AWSToolsModule AWS.Tools.S3 -Force Get-AWSToolsModuleDependenciesAndValidate: Exception calling "OpenRead" with "1" argument(s): "Could not find file 'C:\Users\Ian\AppData\Local\Temp\zcwvmega.5ek\AWS.Tools.EC2.4.1.92.0.nupkg'."

PS C:\Windows\System32> "

asked 2 years ago687 views
1 Answer
1

Hello,

Thank you for reaching out! I found a similar scenario where the code base for the Install-AWSToolsModule and Get-AWSToolsModuleDependenciesAndValidate modules, which seems related to the fo following line:

    try {
        $zipArchive = [ZipFile]::OpenRead($Path)

The error returned is stating that the module can't locate the required nupkg file which is downloaded from the PS gallery. Other potential errors (firewall settings, proxy configuration, internet connectivity) would not return this error message, so we can discard AntiVirus/Security Software, etc... for now.

This could be due to the default version of the TLS protocol that the version of Powershell is configured for TLS1.1. In order to confirm this, please run the following commands in Powershell:

PS C:\> [Net.ServicePointManager]::SecurityProtocol

If the output is either 'Tls11' or 'Tls10' then run:

PS C:\> [enum]::GetNames([Net.SecurityProtocolType])

If the output has 'Tls12', the following command will set the default security protocol type to TLS1.2, and should resolve the issue:

PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Now, please try to reinstall the Tools. The reason this occurs is that when the Install-AWSToolsModule is ran to install a specific service, it pulls the needed files from the following sites:

https://www.powershellgallery.com/api/v2/package/AWS.Tools.S3/4.1.10

https://psg-prod-eastus.azureedge.net

Further reading on this one can be found at Microsoft" "As of April 2020, the PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. If you are not using TLS 1.2 or higher, you will receive an error when trying to access the PowerShell Gallery." (2-3)

If for any reason this does not resolve the issue, You can try upgrading to PowerShell version 7.1 and give this another go (4).

If the issue persists, then perhaps this is something else at the OS level, please run the EC2Rescue utility (5) and review the data at the Event Viewer or other relevant logs.

Have a nice day!

References

(1) Prerequisites for Setting up the AWS Tools for PowerShell

(2) Network access to the PowerShell Gallery

(3) PowerShell Gallery TLS Support

(4) Installing PowerShell on Windows

(5) Use EC2Rescue for Windows Server GUI - Collect data from an active instance

AWS
SUPPORT ENGINEER
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions