Wrapper for the Amazon AWS SDK for Java.
A snapshot release is published on Clojars. It can be added to your Leiningen
This library is very much a work in progress. The following Amazon API's are currently supported:
- Amazon Simple Email Service
- Amazon Simple Notification Service
To use the Amazon API's you'll need your AWS credentials (access key and secret key). These are available in the AWS Console.
Create your credentials using the
(def creds (clj-aws.core/credentials "ACCESS_KEY" "SECRET_KEY"))
(def client (clj-aws.ses/client creds))
(def message (clj-aws.ses/message "Subject" "Hello, World!"))
(def destination (clj-aws.ses/destination ["email@example.com" "firstname.lastname@example.org"]))
(def sender "email@example.com")
(clj-aws.ses/send-email client sender destination message)
Firstly, create a client with your AWS credentials
(def client (clj-aws.sns/client creds))
Next, it's necessary to define the topic for the set of notifications you would like to issue.
(create-topic client "some_topic")
You can use
list-topics to see all currently created topics (and their ARN).
Once you've defined a topic you can create a subscription to that topic. The library allows subscriptions to be defined with the following functions:
All subscriptions are tied to a topic's ARN. This can be found by calling
(.getTopicArn (first (list-topics client)))
Then, subscriptions can be bound as follows:
(subscribe client arn (http-subscription "https://my.site/testing"))
and an email subscription:
(subscribe client arn (email-subscription "firstname.lastname@example.org"))
Notifications can then be posted as follows:
(def topic-arn "arn:aws:sns:us-east-1:121xxx:some_topic")
(publish client topic-arn "Test message!!")
Copyright © 2011 Paul Ingles
Distributed under the Eclipse Public License, the same as Clojure.