PowerShell
Learn how to configure and use PowerShell with Filebase.
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.
Install-Module -Name AWS.Tools.S3 -Scope CurrentUser -Force
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.
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.
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.
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.
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.
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.
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]