Boto3 file upload to S3

Image for post
Image for post

There is a programatic way to upload files into s3 bucket in aws

the package boto3 is a python library where you can use to upload your files in the backend

In this we can see which are the necessary steps to upload a simple file into the s3 bucket

this would be a very basic starting point to navigate into a large library

first we need to see if we can connect to the s3 bucket

fileName: botothree.py

Output:-

Image for post
Image for post

This is a simple python script which shows wether the connection has been established and the buckets name can be fetched

after you have completed that we can now move onto a slightly more complex example of creating a flask app and uploading a file to the s3 bucket

this following code will create a flask app to upload and save a file into the s3 bucket

fileName:index.html

output:-

Image for post
Image for post
Image for post
Image for post

this is just to get you started in boto3 and there is so much more to come

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store