Created
August 3, 2021 05:27
-
-
Save brevityinmotion/f74d62e654b08283bd21c7bc2859f2a1 to your computer and use it in GitHub Desktop.
Example function to load static variables into AWS parameter store
This file contains hidden or 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
def generateParameterStore(dataBucketName,graphBucketName,inputBucketName,presentationBucketName,ATHENA_BUCKET,ATHENA_DB,ATHENA_TABLE): | |
graphBucketPath = 's3://' + dataBucketName + '/graph/' | |
rawBucketPath = 's3://' + dataBucketName + '/raw/' | |
refinedBucketPath = 's3://' + dataBucketName + '/refined/' | |
inputBucketPath = 's3://' + inputBucketName + '/' | |
programInputBucketPath = 's3://' + inputBucketName + '/programs/' | |
presentationBucketPath = 's3://' + presentationBucketName + '/presentation/' | |
variableStatus = 'Variables successfully assigned.' | |
def _putParameters(paramName,paramValue,paramType): | |
client = boto3.client('ssm') | |
response = client.put_parameter( | |
Name=paramName, | |
Value=paramValue, | |
Overwrite=True, | |
Type=paramType, | |
Description='Brevity Workflow', | |
Tier='Standard' | |
) | |
return response['ResponseMetadata']['HTTPStatusCode'] | |
responseDataBucketName = _putParameters('dataBucketName',dataBucketName,'String') | |
responseGraphBucketName = _putParameters('graphBucketName',graphBucketName,'String') | |
responseInputBucketName = _putParameters('inputBucketName',inputBucketName,'String') | |
responseGraphBucketPath = _putParameters('graphBucketPath',graphBucketPath,'String') | |
responseRawBucketPath = _putParameters('rawBucketPath',rawBucketPath,'String') | |
responseRefinedBucketPath = _putParameters('refinedBucketPath',refinedBucketPath,'String') | |
responseInputBucketPath = _putParameters('inputBucketPath',inputBucketPath,'String') | |
responseInputProgramBucketPath = _putParameters('programInputBucketPath',programInputBucketPath,'String') | |
responsePresentationBucketPath = _putParameters('presentationBucketPath',presentationBucketPath,'String') | |
responseAthenaBucket = _putParameters('ATHENA_BUCKET', ATHENA_BUCKET, 'String') | |
responseAthenaDB = _putParameters('ATHENA_DB', ATHENA_DB, 'String') | |
responseAthenaTable = _putParameters('ATHENA_TABLE', ATHENA_TABLE, 'String') | |
response = variableStatus | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment