Create Athena DB and table and run queries on AWS Classic Load Balancer logs.
This file contains 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 bash | |
# shellcheck disable=all | |
exit # don't run this, cat it instead | |
# git clone https://gist.github.com/38b154892c42ce7dde2f42c1eaf65706.git | |
curl -fsSL https://gist.githubusercontent.com/huevos-y-bacon/38b154892c42ce7dde2f42c1eaf65706/raw/c315a7d244f40a85c6f0d10cd78782b83f74e739/steampipe_commands.sh | |
# INSTALL STEAMPIPE AND PLUGINS, configure for eu-west-1 | |
sudo /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/turbot/steampipe/main/install.sh)" |
This file contains 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 bash | |
# Simple script to convert tab separated files to CSV | |
# E.g. DNS Zone files | |
if [ "$1" != "" ]; then | |
# File name might contain spaces | |
IFS=$'\n' | |
ZONE_FILES=("$1") | |
else ZONE_FILES=( |
This file contains 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 | |
# shellcheck disable=SC2086 | |
# This is the same as "set -eux" but also exits on pipefail. | |
# Also see https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425?permalink_comment_id=3935570#set--e--u--x--o-pipefail | |
set -euo pipefail | |
ROOT=$(aws organizations list-roots | jq -r '.Roots[0].Id') | |
# Function to list accounts and organizational units at a given depth |
This file contains 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 bash | |
[[ ! "$(uname -s)" == "Darwin" ]] && NOCOLOR=1 # Disable color output if not macOS | |
mkdir -p "${HOME}"/.terraform.d/plugin-cache # Create local plugin cache folder if not exists | |
ecco(){ | |
if [[ -n "${NOCOLOR}" ]]; then echo -e "${*}" | |
else | |
echo -e "\033[0;1;3;32m${*}\033[0m" # echo green bold and italics | |
fi | |
} |
This file contains 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
# CloudTrail events: By Service / Role / principalId / etc | |
fields | |
eventTime | |
,eventName | |
,eventSource | |
,errorCode | |
,errorMessage | |
,userIdentity.principalId as principalId | |
,userIdentity.sessionContext.sessionIssuer.userName as SESSIONUSERID | |
,@message |
This file contains 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 bash | |
set -e | |
# See: | |
# - https://docs.commonfate.io/granted/getting-started/ | |
# - https://docs.commonfate.io/granted/usage/automatic-config-generation | |
# Remember to update MY_ORG_NAME! | |
SSO_URL=https://MY_ORG_NAME.awsapps.com/start/ | |
SSO_ORG=$(echo $SSO_URL | awk -F. '{print $1}' | awk -F/ '{print $NF}') |
This file contains 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 bash | |
# CONVERT ALL MP3 FILES IN CURRENT DIRECTORY TO MP4 FILES WITH IMAGE AS BACKGROUND. | |
# See https://www.bannerbear.com/blog/how-to-convert-audio-to-video-for-youtube-upload-using-ffmpeg/#convert-mp3-to-mp4-with-an-image | |
# (Tested on MacOS) | |
ext=mp3 | |
image=image.jpg | |
mkdir -p mp4 log |
This file contains 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
AWS_ARGS:=--profile $(AWS_PROFILE) --region $(AWS_REGION) | |
STACK_NAME:=some-infra | |
TEMPLATE_FILE:=some-infra.yaml | |
OWNER:="My Team" | |
CFN_TAGS:=--tags \ | |
Key=Owner,Value='$(OWNER)' \ | |
Key=DeployedBy,Value=CloudFormation |
This file contains 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 bash | |
# shellcheck disable=SC2086 | |
ssm_sm(){ | |
[[ -n $DEBUG ]] && set -x | |
ARG1="$1" | |
get_name(){ | |
INSTANCENAME=$(aws ec2 describe-tags \ | |
--filters \ |