NEW: Script to report s3 deep archive restore status
This commit is contained in:
@@ -10,11 +10,6 @@ S3 head_object API.
|
|||||||
The script is useful for monitoring the progress of S3 batch restore operations
|
The script is useful for monitoring the progress of S3 batch restore operations
|
||||||
or checking the status of individual object restorations from Glacier storage.
|
or checking the status of individual object restorations from Glacier storage.
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- boto3: AWS SDK for Python
|
|
||||||
- AWS credentials configured (via ~/.aws/credentials, environment variables, or IAM role)
|
|
||||||
- Proper IAM permissions to read object metadata (s3:GetObject, s3:ListBucket)
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
# Normal mode (debug output with filenames):
|
# Normal mode (debug output with filenames):
|
||||||
python3 s3-restore-status.py
|
python3 s3-restore-status.py
|
||||||
@@ -38,11 +33,6 @@ Output:
|
|||||||
- Restore status with expiry date (e.g., 'ongoing-request="false", expiry-date="..."')
|
- Restore status with expiry date (e.g., 'ongoing-request="false", expiry-date="..."')
|
||||||
if restoration is complete
|
if restoration is complete
|
||||||
|
|
||||||
In normal mode (when Python is run without -O optimization flag), output includes
|
|
||||||
the filename: <filename>: <restore_status>
|
|
||||||
|
|
||||||
In optimized mode (python3 -O), only the restore status is printed.
|
|
||||||
|
|
||||||
Example Output:
|
Example Output:
|
||||||
Not-being-restored
|
Not-being-restored
|
||||||
ongoing-request="true"
|
ongoing-request="true"
|
||||||
@@ -106,13 +96,9 @@ def main():
|
|||||||
for each object to stdout.
|
for each object to stdout.
|
||||||
|
|
||||||
The restore status indicates:
|
The restore status indicates:
|
||||||
- "Not restoring": Object is not currently being restored (or restore completed and expired)
|
- "Not-being-restored": Object is not currently being restored (or restore completed and expired)
|
||||||
- Restore status string: Contains restore progress and expiry information
|
- Restore status string: Contains restore progress and expiry information
|
||||||
|
|
||||||
In debug mode (Python run without -O optimization flag), output includes
|
|
||||||
the filename along with the status for easier identification.
|
|
||||||
|
|
||||||
Region: ap-east-1 (Asia Pacific - Hong Kong)
|
|
||||||
"""
|
"""
|
||||||
session = boto3.Session(region_name="ap-east-1")
|
session = boto3.Session(region_name="ap-east-1")
|
||||||
s3_client = session.client('s3')
|
s3_client = session.client('s3')
|
||||||
|
|||||||
Reference in New Issue
Block a user