brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
605 stars 227 forks source link

v2.0 user - Regions outside the AWS support realm and s3cmd terminology #826

Closed EdmundsEcho closed 2 years ago

EdmundsEcho commented 2 years ago

I'm new to Amazonka but chose to go with 2.0 because the design was more accessible to me compared to the latest v1 release. Despite the early status of the update, my use case is narrow and overlaps with where other users have confirmed "v2 works" :))

I'm using the sdk to pull files from a S3-compliant service hosted on Digital Ocean. They support a single region: "US". Is there value to "call-out" or otherwise explicit recommended approach when using the sdk outside of AWS? For instance, AWS.Region does not include US.

Also, in general as an FYI from a new user's perspective: I used the s3cmd command line tool to design and confirm a working configuration (a solid, observable, starting point). I noticed that the terminology used in the .s3cfg (e.g., host_base and host_bucket), are not echoed in the documentation. This might be a missed opportunity to leverage a terminology that facilitates plugging into the sdk.

endgame commented 2 years ago

In 2.0, the Region type is actually a newtype over Text and it uses pattern synonyms and a {-# COMPLETE #-} annotation to look like a sum type. The Region' :: Text -> Region constructor is also exported from Amazonka, so you can write Region' "US".

You will probably also be interested in PR #832 which adds support for customising the S3 addressing style used. Otherwise Amazonka might try to use vhost-style bucket addressing which Digital Ocean may not support.

The s3cmd that I found doesn't look like it's been written by AWS; Amazonka tries pretty hard to replicate behaviour and naming conventions from the official AWS SDKs.

I'll close this off now, because I think that answers your question; let me know if I am wrong.