Skip to content

Instantly share code, notes, and snippets.

@acumenix
acumenix / aws-ssm-ec2-proxy-command.sh
Created February 10, 2020 18:31
AWS SSM SSH Proxy Command
#!/usr/bin/env sh
set -eu -o pipefail
######## Usage #################################################################
#
# #1 Install the AWS CLI
# https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
#
# #2 Install the Session Manager Plugin for the AWS CLI
# https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
function _inspec() {
local curcontext="$curcontext" state line
typeset -A opt_args
local -a _top_level_commands _msccm_commands _scap_commands _secrets_chef_vault_commands _compliance_commands _init_commands _supermarket_commands
_top_level_commands=(
'help:Describe available commands or one specific command'
'json:read all tests in PATH and generate a JSON summary'
'check:verify all tests at the specified PATH'
@acumenix
acumenix / jira_template.md
Created November 6, 2019 08:30 — forked from crittermike/jira_template.md
JIRA ticket template in the 3 C's format (Card, Conversation, and Confirmation)

h2. Card

Also known as the User Story. Explain the requirement in a sentence or two. This should just enough text to identify the requirement, including any crucial information about site/environment.

As a [user role], I want [function], so that [value].

If this doesn't fit as a user story (e.g., a bug ticket), that's fine, just explain it as a concise sentence.

h2. Conversation

@acumenix
acumenix / aws-resource-count-ucsf.sh
Created October 9, 2019 05:55 — forked from pavgup/aws-resource-count-ucsf.sh
Updated RedLock Count Resources (command line argument for credentials profile)
#!/bin/bash
aws_regions=(us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 sa-east-1 eu-west-2 ca-central-1)
echo "Total regions: "${#aws_regions[@]}
ec2_instance_count=0;
rds_instance_count=0;
elb_count=0;
elasticache_count=0;
redshift_count=0;
@acumenix
acumenix / instance.py
Created October 9, 2019 05:54 — forked from alq666/instance.py
Compute the count of instances per zone
import simplejson as json
import sys
#{
# "results": 91,
# "rows": [
# {
# "ec2": {
# "instance_action": "none",
# "instance_id": "i-f9069c96",
@acumenix
acumenix / inventory_vpcs.py
Created October 9, 2019 05:52 — forked from jezhumble/inventory_vpcs.py
List EC2, RDS and ElastiCache instances, grouped by VPC
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse, sys, boto3
from colorama import Fore, Style
def count(my_list, my_key):
if my_key not in my_list:
return '0'
else:
@acumenix
acumenix / security-group-cleanup.py
Created October 8, 2019 20:46 — forked from snixon/security-group-cleanup.py
Fancy Security Group Cleanup
#!/usr/bin/env python
import os
import boto3
import argparse
import json
# `pip install -U PTable` will get you the right fork of PrettyTable
from prettytable import PrettyTable
from botocore.exceptions import ClientError
@acumenix
acumenix / security-group-cleanup.py
Created October 8, 2019 20:45 — forked from TomRyan-321/security-group-cleanup.py
Security Group Cleanup using boto3 with RDS check fixed
#!/usr/bin/env python
import boto3
import argparse
def lookup_by_id(sgid):
sg = ec2.get_all_security_groups(group_ids=sgid)
return sg[0].name