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 bash | |
# | |
# SSH port forward to EC2 instance via SSM | |
# | |
# Dependencies | |
# | |
# - Bash >=4 | |
# - AWS Credentials | |
# - Valid SSH private key for the target EC2 instance | |
# - [aws-cli](https://aws.amazon.com/cli/) |
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
# VSCode diff with ephemeral working directory and files | |
diffy() ( | |
# shellcheck disable=SC2317 | |
cleanup() { | |
rm -rf "${HOME}/sandbox" | |
} | |
trap cleanup EXIT | |
trap cleanup TERM | |
[ ! -d "${HOME}/sandbox" ] && mkdir "${HOME}/sandbox" |
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 bash | |
# | |
# Auto-configure AWS CLI ~/.aws/config with SSO roles | |
# | |
# | |
set -o nounset -o pipefail | |
# defaults if unset or null | |
: "${default_region:=eu-west-1}" |