Skip to content

Instantly share code, notes, and snippets.

@naturalett
Created May 4, 2020 15:19
Show Gist options
  • Select an option

  • Save naturalett/bb9aa10bde4857b89077926285407795 to your computer and use it in GitHub Desktop.

Select an option

Save naturalett/bb9aa10bde4857b89077926285407795 to your computer and use it in GitHub Desktop.
SecretManager
'''Example code of the SecretManager class'''
class SecretManager(object):
def __init__(self, serviceName, environment, awsRegion="us-east-1", filepath=""):
try:
self.SERVICE_NAME = serviceName.lower()
self.ENVIRONMENT = environment.lower()
self.FILEPATH = filepath
self.ssm = self.initSSM(awsRegion)
self.CREDENTIAL_KEY_PREFIX = "cred"
self.credentialValues = {}
except Exception as err:
raise err
def initSSM(self, awsRegion):
'''
Initialise AWS connection with given credentials
:param awsRegion:
:return: boto3.client()
'''
try:
return boto3.client("ssm", region_name=awsRegion)
except:
print("An exception occurred\nFailed to establish aws connection")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment