1

I'm trying to issue an aws s3api put-object command with all arguments specified via the --cli-input-json document, which in this case looks like so:

{
  "Body": "this is the part giving me trouble",
  "Bucket": "my-bucket",
  "Key": "my-key"
}

For the Body property, I can't figure out how to specify a file (on the local system) to put to S3. I've tried both:

  • "Body": "the_filepath"
  • "Body": "file://the_filepath"

... but neither work (both result in an Invalid base64 error).

I know I can add the file to the command line call via --body file://the_filepath, but I'm trying to put all command args into the JSON document. I'm also trying to avoid reading in the contents of the object by the controlling script.

I'm stumped and I can't seem to find AWS CLI documentation on this use case.

mmuurr
  • 1,310
  • 1
  • 11
  • 21
  • 1
    You can't, body is always used as is as the body of the newly created object, it's not parsed to look for a filename, or any other use. – Anon Coward Jul 31 '22 at 22:52

0 Answers0