in container-code/src/rdslogsshipper.py [0:0]
def checkLastPointer(bucketName, logPointer):
try:
# Check in the s3 bucket for the dbinstance, if there are any files, and when was last file written
lastDownloadDetails = s3Client.get_object(Bucket=bucketName, Key=logPointer)
print ("lastDownloadDetails {}".format(lastDownloadDetails))
# If this file exists, get the last downloaded details.
# Read the S3 file.
loggedTimeStamp = lastDownloadDetails['Body'].read(lastDownloadDetails['ContentLength'])
except ClientError as KeyException:
if KeyException.response['Error']['Code'] == 'NoSuchKey':
print ("No s3 key found")
print ("The DB Instance logs were never downloaded before!. Going to initiate download")
loggedTimeStamp = 0
else:
raise KeyException
return loggedTimeStamp