<jupyter_start><jupyter_text>AWS - Upload file to S3 bucket<jupyter_code>#! pip install boto3 getpass4
import boto3

ACCESS_KEY_ID = "**********"
SECRET_ACCESS_KEY = "**********"

BUCKET_NAME = "naas-example"
BUCKET_OBJECT_KEY = 'naas_happy_hour.mp3'
s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY_ID, aws_secret_access_key=SECRET_ACCESS_KEY)
with open('naas_happy_hour.mp3', "rb") as f:
    s3.upload_fileobj(f, BUCKET_NAME, BUCKET_OBJECT_KEY)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14791666666666667, 'fraction_numerical': 0.020833333333333332, 'mean_word_length': 8.62, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '122248', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 207, 'n_tokens_neox': 209, 'n_words': 30, 'path': 'AWS/ AWS_Upload_file_to_S3_bucket.ipynb', 'repo_name': 'haresh121/awesome-notebooks', 'size': '480'}