AWS PowerShell With Wasabi
    • 12 Aug 2024
    • 1 Minute to read
    • PDF

    AWS PowerShell With Wasabi

    • PDF

    Article summary

    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, install it on your Windows environment and follow the steps below. For installation steps, refer to Installing the AWS Tools for PowerShell on Windows. To download the tools, visit AWS Tools for PowerShell.

    Once AWS PowerShell is installed, add a new profile to the AWS SDK store and 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 information regarding setting, removing, and listing profiles, refer to Using AWS Credentials.

    Creating 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.

    Listing Buckets

    Run the following command to list all the buckets.

    C:\> Get-S3Bucket  -EndpointUrl "https://s3.wasabisys.com"

    Example output:

    Uploading 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, refer to AWS Tools for PowerShell Cmdlet Reference.

    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 an S3 provider other than Wasabi, be sure that you are using the correct profile to access your storage at Wasabi.

    The endpoints vary with the region of your bucket. For more information regarding service URLs, review Service URLs for Wasabi's Storage Regions.