Skip to content

Commit

Permalink
Update_061224_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Buckingham authored and Buckingham committed Dec 6, 2024
1 parent fc4d041 commit 817a2be
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 14 additions & 2 deletions terraform/environments/ppud/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,8 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev"
description = "AWS IAM Policy for managing aws lambda role cloudwatch get_metric_data development"
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [{
"Statement" : [
{
"Sid" : "CloudwatchMetricPolicy",
"Effect" : "Allow",
"Action" : [
Expand Down Expand Up @@ -1241,7 +1242,18 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev"
"arn:aws:ses:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*",
"arn:aws:ses:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:identity/internaltest.ppud.justice.gov.uk"
]
}]
},
{
"Sid" : "CloudwatchMetricStatsPolicy",
"Effect" : "Allow",
"Action" : [
"cloudwatch:GetMetricStatistics"
],
"Resource" : [
"arn:aws:cloudwatch:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*"
]
},
]
})
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Python script to
# Python script to retrieve cloudwatch metic data (cpu processes), graph it and email it to end users via the internal mail relay.
# Nick Buckingham
# 6 December 2024

import boto3
import os
Expand All @@ -24,7 +26,7 @@
END_TIME = datetime.utcnow()
START_TIME = END_TIME - timedelta(hours=9)
SENDER = "[email protected]"
RECIPIENTS = ["[email protected]"]
RECIPIENTS = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
SUBJECT = f'AWS EC2 CPU Utilization Report - {SERVER} - {CURRENT_DATE}'
REGION = "eu-west-2"
IMAGE_ID = "ami-02f8251c8cdf2464f"
Expand Down

0 comments on commit 817a2be

Please sign in to comment.