Skip to content

Instantly share code, notes, and snippets.

View jimsmith's full-sized avatar

jimsmith

View GitHub Profile
@jimsmith
jimsmith / lambda_function.py
Created April 24, 2020 23:11 — forked from jonrau1/lambda_function.py
Lambda function (Py 3.8) to convert VPC flow logs from Cloudwatch Logs into JSON. Performs enrichment by adding ENI and EC2 information, reverse DNS and geolocation courtesy of ip-api.com
import requests
import time
import os
import json
import boto3
import ipaddress
import socket
import base64
import zlib
import datetime
@jimsmith
jimsmith / PY0101EN-1-1-Types.ipynb
Created November 13, 2019 08:30 — forked from meodihia/PY0101EN-1-1-Types.ipynb
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jimsmith
jimsmith / add_cloudflare_ips.sh
Created November 13, 2019 08:21 — forked from mr-brody/add_cloudflare_ips.sh
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# iterate over the lines in the downloaded file
# make sure to set `--group-id` and `--port`; more details at http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
while read p; do aws ec2 authorize-security-group-ingress --group-id sg-e0000000 --protocol tcp --port 80 --cidr $p; done< ips-v4
@jimsmith
jimsmith / S3_as_Yum_repo.md
Created November 13, 2019 08:20 — forked from mr-brody/S3_as_Yum_repo.md
Use S3 as a Yum repo

S3 as Yum repo

There are two parts to this:

  • Managing access to non-public S3 resources.
  • Building RPM repositories in an automated, deterministic way that Yum can use.

Environment

In general, a CentOS 7 x86_64 box in AWS EC2; in specific, this Packer profile.