0
votes

I want to restore glacier deep archive folder, I do have aws MFA enabled so when I try to run the below command getting the below error:

aws s3api list-objects-v2 --bucket MYBUCKET --query "Contents[?StorageClass=='GLACIER']" --output text | awk '{print substr($0, index($0, $2))}' | awk '{NF-=3};3' > glacier-restore.txt --profile xxx

error : awk: fatal: cannot open file `--profile' for reading (No such file or directory) An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

1

1 Answers

1
votes

The --profile xxx is not an argument of the aws command.

Try:

aws s3api list-objects-v2 --profile xxx --bucket MYBUCKET --query "Contents[?StorageClass=='GLACIER']" --output text | awk '{print substr($0, index($0, $2))}' | awk '{NF-=3};3' > glacier-restore.txt