This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import boto3 | |
import sys | |
from botocore.exceptions import ClientError | |
def check_args(): | |
if len(sys.argv) < 4: | |
print(f'Usage: {sys.argv[0]} profile-name region-name bucket-name [folder-name]') | |
exit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export log format: | |
# ${version} ${account-id} ${interface-id} ${srcaddr} ${dstaddr} ${srcport} ${dstport} ${protocol} ${packets} ${bytes} ${start} ${end} ${action} ${log-status} ${vpc-id} ${subnet-id} ${instance-id} ${tcp-flags} ${type} ${pkt-srcaddr} ${pkt-dstaddr | |
CREATE EXTERNAL TABLE IF NOT EXISTS vpc_flow_logs_myawsaccount ( | |
version int, | |
account string, | |
interfaceid string, | |
sourceaddress string, | |
destinationaddress string, | |
sourceport int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Use an existing tag on AWS EC2 instance/s to add/delete new/old tags. | |
# | |
# Usage: ./ec2-instance-tagger.py <aws-profile> <aws-region> <existing-tag-key> <existing-tag-value> <target-tag-key> <target-tag-value> <action> | |
# | |
# I've 3 EC2 instances already tagged with Temp:True , adding new tag Zone:2 | |
# ./ec2-instance-tagger.py myawsprofile us-east-1 Temp True Zone 2 add | |
# Expected output: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# ~~~~~~~~~~ | |
# Lists number of snapshots associated and not associated with an AMI | |
# Requires : AWS PROFILE/REGION/ACCOUNT ID | |
# | |
# Usage: ./ec2_snapshot_usage.py <aws-profile> <aws-region> <aws-account-id> | |
# Usage: ./ec2_snapshot_usage.py myawsprofile us-east-1 111111111111 | |
# | |
# Expected Output: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import time | |
# | |
vLocalTimeZone='US/Eastern' | |
# | |
def lambda_handler(event, context): | |
# Run time in UTC |