Library for accessing a AWS S3 Bucket storage.
Add following into paket.references
Alma.S3Bucket
BucketName is part of the configuration since it should be paired with specific credentials (and its policies)
open Alma.AWS.S3Bucket
let configuration = {
Region = None // eu-west-1 is a default
Credentials = AccessKey {
Key = "..."
Secret = "..."
}
Bucket = BucketName <| Create.Instance (
Domain "domain"
Context "context"
Purpose "purpose"
Version "version"
)
}
asyncResult {
use! s3client = S3Bucket.connect configuration
}TIP: use S3Bucket.Configuration.forXXX function for easier configuration creation
open Alma.AWS.S3Bucket
open Feather.ErrorHandling
asyncResult {
do! S3Bucket.put s3client {
Name = "Movie"
Content = "Lord of the Rings"
}
}open Alma.AWS.S3Bucket
asyncResult {
let! lotrMovie = "Movie" |> S3Bucket.get s3client
return lotrMovie
}open Feather.ErrorHandling
open Alma.AWS.S3Bucket
open Alma.AWS.S3Bucket.ClientSideEncryption
asyncResult {
let encryptionKey = EncryptionKey "...Base64 encoded AES256..."
// put encrypted file
do! S3Bucket.put s3client encryptionKey {
Name = "Movie"
Content = "Lord of the Rings"
}
// get encrypted file
let! lotrMovie = "Movie" |> S3Bucket.get s3client encryptionKey
}NOTE:
There is a EncryptionKey.createAES256() function, which can be used to create a valid EncryptionKey, but keep in mind, that you need the key, for getting the item back.
So you should persist the key to your secrets store.
- Increment version in
S3Bucket.fsproj - Update
CHANGELOG.md - Commit new version and tag it
./build.sh build./build.sh -t tests