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 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 |
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
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' |
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.
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
#!/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; |
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 simplejson as json | |
import sys | |
#{ | |
# "results": 91, | |
# "rows": [ | |
# { | |
# "ec2": { | |
# "instance_action": "none", | |
# "instance_id": "i-f9069c96", |
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 | |
# -*- 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: |
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 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 |
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 python | |
import boto3 | |
import argparse | |
def lookup_by_id(sgid): | |
sg = ec2.get_all_security_groups(group_ids=sgid) | |
return sg[0].name | |