Liking cljdoc? Tell your friends :D

Codesmith AWS Profile Credentials Provider

A profile credentials provider library for cognitect-labs/aws-api.

This library is based on the cognitect-labs/aws-api AWS Api library.


Assuming an ~/.aws/credentials file with the following content:

source_profile = base-profile
role_arn = arn:aws:iam::123456789012:role/RoleName

aws_access_key_id     = ZZZZZZZZZZZZZZZZZZZZ

You can use the provided profile credentials provider to use the profile role-based-profile; to use the region configured for the profile, you typically use the profile-region-provider in the namespace

(require '[ :as aws])
(require '[ :as region])
(require '[ :as pcp])

(def profile-name "the-profile")

(def s3-client (aws/client {:api                  :s3
                            :credentials-provider (pcp/profile-credentials-provider profile-name)
                            :region-provider      (region/profile-region-provider profile-name)}))

The library use AWS STS to retrieve temporary credentials.


Copyright © 2020 Codesmith GmbH (adaptation)
Copyright © 2015 — 2020 Cognitect (original code and example, licensed under the Apache License, Version 2.0)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close