Vinayak Pandey
Sep 24, 2022

--

Comment out these lines if you don't want to use SES

def send_email(subject,body):

ses_client=boto3.client("ses")

ses_client.send_email(Source='sender@xyz.com',Destination={'ToAddresses': ['recipient@xyz.com']},

Message={

'Subject': {

'Data': subject

},

'Body': {

'Text': {

'Data': body

}

}

}

)

and

send_email("Security Group Notification","Revoked public access to port "+str(ip['FromPort']) +" for security group "+security_group_id)

and

send_email("Security Group Notification","Revoked public access to all ports for security group "+security_group_id)

You can use CloudWatch events to trigger this lambda every 30 minutes

--

--

Vinayak Pandey
Vinayak Pandey

Written by Vinayak Pandey

Experienced Cloud Engineer with a knack of automation. Linkedin profile: https://www.linkedin.com/in/vinayakpandeyit/

No responses yet