Learn to Deploy your Docker Container on EC2 in 15 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good afternoon one and all welcome to the video my name is Sami chai in this video I would be guiding you basically right from scratch how to deploy your flask or any application that is a docker application on Amazon AWS ec2 instance right from scratch I'm gonna show you everything in detail okay so without wasting much time let's get started with this video so here you can see I have a very simple flask application which has a route kalus foo when I go to the route basically it does basically print hello world I have nginx for load balancing basically I'm using the blue WSGI which basically creates multiple instances of my flask API so I'm going to deploy all of these and store I'll show you the best practices basically so guys what are you waiting for let's get started without wasting this video all right so I'm on my Amazon AWS I've already logged in so let's create a new instance so I'm gonna click on launch instance alright so I'm gonna click on Ubuntu right so I'm gonna select this one right here I'm gonna click on I'm just gonna review it it looks good click on the next button right there number of instances one okay everything looks good okay next so size 8 gigabytes is more than enough right everything looks good next add groups next configure groups looks good I mean actually I was actually wanted to look my IP I thought off like that's fine it's fine actually I wanted to limit it to all traffic but it's fine let me see all traffic yep so all traffic make sure you do that review and launch t2 micro looks good launched we want to create a key pair I'm gonna say sawmill sawmill docker ok download keep her and my ec2 instance has been created so I'm gonna take that on the folder let's click on launch instance I'm going to minimize this and I'm gonna create a folder call this docker YouTube paste my keys here here alright guys that's done let's see the instance it's still creating let's go to view instance I'm kind of decent at our Linux nowadays because I've been working a lot with Linux so so that's what it is guys practice makes you perfect you see what I'm saying so alright so meanwhile that has been created create so once it's still--it's Enosh initializing what am I gonna do is basically in order to SSH I can't use the PEM key I need to use puttygen you can download Parisian party Jen click on load I'm gonna go to my desktop I'm gonna go to that folder desktop go to that folder which is docker YouTube click on all files select the PEM files okay save as private yes name the file so we'll new I'm gonna save it in the same folder all right so that's done that's my PBK file so for my ssh and sure enough my server is ready so click on here click on actions click on connect i'm going to copy the name yeah so yeah that's what it is guys practice makes perfect party based you're here the domain name go to SSH go to auth go to browse go to that folder select the PP cake file Oh hold on so next stop always at YouTube docker or the name of the file Oh docker YouTube samel new PPK let's just search into the server alright let's get started guys we are in or so now we are in now I have a nice command I'm gonna list it on github so don't worry guys everything is there okay so I'm gonna just pace come on sauce come on sudo apt-get update so update the server all right done I have everything for you okay so don't need to worry so second come on install yes third come on done okay food come on done okay oops what the hell if it's command six command yes now install docker compose see how easy it is you know people make it just complicated I mean it's pretty easy now to do stuff I mean so let it install guys should be done in a couple of minutes so docker is installed docker compose installed are so server is up and ready for to basically install dupper now docker container let me put this down put this down that's my rest api see i'm gonna use all the tools and get it done quickly right so let me make sure i'm go to my docker file one change I gotta make in the Yama file is the version should be 3.2 I guess 3.3 okay that's all now see how am i uploading files on the server FileZilla so when I go to file I actually forgot to one setting settings SFTP remove add file I'm not sure this was the one maybe yeah I think so next stop let's go to darker desktop docker YouTube PPK alright so that's done um now we need the IP address so let's go back here I can try that one oh that's actually the IP address she'll be fine I don't know 422 what is the username I don't know let's try out I think I won't be able to connect it oh yeah there you go guys that was easy right so now I just need to deploy my in docker right so see how easily I'm doing stuff okay with like piece of cake so one sec show folder Ellis so this is where I'm gonna dump stuff excuse me my daugher right so these are all of my files right so come here take this drag it here so now it's copying on the server directly you see things are easy you know there are so many good software's to help you I mean it should not take much time nowadays to deploy or start stuff so now I just gotta find where exactly is that well where did where did I copy that's let's try home yeah there you go CD my daugher what the hell all right CD my daugher LS now use docker compose compose up oh sorry build oops could not connect to the demon hold on something gone wrong it's a non-standard location specify the URL docker host and water could not connect to the docker demon hold on poker let's see docker okay so that's there so doc compose could not connect to the darker demon at HTTP delete docker whatever XYZ is running okay I think something let me just check docker combo okay so that's also there I think I have just one issue let me just make sure give me one sec I just want to make sure this version because sometimes this version is a little crate crazy so what I make sure that this is the right version I think it was 3.2 I guess let's try nano camel so the compose you know what let me try this there you go like a chump so 3.0 guys okay 3.2 yeah it's easy everything same thing so this is deploying my application right now on AWS of course I'm gonna destroy this after the tutorial let it compose let it make it's doing all this job creating the flask app it's downloading the Alpine operating system doing all the requirements or txt stuff like that yeah same thing easy oops yeah so right now it's starting the nginx server I mean it's installing all of that WSGI and stuff like that so so if you haven't watched the part one of this video that Dow is regarding the architecture how I designed it the code and stuff everything is there on my first part this is the second part like the deployment part on AWS how do deploy your docker containers on data blows right so yeah everything looks good so it's doing all its dependencies and stuff like that should be done all right now let's run it guys docker compose up oops could not connect the docker dude Oh doc sudo docker compose up there you go guys look at this so it created multiple instance nginx is working WS CGI you can see let's try it out where is the public IP that's the private IP I always get confused when it comes to IP address I'm like ah should I use okay which I've where is the IP what IP do I have to use this is always the confusing part is it this one I don't know we'll find out this is not let's see so the route is Fuu okay all right that's not the IP I'm very sure because it did not work come on what's the IP address oh yeah public IP public IP II public IP Hey look at that guys you just got it right look at this load balancing everything look at this look at this so we deployed the darker stuff from if I keep running so it's gonna switch to multiple cores here you can see arm so right now it's a PID one so everything engine rx everything state-of-the-art pretty fast so here you can see it is also switching like it created multiple instance of my API if lot of requesters are coming inside so I hope you guys have enjoyed this tutorial if so do give a like and by the way all the codes and all the all the links basically by the way guys I hope you have enjoyed this tutorial by the way all the code and everything would be there in the description section below I would basically link all the commands that I used to install all of these for example all of these commands right I'm gonna make sure that everything is there in the either my get our bar on my LinkedIn post so hope you have enjoyed it if so do give a like and if you have any more questions please list your questions in the comment section below and as usual keep smiling keep coding and see you guys in the next video
Info
Channel: Soumil Shah
Views: 131,494
Rating: undefined out of 5
Keywords:
Id: awFLzy0XwXo
Channel Id: undefined
Length: 14min 13sec (853 seconds)
Published: Sun Mar 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.