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
# Starts an SSM session in an EC2 instance | |
# | |
# Prerequesites: have the following tools installed: | |
# - awscli | |
# - jq | |
# - session-manager-plugin (https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html) | |
# | |
# Usage: start_ssm_session <instance ID | IP | Name> | |
# Examples: | |
# start_ssm_session i-0041d4a4bd0fdcb2d |
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 ec2 describe-network-interfaces \ | |
--filters Name=status,Values=available \ | |
--query "NetworkInterfaces[*].NetworkInterfaceId" \ | |
| jq --raw-output '.[]' | xargs -I {} aws ec2 delete-network-interface --network-interface-id {} |
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
# To be pasted in ~/.profile | |
vagrant() { | |
if [[ $@ == "halt all" ]]; then | |
command vagrant global-status | grep running | colrm 8 | xargs -L 1 -t vagrant halt | |
else | |
command vagrant "$@" | |
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
# For macOS users | |
# Piece of code to be included in your ~/.profile file. | |
# Typing `vagrant halt all` in your terminal will then halt all the running vagrant VMs. | |
vagrant() { | |
if [[ $@ == "halt all" ]]; then | |
command vagrant global-status | grep running | colrm 8 | xargs -L 1 -t vagrant halt | |
else | |
command vagrant "$@" | |
fi |