PowerShell
Learn how to configure and use PowerShell with Filebase.

What is PowerShell?

PowerShell is a task automation and configuration management program created by Microsoft that consists of a command-line shell interface and a built-in scripting language. PowerShell is available for Windows, macOS, and Linux operating systems.
Read below to learn how to use PowerShell with Filebase.

Prerequisites:

  • Download and install PowerShell.
  • Sign up for a free Filebase account.
  • Have your Filebase Access and Secret Keys. Learn how to view your access keys here.
  • Create a Filebase Bucket. Learn how to create a bucket here.

Configuration

1. Open your PowerShell command line. First, we need to install the Amazon S3 module for use with Filebase. Install this module with the command:

Install-Module -Name AWS.Tools.S3 -Scope CurrentUser -Force

2. Next, we need to configure our Filebase credentials. To do this, use the following command:

Set-AWSCredential -StoreAs Filebase -AccessKey ACCESS_KEY -SecretKey SECRET_KEY
Replace the ACCESS_KEY with your Filebase Access Key, and the SECRET_KEY with your Filebase Secret Key.

Upload Objects

To upload an object to Filebase, use the following command:
Write-S3Object -File OBJECT_NAME -BucketName FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
Replace OBJECT_NAME with the name of the file to be uploaded, and FILEBASE_BUCKET_NAME with your Filebase bucket name.

List Objects

To get a list of all objects in a Filebase bucket, use the following command:
Get-S3Object -BucketName FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
This also lists the metadata for each object stored in the specified bucket.
Replace FILEBASE_BUCKET_NAME with your Filebase bucket name.

Download Objects

To download an object from a bucket, use the following command:
Get-S3Object -Key OBJECT_NAME -BucketName FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
Replace OBJECT_NAME with the name of the file to be downloaded, and FILEBASE_BUCKET_NAME with your Filebase bucket name.

Deleting Objects

To delete an object from a bucket, use the following command:
Remove-S3Object -Key OBJECT_NAME -BucketName FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
Replace OBJECT_NAME with the name of the file to be deleted, and FILEBASE_BUCKET_NAME with your Filebase bucket name.

Creating Buckets

To create a new bucket, use the following command:
New-S3Bucket -BucketName NEW_FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
Replace NEW_FILEBASE_BUCKET_NAME with your new Filebase bucket name.

Deleting Buckets

To delete a bucket, the bucket must first be empty. After the bucket has been emptied, it can be removed with the following command:
Remove-S3Bucket -BucketName FILEBASE_BUCKET_NAME -EndpointUrl https://s3.filebase.com -Region us-east-1 -ProfileName filebase
Replace FILEBASE_BUCKET_NAME with your Filebase bucket name to be deleted.
If you have any questions, please join our Discord server, or send us an email at [email protected]
Copy link
On this page
What is PowerShell?
Configuration
Upload Objects
List Objects
Download Objects
Deleting Objects
Creating Buckets
Deleting Buckets