Skip to content

Commit

Permalink
change from secrets manager to parameter store
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel committed Dec 12, 2021
1 parent 533d507 commit f44c601
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ pack: clean fetch-dependencies
#
deploy-test: pack
aws s3 cp ./dist/function/build.zip s3://${S3_BUCKET}/${TEST_S3_KEY} --profile ${AWS_USER}
aws --region us-east-1 lambda update-function-code --function-name ${TEST_FUNCTION_NAME} --s3-bucket ${S3_BUCKET} --s3-key ${TEST_S3_KEY} --profile ${AWS_USER}
aws --region us-east-1 lambda update-function-code --function-name ${TEST_FUNCTION_NAME} --s3-bucket ${S3_BUCKET} --s3-key ${TEST_S3_KEY} --profile ${AWS_USER} > /dev/null

#
# Copy the code from the test environment to
# production and update the Lambda function
#
deploy-run:
aws s3 cp s3://${S3_BUCKET}/${TEST_S3_KEY} s3://${S3_BUCKET}/${RUN_S3_KEY} --profile ${AWS_USER}
aws lambda update-function-code --function-name ${RUN_FUNCTION_NAME} --s3-bucket ${S3_BUCKET} --s3-key ${RUN_S3_KEY} --profile ${AWS_USER}
aws lambda update-function-code --function-name ${RUN_FUNCTION_NAME} --s3-bucket ${S3_BUCKET} --s3-key ${RUN_S3_KEY} --profile ${AWS_USER} > /dev/null

13 changes: 9 additions & 4 deletions src/logging_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ def get_parameter():
region_name = "us-east-1"

ssm_client = boto3.client('ssm', region_name=region_name)
response = ssm_client.get_parameter(Name=paramter_name)
return response['Parameters']['Value']
response = ssm_client.get_parameter(
Name=paramter_name,
WithDecryption=True
)
return response['Parameter']['Value']

def get_secret():

Expand Down Expand Up @@ -115,14 +118,15 @@ def log_msg(message):

if submission.status_code != 200: # or submission.json['status'] != "ok":
print('Got status {}'.format(submission.status_code))
print(submission.json())
#raise ValueError('Got status {}'.format(submission.status_code))



def log_scan(db_data):
log_env = get_env()

logdna = get_secret()
logdna = get_parameter()


logdata = {
Expand All @@ -147,4 +151,5 @@ def log_scan(db_data):
submission = requests.post('https://logs.logdna.com/logs/ingest?hostname=GLIMPSE&now={}'.format(int(time.time())), json=logdata, headers=h_data, auth=HTTPBasicAuth(logdna, ''))

if submission.status_code != 200: # or submission.json['status'] != "ok":
raise ValueError('Got status {}'.format(submission.status_code))
print('Got status {}'.format(submission.status_code))
#raise ValueError('Got status {}'.format(submission.status_code))

0 comments on commit f44c601

Please sign in to comment.