Skip to main content

All Questions

Tagged with
0 votes
1 answer
40 views

How do you use aws cli --query to filter items using JMESPath functions?

I've been reading the documentation at https://docs.aws.amazon.com/cli/v1/userguide/cli-usage-filter.html and https://jmespath.org/specification.html but it doesn't work. For example, I want to use ...
Bryan Tan's user avatar
  • 361
0 votes
1 answer
72 views

Filtering EC2 instances using JMESPath query

This works: aws ec2 describe-instances \ --region eu-west-1 \ --query Reservations[].Instances[].ImageId [ "ami-0123456789abcdefg", "ami-023456789bcdefghi", "...
Luke's user avatar
  • 23
4 votes
1 answer
774 views

Filtering resources when using resourcegroupstaggingapi CLI

I am trying to find resources in my AWS based on certain tag conditions. I have been using jq to achieve it but is there way of using resourcegroupstaggingapi so they provide a direct way to filter ...
Somethingwhatever's user avatar
0 votes
1 answer
310 views

AWS CLI parse error when listing more than two tags

Why does this command work?: aws ec2 describe-instances \ --profile ike \ --query 'Reservations[].Instances[].[InstanceId,State.Name,InstanceType,PublicIpAddress, Tags[?Key==`Name`]|[0].Value, ...
user avatar
0 votes
2 answers
200 views

sort_by function when using AWS CLI for aws ec2 describe-security-groups

I am trying to compare 2 security groups in AWS that are in 2 different accounts, using aws ec2 describe-security-groups. Even if the security groups are exactly the same, it's impossible for me to ...
Zak25's user avatar
  • 13
2 votes
0 answers
1k views

How can I use a JMESPath query to filter on strings ending with timestamp

How can I use a JMESPath query to filter a property Name which starts with abc, and ends with a timestamp in the format YYYYMMDD-HH, for example: abc-20230913-11. I know how to filter a string using ...
user389955's user avatar
  • 10.5k
0 votes
1 answer
122 views

Unable to access "Tag" attribute value for 'describe-auto-scaling-groups' using AWS CLI JMESPath query command

Purpose - To fetch list of values for "Tags" where 'Key==Project'. Query - For describe-auto-scaling-groups - Trying to access the Tag attributes with 5 array items Tag[5] with each array ...
user16454406's user avatar
-1 votes
1 answer
424 views

AWS CLI JMESPath Query to get details of get-execution-history using --query option

I am trying to execute below cli command to get the execution details of the stepfunction aws stepfunctions get-execution-history --execution-arn <TestArn> --no-paginate --output json --query '...
SwapnilM's user avatar
  • 197
1 vote
1 answer
699 views

How to filter for multiple identifier values in AWS CLI

When filtering multiple identifier values in the AWS CLI, the results are the same with or without a period. Is the period optional? The official references does not mention that it can be omitted. ...
uidy4dkk's user avatar
1 vote
0 answers
655 views

JMESPath to create a dictionary (map) out of Tags key and value pairs from AWS CLI output

I am trying to extract a few properties of AWS EC2 instance using JMESPath. I just started learning JMESPath using this useful guide. But because my knowledge is limited, I was only able to get the ...
user1330974's user avatar
  • 2,616
0 votes
1 answer
597 views

How to find all the instances that were not successful in a "Systems Manager" run command?

I ran the AWS-RunPatchBaseline run command and few of my instance are successful and few of them are timed out. I want to filter the instance that were timed out using the aws cli list-command-...
Shunmugam A's user avatar
1 vote
1 answer
631 views

Can you print the values of a JSON array in an AWS, using a JMESPath query?

I am trying to list all the SQS queues in our account using aws sqs list-queues into a bash one-item-per-line output. Problem is it comes through as a JSON object { "QueueUrls": [ &...
WesAtWork's user avatar
  • 467
2 votes
2 answers
1k views

How to select an element in an array based on two conditions in JMESPath?

I'm trying to select the SerialNumber of a specific AWS MFADevice for different profiles. This command returns the list of MFADevices for a certain profile: aws iam list-mfa-devices --profile xxx and ...
David's user avatar
  • 155
0 votes
1 answer
1k views

select part of AWS CLI query output

I want to return only the current AWS username using AWS CLI. I'm on Windows 11. I think there's a way to do it using a regex but I can't figure out how. I think I need to use a pipe along with a ...
mdailey77's user avatar
  • 2,481
1 vote
1 answer
1k views

JMESPath query with boolean values?

I'm trying to develop the expression to query Route53 and pull out the ID of our private zone. Problem is the query string returns an empty array. Base data below — running aws route53 list-hosted-...
OPP's user avatar
  • 53

15 30 50 per page
1
2 3 4 5