A Clojure library for accessing Amazon Security Token Service, based on the official AWS Java SDK and borrowing heavily from clj-aws-ec2 and James Reeves's clj-aws-s3 library.
Add the following dependency to your project.clj
file:
[clj-aws-sts "0.1.3"]
(require '[aws.sdk.sts :as sts])
(def cred {:access-key "...", :secret-key "..."})
(sts/get-session-token)
(sts/get-session-token cred {:duration-seconds 3600 })
(sts/get-session-token cred {:serial-number "GAHT12345678" token-code "123456"})
(sts/get-federation-token cred {:name "auser})
(sts/get-federation-token cred {:name "auser" :duration-seconds 1800})
(sts/assume-role cred {:role-arn \"arn:aws:iam::123456789012:role/demo\" :role-session-name \"Demo\" :duration-seconds 1800 })"
You can catch exceptions and extract details of the error condition:
(try
(sts/get-session-token cred)
(catch Exception e (sts/decode-exceptions e)))
sts/decode-exceptions
provides a map with the following keys:
:error-code
:error-type
:service-name
:status-code
Copyright (C) 2013 Michael Rowe
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close