Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

358
Views
AWS Object Tagging using x-amz-tagging request header

I'm uploading the contents of a file to s3 using the Put Object endpoint and attempting to use the x-amz-tagging request header.

See documentation here: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html.

As in example 6 in the link above:

Example 6: Upload an Object and Specify Tags

In this upload object request, you specify the optional x-amz-taggging header to add tags to the object.

Copy PUT /example-object HTTP/1.1 Host: example-bucket.s3.amazonaws.com Accept: /
Authorization:authorization string Date: Thu, 22 Sep 2016 21:58:13 GMT x-amz-tagging: tag1=value1&tag2=value2

[... bytes of object data]

I generate a base string like so used to generate the authorization string:

String baseString = "PUT\n\ntext/plain\n" 
    + currentDate + "\n" 
    + "x-amz-tagging:tag1=value1&tag2=value2" + "\n" 
    + "/" + LOG_BUCKET_NAME + THE_REST_OF_THE_URL;

Then build my request like so:

request.setRawHeader("Date", currentDate);
request.setRawHeader("Authorization", authorizationString);
request.setRawHeader("x-amz-tagging", "tag1=value&tag2=value2);

I get a forbidden error every time but adding metadata works perfectly:

Base string:

String baseString = "PUT\n\ntext/plain\n" 
    + currentDate + "\n" 
    + "x-amz-meta-reviewedby:my_email@domain.com" + "\n" 
    + "/" + LOG_BUCKET_NAME + THE_REST_OF_THE_URL;

And then:

request.setRawHeader("Date", currentDate);
request.setRawHeader("Authorization", authorizationString);
request.setRawHeader("X-Amz-Meta-ReviewedBy", "my_email@domain.com");

Is there perhaps additional user permissions required for adding tags?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It was in fact a permissions issue. The fix involved enabling user permissions for Object Tagging.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!