Posts

Showing posts from September, 2019

AWS-Python: Fetching credentials stored in AWS Secret Manager with Python

AWS Secret Manager is a great service to keep all the credetial secretly. Anytime you need to access them to use inside your code, you can fetch those through the AWS SDK. AWS SDK need some information to be ready before start you send any request to AWS Secret Manager AWS Access Key AWS Secret Access Key Region Name Secret Name(The name you have given to store your credential in AWS Secret Manager) Here is code snippet that you need to write to retrive the information from AWS Secret Manager. import boto3 import base64 from botocore.exceptions import ClientError def get_secret(): secret_name= "redshift\db\dbname" region_name = "us-east-1" client = boto3.client( 'secretsmanager' , aws_access_key_id = '<aws_access_key_id>' , aws_secret_access_key = '<aws_secret_access_key>' , region_name = '<region_name>' ...