Created
July 6, 2021 13:12
-
-
Save akoumjian/d44aeeb8ba91dc1765c79f04f34b1597 to your computer and use it in GitHub Desktop.
How to Tell if an S3 Object in Intelligent Tiering is in an Archive Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
def s3_object_needs_restore(bucket, key): | |
s3_client = boto3.client("s3") | |
head_response = s3_client.head_object(Bucket=bucket, Key=key) | |
""" | |
The Head Response will include an `x-amz-archive-status` value if the object | |
is in INTELLIGENT_TIERING and is currently archived | |
""" | |
if "ArchiveStatus" in head_response: | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment