import boto3 # Create an S3 client s3 = boto3.client('s3') # Set the name of the S3 bucket and the file key bucket_name = 'my-bucket' file_key = 'path/to/file.txt' # Use the S3 client to get the object response = s3.get_object(Bucket=bucket_name, Key=file_key) # Extract the file content from the response file_content = response['Body'].read() # Print the file content print(file_content)