aws / aws/aws-cli

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

Open
#9,183 1 comment 0 reactions 1 assignee Claimed by @RyanFitzSimmonsAK View on GitHub
bug documentation p2 s3api service-api
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

When using `aws s3api get-object-attributes` with `--object-attributes ""` 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:

```json
{
"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:
```bash
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.