Categories
PowerShell

Upload file to AWS s3 bucket using PowerShell

In this tutorial, we gonna upload files and folders to the AWS s3 bucket using PowerShell. First, you’ll need to install the general AWS.Tools.Installer package, for more information, follow the link.

Run following command in PowerShell with admin privileges.

Install-Module -Name AWS.Tools.Installer

This post assumes that, you have AccessKey, SecretKey for you AWS s3 bucket.

Set-AWSCredential `
                 -AccessKey "YOUR_ACCESS_KEY_ID" `
                 -SecretKey "YOUR_SECRET_ACCESS_KEY" `
                 -StoreAs default

After setting AWS credential, let’s upload file with following command

 Write-S3Object -BucketName "YourBucketName" -Key "desiredFileNameInBucket.tar" -File "localFile.tar"

For more examples visit : https://docs.aws.amazon.com/powershell/latest/reference/items/Write-S3Object.html

By Praveen Anaparthi

11+ years of IT industry experience holding a wide range of skill sets and roles with significant work on PHP, Node.js, Python, Ruby, Docker, React.js, Microsoft Azure, Azure DevOps, Windows PowerShell, Shell script, Jenkins, MongoDB, SQL, MySQL, Apache, Nginx. etc. It is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.

Leave a Reply

Your email address will not be published.