Skip to content

Specifying a custom endpoint URL when using AWS SDK with Ceph (an S3 compatible storage platform)

Posted on:July 30, 2023 at 07:05 PM

Introduction

Most of the time, if you’re using AWS services, you don’t need to specify an endpoint URL in the command. For example, you can simply run aws mb s3://BUCKET. However, we use an S3-compatible service for block storage, called Ceph, and need to always specify our unique endpoint url with every command: aws --endpoint-url "https://s3.msi.umn.edu" s3 mb "s3://BUCKET" — which is a lot of extra typing!

Set up an aws config file

To make these commands easier (with Amazon or Ceph), it’s advisable to create user-specific config files to automatically use important settings. The aws config commands below will generate two files: ~/.aws/credentials and ~/.aws/config, storing various profile info.

I set up an aws “profile”, called ceph, with this info:

# aws --version >= 2.13.0
aws configure set --profile "ceph" aws_access_key_id "EXAMPLE-ACCESS-KEY"
aws configure set --profile "ceph" aws_secret_access_key "EXAMPLE-SECRET-ACCESS-KEY"
aws configure set --profile "ceph" region "us-east-1"
aws configure set --profile "ceph" output "json"
# This is our custom endpoint url, not an Amazon service
aws configure set --profile "ceph" endpoint_url "https://s3.msi.umn.edu"

Before aws ver 2.13.0, the endpoint_url entry in the config file had zero effect! But now it works great!

Amazon updated the GitHub issue, their SDK documentation, and explained how to implement the new feature on the AWS Developer Tools Blog.