Hi, I configured pipeline to run Powershell script that was working fine except AWS commands so tried to execute statements like given below but it is failing on Install-Package statement. What could be the reason (memory or permission issue) ?
param ([String]$environment,[String]$accessKey, [String] $secretKey, [String]$s3Region, [String]$bucketName, [String]$templateName, [String]$templatePath)Install-Package -Name AWSPowerShell -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination /usr/local/share/powershell/Modules -ForceSet-AWSCredentials -AccessKey $accessKey -SecretKey $secretKeyWrite-S3Object -BucketName $bucketName -File $templateName -Force -Key $templatePath -Region $s3Region
param ([String]$environment,[String]$accessKey, [String] $secretKey, [String]$s3Region, [String]$bucketName, [String]$templateName, [String]$templatePath)Install-Package -Name AWSPowerShell -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination /usr/local/share/powershell/Modules -Force
Set-AWSCredentials -AccessKey $accessKey -SecretKey $secretKey
Write-S3Object -BucketName $bucketName -File $templateName -Force -Key $templatePath -Region $s3Region
Hi @Ranjit Sharma
If I were you, I would preload PowerShell and any required modules onto the build agent to that they are always there for use
However, if that is not possible, and in the interests of faster build times, then you should use the modular AWS.Tools packages rather than the monolithic AWSPowerShell. AWS.Tools has a separate package for each AWS service, so you only install for the services you expect to use, e.g. AWS.Tools.S3. Also install the packages to user-space if you're doing it with each run of your plan
Install-Module AWS.Tools.Installer -Force -Scope CurrentUserInstall-AWSToolsModule AWS.Tools.S3 -Force -Scope CurrentUser -CleanupSet-AWSCredentials -AccessKey $accessKey -SecretKey $secretKeyWrite-S3Object -BucketName $bucketName -File $templateName -Force -Key $templatePath -Region $s3Region
It looks like you're new here. Sign in or register to get started.