How do I use AWS PowerShell with Wasabi?
AWS PowerShell is a tool that can be used to manage S3 object storage environments with PowerShell scripting tools and has been validated for use with Wasabi. To use AWS PowerShell with Wasabi, make sure you've it installed on your Windows environment and follow the steps below. You can refer to this page for installation steps and download the tools from here.
Once AWS PowerShell is installed, add a new profile to the AWS SDK store, run Set-AWSCredential
. Your access key and secret key are stored in your default credentials file.
PS C:\> Set-AWSCredential -AccessKey AKIAIOSFODNN7EXAMPLE -SecretKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY -StoreAs MyProfileName
-
-AccessKey
– The access key. -
-SecretKey
– The secret key. -
-StoreAs
– The profile name, which must be unique.To specify the default profile, set the profile name to
default
.
For more info regarding setting, removing, listing Profiles please refer this guide.
Create A New Bucket
Run the following command to create a new bucket
PS C:\> New-S3Bucket -BucketName "yourbucketnamehere" -EndpointUrl "https://s3.eu-central-1.wasabisys.com" -Region "eu-central-1"
-Region-
This is an optional parameter.-EndpointUrl-
This is a required parameter.
List Buckets
Run the following command to list all the buckets:
C:\> Get-S3Bucket -EndpointUrl "https://s3.wasabisys.com"
The output would look something like this:
Upload an Object to your Bucket
Run the following command to upload an object to your Bucket:
PS C:\> Write-S3Object -BucketName "ps-rahul" -Key "image.png" -File "C:\Users\wasabi\Downloads\image.png" -EndpointUrl "http://s3.eu-central-1.wasabisys.com" -Region "eu-central-1"
-Region-
This is an optional parameter.-EndpointUrl-
This is a required parameter.
For more cmdlets, please refer to this documentation.
Note: The -ProfileName parameter was not used in the above cmdlets as the credentials used were set up in the default profile. If your default profile is associated with a different S3 provider than Wasabi then make sure you're using the correct profile to access your storage at Wasabi.
The endpoints vary with the region of your bucket. Please see this guide for more info regarding Service URLs.