AWS SDK - Go (Golang)

Learn how to use the AWS SDK for Go (Golang) with Filebase.

What is AWS SDK - Go?

AWS SDKs (software development kits) help simplify coding and application development by supporting and providing code objects for use with S3-compatible services. There are a variety of different AWS SDKs, each for a different coding language. This guide covers AWS SDK - Go.

Read below to learn how to use the AWS SDK for Go with Filebase.

Prerequisites:

Create a Bucket

The following code example creates a new Filebase bucket. Replace the following values in the code to match your configuration:

  • filebase-access-key: Your Filebase Access Key

  • filebase-secret-key: Your Filebase Secret Key

  • new-filebase-bucket: The Intended New Bucket Name

Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.

Buckets created through this method will be automatically created on the IPFS network.

Upload an Object

The following code example uploads an object to the specified bucket. Replace the following values in the code to match your configuration:

  • filebase-access-key: Your Filebase Access Key

  • filebase-secret-key: Your Filebase Secret Key

  • bucket-name: Your Filebase Bucket Name

  • /path/to/object/to/upload: The path to the file to upload

  • object-name: The name of the object to upload

Download an Object

The following code example downloads an object from the specified bucket. Replace the following values in the code to match your configuration:

  • filebase-access-key: Your Filebase Access Key

  • filebase-secret-key: Your Filebase Secret Key

  • bucket-name: Your Filebase Bucket Name

  • object-name: The name of the object to download

Delete an Object

The following code example deletes an object from the specified bucket. Replace the following values in the code to match your configuration:

  • filebase-access-key: Your Filebase Access Key

  • filebase-secret-key: Your Filebase Secret Key

  • bucket-name: Your Filebase Bucket Name

  • object-name: The name of the object to be deleted

For more information on the AWS SDK for Go, check out the documentation here.

Last updated

Was this helpful?