From ce2e690c216cb3a685aa5750c568ee1955c3443d Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Mon, 30 Oct 2023 16:01:45 +0000 Subject: [PATCH 01/80] inbound port 22 ssh access for lambda to connect to ec2 instance --- terraform/environments/apex/lambda.tf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index f40e6c7aaea..6066a60fc73 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -10,7 +10,7 @@ module "iambackup" { module "s3_bucket_lambda" { source = "./modules/s3" - bucket_name = "laa-${local.application_name}-${local.environment}-mp" + bucket_name = "laa-${local.application_name}-${local.environment}-mp" tags = merge( local.tags, { Name = "laa-${local.application_name}-${local.environment}-mp" } @@ -30,6 +30,13 @@ resource "aws_security_group" "lambdasg" { protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } + ingress { + description = "inbound ssh access for Lambda" + from_port = 22 + to_port = 22 + protocol = "ssh" + cidr_blocks = local.application_data.accounts[local.environment].mp_vpc_cidr + } } data "archive_file" "dbsnapshot_file" { From 5cdad6b8386fa40fcd36106a92df6465b4b0de25 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Mon, 30 Oct 2023 16:05:47 +0000 Subject: [PATCH 02/80] added brackets for ingress rule --- terraform/environments/apex/lambda.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index 6066a60fc73..f66f70ff502 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -35,7 +35,7 @@ resource "aws_security_group" "lambdasg" { from_port = 22 to_port = 22 protocol = "ssh" - cidr_blocks = local.application_data.accounts[local.environment].mp_vpc_cidr + cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] } } From 56b7862ad020aa8768ca883eb9d7f68f60c83e1c Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Mon, 30 Oct 2023 16:16:59 +0000 Subject: [PATCH 03/80] changed ssh to tcp for ingress rule --- terraform/environments/apex/lambda.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index f66f70ff502..0ea6d7f9db1 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -34,7 +34,7 @@ resource "aws_security_group" "lambdasg" { description = "inbound ssh access for Lambda" from_port = 22 to_port = 22 - protocol = "ssh" + protocol = "tcp" cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] } } From 79737415048a107aa481459e7d7d009babadc662 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 11:08:18 +0000 Subject: [PATCH 04/80] added ingress 1521 rule for Lambda SG --- terraform/environments/apex/lambda.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index 0ea6d7f9db1..8ce5cb0ee1a 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -37,6 +37,13 @@ resource "aws_security_group" "lambdasg" { protocol = "tcp" cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] } + ingress { + description = "inbound sql net access for Lambda" + from_port = 1521 + to_port = 1521 + protocol = "tcp" + cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] + } } data "archive_file" "dbsnapshot_file" { From c493110e81930b458084e58256884524b35e5b03 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 11:10:49 +0000 Subject: [PATCH 05/80] changed event rule time to test Lambda --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 4f1d50044d6..64065011680 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(00 04 ? * MON-SUN *)" + schedule_expression = "cron(18 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 036328725a4abbc361c4a4d8a6dbdde12bf4521d Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 11:28:00 +0000 Subject: [PATCH 06/80] added ingress rule port 22 to ec2 SG --- terraform/environments/apex/ec2.tf | 7 +++++++ terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/lambda.tf | 14 -------------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/terraform/environments/apex/ec2.tf b/terraform/environments/apex/ec2.tf index eee2491bc88..d654c6607fa 100644 --- a/terraform/environments/apex/ec2.tf +++ b/terraform/environments/apex/ec2.tf @@ -94,6 +94,13 @@ resource "aws_security_group" "ec2" { protocol = "tcp" cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] } + ingress { + description = "inbound ssh access for Lambda" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] + } egress { description = "Allow AWS SSM Session Manager" diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 64065011680..1347f7df25f 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(18 11 ? * MON-SUN *)" + schedule_expression = "cron(34 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index 8ce5cb0ee1a..6be2e55d84a 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -30,20 +30,6 @@ resource "aws_security_group" "lambdasg" { protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } - ingress { - description = "inbound ssh access for Lambda" - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] - } - ingress { - description = "inbound sql net access for Lambda" - from_port = 1521 - to_port = 1521 - protocol = "tcp" - cidr_blocks = [local.application_data.accounts[local.environment].mp_vpc_cidr] - } } data "archive_file" "dbsnapshot_file" { From 8b8060b1ab780f21ec6ba64f29aa3bd131f17fc5 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 12:14:09 +0000 Subject: [PATCH 07/80] testing lambda with new time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 1347f7df25f..1dc48e915f5 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(34 11 ? * MON-SUN *)" + schedule_expression = "cron(20 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 75bef5a6a617d46039db091c3ef1f74e03ec4c11 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 14:16:20 +0000 Subject: [PATCH 08/80] debugging sqlplus commands --- terraform/environments/apex/dbconnect.js | 23 ++++++++++--------- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 20c95c528cd..a3582d34d89 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -89,17 +89,18 @@ async function connSSH(action, appname) { ssh .exec( - 'sudo su - oracle -c "sqlplus / as sysdba < Date: Tue, 31 Oct 2023 14:34:10 +0000 Subject: [PATCH 09/80] debugging sqlplus commands --- terraform/environments/apex/dbconnect.js | 2 +- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index a3582d34d89..e5d95b62c03 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -89,7 +89,7 @@ async function connSSH(action, appname) { ssh .exec( - "sudo su - oracle -c sqlplus / as sysdba", + 'sudo su - oracle -c sqlplus / as sysdba', // 'sudo su - oracle -c "sqlplus / as sysdba < Date: Tue, 31 Oct 2023 15:43:19 +0000 Subject: [PATCH 10/80] setting sqlplus cmds back to original ones --- terraform/environments/apex/dbconnect.js | 23 +++++++++---------- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index e5d95b62c03..8640d443131 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -89,18 +89,17 @@ async function connSSH(action, appname) { ssh .exec( - 'sudo su - oracle -c sqlplus / as sysdba', - // 'sudo su - oracle -c "sqlplus / as sysdba < Date: Tue, 31 Oct 2023 16:03:26 +0000 Subject: [PATCH 11/80] re-added MGMT_EC2_KEY_DEFAULT to the MP Parameter Store --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 7745a4fcf55..87d3d7eb3ff 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(51 15 ? * MON-SUN *)" + schedule_expression = "cron(08 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 1a3259809e55196ecb187158bc6687c64edd742b Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 16:27:14 +0000 Subject: [PATCH 12/80] testing lambda --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 87d3d7eb3ff..a5c6935e8a9 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(08 16 ? * MON-SUN *)" + schedule_expression = "cron(32 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From b10c6c68328d0341884e4a2b877b63943df598a9 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Tue, 31 Oct 2023 16:47:20 +0000 Subject: [PATCH 13/80] testing lambda with new time and backup mode ended manually in sqlplus --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index a5c6935e8a9..1f9c72dba88 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(32 16 ? * MON-SUN *)" + schedule_expression = "cron(53 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From bd4df82b05a470a3b5bedfc34c11bf66ade0029a Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 10:08:15 +0000 Subject: [PATCH 14/80] aws-sdk module included to the s3 bucker and change event time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 1f9c72dba88..be1ac1733c1 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(53 16 ? * MON-SUN *)" + schedule_expression = "cron(18 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From d69cfd65d8d9078a5433c1c9b1b43bd44910c6ed Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 11:09:28 +0000 Subject: [PATCH 15/80] change event time again --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index be1ac1733c1..23e7d6cbc78 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(18 10 ? * MON-SUN *)" + schedule_expression = "cron(15 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 21e7b047b574fd0167ab487c930af1c773f57f9d Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 11:42:30 +0000 Subject: [PATCH 16/80] testing lambda with new time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 23e7d6cbc78..c23d66d9a9d 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(15 11 ? * MON-SUN *)" + schedule_expression = "cron(47 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 9b4c6fe9bb1bc27bac2a49bd2b821c398cc4955c Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 11:52:19 +0000 Subject: [PATCH 17/80] testing lambda with new time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index c23d66d9a9d..e200529a34e 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(47 11 ? * MON-SUN *)" + schedule_expression = "cron(58 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 6501c3cf97a7cfc921b4fb4f9c86420090ca2e34 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 12:33:46 +0000 Subject: [PATCH 18/80] testing lambda with new time --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index e200529a34e..3eed05ecda5 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(58 11 ? * MON-SUN *)" + schedule_expression = "cron(39 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 17f680bfed4..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -5,7 +5,7 @@ locals { dbsnapshot_source_file = "dbsnapshot.js" deletesnapshot_source_file = "deletesnapshots.py" dbconnect_source_file = "dbconnect.js" - + dbsnapshot_output_path = "dbsnapshot.zip" deletesnapshot_output_path = "deletesnapshots.zip" dbconnect_output_path = "dbconnect.zip" @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 6b67baf01c9e062159f765e1e29697069d050404 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 12:45:22 +0000 Subject: [PATCH 19/80] testing lambda with new time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 3eed05ecda5..0ac9561aaba 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(39 12 ? * MON-SUN *)" + schedule_expression = "cron(51 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From c8987e5fd36921ef767ddba9c978dbd744aa386f Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 15:20:57 +0000 Subject: [PATCH 20/80] nodejs code change --- terraform/environments/apex/dbconnect.js | 26 +++++++++---------- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 8640d443131..367b86d60cd 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -81,25 +81,25 @@ async function connSSH(action, appname) { user: username, key: myKey, }); - + const { exec } = require('child_process'); + const bashCommand = 'sudo su - oracle -c "sqlplus / as sysdba <> " + address); console.log(`[+] Running "begin backup commands" as Oracle`); ssh - .exec( - 'sudo su - oracle -c "sqlplus / as sysdba < Date: Wed, 1 Nov 2023 15:29:38 +0000 Subject: [PATCH 21/80] changed nodejs from 18 to 14 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 04fb3159506..a57f8a324c7 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(27 15 ? * MON-SUN *)" + schedule_expression = "cron(35 15 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index b1a1c1bc77f..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs18.x" + snapshotDBFunctionruntime = "nodejs14.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 18069fe9c0dd92b0d5c6fb8621d1b3f10cb143b3 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 15:41:33 +0000 Subject: [PATCH 22/80] changed dbconnect code --- terraform/environments/apex/dbconnect.js | 4 ++-- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 367b86d60cd..825bf9401f6 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -6,7 +6,7 @@ // version: 0.1 // auth: phil h ///////////////////////////////////////////////////////////////////// - +import { exec } from 'child_process'; const SSH = require("simple-ssh"); const AWS = require("aws-sdk"); @@ -81,7 +81,7 @@ async function connSSH(action, appname) { user: username, key: myKey, }); - const { exec } = require('child_process'); + // const { exec } = require('child_process'); const bashCommand = 'sudo su - oracle -c "sqlplus / as sysdba < Date: Wed, 1 Nov 2023 15:58:19 +0000 Subject: [PATCH 23/80] changed dbconnect code --- terraform/environments/apex/dbconnect.js | 53 +++++-------------- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +-- 3 files changed, 18 insertions(+), 43 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 825bf9401f6..7915178c315 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -6,35 +6,27 @@ // version: 0.1 // auth: phil h ///////////////////////////////////////////////////////////////////// -import { exec } from 'child_process'; const SSH = require("simple-ssh"); -const AWS = require("aws-sdk"); - +const AWS = require("@aws-sdk"); //SSM object with temp parms const ssm = new AWS.SSM({ apiVersion: "2014-11-06" }); - // Environment variables const pem = "MGMT_EC2_KEY_DEFAULT"; const username = "ec2-user"; - //Set date format var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; var yyyy = today.getFullYear(); - if (dd < 10) { dd = "0" + dd; } - if (mm < 10) { mm = "0" + mm; } today = dd + "-" + mm + "-" + yyyy; - //EC2 object let ec2 = new AWS.EC2({ apiVersion: "2014-10-31" }); - //Get private IP address for EC2 instances tagged with Name:{ appname } // May return more than 1 instance if there are multiple instances with the same name async function getInstances(appname) { @@ -43,7 +35,6 @@ async function getInstances(appname) { .describeInstances({ Filters: [{ Name: "tag:Name", Values: [appname] }] }) .promise(); } - async function getIPaddress(appname) { var instance_ip_list = []; var instance_data = await getInstances(appname); @@ -55,23 +46,16 @@ async function getIPaddress(appname) { console.log("Found ", instance_ip_list.length, " instances"); return instance_ip_list; } - - // Get SSH key from param store - async function getSSMparam() { return await ssm.getParameter({ Name: pem, WithDecryption: true }).promise(); } - // Trigger SSH connection to the EC2 instance // Run SSH command - async function connSSH(action, appname) { //get ssm key const key = await getSSMparam(); - const myKey = key["Parameter"]["Value"]; - const addresses = await getIPaddress(appname); // all this config could be passed in via the event for(var address of addresses){ @@ -81,25 +65,23 @@ async function connSSH(action, appname) { user: username, key: myKey, }); - // const { exec } = require('child_process'); - const bashCommand = 'sudo su - oracle -c "sqlplus / as sysdba <> " + address); console.log(`[+] Running "begin backup commands" as Oracle`); - ssh - exec(bashCommand, + .exec( + 'sudo su - oracle -c "sqlplus / as sysdba <> ` + address); console.log("[+] Returned response: " + response); - ssh.end(); - return response; } catch (e) { console.log(e); @@ -159,15 +136,13 @@ async function connSSH(action, appname) { } } } - exports.handler = async (event, context) => { try { console.log("[+} Received event:", JSON.stringify(event, null, 2)); await connSSH(event.action, event.appname); - context.done(); } catch (error) { console.error(error); context.fail(); } -}; +}; \ No newline at end of file diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index dfda012e2d4..ebfec13dc00 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(46 15 ? * MON-SUN *)" + schedule_expression = "cron(04 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From fd20add7d110e8092b3062dd089f05c9b33e7a15 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 16:20:35 +0000 Subject: [PATCH 24/80] changed dbconnect code --- terraform/environments/apex/dbconnect.js | 2 +- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 7915178c315..62c7fd9f4b7 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -7,7 +7,7 @@ // auth: phil h ///////////////////////////////////////////////////////////////////// const SSH = require("simple-ssh"); -const AWS = require("@aws-sdk"); +const AWS = require("aws-sdk"); //SSM object with temp parms const ssm = new AWS.SSM({ apiVersion: "2014-11-06" }); // Environment variables diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index ebfec13dc00..a58c0d04e3e 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(04 16 ? * MON-SUN *)" + schedule_expression = "cron(25 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 54104384bb17edb38af3768970fccfb768e12ee9 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 16:32:46 +0000 Subject: [PATCH 25/80] changed dbconnect code --- terraform/environments/apex/dbsnapshot.js | 10 +++++----- terraform/environments/apex/event_triggers.tf | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/terraform/environments/apex/dbsnapshot.js b/terraform/environments/apex/dbsnapshot.js index 68050df9637..f279b0290bc 100644 --- a/terraform/environments/apex/dbsnapshot.js +++ b/terraform/environments/apex/dbsnapshot.js @@ -7,7 +7,7 @@ // auth: phil h ///////////////////////////////////////////////////////////////////// -const AWS = require("aws-sdk"); +import { Lambda, EC2 } from "aws-sdk"; //Set date format var date_ob = new Date(); @@ -18,10 +18,10 @@ var year = date_ob.getFullYear(); var date = day + "/" + month + "/" + year; //lambda object -let lambda = new AWS.Lambda({ apiVersion: "2015-03-31" }); +let lambda = new Lambda({ apiVersion: "2015-03-31" }); //EC2 object -let ec2 = new AWS.EC2({ apiVersion: "2014-10-31" }); +let ec2 = new EC2({ apiVersion: "2014-10-31" }); async function invokeLambdaStart(appname) { try { @@ -278,7 +278,7 @@ async function ec2CreateSnapshot2(volume, appname, volume_device, volume_name, d return ec2.createSnapshot(params).promise(); } -exports.handler = async (event, context) => { +export async function handler(event, context) { const appname = event.appname; try { console.log("Putting DB into Hotbackup mode and taking snapshot"); @@ -300,4 +300,4 @@ exports.handler = async (event, context) => { } catch (error) { console.error(error); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index a58c0d04e3e..217db06b516 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(25 16 ? * MON-SUN *)" + schedule_expression = "cron(37 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 93b8f28ecb2ee919f580e9af464d21654330c9cf Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 1 Nov 2023 16:40:21 +0000 Subject: [PATCH 26/80] changed dbconnect code --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 217db06b516..2792db8919a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(37 16 ? * MON-SUN *)" + schedule_expression = "cron(45 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index b1a1c1bc77f..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs18.x" + snapshotDBFunctionruntime = "nodejs14.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 1e88d8883bad9141d723991d2e93be6e6e471f58 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 17:15:09 +0000 Subject: [PATCH 27/80] change runtime version --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 2792db8919a..cc7edc9475d 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(45 16 ? * MON-SUN *)" + schedule_expression = "cron(20 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..8aa676e8f07 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 5d745e67fe4faf0c8333c5d47d409fa5092fc20d Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 17:24:24 +0000 Subject: [PATCH 28/80] change runtime version and use es module --- terraform/environments/apex/dbconnect.js | 12 ++++++------ terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 62c7fd9f4b7..71b73518fc4 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -6,10 +6,10 @@ // version: 0.1 // auth: phil h ///////////////////////////////////////////////////////////////////// -const SSH = require("simple-ssh"); -const AWS = require("aws-sdk"); +import SSH from "simple-ssh"; +import { SSM, EC2 } from "aws-sdk"; //SSM object with temp parms -const ssm = new AWS.SSM({ apiVersion: "2014-11-06" }); +const ssm = new SSM({ apiVersion: "2014-11-06" }); // Environment variables const pem = "MGMT_EC2_KEY_DEFAULT"; const username = "ec2-user"; @@ -26,7 +26,7 @@ if (mm < 10) { } today = dd + "-" + mm + "-" + yyyy; //EC2 object -let ec2 = new AWS.EC2({ apiVersion: "2014-10-31" }); +let ec2 = new EC2({ apiVersion: "2014-10-31" }); //Get private IP address for EC2 instances tagged with Name:{ appname } // May return more than 1 instance if there are multiple instances with the same name async function getInstances(appname) { @@ -136,7 +136,7 @@ async function connSSH(action, appname) { } } } -exports.handler = async (event, context) => { +export async function handler(event, context) { try { console.log("[+} Received event:", JSON.stringify(event, null, 2)); await connSSH(event.action, event.appname); @@ -145,4 +145,4 @@ exports.handler = async (event, context) => { console.error(error); context.fail(); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index cc7edc9475d..714db7b6e9d 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(20 17 ? * MON-SUN *)" + schedule_expression = "cron(28 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 8aa676e8f07..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 8c7230eaa11c44d726db88bbd373a640aebb3214 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 1 Nov 2023 17:32:27 +0000 Subject: [PATCH 29/80] change evenb trigger time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 714db7b6e9d..807b6be9d78 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(28 17 ? * MON-SUN *)" + schedule_expression = "cron(38 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From cee721c47224cafb5dd71f3d6c27922aaed5f935 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 09:52:43 +0000 Subject: [PATCH 30/80] event trigger changed time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 807b6be9d78..a24fcb534bf 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(38 17 ? * MON-SUN *)" + schedule_expression = "cron(57 09 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From cd75d2c858789c1ea57d765d67bf3b8e0fff47ce Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 10:10:32 +0000 Subject: [PATCH 31/80] event trigger changed time v1 nodejs version changed --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index a24fcb534bf..2cfe6afcae6 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(57 09 ? * MON-SUN *)" + schedule_expression = "cron(16 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..871790a45d3 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,7 +23,7 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config From 552b81a9a74e73ee95c7fb6c48d688aa586c21cb Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 10:17:05 +0000 Subject: [PATCH 32/80] event trigger changed time v1 nodejs version changed v1 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 2cfe6afcae6..56a51911814 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(16 10 ? * MON-SUN *)" + schedule_expression = "cron(20 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From c06b8183a6278db0cc5abb2ea6d9c34518e342ee Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 10:19:42 +0000 Subject: [PATCH 33/80] event trigger changed time v1 nodejs version changed v2 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 56a51911814..1b5d57340b7 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(20 10 ? * MON-SUN *)" + schedule_expression = "cron(25 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 49bd16bbd93ade68a5f1da7e7150fe2da987aa82 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 10:55:43 +0000 Subject: [PATCH 34/80] event trigger changed time changed v2 --- terraform/environments/apex/dbconnect.js | 39 +++++++++++++++---- terraform/environments/apex/dbsnapshot.js | 10 ++--- terraform/environments/apex/event_triggers.tf | 2 +- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index 71b73518fc4..ba938d6d86e 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -6,27 +6,35 @@ // version: 0.1 // auth: phil h ///////////////////////////////////////////////////////////////////// -import SSH from "simple-ssh"; -import { SSM, EC2 } from "aws-sdk"; + +const SSH = require("simple-ssh"); +const AWS = require("aws-sdk"); + //SSM object with temp parms -const ssm = new SSM({ apiVersion: "2014-11-06" }); +const ssm = new AWS.SSM({ apiVersion: "2014-11-06" }); + // Environment variables const pem = "MGMT_EC2_KEY_DEFAULT"; const username = "ec2-user"; + //Set date format var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; var yyyy = today.getFullYear(); + if (dd < 10) { dd = "0" + dd; } + if (mm < 10) { mm = "0" + mm; } today = dd + "-" + mm + "-" + yyyy; + //EC2 object -let ec2 = new EC2({ apiVersion: "2014-10-31" }); +let ec2 = new AWS.EC2({ apiVersion: "2014-10-31" }); + //Get private IP address for EC2 instances tagged with Name:{ appname } // May return more than 1 instance if there are multiple instances with the same name async function getInstances(appname) { @@ -35,6 +43,7 @@ async function getInstances(appname) { .describeInstances({ Filters: [{ Name: "tag:Name", Values: [appname] }] }) .promise(); } + async function getIPaddress(appname) { var instance_ip_list = []; var instance_data = await getInstances(appname); @@ -46,16 +55,23 @@ async function getIPaddress(appname) { console.log("Found ", instance_ip_list.length, " instances"); return instance_ip_list; } + + // Get SSH key from param store + async function getSSMparam() { return await ssm.getParameter({ Name: pem, WithDecryption: true }).promise(); } + // Trigger SSH connection to the EC2 instance // Run SSH command + async function connSSH(action, appname) { //get ssm key const key = await getSSMparam(); + const myKey = key["Parameter"]["Value"]; + const addresses = await getIPaddress(appname); // all this config could be passed in via the event for(var address of addresses){ @@ -65,17 +81,19 @@ async function connSSH(action, appname) { user: username, key: myKey, }); + let prom = new Promise(function (resolve, reject) { if (action == "begin") { console.log("[+] Trying connecting to EC2 ==>> " + address); console.log(`[+] Running "begin backup commands" as Oracle`); + ssh .exec( 'sudo su - oracle -c "sqlplus / as sysdba <> ` + address); console.log("[+] Returned response: " + response); + ssh.end(); + return response; } catch (e) { console.log(e); @@ -136,13 +159,15 @@ async function connSSH(action, appname) { } } } -export async function handler(event, context) { + +exports.handler = async (event, context) => { try { console.log("[+} Received event:", JSON.stringify(event, null, 2)); await connSSH(event.action, event.appname); + context.done(); } catch (error) { console.error(error); context.fail(); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/terraform/environments/apex/dbsnapshot.js b/terraform/environments/apex/dbsnapshot.js index f279b0290bc..68050df9637 100644 --- a/terraform/environments/apex/dbsnapshot.js +++ b/terraform/environments/apex/dbsnapshot.js @@ -7,7 +7,7 @@ // auth: phil h ///////////////////////////////////////////////////////////////////// -import { Lambda, EC2 } from "aws-sdk"; +const AWS = require("aws-sdk"); //Set date format var date_ob = new Date(); @@ -18,10 +18,10 @@ var year = date_ob.getFullYear(); var date = day + "/" + month + "/" + year; //lambda object -let lambda = new Lambda({ apiVersion: "2015-03-31" }); +let lambda = new AWS.Lambda({ apiVersion: "2015-03-31" }); //EC2 object -let ec2 = new EC2({ apiVersion: "2014-10-31" }); +let ec2 = new AWS.EC2({ apiVersion: "2014-10-31" }); async function invokeLambdaStart(appname) { try { @@ -278,7 +278,7 @@ async function ec2CreateSnapshot2(volume, appname, volume_device, volume_name, d return ec2.createSnapshot(params).promise(); } -export async function handler(event, context) { +exports.handler = async (event, context) => { const appname = event.appname; try { console.log("Putting DB into Hotbackup mode and taking snapshot"); @@ -300,4 +300,4 @@ export async function handler(event, context) { } catch (error) { console.error(error); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 1b5d57340b7..92fd294911b 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(25 10 ? * MON-SUN *)" + schedule_expression = "cron(01 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 63d981b2bb9549572361399075faf934b81d5791 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 11:19:50 +0000 Subject: [PATCH 35/80] event trigger changed time changed v3 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 92fd294911b..e9ec28c0585 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(01 11 ? * MON-SUN *)" + schedule_expression = "cron(24 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 871790a45d3..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -28,7 +28,7 @@ locals { #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 2d6f7482ca10fbf78fe1e3526539961a024c9ae1 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 11:27:56 +0000 Subject: [PATCH 36/80] event trigger changed time changed v4 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index e9ec28c0585..d07e9b3143e 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(24 11 ? * MON-SUN *)" + schedule_expression = "cron(32 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From aaea8e590b9f794497019f11c81d6feddb1eeb79 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 14:31:57 +0000 Subject: [PATCH 37/80] time change for event triggers --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index d07e9b3143e..9a53bbbd189 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(32 11 ? * MON-SUN *)" + schedule_expression = "cron(36 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From df9760779b0fc7c3448bc9258a153b1eaab9d468 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Thu, 2 Nov 2023 17:00:29 +0000 Subject: [PATCH 38/80] time change for event triggersv1 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 9a53bbbd189..f396b06d32b 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(36 14 ? * MON-SUN *)" + schedule_expression = "cron(05 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 11a25a3773c2d017a6440d8e40aca1a7c62a9e3c Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 09:54:19 +0000 Subject: [PATCH 39/80] change module name --- terraform/environments/apex/dbconnect.js | 2 +- terraform/environments/apex/dbsnapshot.js | 2 +- terraform/environments/apex/event_triggers.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/environments/apex/dbconnect.js b/terraform/environments/apex/dbconnect.js index ba938d6d86e..24025619226 100644 --- a/terraform/environments/apex/dbconnect.js +++ b/terraform/environments/apex/dbconnect.js @@ -8,7 +8,7 @@ ///////////////////////////////////////////////////////////////////// const SSH = require("simple-ssh"); -const AWS = require("aws-sdk"); +const AWS = require("@aws-sdk/client-ec2"); //SSM object with temp parms const ssm = new AWS.SSM({ apiVersion: "2014-11-06" }); diff --git a/terraform/environments/apex/dbsnapshot.js b/terraform/environments/apex/dbsnapshot.js index 68050df9637..a6a8de7bfd7 100644 --- a/terraform/environments/apex/dbsnapshot.js +++ b/terraform/environments/apex/dbsnapshot.js @@ -7,7 +7,7 @@ // auth: phil h ///////////////////////////////////////////////////////////////////// -const AWS = require("aws-sdk"); +const AWS = require("@aws-sdk/client-ec2"); //Set date format var date_ob = new Date(); diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index f396b06d32b..0f5ffc80497 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(05 17 ? * MON-SUN *)" + schedule_expression = "cron(59 09 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 58941fd5ae519c1b897c7cb9f6ff7c607cdbe377 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 10:06:07 +0000 Subject: [PATCH 40/80] chnage time --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 0f5ffc80497..9b6c31c6af2 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(59 09 ? * MON-SUN *)" + schedule_expression = "cron(5099 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 39b7c8e461420c7ddca3bb4f9cdb2240050e0593 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 10:09:55 +0000 Subject: [PATCH 41/80] chnage timev1 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 9b6c31c6af2..07839756d2f 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(5099 10 ? * MON-SUN *)" + schedule_expression = "cron(14 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 9e2141da6aff540bb06ddc1e2664591a567ae3d8 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 12:24:09 +0000 Subject: [PATCH 42/80] chnage timev2 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 07839756d2f..3a6d29b295b 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(14 10 ? * MON-SUN *)" + schedule_expression = "cron(27 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 520949c366b470bf1b80fa8bd2af972ef42287bc Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 12:28:27 +0000 Subject: [PATCH 43/80] chnage timev3 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 3a6d29b295b..85f01a07ce8 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(27 12 ? * MON-SUN *)" + schedule_expression = "cron(34 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 22837688f2656effa58139b1f95553d6f7ee44b3 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 12:58:52 +0000 Subject: [PATCH 44/80] chnage timev4 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 85f01a07ce8..2f08bf21a5a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(34 12 ? * MON-SUN *)" + schedule_expression = "cron(06 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index b1a1c1bc77f..a2030d92c33 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs18.x" + snapshotDBFunctionruntime = "nodejs16.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs16.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs16.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 71ccbd7044226fa756d1b3b0b6062a76210b5434 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 13:24:03 +0000 Subject: [PATCH 45/80] chnage timev5 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 2f08bf21a5a..4bb4defc705 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(06 13 ? * MON-SUN *)" + schedule_expression = "cron(29 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index a2030d92c33..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs16.x" + snapshotDBFunctionruntime = "nodejs14.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs16.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs16.x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 253d52ffc4a66ec1a1e9db99e2fa8e9a43e24bbd Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 13:56:08 +0000 Subject: [PATCH 46/80] chnage timev6 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 4bb4defc705..1bff202d226 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(29 13 ? * MON-SUN *)" + schedule_expression = "cron(00 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From b490c6cf78d3d3b309a3ca9481ac7b663e96cce1 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 14:16:57 +0000 Subject: [PATCH 47/80] chnage timev7 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 1bff202d226..d779dcf7a5d 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(00 14 ? * MON-SUN *)" + schedule_expression = "cron(21 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 7d884485faf9e8d16a3c3e48371dddbb58ab498a Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 14:35:22 +0000 Subject: [PATCH 48/80] chnage timev8 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index d779dcf7a5d..d25fb323992 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(21 14 ? * MON-SUN *)" + schedule_expression = "cron(40 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 262f714c1a3f43a6c9d755af43e41cae49319fb3 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 14:51:09 +0000 Subject: [PATCH 49/80] chnage timev8 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index d25fb323992..f90f52149ce 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(40 14 ? * MON-SUN *)" + schedule_expression = "cron(55 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From b30e66b8063a8531eaacf5b096a4dfdc6b6b6b5d Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 14:59:54 +0000 Subject: [PATCH 50/80] chnage timev9 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index f90f52149ce..6d6269ada35 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(55 14 ? * MON-SUN *)" + schedule_expression = "cron(05 15 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From fc87260fad36afef7c3df767bce0fa3f335ae101 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 15:16:35 +0000 Subject: [PATCH 51/80] chnage timev10 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 6d6269ada35..09e0ac63c28 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(05 15 ? * MON-SUN *)" + schedule_expression = "cron(21 15 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 3d25e602f1b34e91fb984c71280a89bc2198eb15 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 16:40:34 +0000 Subject: [PATCH 52/80] chnage timev11 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 09e0ac63c28..2792db8919a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(21 15 ? * MON-SUN *)" + schedule_expression = "cron(45 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 8178db0916e5288bc9b26edaf1e5c9014c38acb1 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Fri, 3 Nov 2023 17:01:30 +0000 Subject: [PATCH 53/80] chnage timev12 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 2792db8919a..abe05da142e 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(45 16 ? * MON-SUN *)" + schedule_expression = "cron(06 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From b1a22eef4a4b1ff44100da280624861a668acd42 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 12:33:43 +0000 Subject: [PATCH 54/80] chnage timev13 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index abe05da142e..adda4af466c 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(06 17 ? * MON-SUN *)" + schedule_expression = "cron(38 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 0de4373b5c70078e90394e7f4d95e861d8177e70 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 12:46:31 +0000 Subject: [PATCH 55/80] chnage timev14 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index adda4af466c..0ac9561aaba 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(38 12 ? * MON-SUN *)" + schedule_expression = "cron(51 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 3685f4a37580d76a9c8fb17d75b783ba4f9c2903 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 13:04:28 +0000 Subject: [PATCH 56/80] chnage timev15 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 0ac9561aaba..1c516462cfb 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(51 12 ? * MON-SUN *)" + schedule_expression = "cron(09 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 20329599b5da32d8b49936f1cb2ff8cb6d355485 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 14:22:19 +0000 Subject: [PATCH 57/80] chnage timev16 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 1c516462cfb..f0fa2cdf0fa 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(09 13 ? * MON-SUN *)" + schedule_expression = "cron(27 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From a4059af7128861ea1a33a8bd2332f555836aa161 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 14:38:05 +0000 Subject: [PATCH 58/80] chnage timev17 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index f0fa2cdf0fa..f43082a1f7a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(27 14 ? * MON-SUN *)" + schedule_expression = "cron(32 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From e7b0a0d1c99bb715db88a087b0bd3f961d9ea356 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Mon, 6 Nov 2023 14:40:10 +0000 Subject: [PATCH 59/80] chnage timev18 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index f43082a1f7a..9869175305a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(32 14 ? * MON-SUN *)" + schedule_expression = "cron(44 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From f6707c263a33a253b97db5dfa95d960d60c2c9d9 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Tue, 7 Nov 2023 15:03:32 +0000 Subject: [PATCH 60/80] chnage timev19 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 9869175305a..9971dec7001 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(44 14 ? * MON-SUN *)" + schedule_expression = "cron(08 15 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 39cb083ca725b2c9bb668c8dd75b693dc0131fed Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Tue, 7 Nov 2023 15:57:04 +0000 Subject: [PATCH 61/80] chnage timev20 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 9971dec7001..efdeb4d3940 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(08 15 ? * MON-SUN *)" + schedule_expression = "cron(01 16 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 94be941e52ff04dda0264258d9926192a44d8761 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Tue, 7 Nov 2023 17:32:18 +0000 Subject: [PATCH 62/80] chnage timev21 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index efdeb4d3940..e2294362696 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(01 16 ? * MON-SUN *)" + schedule_expression = "cron(37 17 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 9211933810073d93b5bb10526f58f5e2819c23fb Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 09:28:11 +0000 Subject: [PATCH 63/80] chnage timev22 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index e2294362696..a557f4f5826 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(37 17 ? * MON-SUN *)" + schedule_expression = "cron(32 09 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From f77ffba2f807d38e9ec6c4578f839cc794a635fc Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 09:41:37 +0000 Subject: [PATCH 64/80] chnage timev23 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index a557f4f5826..ffaccc2de78 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(32 09 ? * MON-SUN *)" + schedule_expression = "cron(46 09 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 3c228d6cbf6c33fe9756fbd60d92f25239c8782b Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 09:50:46 +0000 Subject: [PATCH 65/80] chnage timev24 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index ffaccc2de78..ebdebd12951 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(46 09 ? * MON-SUN *)" + schedule_expression = "cron(54 09 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 522bbea7010e61e48253b50d98b63e446c3c5507 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 09:58:15 +0000 Subject: [PATCH 66/80] chnage timev25 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index ebdebd12951..14ab57d192b 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(54 09 ? * MON-SUN *)" + schedule_expression = "cron(02 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 510bbe756d2b5f98815e27325df017a641c9442f Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 10:06:50 +0000 Subject: [PATCH 67/80] chnage timev26 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 14ab57d192b..f4128b91610 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(02 10 ? * MON-SUN *)" + schedule_expression = "cron(10 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 96677c4c7b9f4a7d34f5fe88db26e04ad601ef00 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 10:30:57 +0000 Subject: [PATCH 68/80] chnage timev27 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index f4128b91610..3050a8e1aec 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(10 10 ? * MON-SUN *)" + schedule_expression = "cron(36 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index b1a1c1bc77f..7f5a551228b 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs18.x" + snapshotDBFunctionruntime = "nodejs14.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs184x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 3d5ff43d153bb09ede48bc772589c6e40f35f626 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 10:34:29 +0000 Subject: [PATCH 69/80] chnage timev28 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 3050a8e1aec..3a1420f191a 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(36 10 ? * MON-SUN *)" + schedule_expression = "cron(40 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 7f5a551228b..77e9f29a367 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -28,7 +28,7 @@ locals { #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs184x" + compatible_runtimes = "nodejs14x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 599dd42c4ab3e64c68ed9fba230491ea4ec78ed2 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 10:36:15 +0000 Subject: [PATCH 70/80] chnage timev29 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 3a1420f191a..c3f28de2f45 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(40 10 ? * MON-SUN *)" + schedule_expression = "cron(42 10 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 77e9f29a367..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -28,7 +28,7 @@ locals { #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 0d6704ee91dca83173bbd66e320b17d90763ec2a Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 11:09:22 +0000 Subject: [PATCH 71/80] chnage timev30 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index c3f28de2f45..bcbaaa363bc 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(42 10 ? * MON-SUN *)" + schedule_expression = "cron(13 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 14d65b5591142c40f3d8d9ca16b1080d08f61639 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 11:17:28 +0000 Subject: [PATCH 72/80] chnage timev31 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index bcbaaa363bc..afb61086880 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(13 11 ? * MON-SUN *)" + schedule_expression = "cron(22 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 7adc6e5d7f2644dca3e56a86cf4dd2a185e23661 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 11:52:55 +0000 Subject: [PATCH 73/80] chnage timev32 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index afb61086880..08152406ef6 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(22 11 ? * MON-SUN *)" + schedule_expression = "cron(56 11 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index b1a1c1bc77f..155213cc294 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs18.x" + snapshotDBFunctionruntime = "nodejs14.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs18.x" + connectDBFunctionruntime = "nodejs14.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs18.x" + compatible_runtimes = "nodejs14.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From ded69ed4393da86c81b8cb64b8b3c20d042294af Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 12:30:55 +0000 Subject: [PATCH 74/80] chnage timev33 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 08152406ef6..85f01a07ce8 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(56 11 ? * MON-SUN *)" + schedule_expression = "cron(34 12 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 0c1e1fae230b73be4b709add2d7aaad4fac198aa Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 13:08:02 +0000 Subject: [PATCH 75/80] increase timeout and memory --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/lambda.tf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 85f01a07ce8..3c2510a992b 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(34 12 ? * MON-SUN *)" + schedule_expression = "cron(13 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index 6be2e55d84a..a93c6f54c8a 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -72,6 +72,9 @@ resource "aws_lambda_function" "snapshotDBFunction" { layers = [aws_lambda_layer_version.lambda_layer.arn] s3_bucket = module.s3_bucket_lambda.lambdabucketname s3_key = local.snapshotDBFunctionfilename + memory_size = "350MB" + timeout = 300 + environment { variables = { @@ -124,6 +127,8 @@ resource "aws_lambda_function" "connectDBFunction" { layers = [aws_lambda_layer_version.lambda_layer.arn] s3_bucket = module.s3_bucket_lambda.lambdabucketname s3_key = local.connectDBFunctionfilename + memory_size = "350MB" + timeout = 300 environment { variables = { From 9bbbd31613b620915c48ebcbf9ed49eaabaab2dd Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 13:10:16 +0000 Subject: [PATCH 76/80] increase timeout and memoryv1 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/lambda.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 3c2510a992b..0ba0a5d35d6 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(13 13 ? * MON-SUN *)" + schedule_expression = "cron(16 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index a93c6f54c8a..b5e10bb3f18 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -72,7 +72,7 @@ resource "aws_lambda_function" "snapshotDBFunction" { layers = [aws_lambda_layer_version.lambda_layer.arn] s3_bucket = module.s3_bucket_lambda.lambdabucketname s3_key = local.snapshotDBFunctionfilename - memory_size = "350MB" + memory_size = 300 timeout = 300 @@ -127,7 +127,7 @@ resource "aws_lambda_function" "connectDBFunction" { layers = [aws_lambda_layer_version.lambda_layer.arn] s3_bucket = module.s3_bucket_lambda.lambdabucketname s3_key = local.connectDBFunctionfilename - memory_size = "350MB" + memory_size = 350 timeout = 300 environment { From e726890f7959ea8357e9238f9714b0139a529d10 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 13:41:05 +0000 Subject: [PATCH 77/80] change timev35 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 0ba0a5d35d6..01422d224cc 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(16 13 ? * MON-SUN *)" + schedule_expression = "cron(45 13 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From eae37c75d92ca4182a0f3c381139eac26bb7ce49 Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 14:27:08 +0000 Subject: [PATCH 78/80] change timev36 --- terraform/environments/apex/event_triggers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 01422d224cc..64f743731f3 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(45 13 ? * MON-SUN *)" + schedule_expression = "cron(30 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" From 0f1496e1da7b5d8a9cc1cf392ca4da3a217942cf Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 8 Nov 2023 14:46:48 +0000 Subject: [PATCH 79/80] change timev37 --- terraform/environments/apex/event_triggers.tf | 2 +- terraform/environments/apex/lambda.tf | 2 +- terraform/environments/apex/locals.tf | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform/environments/apex/event_triggers.tf b/terraform/environments/apex/event_triggers.tf index 64f743731f3..97f428b49a9 100644 --- a/terraform/environments/apex/event_triggers.tf +++ b/terraform/environments/apex/event_triggers.tf @@ -1,7 +1,7 @@ resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { name = "laa-createSnapshotRule-${local.application_name}-${local.environment}-mp" description = "Daily snapshots of Oracle volumes" - schedule_expression = "cron(30 14 ? * MON-SUN *)" + schedule_expression = "cron(51 14 ? * MON-SUN *)" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { statement_id = "AllowExecutionFromCloudWatch" diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index b5e10bb3f18..c753f8fae0a 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -72,7 +72,7 @@ resource "aws_lambda_function" "snapshotDBFunction" { layers = [aws_lambda_layer_version.lambda_layer.arn] s3_bucket = module.s3_bucket_lambda.lambdabucketname s3_key = local.snapshotDBFunctionfilename - memory_size = 300 + memory_size = 350 timeout = 300 diff --git a/terraform/environments/apex/locals.tf b/terraform/environments/apex/locals.tf index 155213cc294..b1a1c1bc77f 100644 --- a/terraform/environments/apex/locals.tf +++ b/terraform/environments/apex/locals.tf @@ -13,7 +13,7 @@ locals { #Lambda Function creation snapshotDBFunctionname = "snapshotDBFunction" snapshotDBFunctionhandler = "snapshot/dbsnapshot.handler" - snapshotDBFunctionruntime = "nodejs14.x" + snapshotDBFunctionruntime = "nodejs18.x" snapshotDBFunctionfilename = "dbsnapshot.zip" deletesnapshotFunctionname = "deletesnapshotFunction" @@ -23,12 +23,12 @@ locals { connectDBFunctionname = "connectDBFunction" connectDBFunctionhandler = "ssh/dbconnect.handler" - connectDBFunctionruntime = "nodejs14.x" + connectDBFunctionruntime = "nodejs18.x" connectDBFunctionfilename = "dbconnect.zip" #layer config s3layerkey = "nodejs.zip" - compatible_runtimes = "nodejs14.x" + compatible_runtimes = "nodejs18.x" application_test_url = "https://apex.laa-development.modernisation-platform.service.justice.gov.uk/apex/" } \ No newline at end of file From 8f6808d93db21d2be1ec5e2267aa69612259fb46 Mon Sep 17 00:00:00 2001 From: Tariq Mahmood Date: Wed, 8 Nov 2023 15:05:17 +0000 Subject: [PATCH 80/80] LAWS-3514: adding versioning for S3 bucket --- terraform/environments/apex/modules/s3/main.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terraform/environments/apex/modules/s3/main.tf b/terraform/environments/apex/modules/s3/main.tf index 302c985cad6..8e04208f01d 100644 --- a/terraform/environments/apex/modules/s3/main.tf +++ b/terraform/environments/apex/modules/s3/main.tf @@ -26,3 +26,9 @@ resource "aws_s3_bucket_public_access_block" "default" { restrict_public_buckets = true } +resource "aws_s3_bucket_versioning" "laa-lambda-backup-versioning" { + bucket = aws_s3_bucket.laa-lambda-backup.id + versioning_configuration { + status = "Enabled" + } +}