-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] What are the aliases used in The Effective AWS CLI User
?
#7
Comments
I want to add these to the repository. I just need to clean them up a bit before adding them. For the authorize-my-ip =
!f() {
my_cidr=<INSERT_CIDR_BLOCK_HERE>
aws ec2 authorize-security-group-ingress --group-id "${1}" \
--port 22 --protocol tcp --cidr "$my_cidr"
}; f
connect-ssh =
!f() {
instance_output=$(aws ec2 describe-instances \
--instance-ids "${1}" \
--query Reservations[0].Instances[0])
ssh_key_file=$(jp -u KeyName <<< "$instance_output")".pem"
public_ip=$(jp -u PublicIpAddress <<< "$instance_output")
if ! [ -f "$ssh_key_file" ];
then
echo "Error: Could not locate SSH key: "$ssh_key_file" in current" \
"working direcory"
exit 1
fi
if [ "$public_ip" == "null" ];
then
echo "EC2 Instance: "${1}" does not have a public IP address." \
"Unable to connect with SSH."
exit 1
fi
ssh -i "$ssh_key_file" ec2-user@"$public_ip"
}; f For the first one, I want to convert to a subcommand alias possibly and for the second alias I want to remove the dependency on As to the |
Sounds good. Thanks! |
could you do (to replace jp usage): instance_output=($(aws ec2 describe-instances \
--instance-ids "${1}" \
--query 'Reservations[0].Instances[0].[KeyName,PublicIpAddress] | join(`" "`, @)' | tr -d '"'
))
ssh_key_file=$instance_output[1]".pem"
public_ip=$instance_output[2] |
hey @kyleknap does that combo of |
In the following video (https://www.youtube.com/watch?v=Xc1dHtWa9-Q), there were three aliases that I thought were interesting.
What are the commands backing these aliases?
The text was updated successfully, but these errors were encountered: