Skip to content

Instantly share code, notes, and snippets.

@ultrasonex
ultrasonex / AWSCronValidator.py
Last active January 23, 2024 09:25
AWS Cron Validator : Schedule expression
# Author : Niloy Chakraborty
# AWS Schedule Expression cron expression validator
import re
from voluptuous import Invalid
import datetime
minute_regex = r"^([*]|([0]?[0-5]?[0-9]?)|(([0]?[0-5]?[0-9]?)(\/|\-)([0]?[0-5]?[0-9]?))|" \
"(([0]?[0-5]?[0-9]?)((\,)([0]?[0-5]?[0-9]?))*))$"
@amgill
amgill / ec2_sg_rules.py
Last active March 16, 2023 19:35
Generate AWS Security Groups Rules Report of all the Security Groups, as Seen via AWS Web Console. Uses python 3 with boto3 to generate CSV.
#!/usr/local/bin/python3
######################################################################################################################
# Purpose: Generate rules report of all the security groups #
# Input Params: None [Make sure to set AWS CLI session by populating env. vars. with keys.] #
# Usage: ./ec2_sg_rules.py > account-date.csv [python ./ec2_sg_rules.py > gill-dev-sg-2018-04-11.csv] #
# Author: Abdul Gill #
# Doc. Ref: http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_security_groups#
######################################################################################################################
from __future__ import print_function