Skip to content

Instantly share code, notes, and snippets.

View reecestart's full-sized avatar
💻

Reece reecestart

💻
View GitHub Profile
@reecestart
reecestart / whatisthisip.py
Created October 14, 2022 02:54
Checks IP Range to see if it is in the AWS IP Ranges (and what it is assigned to)
#!/usr/bin/env python
import requests
import ipaddr
# Get the AWS IP address ranges https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html
ip_ranges = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').json()['prefixes']
# Get the CIDR to check from from the user
cidrtocheck = input("Enter your CIDR to check... ")
range = ipaddr.IPNetwork(cidrtocheck) # Turn it into IP Network Class
@reecestart
reecestart / lambdaDeprecationSchedule.md
Last active January 16, 2024 00:32
List all Lambda Functions in all regions with deprecated runtimes using the Python SDK

List all Lambda Functions in all regions with deprecated runtimes using the Python SDK

checkLambdas.py

@reecestart
reecestart / healthdemo.md
Last active November 20, 2019 16:57
List all Personal Health Dashboard events in all regions and get affected entities with Python

List all Personal Health Dashboard events in all regions and get affected entities with Python

healthdemo.py

@reecestart
reecestart / simpleDBCreateListDeleteDomains.md
Last active March 13, 2019 03:57
Create, List and Delete SimpleDB Domains with Python

Create, List and Delete SimpleDB Domains with Python

simpleDBCreateListDeleteDomains.py

@reecestart
reecestart / getInstanceStoreForEachEC2InstanceType.py
Created February 13, 2019 06:09
Python script which uses the Pricing API to get the Instance Store details for each EC2 Instance Type
import ast
import boto3
from botocore.exceptions import ClientError
pricingclient = boto3.client('pricing', region_name='us-east-1')
paginator = pricingclient.get_paginator('get_attribute_values')
response_iterator = paginator.paginate(
ServiceCode='AmazonEC2',

Keybase proof

I hereby claim:

  • I am reecestart on github.
  • I am reecestart (https://keybase.io/reecestart) on keybase.
  • I have a public key ASD96G7e5AWoI7kYirqOOtSoOTvm4lH1AMO_tC2Poky-qQo

To claim this, I am signing this object:

@reecestart
reecestart / s3BucketPolicyCloudTrailOrganizations.json
Created January 9, 2019 01:44
Default S3 Bucket Policy for CloudTrail for AWS Organizations
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSCloudTrailAclCheck20150319",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:GetBucketAcl",
@reecestart
reecestart / kmsKeyPolicyforCloudTrailOrganizations.json
Created January 9, 2019 00:04
Default KMS Key Policy for CloudTrail for AWS Organization
{
"Version": "2012-10-17",
"Id": "Key policy created by CloudTrail",
"Statement": [
{
"Sid": "Enable IAM User Permissions",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::012345678901:root",
@reecestart
reecestart / getInstanceTypesAvailable.py
Created December 20, 2018 01:33
Output a CSV of Instance Types available for Launch for each AZ in a given AWS Region
import boto3
from botocore.exceptions import ClientError
class bcolors:
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
pricingclient = boto3.client('pricing', region_name='us-east-1')
@reecestart
reecestart / set-intelligent-lifecycle.py
Created December 3, 2018 05:08
Gets all S3 Buckets and creates an Intelligent Tiering Lifecycle Rule on all of them.
import boto3
from datetime import date
from datetime import datetime
today = date.today()
today = datetime.combine(today, datetime.min.time())
client = boto3.client('s3')
# Get all buckets
response = client.list_buckets()