AWS Boto3 Python Crash Course with AWS S3 | Getting Started with Boto3 and AWS S3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all right so we have successfully done the configuration and installation of both three python package in our computer we have also done successfully our python installation and anaconda all right so all the configuration and settings has been done and it is tested we have about 3 installed in our computer now our task is to use boto3 to access imagine simple services or simple storage services that is s3 so we have to first get some knowledge of s3 what is this s3 s3 is a simple storage services and s3 stores data or document it's like you can find that it's like amazon s3 is like a folder in your computer and or you can say uh storage device in your computer and then there are many buckets so these buckets are like a folder in your computer all right in in the hard disk so these are the buckets and in this bucket we put a lot of document and let's suppose that you have a two type of document one is image another one is a document that's the pdf file so you can create there a two bucket in one bucket you can keep all the images together and in another bucket you can create where you can put all documents together although you can put all the image and documents in a single bucket as well but to just uh for a simplicity so that we can put image separately and pdf separately you can do these things otherwise you can create a symbol sim simple and single bucket and then you can create a folder inside that bucket like a image image folder and document folder separately so these things you can do by using amazon simple storage services so you can create bucket from here with this console otherwise we can create a bucket with the cli otherwise we can also create a bucket by using this moto 3 python package so here we are going to use this moto 3 python package to create a bucket there all right at this start of this lesson we do not have any bucket here now we are going to create it by using boto3 so we had tested it let's go ahead and make the exit there and do remember here we we are going to do this in a folder so what i'm going to do here i'm going to create here a new folder in this document instead of document i'm going to create here in this google drive all right and there i'm going to create a new folder all right let me create here a new folder and in this folder i'm going to say here boto3 all right boto3 all right so inside this bottom three i'll be doing my programming and coding so let's go ahead open here all right so this bottle three i have to come here with the change directory go to three all right now we are inside this bottom three there you have to open a jupiter notebook all right type their jupiter notebook so this jupiter notebook will create a python coding environment in your browser a default browser where we will be doing our coding all right so let's go ahead and zoom in so that you can see it clearly thereafter click on this new and then python 3 and there you will be able to see this let's go ahead and rename it and i'm going to rename it as boto 3 s3 tutorial all right go to 3 for s3 tutorial in python let's say all right so i got that one thereafter i'm going to rename it and then i'm going to press here m in my keyboard now it is converted into markdown language then i'm gonna convert it one key that's mean one heading is there and then run it all right perfect let's go ahead and do some you know these cells so these are known as a cell all right so there is a cell boto 3 for s3 tutorial in python you can simply do here import boto3 all right so we have imported here boto3 successfully now what we are going to do here we are going to create a bucket in our amazon web services all right so boto3 is imported there now we need to create here a client all right now do remember we have already selected our region so by default region is us east 2 so ua us east 2 region will be used here by default so i can get my s3 client here so i can get it like this one client is equal to go to sorry it's bo23 dot client and there i'm gonna use s3 all right so their client is created and now it is connected with my s3 thereafter i am going to create here a bucket all right so how you can create this bucket this is really simple you can simply do here a client dot create bucket all right so you only unite you need to type their create thereafter hit the tab key in your keyboard you will get here these suggestion so there we have create bucket and if you press yes shift and tab you will get there the information about this client create bucket so it says that create a new bucket to create a bucket you must register with amazon s3 and have a valid aws access key idn to authenticate request so we have already done these things thereafter if you scroll it down you will get lots of information how we can use and what are the ah what are the region where it is available so it is available in u.s east virginia california etc i think it's not available in it it's not available in ou so i don't think we will be able to use it in ohio so i'll show you if we are able to create then it's okay all right so these are the region all right usc 2 is there so i think we can create it not a problem all right so these are the information which you can read in the jupiter notebook all right thereafter create this bucket now we need to give here the name of bucket so there i'm gonna provide here a bucket is equal to bucket name and uh there i'm going to say here the kgp docket this is the bucket name all right thereafter i'm going to simply run it all right let's go ahead and run it then see what happens here all right it says that client error and this client error is happening because of uh the region specified endpoint is uh not available for this bucket so what we can do that's mean s3 bucket is not available in ohio so we have to select here us east one let's go ahead and select that one how you can do that one we have to change our setting if you remember in a location uh in c drive inside the user and inside this kgp talkie we had here aws and there we had this configuration all right so click on this configuration there we have to change our location and this is now going to be us each one all right so we are done with these uh setting now let's go ahead and rerun it once again and see what happens all right so this bucket is successfully created now you can see here a response and it is returning status code of 200 that's when this bucket is created successfully and its location is here root folder and name is kgptoki server is amazon s3 all right you can come here and then repress it once you repress you should see there bucket all right perfect so there is bucket and we have we do not have anything inside this bucket so in the next lesson i'll show you how you can upload and download and then how you can list total items inside amazon s3 bucket by using boto3 python package all right i'll see you next lesson all right so this bucket is created named as a kgp talkie you can check it in your s3 management console there this name is and you can also find out the region where this bucket is created this is created in us east one region and the date when i created it this date you might see here some change with the previous video because i continued this video after a week around so you can see this date changes otherwise moreover everything is same as a previous one there is nothing inside this bucket and if you open this bucket you will see there it's empty bucket there is nothing inside this one so our task is to list any existing bucket which is associated with our account i mean with the account iam account which is created earlier so what you can do to find out the existing buckets uh if you see it with console you can clearly see that there is kgp toki but the way we are doing here we are using a bow to 3 and we are supposing that we do not have access to console so we don't know how many buckets are there so if you don't know how many buckets and you want to get the access of those number of buckets from your command line then you can get those like this we have already created our client if you remember so the previously this client go to three dot client s3 that's mean now we have to do here something like this client is equal to client dot list bucket all right so as you soon you type their list you will see these uh suggestion if you press the tab so we are gonna see here list buckets and with this one you will be getting uh sorry i i'm sorry i just made a mistake here this should not be client is equal to client list so this is this one is actually response all right so it's this would be the response now we have modified this client so we have to recreate this client and to recreate this client i'm gonna just copy it and paste it here all right now this client and this client all right now if you run it then there you see a response and this response says that how many buckets are available currently we have here one bucket named as a kgp talking creation date etc and if you want to get only this bucket you can get here with these with this key information that's mean the buckets and it says that this one is only bucket and it was created at this particular time all right so this is how you can list out the existing buckets which is available in your uh in your s3 and thereafter let's go ahead and see how you can create here how you can upload files inside this bucket now you can see the bucket is not having any document inside this this means this is empty and to upload any files we have to write us some code here all right so one thing i'm gonna show you here i'm gonna show you here let me show you the data all right so what i'm going to do here uh if you see there i have listed out some data like this one so here i have one g file one jpeg file and two jpeg file moreover so i'm gonna show you how you can upload this data to your repository sorry to your s3 management console all right so currently i'm inside this folder 103 folder and this one is jupyter file and allah and based on this jupiter file this is a current directory for this jupyter notebook and then this will be the data folder and inside this data these are the files let's suppose that i want to upload this pandaj jpeg file then how would i upload that on our s3 and to upload this this is simple let me show you inside this how you can upload it all right so the first of all you have to write here uh you have to create here a function so i'm going to write the function name like this one upload underscore files and inside function i'm gonna pass here the file name which i want to upload all right file under score name thereafter i also want to give here the bucket name in which i want to upload it thereafter this object name i'll tell you later what is this object name instead of letter let me tell you right now this file name says that what is the file name on your local computer and this object name says that what will be the file name what will be the file name when you upload that object on your s3 all right so if it is passed as none then the object name will be same as a file name otherwise you can pass here a different name it's like this let's say you have this bandage.jpg file on your local computer something like this one and if you want to change this name something else like pandaj picture dot jpg on your s3 console so you have to pass that particular name in this object name all right now with the object name thereafter one more parameter i'm gonna pass here that is the argument and uh by default these parameter i'm passing here and none that's mean if we don't pass anything in object name and argument so these parameter will be none all right so to understand one thing you can make here a concept something like this one let me tell you something like this so what it says that here this file name all right so this file name is a name of file on your local computer name of file on local computer okay this is not coming so i think i need to give here perhaps sorry you have to give here a three double quote to make it like comment multi-line comments uh multi-line comments thereafter you have here a bucket this bucket is a bucket name on which we are going to upload our file thereafter you have here this uh object underscore name that's mean this is going to be name of file on s3 thereafter finally you have here argument so this one if you want to pass your custom arguments otherwise the policy arguments all right so i'll show you those inside this coding stuff all right so inside this coding stuff what we are going to do the first of all we are going to check if this object name is equal to none all right so you can see something like this if object name is none so in that case i want to put this object name is equal to the file name that's mean a same name which is uh like a file name and then i'm gonna say here how we can upload the file and if you notice here we already have this client all right so we already have client but once again what i'm going to do here now i'm going to simply call our client dot upload file all right so it's something like this we have here a client do we have yes there is client i don't know how it is not coming all right so it's client dot upload file all right so inside this upload file i need to give here the file name which i want to upload thereafter there i'm gonna pass here the bucket name and inside that i'm also gonna pass here the object name thereafter this uh after this these arguments these arguments are extra arguments all right so these these are like extra args is equal to args that's mean argument and then i'm gonna see these in a response is equal to like this one thereafter i'm gonna say here this print this response all right so whenever i upload any file this response will be printed here let us go ahead and run this and execute this method and function now we can give the file name which we want to pass so we have to give here a file name if you notice the file name of this one is inside the data so what i'm going to do here the file name is inside the data and then we have here append dodge dot this jpeg file and i want to upload it inside this kgp talkie bucket let's go ahead and run it now once you run it after a successful message it is saying that a response is equal to none perhaps when response is equal to none that's mean this file should be executed and uploaded here otherwise we might have got their error all right so there you notice pandas is uploaded all right this jpeg file and it just uploaded a few second ago all right superb so this is how you can upload a single file but what will happen if you want to upload all these files together in one time then how would you do that all right so if you want to upload all those files together and to do that i'm going to just delete this one from here so you can delete this one then later i'll show you all right that object file is deleted from there now i'm going to show you how you can upload these files together all those files together all right to do that just a second okay sorry i want to put it here actually so the first of all we have to list all the available object inside that folder so for that we are going to use here globe that's when we have to write here import globe thereafter i'm gonna write here a files is equal to globe it's like this one files is equal to globe dot globe and after that we are gonna pass here the directory in which we want to list all the files inside this and if you print these files it says that these are the files which is inside this data folder these are the three files and you can verify those file with its name all right so these are the three files inside the data folder thereafter we are going to write a for loop to upload all these files together all right so for that one what i can do here i'm gonna say something like this for file in files and thereafter i'm gonna say here like this response is equal to i think i don't need response so i can simply call this one all right let's go ahead and call this one and this file name is inside this file that's mean when we iterate this list we will get first this one this one and this one so that is inside this file and then you can simply call here this upload and thereafter i'm gonna here use a print statement and in that i'm gonna say here uploaded which file uploaded that's mean file all right let's go ahead and run this one then we will see what is going to be the output all right so these files the first file which it is going to upload that is a g file and it is a little large file that is why it is taking a little time and thereafter these jpeg file is a smaller size of files and these will be uploaded once any of these files are uploaded then this print statement will be executed and the file which is uploaded on the bucket that will be printed here all right so there you can if you repress it we do not have any file and it should execute by now all right so it says that this is uploaded this one this one and this one so these files are executed and these files are uploaded here and if you repress it we should see here just a second all right all right i think inside this data it is not there but here these files are here all right now if you see these files are here panda jpeg and whatever all those files are inside inside our repository and if you click on these files you will be seeing here the the other information of these files like the size of files the key values and the object url and if you click on this object url you might see notice here the access denied that's mean this is not public this is not public repository and public access for this particular object is denied and if you want to enable a public public access then you can pass this extra argument if you remember this extra arguments we had already said that and for that one we are going to set that extra argument here for that it it's really simple like this one args that's mean extra argument i'm gonna create it like a dictionary and this is a acl access control list that's been access control policy you can say that that's when we are going to now associate each of these files with the public read access and there i am going gonna say here like this public read all right that's mean a public read access will be enabled for each of these files once we pass this args is equal to args that's mean the argument and that's this one extra argument let's go ahead and run it once again and in mean time while it is running ah all right let's go ahead and see here inside this kgb talkie it's ticking uh it is going to again take a little time because the first file this g file is uh larger than other files all right so currently i think these files are a previous one and these are not updated yet perhaps i think if it is uploaded all right so this one is uploaded this one and the another one will be also uploaded and if you notice here the timestamp last modified timestamp i'm gonna refresh it then you should see here these timestamp are changed that's when these are the updated file and if you open this once again we have got here this uh object url and if you open it into a new tab we should be able to see this file and here you see there this is a publicly this file is downloaded here and you can also check these properties like these storage classes metadata etc is uh enabled here and in the permission you can see these the permission this read object read object permission etc if these permissions are enabled so you can get that one and the public access is enabled for everyone and read object all right so these are things you can check manually here otherwise of course with these on your command tool you have already enabled so you know these things all right perfect so this is how you can upload multiple file in your in your bucket now i'm gonna show you after this lesson i'm gonna show you how you can download multiple files i mean how you can download files from s3 all right so let's go ahead and see how to download files from s3 and to show you download files what i'm going to do i'm going to right here a small piece of code and the piece of code which i'm gonna say here if you remember you have to first get you have to first get information that what are the object files available in your s3 and which files you want to download well with this console data you can definitely know these are the files which you want to download but the way but the reason we are we are doing this bottom three we don't have access to this console that's mean we do not know any of these information all right so for that we have to get these information from in uh from this python uh python file itself so the first of all i'm gonna show you how you can create a resource all right so earlier we have been creating a client but now we are going to create here a resource so the resource is like this one boto3 dot resource thereafter you have here s3 all right and if you run it this s3 thereafter for bucket sorry for otherwise you can do one thing a simple thing s3 dot buckets dot all so you get to know that what are the buckets which is inside this all right so this is a collection so we have to perhaps do iteration otherwise we can call here like a list so we should be getting those bucket so it says that we have here only the kgb talky bucket and earlier if you remember we had also previously executed this uh with the same uh with the client as well you can do the same thing with the client as well like this one all right so these are the various way with this one we get only a small information but this one we get all the information regarding when these buckets are created and who are the owner etc all right so ultimately this is creating an overhead of these a larger piece of the data all right now let's suppose that we have selected this kgp talkie bucket and we want to know what are the documents which are stored inside this kgb talking bucket and to get the number of number of objects which is inside this kgp talkie bucket you have to do this the first of all ah all right so we have already uh we we have the information of bucket and uh let let me think it all right so how how you can do that you can do like this one uh bucket i think we already have this bucket do we have i think s3 sorry this one is s3 so this s3 is a service resource which we already have with us and now we want a service resource for our kgp talkie bucket so for that you can do like this one bucket is equal to s3 dot bucket and then i want it for kgp toki so we have got here a bucket resource for kgp talky bucket thereafter you can say simply like this one bucket dot objects dot all that's mean you will be getting all the objects here and if you do here a list you will get the all the objects listed here so these are the object which is inside our bucket all right now let's suppose that you want to download all these files regardless of the type of these files and to do that what you can do here so these are the files and to get the list of these files you can simply do like this one files is equal to like this then these are the files for file in files that's me now we will be downloading these keys data and for that you can do something like this we want here download location file that's mean file dot split and in that we want to split it at this uh forward slash ah okay we do not have any forward slash here all right one more thing what you can do all right so you can actually as of now you can comment it so i'll do that later once we execute this s3 dot download uh do we have s3 dot download no we have actually client dot download file all right and in that i want to pass the information from the bucket where i want to download and the key value so the key value is this one all right thereafter i want the file name by which name it will be on my local computer so let's go ahead and pass this bucket and key name so the bucket i'm gonna pass here this kgptaki and the key name is this file all right let's go ahead and run this and see what happen all right it says that the file name another one that's mean the third one what will be the name of file on our local computer is missing so i'm gonna give here this simply this file name all right so this says that that should be the string all right one more thing i can do uh just just a second let me verify this one let's say you have these files and inside this files you have this object and inside this object if you use here this print statement you gets alright you get same thing without any issue all right and if you use here the key value i'm not sure what i'm going to get here okay all right do i get anything here all right so with this key i get this information all right so i want to give this file name that's mean that is going to be file dot key here all right once again it says that here this key value is also not valid perhaps here all right now it is executed now if you remember earlier we had also took lots of time all right now you see here these files are being downloaded all right so one more thing uh you might notice here that these files were earlier present so for your i'm gonna delete it all right all right so i have just deleted it and then i'm going to re-run it once again all right while it is running let me show you so that you can also see it here do you see here those files were not present and here the last files are present here now these files are downloaded they're inside this data why this is inside this data because we have sorry we have it here all right data and this is a data folder and then the file name all right super congratulations now you know how you can upload multiple file on s3 and how you can download whole objects or it depends how many objects you want to download it's completely up to you all right superb now i'm gonna take you to the bucket policy i have i i have not talked about the bucket policy what is the bucket policy you see um the previously we had pasted a problem while downloading the objects from our bucket we did not had permission to download our object but suppose that you want to set some particular policy for your bucket let's say if you want to make whole bucket to a public rate otherwise if you want to make this whole bucket to just a specific ip address then you can do this all right because this bucket if you click on this bucket this bucket also have this bucket also have its url and you can get that url from this perhaps properties do we have no this one should be inside this permission perhaps inside this bucket policy no all right it should be somewhere here then it should be inside this properties object level static version object log tag all right so currently i think we do not have access we we do not have we should have somewhere i'm not able to find that one but there should be somewhere the address for this particular bucket perhaps inside these things somewhere it should be yeah this one all right so this one is actually addressed for this bucket no this one is for website so you should uh so something like this one we should have somewhere i'll show you later if i come to across the bucket policy but if you can go through all with these links it is there but i'm not sure where are those these are the access control list all right so these are not here all right so the moreover these are somewhere i'll show you later if i get to know there in mean time let's go ahead and play with the bucket policy so how you can do this bucket policy let me add fuel cell in our notebook all right so for a bucket policy let me show you a bucket policy address here this one is bucket policy address and it is very important you should visit this because if i teach you here you will not be able to understand what i am talking about all right so what i'm going to do here i'm going to say here um these are the various type of bucket policies which you can utilize so these the samples are given here and these samples are something like this so it is saying that uh okay cancelled account control list and they say that this is the condition for this particular account it is cancelled so that person cannot access this one and then granting read permission to the anonymous user it says that so there you have a public reader allow and then action is s3 get object s3 get object version that's mean uh the anybody from public can read this so the moreover what i'm going to i'm going to take this randomly all right now it's up it's up to you which policy you want to implement your s3 bucket you can choose any of those policies out of these buckets which is available here all right you can select any of these so these have a various type of use cases like this one granting cross account permission to upload objects while ensuring the bucket owner has full control etcetera all right so we are gonna simply use this policy just a second yep this policy all right so this is this code is going to be a little larger and i want you to be patience all right and keep following this lesson so the first of all i'm gonna start with import json thereafter i'm gonna say here this bucket name is equal to kgp talking and thereafter i'm gonna say here the bucket policy now do uh do remember here the bucket policy i'm gonna put this one so the bucket policy is equal to this one all right and in this bucket everything is okay not a issue we only need to change this part all right so what is this part this part is k g p talking because i want to allow a public read access to all of my files for this particular for this particular uh bucket all right and other things are okay so in this anybody can get the object and get the object version because of the the bucket policy is here a public read effect is allow all right you can even see here a deny so these things will be denied and other things will be left as it is if it was earlier allowed that those will be allowed otherwise if those were denied then those were will be in the condition of deny all right thereafter i'm gonna say simply here bucket polishing a bucket polish is equal to json dot dumps now do you see here this json dumps what dodge json dumps will convert the dictionary in the form of a particular in the form of json object all right so this bucket policy is converted into actual json object and if you want to verify that you can actually verify this one so like this one you have got this bucket policy like this and once you get this bucket policy we already have our client you can simply say like client dot put bucket policy do you see there put bucket policy and there i want to say here the bucket in which i want to put it so that's the bucket name that's the kgp token and here the policy which i'm gonna put the policies bucket policy all right let's go ahead and run it now you should see here a successful result that's mean a successfully a new policy is updated all right so how you can verify this new policy successive fully updated you can click on here inside this bucket then you come inside perhaps permission yes i think it now you you can notice here this public is there and there is bucket policy so the same bucket policy which we did earlier and this bucket policy is applied here all right superb congratulations so now you know how to put how to put the object inside the bucket you know how to download object from the bucket you know how to get the list of those objects list of buckets list of permissions etc by using your python 3 403 library superb now let's go ahead and retrieve the bucket policy now suppose that let's say you did not set these policies and you are trying to access some s3 bucket and you want to know the policy which are already applied to those bucket how would you get that this is simple you can simply say here s3 that's mean that is the client dot get bucket policy do you see here how simple this uh working how simple working with the boto3 the bucket is equal to each bucket name which was kgptoki so you will get here the bucket which we applied here and yes you got it here all right so this was the policy of bucket which we applied earlier all right so bob congratulations now you know now let's say if you want to delete a bucket policy you can simply type their client dot delete bucket policy bucket is equal to bucket name it will delete this bucket policy but i don't want to delete this bucket policy because because i'll be using it in our further lesson all right superb now let me show you a very interesting thing here and if you come perhaps in the properties it watch yes if you come inside this properties do you see here this static website hosting what is this that means you can use your s3 bucket to host your static website all right but by default it is disabled and suppose that if you want to host your static website do remember only html css php will be not hosted here so how would you host it well you can definitely do it from here itself but we are supposing that we do not have access to your console so we have to do it from our python all right now i'm going to show you how you can host a static website in s3 all right superb so it's a simple but a few things i have to do here the thing which i'm going to pass here that's the configuration configuration file for our website and the configuration file our website is simple let me get the link of that configuration that you can get it from here by default configuration those list of configuration is here so it says that we have to get this bucket policy well so this thing i think we have already added in our previous bucket policy all right so i think yes we have got it already the final piece of configuration which we are gonna do here that's the error document all right so whenever error happen while accessing your uh while accessing your website which document you want to so so i want to say here error.html thereafter it wants index document that's been the homepage document which you want to show first that's the index document and then it says that what is going to be the suffix for this one so there you have here a suffix is like this one index dot html file any file which is placed as a index dot html will be used here for our website configuration home page all right so we have got this configuration we did a setting for our configuration thereafter in the final step we are going to simply do like this client dot put bucket website and then there i'm gonna use here this bucket is equal to bucket name the bucket name is kgptoki if you have seen the previously i had set that thereafter it says that what is going to be a website configuration sorry a website configuration is equal to config all right it's conf actually all right so this one is configuration let's go ahead and run this once you run this it says that a successful message is presented there there is no retry there is no retry attempts etcetera so it is done all right moreover it is done and you can verify it from here i think we have to repress it to see this one otherwise you can go back and then you can come back there so you will be seeing there the website configuration should be enabled so this says that public access is already enabled because we had already set that perhaps inside this permission sorry that well that should be inside the proper teach all right now you see there this bucket hosting is enabled for our static website hosting all right super so static website hosting is enabled for our bucket and if you want to know whether it is enabled or not you can simply also get that information from here like this one get bucket website and there i want to pass the bucket name all right so so this says that these are the settings which are already these are the configuration file which are already set to our client dot get worked website superb superb all right so you have got it successfully i am sure you are happy with all these process and if you are happy with this lesson i do request you please like and subscribe this channel super now let's go ahead and upload some file to our uh let's go ahead and upload some file to our website and to upload some file to our website simply what i'm going to do here actually it's up i do not have any website here so for that purpose i'm going to put here this inside data i'm going to just create one html file here all right okay index dot html all right so this index dot html is there and then finally i'm going to do some edit here let me see if i can open it it well so that mistake from my part i should have written something before saving it otherwise it's okay all right so there i have opened it in my notepad just a second all right otherwise i can also use here any tag if you want but i'm not intended to use any tag here oh superb this is how this should be visible once we open this now do you see this should be visible all right so the moreover now we are going to upload that index.html file now do you remember previously we had used a simple step to upload a file this one was a download there was upload upload file file name bucket and all those stuff all right so simply i'm gonna just copy this and then i'll change that index.html name there so there i have it here like this upload file and this should be like this index.html and i want to upload it inside the kgp docu all right and where i want to upload it do remember the object name here i'm gonna set here this object name object name should be index.html otherwise it will be uploaded inside the or inside this data so index.html should be always in root directory of your website so the object name is index dot html let's go ahead and run this we should see here this one should be uploaded let's go ahead and close this one and [Music] there we had this bucket and inside this bucket now we should have let me see this index.html and if you open this index.html this one is object url yes do you remember i was telling that there should be an object something there and we got that and one more thing do you see there this index dot html is downloaded instead of opening so it is happening because we did not set here uh these files are html and we want to show it and that's mean we want to serve it there so for that purpose we have to pass here the extra arguments if you remember that's the args is equal to acl access control list and for that one it is already public read so i don't i don't need to pass but just for you know a purpose i'm gonna just pass it i mean without any purpose all right just make a continuity here so acl is already public read whether you pass it or not it doesn't matter then we have here a content type the content type which i'm gonna pass here that content type is either text or html that's mean i want to serve it there once it is uh done then i'm gonna pass this args and all right super perhaps now this should run it says that there is an error all right so there should be the orgs i think it was like this arcs is equal to args all right now it has successfully enabled let's go ahead and open this well i think we have to replace it to get the get the new policy updated let's go ahead and open a new link there well it is uh is still downloading not sure let me see oh sorry that one is part there let me check it well so still it is doing so make it proper what i can do it is having here only one version i'm not sure but here it says that this one is updated all right so for that purpose i'm not sure one thing i can do i can delete this file and then i can re-upload it so that i i can be sure that this one is deleted and new file is uploaded with this particular configuration setting all right if i refresh it from here you see there we have got it and oops it is once again downloaded i'm not sure why this is happening let me see it in some other browser well i think this is happening because of this particular browser but if you notice it here let me show you here if you notice there ah it is running all right so it could be because of this browser or something that but if you notice hello guys please like this video it is running at this particular address so with the same process all right so with the same process if you have your website ready you can upload all the static content in your website it can show here a beautiful html css website here which is made do remember a dynamic website will not be hosted here for that purpose you will be needing a different server all right superb superb all right so this is how you can this is how you can host your website static website on s3 now let's go ahead and recap this recap this lesson we had first created a bucket then i listed out how many buckets are there then i saw i had shown you how you can upload the files with various type of the methods like one file and the many files how you can download the files how you can get the number of files and all those things so everything here i have shown almost i mean many things in the moto 3 and s3 now i'm sure you will be able to make your own algorithm make your own application which includes uh which involves the python s3 all those things and if you are happy with this lesson i request you please do like and subscribe this channel so that you can get updates directly into your inbox bye bye have a nice day
Info
Channel: KGP Talkie
Views: 21,897
Rating: 4.7873755 out of 5
Keywords: kgp talkie, kgp talkie videos, aws automation, aws boto3, aws python, boto3, python boto3 tutorial, aws python boto3, getting started with boto3, boto3 python aws lesson, boto3 tutorial aws, aws python tutorial, boto3 aws, boto3 tutorial, boto3 lambda, boto3 s3, boto3 python, boto3 aws tutorial, boto3 aws ec2, boto3 aws lambda, boto3 aws credentials, boto3 aws python, boto3 basics, boto3 bulk upload, boto3 bucket acl, boto3 client, boto3 code, boto3 credentials setup
Id: qsPZL-0OIJg
Channel Id: undefined
Length: 57min 49sec (3469 seconds)
Published: Sun Aug 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.