Skip to content

Commit

Permalink
tighten up instance name matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Steinberg committed Oct 8, 2022
1 parent 2a99059 commit 41164e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bash/aws_functions
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function hostname_from_instance() {

function instance_id_from_name() {
name=$1 ; shift
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`] | [0].Value,InstanceId]' --output text | grep $name | awk '{print $2}'
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`] | [0].Value,InstanceId]' --output text | grep -E "^${name}\s+" | awk '{print $2}'
}

function ip_from_instance() {
Expand Down

0 comments on commit 41164e3

Please sign in to comment.