2

I'm having a bit of an issue when it comes to Amazon Glacier.

I typed in the command

aws glacier initiate-multipart-upload \
    --account-id - \
    --archive-description "Qozu Chronicles May 2023 Backup" \
    --part-size 4294967296 \
    --vault-name tyllavideo

and got the following result:

{
    "location": "/953374234641/vaults/tyllavideo/multipart-uploads/-BbO80kesvItrSPcGdZrfhco87xzs1oPdWG4r1WW7lJ1aTjElIICKthnMnkFuFjej8k4kWvJvaOQFNXGufCfYNKKSuiW",
    "uploadId": "-BbO80kesvItrSPcGdZrfhco87xzs1oPdWG4r1WW7lJ1aTjElIICKthnMnkFuFjej8k4kWvJvaOQFNXGufCfYNKKSuiW"
}

Note that the uploadId starts with a -. This becomes a problem when I want to upload a part, as when I run the command

aws glacier upload-multipart-part \
    --upload-id -BbO80kesvItrSPcGdZrfhco87xzs1oPdWG4r1WW7lJ1aTjElIICKthnMnkFuFjej8k4kWvJvaOQFNXGufCfYNKKSuiW \
    --body chunkaa \
    --range 'bytes 0-6717640/*' \
    --account-id - \
    --vault-name tyllavideo

I get this error:

aws: error: argument --upload-id: expected one argument

I tried enclosing the uploadId in quotes, and I tried using a \ to escape the -. Both gave the same error. What am I doing wrong, and how do I get the upload started?

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
Tyll'a
  • 223
  • 2
  • 9
  • did you try single quotes the same way `--range` is handled? Not sure what you are using aws cli in, but you can store the uploadId as a variable and then pass it in. In powershell - `$uploadId="-Bb08...."` then `aws glacier..... --upload-id $uploadId` – Narzard May 24 '23 at 02:39
  • @Narzard single quotes did not work, and I am using Bash on a Linux machine. – Tyll'a May 24 '23 at 02:45
  • https://github.com/aws/aws-cli/issues/1550#issuecomment-146488782 – Kamil Maciorowski May 24 '23 at 03:13
  • @KamilMaciorowski unfortunately that just gives me a different error: ```An error occurred (ResourceNotFoundException) when calling the UploadMultipartPart operation: The upload ID was not found: <-BbO80kesvItrSPcGdZrfhco87xzs1oPdWG4r1WW7lJ1aTjElIICKthnMnkFuFjej8k4kWvJvaOQFNXGufCfYNKKSuiW>``` – Tyll'a May 24 '23 at 04:54
  • I don't think `<` and `>` are meant to be literal. Or did you try `--upload-id='-Bb…'`? – Kamil Maciorowski May 24 '23 at 04:57
  • @KamilMaciorowski Yes, I tried the single quotes both with and without the `<` and `>`. Without, it gave the same error from my original question. With, it gave the error I @'d you about earlier. – Tyll'a May 24 '23 at 05:35
  • The single-quotes are least important. `=` is most important. Doesn't help, oh well. – Kamil Maciorowski May 24 '23 at 05:40

1 Answers1

2

This problem is mentioned in the bug report
aws glacier fails to work with archiveID's which start with a hyphen (-) #1319 .

This post relates to archiveId, but the suggested syntax will probably also work for uploadId instead.

The suggested workarounds all use methods for avoiding specifying directly the uploadId in the command.

Workaround 1 : Using the JSON parameter input method instead of the normal command-line inputs:

aws glacier delete-archive --account-id - --vault-name myvault --cli-input-json '{"archiveId": "-test"}'

Workaround 2 : Use the argument syntax name='value':

aws glacier delete-archive --account-id '-' --vault-name myvault --archive-id='-test'
harrymc
  • 455,459
  • 31
  • 526
  • 924