AWS

Rye can talk to Amazon S3 (object storage) and SES (email) through the AWS SDK. Credentials are read from the standard AWS environment variables and shared config files (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ~/.aws/credentials, etc.).

This package needs a build with -tags "b_contrib,b_aws".

Create a session

Everything starts with a session tied to an AWS region.

sess: new-aws-session "us-east-1"

S3: store and retrieve objects

s3: sess .Open-s3

; Upload an object (bucket, key, reader, content)
s3 .Put-object "my-bucket" "file.txt" reader "hello"

; Download an object, returned as a reader
obj: s3 .Get-object "my-bucket" "file.txt"

; Delete an object
s3 .Delete-object "my-bucket" "file.txt"

Put-object takes a reader as its data source, so you can upload strings, file contents, or any other reader-based value.

SES: send email

SES sends raw email messages. Compose a message with the gomail-based email builtins, then hand it to SES with a sender, recipients, and a “from” address.

ses: sess .Open-ses

; Build a message with the email builtins (gomail), then send it
ses .Send-raw message "sender@example.com" [ "recipient@example.com" ]

The Send-raw arguments are the SES client, a gomail message, a block of recipients, and the from email address.

Notes

Keep AWS credentials out of source code — rely on environment variables or the shared credentials file. Each operation is independent and returns a Rye error on failure, so you can wrap calls in fix or either to handle problems gracefully.