Interview Prep/AWS/Rapid-Fire AWS CLI

How do you tail CloudWatch logs and run a Logs Insights query from the CLI?

BeginnerProductionRapid-Fire AWS CLI
Answer
aws logs tail /ecs/orders-api --follow --since 15m --filter-pattern ERROR
QID=$(aws logs start-query --log-group-name /ecs/orders-api \
  --start-time $(date -d '-1 hour' +%s) --end-time $(date +%s) \
  --query-string 'fields @timestamp, @message | filter @message like /ERROR/ | stats count() by bin(5m)' \
  --query queryId --output text)
aws logs get-query-results --query-id $QID
aws All AWS questions

More on Rapid-Fire AWS CLI