Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonathanhle/a0ea15554ffc48f813c699f354d43548 to your computer and use it in GitHub Desktop.
Save jonathanhle/a0ea15554ffc48f813c699f354d43548 to your computer and use it in GitHub Desktop.
boto3 hvac vault testing
import boto3
import hvac
import ssl
#ssl._create_default_https_context = ssl._create_unverified_context
session = boto3.Session()
credentials = session.get_credentials()
client = hvac.Client(verify=False)
client.auth_aws_iam(credentials.access_key, credentials.secret_key, credentials.token, role='example-role', header_value='vault.service.consul')
client.secrets.kv.default_kv_version = '1'
create_response = client.secrets.kv.create_or_update_secret('example_foo', secret=dict(baz='bar'))
read_response = client.secrets.kv.read_secret('example_foo')
print(read_response)
@jonathanhle
Copy link
Author

boto3==1.9.175
botocore==1.12.175
certifi==2019.6.16
chardet==3.0.4
docutils==0.14
hvac==0.9.2
idna==2.8
jmespath==0.9.4
python-dateutil==2.8.0
requests==2.22.0
s3transfer==0.2.1
six==1.12.0
urllib3==1.25.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment