Created
June 19, 2018 22:10
-
-
Save redbo/24a822eaed4cae016fa857e89e120f55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# export OS_USERNAME=tester | |
# export OS_PASSWORD=testing | |
# export OS_PROJECT_NAME=test | |
# export OS_TENANT_NAME=test | |
# export OS_AUTH_URL=http://localhost:5000/v3 | |
# export OS_IDENTITY_API_VERSION=3 | |
# export OS_AUTH_VERSION=3 | |
# | |
# openstack ec2 credentials create | |
import boto | |
from boto.s3.connection import S3Connection | |
from swiftly.client.standardclient import StandardClient | |
cl = StandardClient(auth_url='http://127.0.0.1:5000/v2.0', | |
auth_tenant='test', auth_user='tester', auth_key='testing') | |
cl.auth() | |
cl.put_container('XXX') | |
cl.put_object('XXX', 'test-object', | |
'THIS IS SOME DATA', headers={'Content-Type': 'text/plain'}) | |
connection = S3Connection( | |
aws_access_key_id="40e97a98169a43e4a96a79585fe1ed5a", # "access" from ec2 creds | |
aws_secret_access_key="844c7420b64a45f98de57a4ddeb0c067", # "secret" from ec2 creds | |
port=8080, | |
host='127.0.0.1', | |
is_secure=False, | |
calling_format=boto.s3.connection.OrdinaryCallingFormat() | |
) | |
print connection.get_all_buckets() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment