Skip to content

Instantly share code, notes, and snippets.

@djenriquez
djenriquez / find_aws_public_ip_ranges_by_region
Last active July 10, 2018 21:00
Find AWS public IP ranges by region
#!/usr/local/bin/python3
import argparse
import json
import requests
"""
IPRangeFinder will fetch the ip-ranges file from AWS
and parse it to find the public IP addresses registered
to a region. This is useful when searching for the range
of public IP addresses that can be allocated to your AWS
@djenriquez
djenriquez / kafka-dos-fix_amzn_linux.sh
Last active July 5, 2018 23:04
RSyslog-OMKafka DoS Fix (AMZN Linux)
#!/bin/bash
# On Amazon Linux
mkdir -p /tmp/rsyslog-fix && cd /tmp/rsyslog-fix
git clone https://github.com/edenhill/librdkafka.git
# Install Libredkafka
cd librdkafka && . configure
make
sudo make install
@djenriquez
djenriquez / ECS-Container-Autoscale.js
Last active October 10, 2016 09:34
AWS ECS Container Autoscale Lambda function: Create a CloudWatch CPU metric for high and low alarms. Create SNS topics to trigger from each alarm. Subscribe the lambda function to the SNS topics. Let magic happen.
console.log('Loading event');
//Import AWS-SDK
var AWS = require('aws-sdk');
//Fetch the assigned cpu requirements for a task definition
var fetchRequiredCPU = function(taskDefinitionData)
{
var cpu = taskDefinitionData.taskDefinition.containerDefinitions[0].cpu;
return cpu;
};