database operation and s3 implementation