• Alex Marsh - Monday, October 20, 2014 9:12 AM

    Comments posted to this topic are about the item Upload Backup Files to Amazon S3

    Hi! thank you for you script, it helps a lot in my issue. 
    I have had a problem, It doesn't load by default the AWSPowerShell module (you can modify your ps profile for loading it,but...) .
    I decide to create an script with params 
    * Create CopyFilesToS3.ps1
       param([string]$BucketName="?",[string]$AccessKey="?",[string]$secretKey="?",[string]$region="?",[string]$filename="?")
       Set-ExecutionPolicy RemoteSigned
       Import-Module "{your-path}\AWSPowerShell.psd1"
       Write-S3Object -BucketName $BucketName -AccessKey $AccessKey -secretKey $secretKey -Region $region -File $filename -key $filename
    And call it 

        SET @cmd = 'powershell .\CopyFilesToS3.ps1'
        SET @cmd += ' -BucketName "' + @AWSbucketName;
        SET @cmd += '" -AccessKey "' + @AWSAccessKey;
        SET @cmd += '" -secretKey "' + @AWSSecretKey;
        SET @cmd += '" -Region "' + @AWSregion;   
        SET @psCmd = @cmd + '" -File "' + @fileName + '" -key "' + @fileName+'"';
        exec xp_cmdshell @psCmd;