SHARE
TWEET

Untitled

a guest Jul 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def get_secret():
  2. secret_name = "abc"
  3. region_name = "xyz"
  4.  
  5. session = boto3.session.Session()
  6. client = session.client(
  7.     service_name='secretsmanager',
  8.     region_name=region_name
  9. )
  10. try:
  11.     get_secret_value_response = client.get_secret_value(
  12.         SecretId=secret_name
  13.     )
  14.  
  15. except ClientError as e:
  16.     print(e)
  17. else:
  18.     if 'SecretString' in get_secret_value_response:
  19.         secret = get_secret_value_response['SecretString']
  20.         #Print Credentials
  21.         print(secret)
  22.      
  23. {"username":"xxxxx","password":"yyyyyyy","engine":"mysql","host":"only master host here","port":zzzz,"dbClusterIdentifier":"aaaaaaaaa"}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top