Skip to content

Commit

Permalink
RDS and S3 Changes (#29)
Browse files Browse the repository at this point in the history
* .gitignore

* rds and s3 changes

* changes

---------

Co-authored-by: ranchodeluxe <[email protected]>
  • Loading branch information
ranchodeluxe and ranchodeluxe authored May 22, 2024
1 parent 65469a9 commit 857a3e0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ data/

.pgdata

terraform/veda-wfs3-shared-mcp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,25 @@ def lambda_handler(event, context):
s3_filename_no_ext = os.path.splitext(s3_filename_target)[0]
print(f"[ S3 FILENAME NO EXT ]: {s3_filename_no_ext}")

if s3_filename_target.endswith(".gpkg"):
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}

if s3_event_key.startswith("EIS/FEDSoutput-v3"):
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}

bucket_key_prefix = "EIS/FEDSoutput/Snapshot/"
if s3_event_key.startswith("EIS/FEDSoutput-v3"):
bucket_key_prefix = "EIS/FEDSoutput-v3/Snapshot/"
if s3_filename_no_ext.startswith("lf_"):
bucket_key_prefix = "EIS/FEDSoutput/LFArchive/"


# get web token
mwaa_cli_token = client.create_cli_token(
Name=mwaa_env_name
Expand Down Expand Up @@ -54,4 +69,4 @@ def lambda_handler(event, context):
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
}
2 changes: 1 addition & 1 deletion terraform/veda-wfs3/rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "aws_db_instance" "db" {
db_name = "veda"
identifier = "${var.project_name}-${var.env}"
engine = "postgres"
engine_version = "14.7"
engine_version = "14.10"
// https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
allocated_storage = 100
max_allocated_storage = 500
Expand Down
8 changes: 7 additions & 1 deletion terraform/veda-wfs3/s3_event_bridge_lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,15 @@ resource "aws_lambda_function" "lambda" {
role = aws_iam_role.lambda_exec_role.arn
handler = "lambda_function.lambda_handler"
source_code_hash = data.archive_file.archive.output_base64sha256
runtime = "python3.7"
runtime = "python3.9"
publish = true
tags = var.tags

environment {
variables = {
LOG_GROUP_NAME = "/aws/lambda/s3-event-bridge-to-sfn-execute-${var.project_name}-${var.env}"
}
}
}

resource "aws_cloudwatch_log_group" "group" {
Expand Down

0 comments on commit 857a3e0

Please sign in to comment.