PowerShell Script: Pushing Zipped Backup Database to AWS S3 Bucket

I have a PowerShell Script in a project that backups a database and zips it. I have a job task to send the output file into AWS S3 bucket. I need to add it to the script so that it sends the file using the bucket URL, I can’t use AWS Tools for Powershell as I would need to download them on each tentacle. Wondering if any one with expertise with PowerShell could help. I am using Invoke-Rest Method to try and POST. Thank you

EDIT: My buckets has all the right policies, I have the Secret Key and Access Key


Thanks for getting in touch.

There are a couple of ways to achieve this, depending on the version of Octopus you are using.

In version 2018.2 we introduced an AWS CLI step. If you convert your existing PowerShell step to the AWS CLI step, then you you can use the AWS CLI S3 command to push the file for you. This would be the recommended approach, if you are using this version or later.
In version 2018.4, we added a specific step for S3 uploads, but this will only work if the file is already available in a package feed.

You could also install the AWS PowerShell Tools by adding the line Install-Module -Name AWSPowerShell -Force to the top of your step. The Script Console could also be used to run the Install-Module command on all of your tentacles, scoped by role or environment.

Hopefully this helps get you going.