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

S3 glacier restore status missing from metadata #361

Closed
1 task
ukdocCT opened this issue Oct 15, 2024 · 5 comments
Closed
1 task

S3 glacier restore status missing from metadata #361

ukdocCT opened this issue Oct 15, 2024 · 5 comments
Labels
bug This issue is a bug. closed-for-staleness module/powershell-cmdlets p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@ukdocCT
Copy link

ukdocCT commented Oct 15, 2024

Describe the bug

I recently restore a large number of files in one of our S3 buckets.
In the web console i can see that some are restored (the batch job is still running).
However i am unable to find that status using powershell. I can get the header metadata using aws s3api head-object which returns a Restore object (eg Restore : ongoing-request="false", expiry-date="Mon, 13 Jan 2025 00:00:00 GMT").
However, when using get-s3objectmetadata it does not return all the data that aws s3api head-object returns.

Regression Issue

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

Expected Behavior

Get-S3ObjectMetadata should return the same metadata that aws s3api head-object does.

Current Behavior

aws s3api head-object --bucket "_<bucket>_" --key "_<key>_" --output json
{
    "AcceptRanges": "bytes",
    "LastModified": "2018-07-27T11:16:03+00:00",
    "ContentLength": 5630,
    "ETag": "\"_<tag>_\"",
    "VersionId": "_<VersionId>_",
    "ContentType": "application/octet-stream",
    "Metadata": {
        "mode": "33188",
        "gid": "1011",
        "uid": "1007",
        "mtime": "1532690162"
    }
}

get-s3objectmetadata -bucket "_<bucket>_" -key "_<key>_"
ExpiresString                                 :
Headers                                       : Amazon.S3.Model.HeadersCollection
Metadata                                      : Amazon.S3.Model.MetadataCollection
DeleteMarker                                  :
AcceptRanges                                  : bytes
ContentRange                                  :
Expiration                                    :
RestoreExpiration                             : 13/01/2025 00:00:00
RestoreInProgress                             : False
LastModified                                  : 01/04/2014 09:26:26
ETag                                          : "_<eTag>_"
MissingMeta                                   : 0
VersionId                                     :
WebsiteRedirectLocation                       :
ServerSideEncryptionMethod                    :
ServerSideEncryptionCustomerMethod            :
ServerSideEncryptionKeyManagementServiceKeyId :
ReplicationStatus                             :
ArchiveStatus                                 :
PartsCount                                    :
ObjectLockLegalHoldStatus                     :
ObjectLockMode                                :
ObjectLockRetainUntilDate                     : 01/01/0001 00:00:00
StorageClass                                  : GLACIER
RequestCharged                                :
BucketKeyEnabled                              : False
ChecksumCRC32                                 :
ChecksumCRC32C                                :
ChecksumSHA1                                  :
ChecksumSHA256                                :

Reproduction Steps

aws s3api head-object --bucket "_<bucket>_" --key "_<key>_" --output json
{
    "AcceptRanges": "bytes",
    "LastModified": "2018-07-27T11:16:03+00:00",
    "ContentLength": 5630,
    "ETag": "\"_<tag>_\"",
    "VersionId": "_<VersionId>_",
    "ContentType": "application/octet-stream",
    "Metadata": {
        "mode": "33188",
        "gid": "1011",
        "uid": "1007",
        "mtime": "1532690162"
    }
}

get-s3objectmetadata -bucket "_<bucket>_" -key "_<key>_"
ExpiresString                                 :
Headers                                       : Amazon.S3.Model.HeadersCollection
Metadata                                      : Amazon.S3.Model.MetadataCollection
DeleteMarker                                  :
AcceptRanges                                  : bytes
ContentRange                                  :
Expiration                                    :
RestoreExpiration                             : 13/01/2025 00:00:00
RestoreInProgress                             : False
LastModified                                  : 01/04/2014 09:26:26
ETag                                          : "_<eTag>_"
MissingMeta                                   : 0
VersionId                                     :
WebsiteRedirectLocation                       :
ServerSideEncryptionMethod                    :
ServerSideEncryptionCustomerMethod            :
ServerSideEncryptionKeyManagementServiceKeyId :
ReplicationStatus                             :
ArchiveStatus                                 :
PartsCount                                    :
ObjectLockLegalHoldStatus                     :
ObjectLockMode                                :
ObjectLockRetainUntilDate                     : 01/01/0001 00:00:00
StorageClass                                  : GLACIER
RequestCharged                                :
BucketKeyEnabled                              : False
ChecksumCRC32                                 :
ChecksumCRC32C                                :
ChecksumSHA1                                  :
ChecksumSHA256                                :`

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS Tools for PowerShell version used

AWS.Tools.S3 v4.1.461

### PowerShell version used

Name Value


PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0


### Operating System and version

Windows 10 22H2 10.0.19045 patched to Oct 2024
@ukdocCT ukdocCT added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 15, 2024
@bhoradc bhoradc added module/powershell-cmdlets p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Oct 15, 2024
@bhoradc bhoradc self-assigned this Oct 15, 2024
@ashishdhingra ashishdhingra added the needs-reproduction This issue needs reproduction. label Oct 15, 2024
@bhoradc
Copy link

bhoradc commented Oct 24, 2024

Hi @ukdocCT,

Thanks for reporting the issue. The S3 glacier restoration process related metadata which is available on aws s3api head-object call is also available with get-s3objectmetadata PowerShell cmdlet - RestoreExpiration, RestoreInProgress, StorageClass.

Are you looking for any specific metadata in this case? I can see that the HeadersCollection and MetadataCollection objects are available in Powershell and in .NET SDK as well.

I will review this further with the team to investigate it.

Regards,
Chaitanya

@bhoradc bhoradc added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. needs-review and removed needs-reproduction This issue needs reproduction. labels Oct 24, 2024
@bhoradc bhoradc removed their assignment Oct 25, 2024
Copy link

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 30, 2024
@bhoradc bhoradc added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 30, 2024
Copy link

github-actions bot commented Nov 4, 2024

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Nov 4, 2024
@bhoradc bhoradc removed closing-soon This issue will automatically close in 4 days unless further comments are made. needs-review labels Nov 4, 2024
@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 5, 2024
@bhoradc
Copy link

bhoradc commented Nov 5, 2024

Hi @ukdocCT,

To retrieve the custom metadata associated with an S3 object, you can use the following PowerShell command:

$metadata = Get-S3ObjectMetadata -BucketName <<bucket_name>> -Key <<key_name>>'
$customMetadata = $metadata.Metadata

$customMetadata.Keys | ForEach-Object {
    $key = $_
    $value = $customMetadata[$key]
    Write-Output "Key: $key, Value: $value"
}

This command will output the custom metadata key-value pairs associated with the specified S3 object. For example:

Key: x-amz-meta-mode, Value: 33188
Key: x-amz-meta-gid, Value: 1011
Key: x-amz-meta-uid, Value: 1007
Key: x-amz-meta-mtime, Value: 1532690162

As I mentioned earlier, the Get-S3ObjectMetadata cmdlet also retrieves metadata related to the S3 Glacier restoration process, such as RestoreExpiration, RestoreInProgress, and StorageClass. These properties are available in the cmdlet's output, similar to the aws s3api head-object command.

If you require any specific glacier restoration-related metadata that is not present in the current output, please let us know, and we can look into it further.

Regards,
Chaitanya

@bhoradc bhoradc added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 5, 2024
Copy link

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 11, 2024
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. closed-for-staleness module/powershell-cmdlets p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants