Amazon Web Services - EC2 Server Setup - Free Server for 1 Year

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys today I want to talk about the Amazon Web Services or AWS this service provided by Amazon is actually one of the nicest services that have come out in recent years for being able to basically host your own web sites or servers and being in control of the service that you are getting one of the problems that I've had in the past with hosting providers is that basically you're kind of playing craps because if you if you purchase a hosting service on a shared basis you may or may not get what you pay for for the sheer fact that you don't know that if you're sharing that in quote shared service with a major gaming site or a video site or any of the number of high a either high bandwidth high memory or high CPU computer systems websites that that basically kind of hog up the whole shared use and most of the time what I find is it's kind of touch-and-go sometimes you get a nice system sometimes you get a system that just doesn't seem to respond or or is really laggy or just kind of a disappointment all around and I've tried all the systems at least all the ones in the United States over the decades that I've been doing web design whether it was for my own companies or for customers those systems just have never really been that nice one of the other big problems with using a hosting service is downtime and that's basically when they go to do you know major software upgrades or maybe major service upgrades or hardware or there is a crash in the system or anything really that you know affects any type of hosting company well when you when you call I'm up and try and figure out how long your system is gonna be down or how long your customer systems are going to be down whether that's email or a high volume or storefront or something of that nature for your customers or even just a billboard you know once that happens and you have to tell your customers yeah I know it's down I have no idea when it'll be up I don't exactly know what's wrong with the system that is you know the nature of dealing with a hosting service that's not really a good answer to have for your customers and your customers certainly don't understand that right they've hired you because they don't understand the service server side of web of the web interface and the answer of well you know basically I don't know it's out of my hands it's the company that we that I recommended that you use is is a bad position to be in well the nice thing about the AWS systems is is that you're in complete control so if something goes down or something goes wrong to backup restore to bring up a new server to do really anything to get that system back up and running is literally minutes so in most cases by the time your customer would even know that something had happened to their website you're already in the process of bringing it up a new server that is something that's nice especially if you get a phone call or an email and your response gets to be yes I caught it when it went down I've already got a new server revving up it'll should be up in you know 60 seconds or 120 seconds your customers gonna appreciate that vastly over yeah I know it's down I don't know what they did but you know the hosting service says they're gonna get to it as soon as possible could be down four minutes could be down four hours could be down four days we just don't know so the so the AWS system actually gives us that that flexibility that power and that control to at least be able to tell our customers and/or our employers or whom that the system is up or it will be up very shortly so that's why I love the system not to mention the fact that the way it's built in the way it's constructed and the way it's piped as far as bandwidth is I've never had a problem with it as a matter of fact the the system the snappiness you know you put in a URL that goes to an AWS site and it's response is almost instantaneous as far as now I mean that doesn't mean that you can you know front-end load a website to where you create a blocking system with JavaScript or something and it'll slow down the actual load of the website but the the the route from my computer across through the internet through the routers to the AWS server and for it to respond back as a 200 is virtually instantaneous it's incredibly snappy and I've never had a complaint with it and I get to cross compare because I still actually have some customers that are using some of the big posting services one of them highly recommended by developers and of course one of them is one of the known large big branders that most developers tend to to avoid unfortunately my customer had purchased all of his stuff through that before speaking to anybody else you know because of the advertising the advertising worked very well for them in that particular case unfortunately for developers and and and some other people that's that's just the way it works and we have to deal with that and we have to use them and it's it's not that big of a deal it's just it's just when when you do use them sometimes you don't really get what you pay for anyway so I want to show you how to set up a server using the AWS systems it'll be your own server if this is the first time that you've used the AWS system you get two servers for free for one year now the servers are a primary gateway server a internet-facing server so you can put anything you want to on it whether it's api's or a website or WordPress site you know a game back-end engine the even databases or whatever though the second server they give you is a database server it's that's all it does is serve database functionality and whatever database that you're most comfortable with and in my case I use my sequel the most because it matches with PHP the the best right but you can you can do post grass you can use sequel server sorry let's take a Microsoft sequel server you can use or any of a number of others and you can just look that up under what they call the RDS that's relational database services and that's that's the secondary server that you can also have for one year without any charge from from the Amazon services so with with that I want to go ahead and show you how to go ahead and set up one of these servers and then we'll get into the terminal and we'll actually because we're gonna load a Linux server this is an Amazon semi proprietary Linux server though it's just basic Linux base it's just preloaded with some packages and some interface stuff to allow a little easier integration with Amazon the you don't have to use these as a matter of fact let's let's go ahead and get started and we'll talk about the sign-in so when you do your sign-in you're gonna go to the the URL aws.amazon.com and that will give you the sign-in now if you're not a prime member or you have not signed in to Amazon before this is a standard sign-in if you have never signed in to anything you probably this course is probably way too high for you but it's just a standard sign in the only difference with this sign in is it does require a credit card now you're not gonna get charged anything unless you go overboard on what your purchasing is for our services but because the the hard drive for one server is free the bandwidth the the the server itself and the relational database is free there really shouldn't be any charges at all associated with it if in fact there were charges we're talking about maybe a dollar a month while all this free stuff is happening now you can buy more you can you can when I first started this over two years ago I purchased you know I went through the free learn how to use it real quick and I was so excited about it because of what I was learning and and how it improved my interfaces with my customers that you know way before I had used up the first year I had ten ten servers up and running so obviously I was paying for those and and you will but let's go ahead and and and do the sign-in so you're gonna have a sign-in you'll go through the standard steps of that such sign-in and it'll ask for a telephone number or the last four you know your basic sign-in stuff that you're used to doing and it'll ask for a credit card and and again like I said you're not gonna get any surprise charges or anything like that you can monitor your usage at any given time and even right now I think I'm using eleven servers I've prepaid for some but but the trickle charge such as bandwidth usage and hard drive usage the the gigabytes of hard drive that I'm using I'm still looking only at like twenty five dollars a month in extraneous usage now that's I pre purchased servers so that doesn't include the server costs a lot of times that just includes the the bandwidth and hard drives and things of that nature but we're talking a lot of servers and a lot of systems running with a $25 a month charge anyway so go through the sign and and and go ahead and sign in so I have two accounts with Amazon I have one to do the tutorials and then of course I have I have my primary so you won't see my systems this is a for lack of a better term a dummy account okay so when you once you've logged in this will be your what they call your dashboard and in your dashboard you're gonna have all their services and as you can see it's a massive ecosystem as you learn about all the different products and services that they that they provide and I don't use half of these I mean I probably die I don't use 1/3 of these I use the ec2 which stands for elastic cloud compute which is there which is their servers so your ec2 elastic cloud compute server system is gonna be your primary system if you follow the route that I'm going now you can use their tutorials but you're gonna bring up two servers because they do load balancing elastic beanstalk and auto scaling so that's their default startup right which is gonna be more than one server which means that even if you get a free server you're gonna be buying more from them than you probably need because I bring up one server at a time I still only use one server I don't use load balancing I don't have a client currently that has that type of load system and I don't have I don't I just don't have the system that needs an auto scaling I don't have I don't have sites that all of a sudden change in usage by millions and then stop and then changing usage you know something like weather calms when a hurricane comes through all of a sudden everybody's looking at the Weather Channel when the weather is normal nobody's looking at the Weather Channel you know so they need that they need that scalability excuse me at a moment's notice so you've got storage on if you know anything about the AWS the s3 storage is very popular it's basically a large storage capacity server system so it's just like a very big hard drive there's a lot of other stuff I do use there's the RDS database system route 53 is if you want to do your DNS routing so instead of using somebody again very popular I don't want to name names I simply just don't want to so but you know what I'm talking about when you talk about buying URLs route 53 is the exact same thing as if you were to go through a hosting service except you have complete control over it you have control over the DNS it's automatically interfaced into the ecosystem and it's a joy to use and it automatically obscures your information you know you normally if you go through a hosting service they'll charge you like ten bucks a year or twelve bucks a year or something to run that behind a firewall a visual firewall for obscuring the data of the URL holder and you should you know for basic purposes I think you should always kind of obscure that data there's no reason for the the public or malicious people to have your mailing address in your name and your email address and all that you you never know what people are gonna do with that and there's other ways to give that information out that are more controlled anyway so it provides a lot of service and it's it's relatively cheap I think it runs like 50 cents a month for for that service per DNS that you want to run and of course they're canceled cancelable at any time but you buy them in one year Vokes see migration what else you know there there's so much here I used their work male for mail systems and it's always a tough call with the work mail system because the work mail and the the outlook they cost the same about $4 per person per user whether you're using an exchange server for Microsoft or whether using work mail from from Amazon and I would probably say that that the outlook online exchange system is probably it certainly has a nicer interface because it's an outlook based product it also interfaces probably interfaces better certainly without look it's the the the the purchased outlook because the fact that it that it is talking to an exchange server the the work mail is also has a web interface and you can attach it to an email software program through its pop accounts and things of that nature I use it for a number of different accounts and but I also have an exchange server system again both of them about $4 a piece you know per month and I think that's a little expensive for email but again I'm using them because I like their their interfaces and and there's a number of other things whether you're doing you know Internet of Things or if you're doing game systems or you're doing api's or backends or whatever there's they've just got a massive ecosystem but to get back to our point we're gonna go ahead and talk about the ec2 so if once you log in you'll have your your recent visited services and that would probably be blank if you haven't gone into this so we're just going to come down here to all services and what we want right now is the ec2 at the bottom of this page you're gonna have build solutions and learn to builds so if you're building a website using their tutorials they're gonna start with elastic beanstalk they're gonna do load balancing they're gonna do auto scaling you know and that's great if you're working in an enterprise environment if you're just building a simple website an interactive website now I mean if you're just doing a billboard website with no interactivity then you can use the s3 you know storage system which as a which is like a hard drive that is that is web accessible but to build an actual functional website that can run a server such as Apache and to have you know backend scripting language or language such as PHP or you know JSP or whatever you want to run then you're gonna need to actually build a server website and these I think they're just overkill and they're gonna cost you money even if even with their free tier service you're gonna have the load balancer has to have to two servers running that's how it load balances between two servers obviously auto-scaling if you if you hit the limit of the scale boundary it's gonna bring up another server to share that load and then of course another server on another server depending on how much auto-scaling you want I just don't have anything that needs auto scaling my clientele doesn't have that type of presence even even some of our big stores we're just running bigger bigger servers instead of trying because the the system is is not something that that probably racks well without a scaling and we don't get those types of hills and valleys so so we just run bigger servers for the for the big stores anyway get back to the point we're gonna go ahead and start with the ec2 all right so I just clicked on the ec2 and this is gonna be your kind of your starting point now I've I've run through this a number of times just to make sure that I don't you know so I'm familiar with it enough that I don't have any positives of my tutorials so this should be what you start with with zero on all these except your security group you start with one security group so if you're going to create an instance which is your ec2 that's your starting point it's going to be under running instances or you can launch an instance from this button if yeah now you can see I ran this I brought up an instance and I shut it down or I terminated it using their their terminology it takes a little bit for this for this line item the the server that I created and terminate to actually just disappear from the screen so you're gonna see this terminated line on the video but when you first start there's obviously nothing there so we're gonna go ahead and create a new one and you can just pretend that this doesn't exist because this was my trial run so we can go under instances and launch an instance so if we're under the ec2 dashboard from here you can do run instance you can launch an instance from here they're all gonna take you to the same basic place do you hit a launch instance it's going to take you to the list of servers I'm gonna go back and you can go from winning instance to launch instance it's gonna take you the same place so these are the the available types of servers that you can use and we're gonna use this Amazon Linux ami it's free tier eligible so if you're going to create if you want to take advantage of that free tier for one year and you haven't already used it up which is impossible unless you you have a have created these then you're gonna want to pick one that's free tier eligible and as you can see you can even get some Windows systems but once you get into the higher windows systems and some of the other operating systems there's licensing involved so they end up costing money and at any point in time you can select them or end or look up their pricing but this one's free and it's actually always free as far as licensing is concerned so amazon linux ami never charges you a licensing fee for the operating system or anything associated with it it comes bundled packaged with PHP and docket and docker and and my sequel and let's see it's got Postgres and many other packages obviously apache and a number of other things now they're their packages sitting on the server so you still have to actually install them you still have to all of and brand and run them but they're already prepackaged so you don't have to worry about that you can go to the Dell to the to the marketplace and you know pick a pre-built server so that's always an option just watch your licensing watch what the residual costs are and they will typically tell you right off the bat what the what the residual monthly cost is on that but I personally just kind of like to set them up myself because I I know what I want so we're gonna start with the Amazon Linux ami it's the top one on the list we're gonna select that and we're gonna select the type of server Brighton's not the operating system but the hardware side of it so the t2 micro is the is the one that is free tier eligible and it's really a good server so you look at something where it says low to moderate network performance realize this is a server that's not a laptop this is not a desktop computer so you know if you said low to moderate in comparison to a laptop or you said low to moderate in comparison to a desktop that would bring up some red flags but these are servers so when you say low to moderate on the server that's a completely different subject I've run quite a number of you know fairly intensive websites on the micro without any problems whatsoever the problem that I run into is if I'm running something like a WordPress site with a lot of plugins and I'm trying to run the sequel server on the same server this the the my sequel in the background on the same server then yeah we start to run out of memory and and you'll see that if you play around with it you'll you'll kind of learn what its limitations are and it's really a memory limitation with the one gigabyte of memory what ends up happening with a with something like a WordPress site is the WordPress site takes up X amount of memory and then the database takes it takes a X amount of memory if you try and put them both on the same server and then what happens is it runs out of connections and the the database and the WordPress site disconnect and you see this line when you go to your site that says database cannot connect to WordPress or database cannot connect to server I can't remember which one it is immediately if you see that anytime you've run out of memory you've run out of connections and you run out of memory on your on your server and that's the problem you can fix it by either going to the next size level server or a better solution is to move your database system to a different server and that's why they give you two to free servers you get a database server under the RDS as well as the primary server that you get here they're both they're both the same size that that t2 which stands for a general service server and the micro but on the database side I have seen the the t2 micro being able to run I think I can run like 10 databases for for WordPress site simultaneously and I think I'm sitting in the 90% usage range on those servers so the databases are really efficient on the on the micro server it's just when you start piling everything up on the same server and you really shouldn't have your database and your primary software on the same server when you're doing the WordPress site anyway anyway we're gonna stick with this you can get very large as you can see as we go up in size you know we're talking about some really really big systems so you can always you know as if you're getting enough traffic to justify going to the next server the server cost is incredibly minimal compared to what would I what I would assume if you're getting that much traffic the value of the traffic is when you're looking at pricing on the on the servers you can just literally so you're looking at pricing for the t2 micro you can just do t2 micro pricing and you know I mean that's kind of nice but just go to their pricing level here and we're gonna look at the on-demand pricing if you looked at their reserved pricing it will give the on-demand also so let's low let's go to the reserved pricing because I want to talk about the reserved pricing real quick as well here's your nano that's the smallest and here's your micro and since we're using micro I'm going to stick with this but you can apply this to any other service so you get small and it goes up and up and up and up and up from there but let's look at the micro service real quick and you're gonna see that on demand now on demand as you pay by the hour you have no contract you have no limitations you know you're simply paying by the hour so on-demand hourly it's gonna cost you one point two cents per hour of use now you get 750 free hours for this micro service per month and you'll never exceed 750 hours in a given month it's just mathematically impossible so for one year you get that 750 hours every month for a tea - micro if you have - tea - micros that'll spill over in some months so you'll actually get a little discount on your second tea - micro because you get 750 hours whether it's one or two or ten so if you're paying if you decide to pay for another one or you're want to build one or you go to a different server or you need more space or etc you can prepay which allows them to give you a pretty substantial discount even even if you don't prepay and you just reserve it and say hey I'm gonna be using this no matter what they'll start giving you discounts because they can budget based on known income right so if you say hey I'm gonna use this service for one year guaranteed then they can budget because you're they're guaranteed at least X dollars because you're gonna use it for a year well that budgeting allows them to give you substantial discounts if you notice on the the just doing a standard one-year term if you're doing on-demand with no with no reservation you're gonna pay 1.2 cents per hour if you guarantee that you're gonna use it for a year just by saying yeah I'm not there's no difference except I promise you I will at least be using a t2 micro any t2 micro I'll be using one guaranteed for one year then the price automatically drops 2.8 cents per per hour so you're gonna get a 30% reduction right off the bat by doing by by just telling them how I'm going to use it for a year and you know I if if you're doing anything with with websites you can almost guarantee that you're gonna have at least one per year so so you can you know once you start building these things you know what you're gonna have is a minimum per year so reserving space starts to get not only it just becomes economically savvy right become smart to prepay so if I want to prepay I can bring that price down to the effective hourly of 33 the 33% less in a one-year term I can pay $69 one time and I now have that t2 microserver for one year now I can do anything I want to with that server I can erase it I can restart a new one right I have to bring down the old one but I have to I can restart a new one I can bring one up from scratch I can I can put anything I want to on it I can switch it out I can change the software it's irrelevant right it's just the hourly cost of a t1 excuse me a t2 micro so you're not limited it's not like oh I'm buying a Amazon am i Lennox and I really need in a bunt I can't get rid of the ami that's and that's not true you can just it's it's simply the t2 microserver so so if you bring up - you're paying for two servers per hour if you bring up one if you take it down and bring up another one then you're paying for one server okay so so just remember that and and you can get some pretty substantial discounts now I purchase mine in standard three-year terms so as you can see that for three years I will buy say t2 Micro I'll pay a hundred and twenty four dollars one-time fee and now I have that micro server for a full three years and a hundred and twenty four dollars and if we you know bring that out that's you know 124 124 divided by three you know so I'm paying forty one dollars a year so we divide that by twelve I'm paying three dollars and forty four cents for my server per month hey and that's a t2 micro so that's you know I don't I don't know of anybody who offers those kind of pricing levels it's that's just absurd so so that's what I typically do and I go with the you know biggest discount the 58 percent now now you can do this even with the larger servers so if you find out that you're running a pretty plug-in intensive you know WordPress site or something like that and you need a larger server you know you're just looking at a little bit more money every single time you go up so you get small and you got medium you know and and it just gets bigger and bigger and bigger you know up to the thousands upon thousands upon thousands you know there's five thousand dollars for three years for what is this this is a double extra-large you know and these get these can get ridiculously large I think we seen a year into the ten thousand dollar range $20,000 range twenty three times and it gets bigger and bigger I mean these are massive systems these are the kind of systems that wthr.com uses off the AWS system and they can afford to do it because you know obviously they're getting paid by advertisers and things of that nature for their click-throughs so anyway I want to talk about the pricing and that gets you clear on the pricing you can either do it on demand and calculate your pricing or you can start to do reserved pricing and if you're doing reserve pricing I'll show you how to to to purchase that preserve pricing as a matter of fact if you if you back up let's let's back up out of here real quick in your dashboard right so this is where you start off right down here is reserved instances so you can click on that and you can purchase a reserved instance so let's say you're running the you know Linux system when you're running it in standard you're running a t2 micro you're gonna do the three-year terms and all upfront and you do a search on that well there you go so there's one hundred twenty-four dollars and you'll add that to the cart you'll pay for it and then you have that server for three years and that's yours for three years so I just showed you that real quick I just wanted to show you how to do the reserved instance to lower your price if you start say hey this this free one's awesome I want more so you can do that reserved instance and of course you can do it with any size and type alright so let's go ahead and launch our instance again so we we were going back through we did the Amazon ami here's our t2 micro and you know if you have questions be sure and read through this because there is learning you know a little bit of learning experience to go through this and more you learn the more the more you the more you benefit from their ecosystem so we're going to configure the instance and we're gonna want one instance more instances for auto scaling so I can I can bring up two or three on the same interface and basically they ought to scale for me so let's say I am weather calm and a hurricane is coming through you know you have normal usage then also and you'll have a spiked usage of the Weather Channel when everybody's looking for basically looking for you know what the Hurricanes doing so that's what your auto scaling does it starts to bring up other servers as your as your traffic and and needs increase and then they go away as that traffic decreases so it scales up and then it scales down - to make sure the the pricing is most most optimized because you don't want 20 servers running at any given time when the weather's normal but one server won't handle when hurricane comes through so that's the scaling system we're gonna leave it at 1 because we get one free free system and we just right now we don't need to pay for anything we're not doing spot request purchasing spot spot instances gets a little bit cheaper because they know that you're not going to be using up those resources your VPC is your virtual private connection it's your internal internal network so it's just going to leave that default subnet you can set up your subnets for 4 if you set up one computer and one subnet and another computer and the other subnet and you load balance the two then you've got some additional protection we're just gonna leave that as default these don't give you any choice so just leave them a default you can shut down behavior can be stopped or terminate and that just means when you shut down a server it will literally terminate and race the server so just leave it at stop you can protect against accidental determination so if you had that set to terminate and you shut down a server and you went through all the steps to actually shut down the server it would actually come at the end and go know you've got protection on you can't do it so you go back and turn off the protection and I don't really necessarily understand that the the how you can go through the steps of terminating and deleting a server accidentally right but I'm guessing you know they need it so apparently there's a way to do it that that requires that you've got your cloud watch detailed monitoring you can go to leave that that blank for now you don't get any more monitoring by selecting the detailed monitoring you get the same monitoring more often so in other words instead of every five minutes you get all the information on your server you get it every 10 seconds something of that nature I actually don't remember how often it is it may tell you if you know it doesn't tell you often but you can look that up and see that that the monitoring doesn't change you don't get more information you get the same information more often right in a time frame so if if you're running something like weather comm then that would make sense to have detailed monitoring so that when you scale up because of a hurricane coming through that you can scale up as fast as possible as that traffic hits all right so that would be something that that would that would apply I don't use it because I don't have anything that needs to scale up and then leave this is its default we're not running dedicated servers and we're not running dedicated environments we're running a shared hardware instance but that's not the same shared hardware instance that you would expect from a shared host right because in a shared host you're literally sharing the pipe you're sharing the computer you're sharing you know it's not separated out the same when I purchase a a virtual server from AWS I I have never gotten one server that acts differently than the other right I don't get one that's snappy and one that's crappy right they've all acted the same they're all very quick they're all responsive they don't act differently one doesn't use up more memory than the other so it's not like going to one of the big ISPs or hosting services and getting a shared server in which case that it's a crapshoot in the case that you know you may be sharing your server with a game host or you know got a bit of pornography site or something like that that at certain points of time the entire bandwidth used and the entire memories used and you're just struggling to keep your website running a usable pace anyway it's not the same just leave it as a shared and we'll move on to the next thing here's our hard drive we're gonna be using 8 gigabytes which is plenty for almost any server system it's certainly plenty because it doesn't include the operating system or maybe it does I actually have to go check him but anyway 8 gigabytes is quite a bit you'll see that you have plenty of space if you go through and look at your hard drives after the fact and if you want more space it's better to use the s3 that's the storage bucket that they provide to host large amounts and there's even a there's even a magnetic storage hard drive system which is what they call the low access system it's not it's not speedy but if you need to archive information that is accessed very rarely then you can even use that so you've got I think three different levels you've got the instant GP you know GP to you know solid-state drives for speed and then you've got you know the the storage s3 which i think is just magnetic you know mechanical drives which aren't super speedy but they can hold a lot of data and then you even have just massive massive archival byte backup systems that that allow you to do you know terabytes of data but it's accessed rarely so backups and storage and things of that nature that you don't use often but you don't ever want to lose either anyway so we're gonna use the eight gigabytes we're gonna we're gonna pick the general-purpose solid-state drive which I think most hosting service actually charge you extra for or at least they used to unless you're using a lot of data and you're turning it over and it needs to be fast some type of data system you don't need the provisioned I ops but if you're if you're flopping over large amounts of data constantly then you you may want to look at something like like a high IAP SSD but you're probably going to need a larger larger gigabyte size because it needs to be able to to to use that hard drive for the ions and then of course you can even go cheaper and go to the magnetic drive but no real reason that I can see in doing that so we'll do the general purpose and go to the next step you can do a delete on termination that deletes your hard drive I Eve it checked because if I'm if I'm terminating a a server I've already got the server backed up I don't need to save its hard drive and orphan the hard drive for any any reason in a in an orphaned volume I'll have a snapshot so I'll be terminating that server and I'll be bringing up a new server based on the snapshot so I don't need to save its particulars our drive for any reason whatsoever so I let it go out with termination but if you if you have a reason they even think of that you would want to keep the volume orphan the hard drive without the server then you can certainly you know just uncheck that okay so we've got that and now we come up to adding tags if you have a bunch of servers that have specific purposes this is you know you may add tags to to connect them to the ecosystem right so if you're if you're using the Internet of Things and other other things of that nature this is just a way of labeling and tagging systems so that you can kind of keep up and keep organized I don't worry about it because I can name my server on the front end and I'll show you that right after we get get it started ok so the next step is the security group this is basically the same thing as a firewall and we're going to create a new security group for our servers right so if this is a web facing server we can use the same security group for all the web facing servers if it's an email server we can use the same security group for all the email servers if it's a database server we can use the same interface for all the security group for the the database servers but you're going to want to let certain things through based on what type of server it is so again like I said it's it's very similar to to a firewall if it's not the exact same thing so if I call this main server security group alright give it a description if you if you want to it's gonna allow the secure socket hosting service through that's your secure socket what I want to call that I'm trying to think of what what what to call that it's the ability to go through putty or webstorm or phpstorm to connect to your to your Linux terminal so whether you're using putty or whether you're using webstorm or phpstorm or one of the jetbrains product line that have that interface that that secure socket interface then then this is how you get to it and it's actually one of the only ways you can get to these the lennox server so that has to be open and right now it's open to the world that's the 0.0.0.0 four five zero and that's gonna allow you to be able to communicate with the with the server itself so you're gonna want to leave that now you may want to actually restrict that to your personal IP address so you could go to you know what's my IP org and if I click on that it'll tell you exactly what my IP address is and you can then insert that here and that will prevent anybody else from getting into the system you still need a key a PM key and you still have to go through SSH so the likelihood of somebody getting through even with this open is you know pretty darn slim they would have to be able to get a copy of your pen key and they bet they'd have to you know basically know you know everything on how to get into the system not impossible I'm assuming because they does have the double layer of security I'm gonna leave it blank now but even on my personal system I only allow my IP address through so it's one of those simple things you know you put your IP address in there and boom it's done now this is going to be an HTTP you know lamp stack so you know that's what we're building right now is a lamp stack so I'm gonna go ahead and add a rule and I'm gonna allow HTTP through because it's an instant you know coming in interface I am gonna let all things HTTP into the system so that basically covers that that's your entire firewall security group because you can allow HTTP through and you're gonna allow the ability to connect to a terminal if you wanted to you could probably justify doing your HTTP as well it's completely up to you we obviously need to to put in a security certificate to have that function so you can either put it in a now or you can put it in when you put the security certificate in and that would be a completely different tutorial because you actually have to get into the the operating system and do you need Apache and PHP to interface with that security system and then allow for the security that certificate to be used and if you're interested in turning your ec2 into an HTTPS just let me know and we'll well we'll make a tutorial on it it's it's hard because there's not a lot of information out there it's easy because it's not an enormous number of steps that makes sense okay let's go ahead and do that we're creating the new server we've given it a name we've left the SSH and we're adding HTTP and for posterity sake we're adding HTTP though we don't need it to run the server all right so we're gonna review and launch and that's just gonna give you a review of what you've set up we're gonna hit launch and it's gonna ask us to either choose an existing key pair but since this is our first server we don't have any key pairs or create a new key pair and we're gonna create this key pair and this is how you securely attach to the server using SSH and that's done through putty or some other secure interface all right I use webstorm and phpstorm so we'll just call this main servers key pair we need to download that key pair so we're gonna download that too let's go ahead and just bear with me just here for a second I'm gonna delete those all right and you obviously don't have to do this I just had done it before and I don't want to get mixed up when I go to use it again so we're just going to save that at this pretend I'm gonna put it in a safe space you know wherever you keep stuff for this purpose I'm just putting it on my desktop we acknowledge that and then we launch the instance all right now you're gonna sit here and you can go view instances so now we're gonna be launching the instance I see that my terminated one has now refreshed and disappeared so here's our instance now so now we have the instance we're gonna go ahead and just kind of click that put main server alright now we have the instance it's running and initializing and basically it's just a Linux that's got a internet facing network system we still don't have a patchy on it we still don't have PHP server on it if we wanted to we could put my sequel on it you know to put in a database a database system I'm trying to in my mind so we've got basically we're building a lamp server so it's you know Lennox Apache my sequel and PHP but we're not gonna put my sequel on it just for the fact that well you know what we probably will we just won't start it because we're gonna use an RDS server for for our database system but we'll go install it just doesn't really hurt anything because we're not gonna start it so therefore it won't be using any memory so that's up and running and if we look at the info on it here is our public IP address right there now there's a difference in this public IP address the IP addressing system on this is subject to change all right that simply means that if you reboot the server this main server you may not excuse me you may not get this IP address again that would be problematic if it if a DNS is pointing to it so to resolve that problem and a better solution is we use what's called an elastic IP and what that is is it's an IP address that we're assigned and we can slip that IP address anywhere we want to so if here's an example of how it it would be really really nice in a problem in tast rafi so we've got our DNS our DNS talks to or points to our our elastic IP this elastic IP may be attached to this server right here all right so that all works the customer puts in a URL the DNS points to this IP address it responds back that's our server and that's how it works the problem occurs when this server fails right what's nice is is we can jump into our system real quick and jump this IP to another server and our DNS doesn't change it's still pointing to this IP address this is a brand new server that's that's either just been brought up or sitting in reserve you know depending on how important so the old server failed maybe it's a piece of hardware maybe it's a software update that failed maybe it's just a glitch who knows but whatever it is just by moving this IP address to a new server just attaching it to a new server has rerouted the system and the customers have no idea they don't know that the server just switched to a brand new server all they know is the system is still running because now we've just jumped the IP address to a new server so that's the really nice thing about the elastic IP addresses and what we're gonna do real quick so we're going to set one up so down on this left-hand column over here we can go to the the elastic IPS we're going to click on that we're gonna allocate a new dress now you get five I think you get five IP addresses elastic IP addresses automatically don't leave them running you know just if you're using one use one don't allocate IP addresses and not use them because it's a limited pool resource right open outside availability IP addresses is considered limited pool there's only a strict number of them so they issue you five and if you use more than five well they won't give you more than five unless you request and then it's like I did I just send them an email saying hey I need some more some more elastic IPS and they were like oh sure here here's here's I think they gave me five more and said if I need more just can just let them know but they do want to make sure you're actually using them because if you orphan them then they're losing their losing IP addresses and for no apparent reason other than you know people's laziness so anyway for IP addresses we're gonna allocate a new IP address and allocate it there we go we've got a new public facing IP address of thirty-four to thirty four to thirty one one sixteen now if you have a DNS if you're using Route three that's even easier part of their ecosystem but let's say you're using a hosting services DNS you went to the big you know the big advertiser guy you can jump into their DNS editor and you can now point to this IP address using their DNS servers and that will allow all their server information to just simply forward right to this IP address so we close that we've got the IP address now what we have to do is to sign it or associate it with our new instance we brought up and this will be a list of servers if you've got more than one we just have one so that will assign that IP address to this server now if you're moving it like I was talking about if you're moving it to a new server then you would select a different server here and you would hit this check box right here that allows it to slip to a new server without check boxing that without selecting that check box I'm going to assume that it it doesn't slip from server to server it'll give you an error some some other problem so but we're not moving it this is the first assignment of this IP address to this server so we're going to associate it and close that and now our IP address is associated with our server we can go back to our instance and we can see that now we have that 34 - 34 - 31 1 1 6 now we we now have a public interface to our server but we still don't have a patchy running on it for our web server and we have no PHP or anything like that of course patch is all you need but we do want the backend PHP in this particular case now this could be a node server or anything else you can put anything you want to on it and they have pre-built node servers and everything else just just look at the some of the pre-built remember that marketplace they have a lot of node servers that don't cost any money certainly don't cost any more than then the standard T - micro and they have free eligible free tier eligible systems in all different styles including the nodejs servers you've got uh you know lamp servers you've got laravel servers you name it they've got it anything that you can think of that is you know marginally popular they'll have a system running it okay so so now we've got a public interface to it and our servers up and running it's running Linux all ready to go so at this point in time all we need to do is jump onto the actual server now and install those packages but our service running we've got a public interface the next step for me is I'm gonna bring up webstorm maybe phpstorm but we'll figure it out just a few minutes because I'm gonna take a little small break but we're gonna bring up those one of those two and I'm gonna bring up my ssh interface by secure FTPS interface and we're gonna login to this IP address and go ahead and and hit control-c now so we're gonna log in to that address through the terminal system to connect to the Amazon Web Services to our now server right and that's it for right now I'm going to take a small break and then we'll be right back okay guys I'm back real quick just needs a little break get some water anyway so we've got our server up and running we've got a forward-facing IP address that we can get to publicly so I'm just going to go ahead and bring in my webstorm that I've went ahead set up I'm gonna split my screen here real quick and I'm gonna give myself a little room here got our server there's our IP address here's my webstorm now to create a secure shell into the lennox server i can do two ways i can go directly by using tools and start ssh session which will bring up an edit credentials and then jump into it or because I'm gonna use it eventually anyway I'm going to go ahead and clear this get rid of that real quick is I can go to tools deployment and hit browse remote host and set up a remote host which will be that that unit so I'm going to click that and I'm going to set it up as my AWS server name it whatever you want to we're gonna go in through secure FTP it okay alright and the post is the IP address that we copied earlier with the ctrl C so I just did a control V port 22 for SSH so if you're using putty that's the port you're going to be using is 22 we're gonna go into the root path the username is always the same for the Linux am I the the Amazon Linux ami is always the same it's gonna be ec2 user alright if you're using a boon to or another one or if you're using one of the pre-built under the marketplace those may change and they'll give it to you in the instructions right as you look at it all right so our password is actually a key pair so you've got open SSH or putty if you're using those particular items alright so we're gonna look it up it's on my desktop this button gets me to the desktop in this program and we had it under main server key pair p.m. alright so we're gonna add that nope there's no passphrase or anything all right that gets us the entire thing we can test our ST secure SFTP anyway so the it's gonna give us a you know little warning here we just hit yes it's gonna test it and now we're successfully connected to it all right so we can hit OK and that's gonna bring up our server and now this is the root folder of our server so we're seeing every single thing inside the folder and realize there's no Apache there's no www there's no HTML folder in here yet because we haven't even installed Apache on the server as of yet so we can go ahead we've now got the server so we can actually view all the files on the server and if we were going to be setting up secure socket lair as HTTP and putting in a certificate we would be working in in this part of the system and this is how we can get to it so under tools again now we're going to go to start SSH session just like before but we've already got it set up now for the AWS server so we don't have to keep putting it in so we're connected now we're completely connected to the to the remote server and I'm gonna go ahead now and and minimize the the chrome interface to it and go ahead and expand this so we can keep a good eye on that all right so the first thing it's gonna ask you is to go ahead and update the the server so we're gonna go ahead and update the server you're doing exactly what it tells you to do so it's the sudo for super user yum update so sudo yum update and you can tag that with a dash Y so that it doesn't ask you each for each step right so it'll just update what it needs to update and proceed with that update without asking you here's the update available do you want to update this you know etc etc all right so as soon as that's finished okay so we're finished and I probably did a clever edit that took about 60 seconds a little more time than I thought depending on when the last time the package was set by Amazon depends on how big via the update can be so from here we've got our we've got our server everything's running now we need to install the lamp system so I'm gonna go back to splitting my screens here and bringing up this screen and what we're gonna do is look up AWS lamp and it should give us a tutorial installing the lamp server right there okay so for at this point in time we're just gonna go straight through and follow their instructions to set up the lamp server and you could can and should read through this for the understanding of it but I've done it a number of times and I've read through it all so I'm just gonna go ahead and follow their instructions per copy/paste and run all right for each one of their command lines and we've already done the sudo yum update the yum is their package manager so that's why that's why the yum portion of it again here we're gonna use yum to put in the apache which is HTTP d24 2.4 that's their apache server you've got PHP 7.0 you've got my sequel version 5.6 and that's the actual server and then you've got PHP 7.0 - my sequel which is the which is the driver that allows PHP to talk to the Michael server so even if you don't install this you can eliminate this lot this this object in the line you'll still want the PHP 7.0 - my sequel not 7.0 the PHP 7-0 - my sequel because that's the driver so even if it's on a different server you'll still need the driver for PHP to talk to my sequel alright so we're just gonna copy this and like I said in this particular case we're gonna go ahead and just install the my sequel server we're just not gonna actually start it just to keep everything simple but you don't have to you can you can not install that particular item okay so and of course we use the the - why so that it didn't ask us each time we were installing that's done so we can go to the next thing we can go ahead and start our Apache service so this starts our Apache now that we've got it installed all right we get a verbose okay we can do the check config for the Apache server and this ensures that if the server reboots that Apache starts automatically without having to have somebody actually physically do the start command and then we can just make sure that everything started as expected and you can you can really skip this step and really just kind of move to the next one but you're just looking to match the zero-one excuse me off off on on on on off so you know off off on on on on off and that that tells you that everything's running properly at this point in time your server is up and running so we should be able to go to our public IP address move over here because that link will take me to the other other manager all right so we should be able to do this and it should show us our Apache now there you go so now we have an Apache server up and running and this is Apaches default if it doesn't have an index file so that it shows you the admin test page but now you've set up your own Amazon remote host system running running Apache we just need to set up some security aspects so that the ec2 user you and the Apache server can add files and add directories and such within the WWE folder okay so we it's going to talk here about adding security groups if you still can't get to it you didn't add the right security group or and that was the firewall remember the security group for HTTP and make sure all that's up and and allowing traffic in and then of course talking about Public DNS to point so we now have our var /ww and I think it's forward slash HTML and we can look at it right here if we come over here to bar our usable route here so www and here's where our documents end up going right here for you know your index files and this is your your basic route document of your website so anything that we add right here ends up being the usable document root and it's usable right now we just need to set up some permissions so that if we're using things like WordPress or other items that the permissions will allow us to to make some changes as needed so here's where we're gonna be setting our file permissions and again all we're doing is running right down the line and doing a copy and paste so that it gives us our Apache and user at this point in time because we don't actually exit the the system we're just exiting the interface you can hit exit because what they're wanting is a reboot because we've now added the Apache group and if we hit exit and I'll show you we hit exit which exits exits us out from the interface and then we reconnect right here and we do groups you'll see that I still don't have the Apache in the group the way I've always solved this is simply when I bring up a new system is grab the the server that you created actions instant state and hit reboot and hit yes reboot now while that system reboots you notice I got kicked off as would be expected the the system is going to reboot and all that software set and because we set the the config to on now if i refresh that obviously our servers down so everything you would expect from a reboot because we set this line right here this check config when it reboots it will automatically start the Apache server so we don't have to actually worry about the fact that when we reboot we don't have a server there anymore and looks like maybe we're back up so you can see how incredibly fast that is for a reboot if you needed a secondary server to come up we're no longer talking about minutes and hours and days for your host service so the benefit is just immeasurable the benefits immeasurable compared to running a hosting working with a hosting company ok so let's go ahead and connect back to our system under tools and we're back up now as you can see because we already updated it's not giving us anything saying hey we should update and it will so when you when you log into your ssh and work on your servers or anything if it's time to update then it will tell you alright and now we can do groups and we have the apache group added to the set alright and now we just continue to go on down and we're going to give file and folder permissions to our WWE so that the user and the Apache system can add and remove files within this folder only at will all right so let's see that's it so now you've set it up you set the permission that it would have still worked I mean if you dump up some some files into the HTML the problem is is if you tried to copy anything from here into HTML it probably would have blocked you and said you don't have permissions so we just gave ourselves permissions so if we're looking at a project and let's say just say I want to put a new a new file here and we'll just call it index.html and we'll run html5 for Emmet all right let's squeeze out here and in our body we'll just put up you know just for the sake of because we'll just do hello world all right and we'll save that and now we can literally copy this bring it right into our HTML it pasted all right so we're now we're in there and now if we refresh this because now it has an index file we'll get the hello world so and this is the nice thing about you know webstorm and phpstorm you really do have an integrated environment you're building on the left-hand side your you're uploading on the right-hand side you have this this ecosystem you've got your your terminal at the base which you can do windows terminal systems and you can obviously do the shell terminal out to the actual Linux computer so all of this working together in an ecosystem is really nice in webstorm or phpstorm so and they do a free trial so just go to JetBrains comm or whatever it is and check it out if you're if you're interested in an IDE or if your IDE is is something that's not not completely what you like I know that if you're looking for an IDE I really like the Visual Studio code which is their Visual Studio lite version it's completely free it's open source it's really good it doesn't have all these features it does have a terminal which is really so connecting into a Windows terminal it does have that ability and it has some other things it's got Emmitt and it's got a number of key enhancements it's got intellisense which is you know as you type if you're typing something it gives you suggestions and the closer you get to that suggestion it narrows it down that's and that's what Microsoft originally called intellisense way way back in the day and of course that's what we call it at least I call it now throughout the IDE environment integrated development environments and it's really nice the you can use things like note notebook plus plus or whatever notepad plus plus and it'll get you it'll get the job done but even the best programmers don't remember everything so that intellisense allows us to work a lot faster anyway enough of a plug for webstorm or phpstorm or whatever you're using so so that's it now you've got that whole system up and running PHP is running on the server and we're going to show you here real quick I'm gonna go ahead and shut all that down real quick and bring this up over here and then down here in the terminal let's go back to our instructions tutorial that they provide and we're just gonna echo out a PHP file to the directory to make sure that apache has all the appropriate permissions to write to it because we're gonna use apache to echo out and write PHP to the to the folder so if that failed for some reason then you need to go back and go through the permission set again you know it's cut paste and and see if you missed something because it would mean that we don't have file permissions to write into that folder so now if we refresh that folder we should have the PHP info and if we're looking at the IP address we can then actually type the filename and we'll get the PHP info I and I kick out right there so the complete set up of PHP and and that's it so now you see it now if you're using webstorm or phpstorm and you want to keep this configuration you can oops HTML hit that and then of course in your mappings I say of course then in your mappings hit a forward slash here so it can upload and download otherwise it it doesn't associate the upload and I'll show you what that shows so this is gonna get you to your folder and let's just hit OK I'll show you so now you don't see all that other server stuff right so now you're just in your HTML folder where you would normally work you still have complete access to the entire server simply by backing out here if you want to get to it but for most of us who are just working here we just want to see our main root of our internet-facing folder and I was gonna show you something I can't remember what it was oh ok so so now if I'm using my project over here and I want to upload something I can do the right click and upload to AWS server if that mapping that /i putting the mapping right here if that doesn't exist it can't map automatic uploads because it's missing a forward slash pretty pretty simple stuff but that has to be set to a forward slash so that's why I set that to tabs connection tab this is your primary connection this is gonna be your starting folder your mapping for deployment needs to have that forward slash because it starts off like that right so it can't deploy anything so you just hit that forward slash and you're good to go and then that allows you to just simply if you're uploading an index file and I'll do it here real quick we'll open it up and and just there we go we'll just do that so if I want to deploy that I can just upload that to the AWS server and getting rid of my PHP there you go so there you go now you have a complete server and complete running system and however you upload to your servers whether it's uh you can't use a you can't use FTP unless you actually install the FTP services and that's a completely different subject now you can just look up on the web for AWS and FTP because you need to install that that functionality into your server you'll also need to open up the security ports for FTP so just remember that that stuff as you go through the best way to work with it really for me is is simply using webstorm or phpstorm through the SSH if if you if you find another ide that has this as is at this ssh capability built right into it hey let me know because as of right now this is the only ide that i know that has this ability to jump into a foreign linux server on Windows and it's super nice so if there's other options for other users to use that would be that would be really cool excuse me that would be really cool for me to be able to let them know of other opportunities in that now again like I like I said before we're still using the public facing IP address that would obviously typically want to be changed using a DNS you know you'd buy your URL through whatever I use route 53 again through AWS if we're looking at the services we can go to route 53 and you can find that on the main dashboard or anything else we can open that up and it's DNS management so I mean really domain registration the whole bit so you know if I'm if I'm you know checking to to start up a new domain I'm gonna you know xyz.com obviously and we know that's taken but you can check it and it'll check for you doing the standard who is checked and you know if it's available you can add it to the cart so they give you all the options standard pricing cost you $12 a year that may seem a little bit more expensive than some of the hosting services who either give it to you for free or at a discounted rate though they typically do charge you two to hide the data on the user admin for for the URL which you need to do in almost all cases and that normally costs like nine or ten bucks extra and then all of a sudden you've lost all your discount but and this one does it automatically you know you just you the check boxes automatically checked as you go through so you literally have to uncheck it to have that publicly available it's $12 a year it may seem expensive but the reason that the other services can give it to you cheaper is because they're burying other costs and sliding those numbers around to the actual cost of the server and such so that you're not really benefiting a whole bunch by them giving you a cheaper DNS but it doesn't hurt so if you want to use the DNS from another another company and simply point that that DNS to your to your public of a publicly available IP address that one works fine too all right so I think that gets you covered if you have any questions leave them in the comments below and I'll see if I can answer them the best I can this is kind of a precursor to continuing on with the view courses that I do as we work on the remote hosts because we would need one of these to do a secure SSL HTTP server because one of the things that we're gonna be getting into shortly is going to be the PWA s which are becoming really popular that's personal web applications or professional web applications or whatever you want to name it today it's it's progressive web applications but what we what we're going to be moving to as long as Google and the Internet of Things and everybody is moving in that direction as long as Apple falls along then the PWA architecture should start to take over and be at least equal to the native systems it just depends on where Apple and Google take that system and how far they allow us to go because right now the internet interfaces through Chrome and Safari allow almost the exact same connectable interface to your mobile device as if you were doing it native and then the only advantage of native would be sheer speed and the fact that the system is local to that particular hardware and since you're writing in the hardware of the application instead of through a proxy which would be Chrome or Safari it's gonna be faster but for most people that absolute speed is not necessary in the application we're not talking about lag we're talking about the speed of the actual application so if you're writing a graphic intensive game then you're probably going to want that native if you're writing a interactive database then you don't really care right I mean the PWA is absolutely fine you're not looking to reduce flicker because you're not gonna get any flicker out of your database interface you may get a flicker out of you know trying to create a HTML canvas game and having it work in real time on a an iPhone or a Android phone anyway that's what we're doing we're creating precursors to allow us to create those HTTP remote servers so that our PWA works because service worker and I think some other things require secure socket layer secure services TLS to to work properly you can't actually properly design them on your local computer unless you can simulate an HTTP on your local computer if you know how to do that let me know because I don't know how to do that I only know how to do that on a remote I don't know how to set up a secure certificate on a local Windows server with a web some type of web server short of actually creating a real server anyway I think that's it so if you liked it hey give us a thumbs up thumbs down if you didn't like it and if you didn't like it please let me know why because I'm always trying to improve these improve the hardware just got new audio systems so hopefully that sounds a little bit better running a shotgun mic so it's there's nothing in front of me and obviously improving the resolution to try and make it readable on small of an item as possible we switched to the sixteen by nine resolution a couple couple videos back the aspect ratio of 16:9 and we've dropped the the resolution to 720p so that if you're running 720p or 1440 obviously you should be able to see these with no problem my problem is space and trying to figure out how to how to move everything around in such a tiny space but I'm working it out and it works out so far okay subscribe so you can get the next ones and see what else we've got coming up and like I said we're gonna be moving on to some PW A's I gonna be doing a routing view routing in-depth routing and not just the simple routing but nested nested nested routing so a lot of people have been asking about how the route system works if if you're running you know a primary menu bar and then maybe a secondary menu bar and then maybe you got some widgets you want to be able to switch out so you're running three levels of nesting and and view allows you to just continually nest the route system and it's actually it's it's uh I'd say it's pretty simple but you know do it a couple of times and then it starts to become a little a little more simple but yeah it allows you to do all kinds of stuff like that especially the nested routing which is something I was worried about when I first started because I had ideas of dashboards that had switchable parts in them and not only that of course is a main menu and then a whole ecosystem of menus that would take you to different parts of the site take you to different pages of the site and of course then switch out pieces and parts of the site which is a lot of nesting anyway that's what I plan on getting to next time and hopefully this will hold you over for a couple days until we get to pulling that up thank you guys keep coding subscribe thumbs up thumbs down leave a comment if you have any questions and of course leave a comment if you didn't like it and would like to see something changed again thank you guys keep coding we'll see you next time bye
Info
Channel: RAS Web Design
Views: 24,182
Rating: 4.9213481 out of 5
Keywords: aws, amazon web services, ec2, lamp, stack, linux, apache, mysql, php, free server, aws setup, webstorm, phpstorm
Id: HfnIL5lM8WY
Channel Id: undefined
Length: 89min 31sec (5371 seconds)
Published: Sat Sep 16 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.