You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/01/17 17:33:20 UTC

git commit: docs: Add an example of how to use Amazon temporary security credentials.

Updated Branches:
  refs/heads/trunk dd20d6461 -> b4a708f31


docs: Add an example of how to use Amazon temporary security credentials.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b4a708f3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b4a708f3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b4a708f3

Branch: refs/heads/trunk
Commit: b4a708f31023f1af1d3b7967c9ef6383c7f92ce5
Parents: dd20d64
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 17 17:29:44 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 17 17:29:44 2014 +0100

----------------------------------------------------------------------
 docs/compute/drivers/ec2.rst                    | 20 ++++++++++++++++++++
 .../compute/ec2/temporary_credentials.py        |  6 ++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b4a708f3/docs/compute/drivers/ec2.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/ec2.rst b/docs/compute/drivers/ec2.rst
index 232dfc8..d7d6f71 100644
--- a/docs/compute/drivers/ec2.rst
+++ b/docs/compute/drivers/ec2.rst
@@ -21,6 +21,25 @@ It allows users to rent virtual servers in more than 8 regions such as:
 * Asia Pacific (Tokyo) Region
 * South America (Sao Paulo) Region
 
+Using temporary security credentials
+------------------------------------
+
+Since Libcloud 0.14.0 above, all the Amazon drivers support using temporary
+security credentials.
+
+Temporary credentials can be used by passing ``token`` argument to the driver
+constructor in addition to the access and secret key. In this case ``token``
+represents a temporary session token, access key represents temporary
+access key and secret key represents a temporary secret key.
+
+For example:
+
+.. literalinclude:: /examples/compute/ec2/temporary_credentials.py
+   :language: python
+
+For more information, please refer to the `Using Temporary Security
+Credentials`_ section of the official documentation.
+
 Examples
 --------
 
@@ -38,3 +57,4 @@ API Docs
     :inherited-members:
 
 .. _`Amazon Elastic Compute Cloud (EC2)`: https://aws.amazon.com/ec2/
+.. _`Using Temporary Security Credentials`: http://docs.aws.amazon.com/STS/latest/UsingSTS/using-temp-creds.html

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b4a708f3/docs/examples/compute/ec2/temporary_credentials.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/ec2/temporary_credentials.py b/docs/examples/compute/ec2/temporary_credentials.py
new file mode 100644
index 0000000..b1e78e6
--- /dev/null
+++ b/docs/examples/compute/ec2/temporary_credentials.py
@@ -0,0 +1,6 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.EC2_US_WEST)
+driver = cls('temporary access key', 'temporary secret key',
+             token='temporary session token')