Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set metadata on S3 objects #356

Closed
garnaat opened this issue Sep 16, 2013 · 10 comments · Fixed by boto/botocore#274
Closed

Unable to set metadata on S3 objects #356

garnaat opened this issue Sep 16, 2013 · 10 comments · Fixed by boto/botocore#274
Labels
bug This issue is a bug.

Comments

@garnaat
Copy link
Contributor

garnaat commented Sep 16, 2013

Setting metadata when putting a new object with the low-level s3api command, fails. Trying to do so using the shorthand syntax results in:

'StringParameter' object has no attribute 'enum' 

and trying to use the JSON syntax gives:

AttributeError: 'dict' object has no attribute 'strip'
@ghost ghost assigned garnaat Sep 16, 2013
@garnaat
Copy link
Contributor Author

garnaat commented Sep 19, 2013

This has been fixed in the latest release.

@garnaat garnaat closed this as completed Sep 19, 2013
@ghost ghost assigned toastdriven Sep 30, 2013
@timvisher
Copy link

I'm using aws-cli/1.2.4 Python/2.7.3 Linux/2.6.18-308.1.1.el5xen

and

$ aws s3api copy-object \
   --copy-source bucket/logo.svg \
   --metadata "Content-Type=image/svg+xml" \
   --bucket bucket \
   --key logo.svg
'StringParameter' object has no attribute 'enum'
$ aws s3api copy-object \
   --copy-source bucket/logo.svg \
   --metadata '{"Content-Type":"image/svg+xml"}' \
   --bucket bucket \
   --key logo.svg
'dict' object has no attribute 'strip'

?

@garnaat
Copy link
Contributor Author

garnaat commented Nov 12, 2013

There is a specific option for setting content-type, so I would use this:

aws s3api copy-object --content-type "image/xvg+xml"

As for the metadata issue, there does seem to be an issue there. Looking into it now. Thanks for reporting.

@tader
Copy link

tader commented Feb 26, 2014

I have just tried version 1.2.13 and in this version it still does not work.

@Chili-Man
Copy link

I can confirm that this issue still exists as well in 1.2.13. If I try to upload with metadata in the shorthand form, I get this:
aws s3api put-object --acl private --bucket some-bucket --key some-key --body some-object.sh --metadata sha256sum=4c8b8f62b3c7537aebac8587ae006698124a6f9db85e670e4ef8f056ae89e243

'OrderedDict' object has no attribute 'strip'

Or if I try the JSON form:

aws s3api put-object --acl private --bucket og-deployments --key s3deploy.sh --body s3deploy.sh --metadata '{"sha256sum":"4c8b8f62b3c7537aebac8587ae006698124a6f9db85e670e4ef8f056ae89e243"}'

'OrderedDict' object has no attribute 'strip'

@andy3rdworld
Copy link

@tader, @garnaat 's switch-based method works, and this also handles, e.g. --content-encoding, etc. as you would normally set in --metadata.

I also get error using --metadata switch (ordereddict...).

@drewr
Copy link

drewr commented Mar 24, 2014

Seeing this with pip-installed 1.3.2.

% aws s3api put-object --acl public-read --metadata x-amz-meta-runtime=45:56 --body foo.mp3 --bucket media.example.com --key foo.mp3
'OrderedDict' object has no attribute 'strip'

@rmatt
Copy link

rmatt commented Nov 1, 2014

Is there any way to do this with 'aws s3 cp'? My scenario is a bit difficult. I'd like to use 's3api put-object' but it doesn't handle multi-part for large file upload (> 1TB). As a result I need to use 's3 cp', but that doesn't appear to have a way to insert metadata.

A second question -- I'd also like to insert multiple key-value pairs. Do you specify these in any particular list form using aws-cli?

Great product so far -- thanks for the development effort!

@tim-kos
Copy link

tim-kos commented Oct 6, 2015

+1 for @rmatt to add the ability to insert meta data with aws s3 cp. We need this, too. What is the status on this?

@timvisher
Copy link

@rmatt @tim-kos Given that the OP was regarding the s3api subcommand, it might be best to open a new issue if you're looking to add support for arbitrary metadata to s3 cp.

The way I've done this in the past is to s3 cp the file to a staging bucket/key and then s3api copy-object it from there to where it should actually go with the correct metadata, and then s3 rm the temporary object. It's a little more work than a single cp operation but ¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants