Skip to content

aws s3api get-object-attributes showing whats not supposed to show when using --object-attributes flag #9183

Open
@thiagomarafeli

Description

Describe the bug

When using aws s3api get-object-attributes with --object-attributes "<something>" flag, it is returning a date that stands for LastModified, even when there is nothing to be returned for my option.

In the aws s3api get-object-attributes help command, the option --object-attributes says:

"Specifies the fields at the root level that you want returned in the response. Fields that you do not specify are not returned."
But, it always shows that timestamp, although it says Fields that you do not specify are not returned.

I believe that either that must be more clear on the documentation or this behavior should be removed.
Being clearer in the docs helps knowing what to expect from the response (output) and use it to do other stuff with it.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I expect to show only what I asked.

Current Behavior

The output shows the LastModified timestamp, as shown below using aws s3api get-object-attributes --bucket "mybucket" --key "my/path" --object-attributes "StorageClass" "ObjectSize" command as example:

{
    "LastModified": "2025-01-03T23:51:28+00:00",
    "StorageClass": "STANDARD",
    "ObjectSize": 21484232
}

Reproduction Steps

  1. Create a dummy file
  2. Upload it to a AWS S3 bucket with standard configuration
  3. Retrieve its attributes using the command:
aws s3api get-object-attributes --bucket "mybucket" --key "my/path" --object-attributes "StorageClass" "ObjectSize"

Possible Solution

Either:

  • Explicit this behavior on its manual
  • Remove this behavior (which, I believe, is more problematic)

Additional Information/Context

No response

CLI version used

aws-cli/2.22.28 Python/3.12.6 Linux/6.8.0-50-generic exe/x86_64.ubuntu.22

Environment details (OS name and version, etc.)

Ubuntu 22.04.5 LTS

Metadata

Labels

bugThis issue is a bug.documentationThis is a problem with documentation.p2This is a standard priority issues3apiservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions