looping through a list of archive id with cli aws describe-job returns null on output

雨燕双飞 提交于 2020-04-17 22:09:26

问题


I have a loop that gets all the ids and checks for the status of the jobs on cli.

jq -r '.JobList |= unique_by(.ArchiveId) | .JobList[] | "\(.JobId)"' jobs.json\
  | while IFS= read -r job_id; do
  job_status=$(aws glacier describe-job --account-id 2222222--vault-name my-vault --job-id $job_id --output json)
  echo $job_status"," >> job-status.json
done

My issue here is that I get the following response everytime it goes past the job_status command

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

If i run this one by one I would get the result and it would append. But once I do a loop through, it would have empty values on the json file.

来源:https://stackoverflow.com/questions/60501032/looping-through-a-list-of-archive-id-with-cli-aws-describe-job-returns-null-on-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!