aws-cli

How can I get list of only running instances when using ec2-describe-tags

a 夏天 提交于 2020-12-29 04:58:17
问题 How can I get list of only running instances when using ec2-describe-tags . I am using my command like this: ec2-describe-tags --filter "resource-type=instance" --filter "value=somevalue" --filter "key=key" 回答1: It is easy using the aws-cli: aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId]' --filters Name=instance-state-name,Values=running --output text 回答2: Expanding on John Rotenstein's answer you can definitely do this with describe-instances. This will list

How to turn off the pager for AWS CLI return value?

巧了我就是萌 提交于 2020-12-02 05:55:07
问题 I am attempting to utilize the AWS CLI along with a for loop in bash to iteratively purge multiple SQS message queues. The bash script works almost as intended, the problem I am having is with the return value each time the AWS CLI sends a request. When the request is successful, it returns an empty value and opens up an interactive pager in the command line. I then have to manually type q to exit the interactive screen and allow the for loop to continue to the next iteration. This becomes