[Haskell-cafe] Amazonka: How to generate S3:// uri from Network.AWS.S3.Types.Object?

Mark Fine mark.fine at gmail.com
Thu Nov 2 03:43:36 UTC 2017

The *getFile* example downloads and object from S3 and "sinks" its contents
to a file. To integrate with an existing program that's using S3 URIs, you
can build it with the bucket and key:

s3Uri :: BucketName -> ObjectKey -> Text
s3Uri (BucketName bn) (ObjectKey ok) = "s3://" <> bn <> "/" <> ok

There are also presigned S3 URLs (also in the examples file), but those are
for HTTP requests, not aws cli requests.

Using turtle with with aws cli is great - nice light way to get AWS
functionality without going pulling in amazonka.


On Tue, Oct 31, 2017 at 11:43 PM, Cody Goodman <
codygman.consulting at gmail.com> wrote:

> Question: How can I generate an S3://absolute/url from an Object (
> https://hackage.haskell.org/package/amazonka-s3-1.4.5/
> docs/Network-AWS-S3-Types.html#t:Object)?
> Context: I've been using turtle to call "aws s3 ls" and I'm trying to
> figure out how to replace that with amazonka. Absolute s3 urls were central
> to how my program worked. I KNow how to get objects now and filter them,
> but I don't know how to convert an object to an S3 url to integrate with my
> existing program.
> I came across the getFile function (https://github.com/
> brendanhay/amazonka/blob/4fdd746346323aac7de6e82752b166
> 09ef0bf212/examples/src/Example/S3.hs#L65) and tried downloading a file
> from s3.
> Perhaps I had something wrong, but it didn't seem like just the S3 Bucket
> and S3 Object key were enough to download a given file. If I'm wrong about
> that I need to double check my configuration.
> Thanks,
> Cody Goodman
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20171101/c669e079/attachment.html>

More information about the Haskell-Cafe mailing list