import boto3 import os import argparse from dotenv import load_dotenv def upload_index_file_to_s3(local_file_path, s3_bucket, s3_key): s3 = boto3.client('s3') if not os.path.exists(local_file_path): raise FileNotFoundError(f"File not found: {local_file_path}") s3.upload_file(local_file_path, s3_bucket, s3_key) if __name__ == "__main__": parser = argparse.ArgumentParser( description="Upload index file to S3." ) parser.add_argument( "--local_file_path", type=str, required=True, help="Path to the local file to upload." ) parser.add_argument( "--s3_bucket", type=str, required=True, help="S3 bucket name." ) parser.add_argument( "--s3_key", type=str, required=True, help="S3 key." ) args = parser.parse_args() load_dotenv() upload_index_file_to_s3(args.local_file_path, args.s3_bucket, args.s3_key)