From bc3dffde40ce51fe8b819cbd665206cdae9d383e Mon Sep 17 00:00:00 2001 From: Kien Nguyen Date: Tue, 31 Jan 2017 00:07:09 +0700 Subject: [PATCH] Fix boto syntax Boto library is changed, so an example need to be updated. - Change boto.s3.Connection to boto.s3.connection.S3Connection, it's the right syntax. - Remove calling_format arg, is unnecessary and in some cases, it doesn't works. Default calling_format(DefaultCallingFormat) worked fine. - Update an example client using boto3 library. - Note libraries version. Change-Id: If02edd337e451aff257fa9db920f2bfbf230d924 Closes-Bug: #1660387 --- .../source/object-storage/configure-s3.rst | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/doc/config-reference/source/object-storage/configure-s3.rst b/doc/config-reference/source/object-storage/configure-s3.rst index 7bc5962c4f..784bc291ff 100644 --- a/doc/config-reference/source/object-storage/configure-s3.rst +++ b/doc/config-reference/source/object-storage/configure-s3.rst @@ -78,15 +78,38 @@ To set up your client, ensure you are using the ec2 credentials, which can be downloaded from the API Endpoints tab of the dashboard. The host should also point to the Object Storage node's hostname. It also will have to use the old-style calling format, and not the hostname-based -container format. Here is an example client setup using the Python boto -library on a locally installed all-in-one Object Storage installation. +container format. Here are two examples of client setup using both Python +boto_ library (version 2.45.0) and boto3_(version 1.4.4) library on a locally +installed all-in-one Object Storage installation. .. code-block:: python - connection = boto.s3.Connection( + # Connection using boto library + connection = boto.s3.connection.S3Connection( aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c', aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd', port=8080, host='127.0.0.1', - is_secure=False, - calling_format=boto.s3.connection.OrdinaryCallingFormat()) + is_secure=False) + + # Connection using boto3 library + + # Create a low-level service client + s3_client = boto3.client( + 's3', + aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c', + aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd', + endpoint_url='http://127.0.0.1:8080' + ) + + # Create a resource service client + s3_resource = boto3.resource( + 's3', + aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c', + aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd', + endpoint_url='http://127.0.0.1:8080' + ) + +.. _boto: https://github.com/boto/boto + +.. _boto3: https://github.com/boto/boto3/