Deploying Spring Boot Apps to AWS using Elastic Beanstalk - First 10 Steps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to this course on deploying spring boot applications to the cloud with AWS elastic beanstalk I am Ranga Rao carnem I have more than 20 years of application development experience with a variety of languages like Java Python and JavaScript and a variety of frameworks REST API frameworks like spring boot and front end frameworks like angular react and view I am also an AWS certified solution architect at in 28 minutes we ask ourselves one question every day how do we create more amazing course experiences the success on a variety of platforms including udemy with more than 200,000 learners is a result of this pursuit of excellence we love programming and we believe cloud offers enormous potential to programmers and enterprises we believe that cloud is among the top skills to acquire for Java developers today in this awesome course we will help you get started with Amazon Web Services deploying a variety of Java springboard applications using AWS elastic beanstalk getting started with Amazon Web Services could be tough and a bumpy ride elastic Beanstalk makes the journey to cloud easier in this course will deploy a variety of Springwood applications to AWS will deploy a REST API we will deploy a web application a full stack application using spring boot in the backend and react in the front end we'll also deploy containers created using docker by deploying a variety of Springwood applications you'll learn the basics of Amazon Web Services you will also learn how to deploy applications from the command line using elastic Beanstalk command-line interface will create complex environments including a load balancer and the auto scaling features we will set up a continuous delivery pipeline with AWS code pipeline we expect you to know the basics of Java programming and JavaScript programming some knowledge of react spring boot and JPA would be of great help to do this course you need a AWS account to create which you need a valid debit or credit card will help you install all the tools that you would need for the course the complete source code including the step-by-step details of the course are available on the github repository of the course what are you waiting for let's have some fun deploying spring boot applications to the cloud with elastic beanstalk we had a lot of fun creating this course and we are sure you will have a lot of fun too if you want to learn more go ahead and click the enroll button or you can take a test drive using the free preview feature good luck and I'll see you in the course welcome back in this video let's get quickly started with the course first of all let me congratulate you on making a great choice now let's get started one of the first things that you need to do is to make sure that you bookmark the github repository of this course the github repository of this course is github calm in 28 minutes deploy Springwood AWS EB you can also find the link to the github repository in the resources of this specific video this github repository contains the source code for all the different projects that we will be using during this course we will start with a hollow well-dressed API we will then move on to a to-do REST API which is talking to h2 in memory database after that we will deploy a web application to do web application which is talking to in memory database h2 after that we will be deploying this web application talking to a real database my sequel 0 5 is a full stack application front-end react and Springwood api is in the backend and following that are the containerized application basically we would use docker to build image for the two newest api and deploy the docker image 0 7 is an example for multiple docker containers deployed as a single application we will have a REST API we'll have my sequel database deployed in separate containers and we'll deploy them together to elastic Beanstalk 0 8 is an example for using the eb CLI which stands for elastic beanstalk command-line interface elastic beanstalk also supports something called worker applications 0 9 is an example of a worker application if you do not understand some of the terminology that's cool we will look at all that stuff when we get to those specific applications the github repository also has a section called getting started in this course we assume that you have good idea about docker springs fling boot JPA hibernate react and JWT spring security however if you don't have that experience you can quickly watch this videos and get started with those specific tools you don't really need to watch all the videos right now what will when we get to a specific section we will highlight the videos which might be important for you and at that point you might refer to some of these videos or articles the installation guide contain installation instructions for different tools that we use during this specific course in the first sections of the course we'll use Java Eclipse and embedded moment so if you don't have Java installed or Eclipse installed I recommend you to actually follow these guides and install the right version of Java and eclipse anything greater than Java 8 should be fine and any of the latest versions of Eclipse should be cool when we get to the full stack application you can install NPM and Visual Studio code for enough you can skip that part there are also instructions to help you to troubleshoot down here each of the project folders contain details about the project what are the URLs exposed and also what is the response you might expect the other thing which would also be present is the build artifacts back up so what we'll do in each of these sections is build a jar up and use it to deploy to AWS if you are lazy like me then instead of building this jar you can actually directly make use of the jar directly from the build artifacts back up okay I guess I have bored you enough with all these details make sure that you have Java eight plus and a latest version of Eclipse installed and I'll see you in the next step until then oh my welcome back are you excited to get onto the cloud I am very very excited to get you on your journey to its cloud and the first step is to create an AWS account you need to go to your website aws.amazon.com to be able to create an AWS account you'd need two things one is your personal details including your address the second one is a valid debit or a credit card even though we are going to use a free account for most part of these courses amazon needs your credit card or debit card details so go ahead have them handy and click the create an AWS account link you can also click the create a free account or if you don't see what those buttons you can click something only my account as well and you'd land up on a screen like this or here you need to enter the email address that you'd want to use with your email AWS account and you'd want to give a password for your AWS account and confirm the password as well you can also give a account name for your AWS account so I've entered the email address passwords and also the account name you would want to use once you are done you can go ahead and click the continue button once you click the continue button you should see a contact information page you can either create a professional account which is associated with our organization a company or a personal account which is associated with a person I'll choose a personal account and enter my personal details in here you need to enter your name your phone number choose your country and enter your address as well as your city state and your postal code make sure that you are giving you a real details and also give a valid mobile number because Amazon would use that to verify once you have entered all the details you can check this button to ensure that you are agreeing to all AWS policies you can click that and read through and make sure that you are fine with it you can now go ahead and take create account and continue the next screen you would see is a payment information screen where Amazon asks you for your credit debit card details one of the important things to understand is also the fact that Amazon will not charge you unless you exceed the free tire limits you can get more information about what is in the free tire by clicking this link you can also read the frequently asked questions so go ahead understand what you are getting into and once you are comfortable go ahead and enter your details in here you also need to enter your billing address once you have entered all the details go ahead and click the secure submit button there might be additional screens you would see to make sure that your bank transaction goes perfectly and Amazon is able to do a transaction with your account once your bank transaction goes through successfully a beige one would ask you to confirm your identity it is done by verifying your phone number so enter your details and click contact me once I click contact me a screen with a pin would be shown to you Amazon would call you and you need enter whatever you see on the screen on your phone a few times arabia's might send you a verification code and ask you to enter it on the screen I know it's kind of boring process the initial signup to get on to the cloud is little boring Amazon is giving you access to very powerful servers and they want to be really sure who you are and they have a way to reach you in case there's a problem that's the reason why this sign up process is a little tricky once you're verified you can go ahead and click the continue we'll go with a free tire plan that's the one which we'll choose on the next screen on the next screen you can personalize your experience by selecting a role and also selecting an area you are interested in I would actually close this out and click complete sign up now I can actually sign into the console by clicking the sign into the console in here or clicking my account and going to AWS management console so I'll say sign into the console you would be taken to a screen where you can enter your email address and enter your password then click sign it once you do that you'll log into AWS that's cool that's great you now have an AWS account and let's play with it a lot more in the next step in this step we created our AWS account I know it was a kind of a boring process but this is just a one-time activity that we do and it should not be a problem for us going forward I'll see you in the next step until then bye welcome back in the previous step we created our AWS account in this step let's make our AWS account more secure let's learn about something called I a M and let's learn how to create a I am user and have to use an I am user for all our AWS activities when we first created our AWS account the email ID and the password we use to create is what is called the root user the root user can be used both for the console axis as well as programmatic access to the application the root user has complete access to everything within your AWS account he can even close your AWS account so it is strongly recommended not to use the root user for your day-to-day activities even for the administrative activities it is better to create a different set of users called the I am users Identity and Access Management users so the only thing you should be doing with your root user is to first create an I am user and log down the credentials somewhere secure let's learn how to create a I am user next let's get started enough I am already logged in into the AWS console how do we get into the AWS console you can go to aws.amazon.com and sign into console since I am already logged in it directly takes me into the account lets go to services and type in I am when I type in I am you would see that it says I am and manage user access and encryption keys I click this lets go to I am I am is used to create AWS users assign them to groups and also assign what permissions they have in AWS if I want to assign a permission to a specific user there are two ways I can do that one is directly assign a policy to him directly assign a permission to him the other is to create a group assign the permissions to a group assign the policy to a group and make the user a part of that group what we'll do now is take the second approach we'll create a group and we'll assign a user to that specific group so let's get started let's start with creating a new group I'll call this developers so I'll create a group called developers next step I'll need to give these developers access so what can these developers do how can I do that in AWS we have to attach policies there are a number of predefined policies which are present in here these are called managed policies and these are managed by AWS fair enough I'll give all developers administrator access you can also give them access to billing you can for example AWS lambda is one of these services so you can give full access to a SS lambda what I'll do is I will take a shortcut for now and I'll just give administrator access so they get access to everything now I'll say next step and now I can create the group now we have a group now I would want to actually go back so dashboard we have a group what you would need to do enough we need to create a user how do we create a user what we are doing in here is creating a user for our AWS account I'll say add user on this screen you can enter the ID you'd want for that specific user I'll say in 28 minutes underscore dev as you can see here you can create multiple users at the same time with similar kind of accesses but let's stick with one user for enough next thing you can select is the AWS access type now what is access type typically whenever we talk about performing actions there are two type of users one is people who won't actually log in use the UI and perform actions the other kind of users might be grams so you want to write a program to create some resource in AWS so that's why there are two kinds of accesses which are present programmatic access and AWS management console access what we are doing enough is using the AWS management console access we use the AWS root account logged in and we are manually going through these screens and doing all the action so what I'm doing is I'm giving AWS management console access to this user so this user would be able to log in with his user ID and password and do exactly what we are doing in here so he'll be able login to console and perform all the actions I will also provide programmatic access to this user what does programmatic access LF for example if you have a command line tool AWS CLI it of the CLI is a command line tool where you can run commands and do things with AWS and when you want to use AWS CLI you would want to use programmatic access and there this kind of access type will be really useful we'll talk about programmatic access a little later for enough the important thing is the fact that we are giving this user both types of access so you can use this user credentials for logging into a SS management console as well as through a programmatic means and let's use custom password so I would want to assign a specific password you can also use auto-generated password but let's go with custom and what we can also do is to have the user create a new password when he tries to sign in for me that's not important so I'll uncheck that and let's click Next the next thing is to assign a group so I'll assign a group of developers for this specific user you can assign multiple groups here we have only one group so let's assign just that let's not worry about tags for enough let's go to the review screen where we can see the fact that we acquire a user called into a date and it's underscore deaf we are providing a programmatic and AWS management console access and we are assigning him to a group of developers and let's go ahead and create user so what you would see enough is a success screen so you'd see that we have created a user successfully now I would want to login with this specific user credentials can I go to aws.amazon.com and use that URL to sign in with I am user credentials which we created just enough the answer is no the important thing you need to remember is from now on to login into your account into your AWS account as an I am user you need to use this URL so I have taken this URL copied it I'll log out so I'm signing out of my account and I am pasting the URL which we have copied so let's space that in out go ahead and enter my user ID and password and sign in and now you would see that we are again logged in to our AWS management console in this step we created a I am user and we logged in with the I am user credentials and from now on we'll be using I am user for performing all our activities with our it appears account I'll see you in the next step welcome back before we get our hands dirty let's get a 10000 feet overview of this stuff we would be doing we would be using something called elastic beanstalk to deploy our applications to AWS and AWS is part of something called the cloud why do we need the cloud what is cloud the most important feature of cloud is on-demand resource provisioning let's talk about the good old days where if I need a server I would need to start planning months ahead but with the cloud it's on demand I need it now I place a request I would get the resource that's the most important feature of the cloud on-demand resource provisioning let's think of the use cases let's say I am running an online shopping application Amazon is a very very good example you know that these applications have varying loads through the year on the Thanksgiving they they have very very high load and on other days maybe it's not as much load if you have the data center sitting with you then you need to provision resources that would satisfy the peak load and rest of the year those resources would be sitting idle if you use the cloud then when you have peak load you provision resources and as soon as the peak load is over you would release them consider you are a startup you hope it would be successful but you don't know how successful it would be so should you procure all the resources have them in a data center or should you make use of the cloud and provision resources as and when they are needed as and when you are successful Club is really helpful in a variety of use cases and that takes us to AWS Amazon Web Services AWS is the leading cloud service provider the other two competitors are Azure Microsoft Azure and Google cloud provider or the GCP AWS is not just the first among them but continues to build the leader in terms of the variety of services provided it provides around 90 plus services with a wide variety of features during last decade eldest established itself as reliable secure and also cost-effective we go to cloud for on-demand resource provisioning and AWS is the leading cloud service provider then why elastic Beanstalk we said AWS offers 90-plus services now you'd want to deploy your application to AWS how do you choose which service to use how do you make sure you are following the best practices that's a very difficult thing I'm logged into AWS console and you can see a wide variety of services which are present in here when I expand all services these are the number of services which are present in there making a choice is very very difficult especially when you are getting started with AWS and that's what elastic Beanstalk aims to make easy it helps you get started with the cloud it helps you quickly deploy your application with a very very simple interface elastic Beanstalk helps you to deploy a variety of applications on a variety of platforms you can deploy applications to Tomcat you can run Java applications Python applications nodejs applications and a variety of other apps as well in the subsequent steps will deploy REST API web applications full stack applications container and multi container applications using elastic Beanstalk what are we waiting for let's get started in the next step in this quick step we took a 10,000 feet overview at cloud AWS and elastic Beanstalk I'll see you the next step welcome back are you excited to deploy your first application in the cloud let's get started with that in this specific step and we have elastic beanstalk to help us do that one of the first things I have done is I've logged into the AWS console I've logged in with an IM user in 28 minutes underscore dev the second thing you need to make sure is that you are using the region US East North Virginia we will talk about regions availability zones a little later for enough make sure that you are in US East North Virginia now once we have that out of the way let's get started with elastic Beanstalk you need to go to services and type in elastic bean stock so this is the elastic Beanstalk service that we are looking for you can go ahead and click it once you click it you'd see that a getting started screen would come up all this getting started screen there's a little bit of information about what is the AWS elastic beam stack is all about elastic Beanstalk helps us to deploy monitor and scale and application quickly you would look at all those features in depth a little later for me now what we want to do is we want to create a application how do we create an application you already see a button in here so let's start with creating a new application I will do create new application and I'll give the name of the application as REST API in 28 minutes you can enter a description and tag I'll skip them and just say create so this would actually create a simple application there is nothing deployed yet to create a deployment if you need to create something called an environment so the concept is very simple you have an application and you have multiple environments for that specific application so you can have a dev environment a Q and we're on when the stage environment or a production environment when we create an environment right now by clicking to create one now we would start actually customizing all the things that are related to a and we're on rent now I'm choosing what kind of an application environment I would want you want to deploy a web application or do you want to deploy your batch apple occation if you want to deploy a web application the best option to choose is web server environment if you want to create a batch environment you choose a worker and adornment fair enough let's focus on a web application so let's choose web server and we're on mint and click select the next screen is where you can actually configure what kind of a platform you would want to run your environment so what I would do is I'd choose the environment name I would want to actually give a proper environment Dave name always so I will choose application name - the name of the environment which is - Dave I'll leave the domain name empty I would let Amazon pre configure it for me if you think you would want to try a custom domain enter it in here and click check availability to see if it's available if it's available you can go ahead and use it for now I'll leave it empty I'd not really into a description or anything like that the next thing you can choose is what kind of platform you would want to run this application or is it a java application is it a Python application is it a wire file is it a container and things like that if you think this drop down you'd be able to see the different options you can see docker to deploy your containers if you have multiple containers and you want to deploy them together you can use multiple multi container docker if you have not heard about containers at all don't worry we'll look at it a little later the other options which are present in here are various languages you can see Java Python Ruby Tomcat is an option - in here in this course what we'll focus on is deploying two kind of applications one is web applications using jar files and the other one is web applications using traditional var files if you want to deploy a web application using jar file the option you need to choose is Java if you want to deploy a web application using var file the option you'd need to choose is Tomcat we will choose job offer now so this would be Java version 8 as of today as of love when we are recording this video I would choose a sample application for enough for nobody focuses on elastic Beanstalk so let's use a sample application and click configure more options the configure more options allows us to configure different things about the environment so you can configure environment variables you can configure configuration you'd want with the instances you are running your applications on you can also configure whether you'd want one instance or ten instances and all that stuff in capacity and load balancers come into picture when you have multiple instances you can also configure how you want to do the updates when you deploy a new version how should it be deployed all that stuff can be configured in rolling update and deployments you can configure security you can configure how you'd want to monitor your application and also if you'd want to actually create a database for this specific application for enough let's not worry about all this I'll click previous to go back to the previous screen and I'll say create an environment we'll discuss about all the other options when we get into them a little later for now we are creating a environment and this would actually take a little while so what I would recommend you to do is to take a break get a coffee wait for five minutes and I'll see you in the next step in this step what we did is we started the process of setting up our first environment or deploying our first application in elastic Beanstalk I'll see you in the next step welcome back I hope you had a nice coffee and you're back with all your energy and I hope you were able to successfully create your first and environment if everything worked out fine this is the screen you should see you should see a screen showing health is okay and a lot of stuff around we'll talk about this screen a little later for now if you have a problem if you still see this data screen where it's showing the steps which are being executed then you need to wait until you see a message which is similar to this environment health has transition from pending to okay if you really want to make sure that the screen is getting refreshed one of the things you can do is actually go back so choose the application named REST API in 28 minutes and you can actually check the status in here so if it's not yet created you would see your health status of pending so wait until it's completed if you see a health sit is oh okay that's cool just click it and this is the screen we were on earlier that's cool we have an environment created and you can see that there were a lot of steps which were done to create this environment oh here you'd see the ID for that specific environment and also you would see a URL so I'll open this link in a new tab and you can see that this is the application that we have deployed so our sample application is deployed and we are able to successfully access it right now congratulations on having your first aid obvious elastic beanstalk java application running now I'll close this I will get back to this screen where we are and in this step let's focus on exploring what are the different things that you can see as part of your elastic beanstalk environment control so we are inside a specific environment what are the different things that you can do in here you if you go to the actions tab in here the important actions that you can actually do is restart the application servers you can actually rebuild the environment completely so if you do rebuild anyone when the entire environment would get rebuilt from zero the other option is terminate environment one of the important things that you need to remember is you will be charged when your usage exceeds the free their usage so the best thing that you can do is whenever your AWS session ends so when you are doing this course and you decide to stop the course the first thing that you need to do is terminate all the environments which you have created if you don't terminate the environments and the usage exceeds the feet free tire usage you would get charged for it have a note attached somewhere saying terminate the environments when you stop using the environment so now I'll leave the application running so let's not worry about it the other thing you can do in here as you can see is upload and deploy so you can actually upload a custom application so you can actually choose a jar file and deploy it we'll get to that a little later you can change the configuration of the environment and over here you can see all the recent events if you go to the configuration tab you would see all the configuration options available for configuring the environment so you can actually create environment variables in here you can modify the type of instances which are used to run our application so if I click modify I'll be able to choose the different instance types so make sure that you are sticking to the d2 micro which is kind of the instance which is available on the free tire do not change to any of the other instances each of these instance types comes along with a specific configuration if you want to find the configuration of each of these instances all that you need to do is do a google for 2 T 2 dot micro configuration and you'd get the configuration for each of these T 2 instances so you can see that T 2 dot micro comes with one virtual CPU 1gb of RAM about six CPU credits per R and you can see the pricing for it similar to that you see the other instances as well so you can see that there are a wide variety of instances based on whether their CPU optimize their memory optimized or they are optimized in accessing the hard disk so different types of instances are made available for you you can also configure the monitoring interval so basically how often should cloud watch cloud watch is a monitoring tool how often should cloud watch monitor your application you can leave it at five minutes do not reduce the monitoring interval because that might result in you going out of the free tire you can also configure the hard disk which is associated with it and you can also configure the different security groups we'll talk about security groups a little later the next thing you can also see in here is the logs so if you want to get logs from the application you can actually say request logs last hundred lines and you can see the last hundred lines of log from the application for example this is the log which is present right enough you can also get the full logs so this full logs would download all the logs and it would create a zip and it would make it available for you but now let's not worry about it now the health tab helps you to monitor the health of the application you can see different information about the requests which are coming to the application whether the server is running fine how long it is taking to satisfy the requests and all that fun stuff the monitoring tab can be used to check the performance of the environment you can see CPU utilization what are the number of bytes which are coming in what are the number of bytes which are going out and you can see a graph of everything as well alarms help you to configure if something goes wrong with your application let's not worry about it manager updates will help you to configure hope you do want to update the application when there is a new version of the application so I have a current instance of an application running and their users using that application but I want to deploy a new jar or a bar I don't want the existing users of the application to get affected so I would want to do something well the existing application is active and I would create a new instance of the application and once I am sure that the new instance of the application is working I want to switch to the new version of the application managed updates allows us to do that will configure manage updates a little later and we will see how it works the next tab is events so you can see all the events which happen with the application in here so you can see the fact that there were a lot of things created as well as see the fact that I have pulled logs for anyone maintenance so we did a fetch log so you can see that we did that action in here so events shows all the events which have happened during the lifetime of this environment and you can use tags to identify and name an environment if you have 100 environments if you have a large production environment you might want to use tags to identify the environments of a specific type maybe one of the tags you might give to an environment is it's a dev environment it's a QA environment it's a test environment the idea behind this step was to just give you a quick overview of the different things that you can do in the UI for a specific environment I'll see you in the next step until then welcome back in the previous step we create an elastic Beanstalk application and we created it in a specific region we created it in something called US East North Virginia now what are regions why do we need them one of the things that AWS wants you to specify when you create any resource in AWS for most of the resources is something called this region we had earlier created our elastic Beanstalk application in u.s. East North Virginia what I'll do is enough switch to u.s. East Ohio you'd see that the application that we have created in North Virginia does not exist in Ohio you'd see the same thing whether you go to US West Oregon because we have not done anything in that region as well I come back to us is not Virginia because that's the region where we created the elastic beam stack instances and you can see the fact that there is an instance in here we have elastic beam stack instance running now what are these regions why do you have these kind of regions now if you do a Google for Google global infrastructure Amazon you'd land up on this page where you can see all the details of the infrastructure that has been set up as part of a double years this is a picture which you'd see in here where all the different regions are shown you can see that there are regions in most of the continents and there are some regions which are coming soon as well the reason why we have regions across the world are two main reasons one is performance right so if you have a user in India trying to access your application you'd rather have your servers hosted in Mumbai if you are trying to serve the request from Canada central or if you are search serving the request from let's say somewhere on the u.s. West what would happen the request would be slow so that's one reason why you have regions the second reason why you have so many regions he availability if you have your application only in Mumbai and let's say some natural calamity happen there then your application will not be available one of the options you have is to deploy your application across multiple regions and then your application will be much more available at the time of recording this video amazon has around 21 regions and therefore planning to come soon if you want to get the latest you can go to this URL and you should be able to find more information so the important things for you to remember as far as regions are concerned is when you create most of the amazon resources you would need to choose a region and sometimes I would get complaints from students saying I am NOT able to find my resource the first thing you need to make sure is to go to the region where you created the resource so if you created a resource in US East North Virginia and you are searching for it in US West Oregon you will not find it so make sure that you are using this specific region called North Virginia u.s. is this is also called US East one let's make sure that we use this only for all this stuff in this specific course it is video we learned what is a region how many regions as AWS has across the world and why regions are important regions are important because of two important reasons a performance and B availability I'll see you in the next step until then bye welcome back in the previous steps we created environments with elastic beanstalk and we saw that it was very very easy in this step let's look at some of the things elastic beanstalk does in the background to get the environment up and running the first service we'll start with is ec2 easy to stands for Elastic Compute cloud these are the virtual servers on which our application is deployed once you click it you can see that there is one running instance and that's this specific instance ec2 is basically a web service to obtain virtual resources virtual servers in the cloud easy to support a variety of research configurations you can configure memory CPU storage network capacity and a variety of other things for your virtual servers and ec2 instances are charged by the amount of time they are running so if you keep your ec2 instance running for a long time and you exceed the free tier limits you will be charged you can perform a variety of actions with the ec2 instance for example you can stop reboot terminate these easy to instance directly from here if you go to instant settings the interesting thing is that you can get the system log and also get a screenshot of the instance you can also add monitoring on top of your ec2 instance the most interesting thing in here is the instance type it says t2 dot micro if I do a Google 42 at micro configuration you'd launch up on this page where if you scroll down you can see the details about the t2 in here you can see that it's it has one virtual CPUs 1gb of RAM and how much it costs per hour the interesting thing is T 2 dot micro is currently part of the free tire so for the first 12 months from the time you created your AWS account you get about 750 hours of t2 micro per month for free for the current status I would really recommend you to check the free tire so just do a google search for free tire and you should be able to get the current details of t2 micro free tire but the important thing is these instant types dictates how much CPU how much RAM is available for your ec2 instance if you go to statistics you can see a variety of statistics that are done on this specific instance if you go to monitoring you'll be able to see all the basic metrics which are coming out from Cloud Watch by default basic monitoring is enabled and it shows the CP utilization disk reads discrete operations and all that kind of stuff now if I minimize the instances and the images and I would go to elastic block store and go to volumes you would see that there is one volume of 8gb which is associated with this specific instance if you click here it would take you to the ec2 instance so this is basically the hard disk which is attached with the virtual server so elastic block stores serve the purpose of a typical hard disk on your machine so elastic block store instance is created and attached with your ec2 instance if you go to security groups you would see that there is a security group with the same name as the ec2 instance we will talk about security groups a little later for now the important thing to understand is you can use security groups to configure what kind of traffic is coming into your instance and what kind of traffic is going out of your instance the next thing you would see is an elastic IP you would see that this specific elastic IP is associated with again which instance with the ec2 instance if I click that link it would take me back to the ec2 instance which is created here why do we need a lastik IP the thing is every time you rebuild the elastic Beanstalk and adornment a new IP address new public IP address gets associated with this specific instance you cannot keep giving new URLs to your clients and that's why elastic IP types of provides a static IP address for this environment so even if you restart your ec2 instances even if you rebuild the environment the elastic IP of that environment remains the same in summary and easy to instance can have a public dns name and a public IP address how every time you rebuild an ec2 instance these are refreshed elastic IP helps you to configure a static address the interesting thing about elastic IP is you are charged when you are not using it so if you have an elastic IP which is not connected to any ec2 instance that's when you are charged the great thing is as far as you are using elastic beanstalk to create all these resources will not need to be worried about it as soon as we terminate the elastic beanstalk environment all this stuff would be automatically terminated the other things load balancing and auto scaling will get to them when we create a multi instance load balanced environment in this quick step we looked at some of the things which are happening in the background of elastic Beanstalk we saw have ec2 instance is associated with an elastic block store and elastic IP address and a security group some of the other services used include DNS to map a DNS name to the IP address and also something called s3 which is simple storage service which is where all the code that we are uploading and the different versions of the charge and the VARs are stored we'll talk about all this a little later as well the idea behind this step was to quickly give you overview over happening in the background of elastic Beanstalk there are a lot of things that it does and we are just getting started with understanding it will incur a lot more magic in the next few steps until then welcome back as they say with great power comes great responsibility cloud gives you great power you can provision powerful resources at a click of the mouse however it's your responsibility to know what the cost of the power that cloud is providing you with any step let's look at five recommendations to keep your costs as low as possible number one set billing alerts if you look at the depository of the course there's a video on half you can set billing alerts for your account make sure that you set those building alerts the second thing that we recommend is for the first week that you are making use of cloud monitor the building dashboard every day whenever you are accessing the course the first thing in the day check your billing - would see if you are getting built for anything it's easy to access your billing dashboard all that you need to do is I am logged in to the I am account and I am trying to access my billing dashboard mmm it's going there and it says you don't have permission to access the billing information for this account I log out of this account and go to the root account from the root account we need to give it give a permission sign out sign in again I won't sign in with root let's sign in with the credentials click on internet minutes or your name there and click my account this will open up in a new window and over here you can search for I am this is where you can configure it you can see I am user and role access to billing information you can see that currently the I am user role access to billing information is deactivated but because we will be using the I am role for the most part during the course we would want to enable access to billing because that could be easy what you can do is look at it and say activate I am access and update now you can see that I am role user access to billing information is activated I'll go to I am I'll copy this URL and I will try to go to the I am console I'll sign in with the I am credentials and let's see if we are able to access the D billing dashboard right now good enough you can see that I can see my billing dashboard over here in the billing dashboard one of the important things you can see is what is the frita usage limit what is the service and how much have you used in this month until now you can see that in the first week of recording of this course I got up to 100% for the s3 I haven't really got charged for it yet so I'm not really built for it yet but this is something you need to keep monitoring so make sure that you are monitoring this closely and you are seeing how much you are getting billed for whatever you are using you can see that I have used about 55 percent of my free ARS for Amazon ec2 so that's the second one keep monitoring it every day the third and the most important one is to stop resources when you are not using them I know we come from a background where we procure the servers and in our dev environment skew anyone when staging environments we are not used to stopping them at any point in time you just keep them running all the time but that's not how cloud works cloud is on demand and you are charged for keeping your resources running and therefore you should optimize the use of fewer resources so if there are any easy to instances if there are any relational databases if there are any load balancers anything which is expensive would have them running all the time if you're not using it just stop it and that applies to this course as well if you had bring the course for an R at the end of the hour terminate all environments do not leave them running cloud is here to stay and this is a habit we should develop as a responsible cloud developer the next two things are little hard to do especially when you are getting started with the cloud understanding the free tire understanding the fact that there is a 12 month limit from the time you created your account to most of the things which are there in the free tire and understanding how pricing works for different resources these are little tricky things at the start these are things you'd learn as you go but make sure that you access these two resources the first one is AWS free tire just Google for AWS feet are you'd get onto this page and you can see what are all the things which are part of the free tire the important thing to understand is there are certain things which are only free for the first 12 months of your account and other thing is these rules could change any time so make sure that you look at the rules see what are free for 12 months what are free forever and make sure that your usage is monitored understanding how pricing work for different resources is even more complicated especially when you're getting started you can do a google for AWS pricing and you know end up on this page AWS pricing it's not easy to understand all the pricing because there's a lot of fine print to most of it but just try to get a high level overview of of how pricing works for example ec2 instances are built when you keep them running so the longer you run them the more they would cost you storage might work a little differently for example if you take s3 you'll be billed based on how much amount of storage you are making use of how many gates you are doing how many puts you are doing and all that stuff just spend some time in here to get used to the whole fact because these two things are hard to do things I would recommend you to do is the first three things make sure that you are setting building alerts make sure that you are monitoring it every day and make sure that you are stopping resources when you're not using them building is one of the most difficult topics for somebody who's getting started with the cloud it's something you'd get used to or a period of time make sure that you are there - the first three rules and you would see that you do well over a period of time I'll see you in the next step welcome back in the previous step we were talking about how you can reduce building and one of the important things we said was set building alerts in this step let's look at how you can set building alerts for your AWS account I'm logged in with my I am account in 28 minutes under school dev you can actually do this changes with either the root account or the IM account but as always it's recommended to do these kind of stuff with your I am account I'll click the link in here and I'll go to my billing dashboard and over here inside the building we can set building preferences so what we want to do is we want to receive a PDF invoice by email we would want to receive free tire usage alerts and you would also want to receive billing alerts so I'll do this and say save preferences once you click Save differences the billing alerts feature is enabled but how do we configure the actual billing alert to say ok if the billing goes about this amount I would want to be alerted how can I configure that earlier there was just one option for doing that that was called cloud watch which is what is redirected by this link now there is a new feature called budget as well either you can click the link here and go to cloud watch or we can directly go to cloud watch from here so I can type in cloud watch in services and pick up cloud watch from here cloud watch is basically a monitoring service so you can monitor the AWS services and trigger alarms when something unexpected happens for example if you see that the usage of a specific resource is greater than a specific thing if CPU is used beyond a certain limit all that kind of stuff you can actually configure using cloud watch for now let's restrict ourselves to billing make sure that you are selecting us east North Virginia as the region make sure that you are selecting us is North Virginia and now you can go in and click building you can see that you could get 10 free alarms and thousand free email notifications each month as part of your AWS free tire so let's go ahead and create the a lab so when do we want to get the alarm when the estimated charges over six hours is greater than let's say 0 USD and click Next what should happen when it's greater than 0 USD we would want to actually create email so what I'm saying is we attendance is something called simple notification service this can send our email to us when the cloud watch alarm is triggered so the when the alarm is triggered we would want email to be sent so I'll say building cloud watch alarms topic and the email ID which I would want the billing alerts to be sent to I can say create topic once you do that you might need to validate your email address if you get an email on your email box if you don't that's fine all that you need to do next is to go ahead and click Next now I can give the alarm a name I'll say billing alert I'll say next you can review everything that we have specified in here so what we are saying is when estimated charges is greater than zero send a notification to this specific topic and that would send us an email saying create an alarm and you'd see that we have successfully created an alarm called billing alert the other option to create an alert would be used to use budgets so we can use AWS budgets that's another service which is recently introduced into AWS which is used to monitor your budgets let's create a budget there different types of budgets that we can create let's only worry about the cost for now so cause budget and I'll say monthly cost budget and let's set a fixed amount of $1.00 I cannot use 0 in here so I'll set a fixed amount of $1.00 as the budget including everything and I'll say configure alerts what you want to configure as an alert I'll say send alert based on actual cause then we cross more than 10% of the budgeted amount so as soon as we are spending more than 0.1 $0 want email to be sent I'll configure my email id it went admin's at gmail.com and say confirm budget let's review everything and actually calls are greater than zero point one we actually get a email so let's go ahead and say create so we created a budget with an alert as well with any of the cloud providers it's very very important that you are on top of building that's basically what we are doing we created a couple of alert one using cloud watch the other one using the new budgets feature both these features when there is some amount of building that happens you will be notified immediately I'll see you in the next step welcome back in this step let's download all the projects which applies in time to github repository and setup set them up in your IDE Eclipse if you're using integer then you need to set these projects up one by one so you can import each one of these one project at a time but if you are using Eclipse then you can import almost all these projects at a single go now how do you start downloading the projects all that you need to do is on the github repository go here and say clean or download and say download zip once you click download zip the download of us zip file would start the zip file is about 160 MB so it will take a little while to download so start kick it off and wait for the download to complete make sure that you unzip it to be root so directly unzip it on the C colon or the de colon and not do a subfolder inside I'll launch up Eclipse and choose any workspace on your local machine and say launch I will close the Eclipse welcome page and I will start with saying file input enough you can navigate to import maven most important import maven so we are going to choose existing maven projects all the projects which we have created are maven projects and will import them as maven projects so this is something you need to be extremely careful about and click Next what is it click Next you can choose the directory the root directory containing all the maven projects the great thing about Eclipse is that it allows us to import multiple projects at a go if you are using IntelliJ then you can actually choose one project at a time I would go to browse and browse to the folder where you downloaded your github repository to so this is where I've downloaded my github repository to deploy Springwood AWS EB master at the root directly so you can do something of that kind or you can have if you're on Windows C colon slash that so that's cool now I can see all the nine projects that we are going to use in this specific course I have unchecked eight and nine because let's import to seven first and after that at a later point in time we will create them as needed eight and nine so now be a good import seven different maven projects into our workspace repository I'll say finish this import will take a while if this is the first time you are doing this specific version of spring boot in your local machine its importing all the dependencies related to seven different projects you can wait until all the projects complete importing and you should see something of this kind you might also see zero six and zero seven for this if you don't really see zero 600 zero seven for the to do rest api h2n the to do rest APM is equal projects what you can do is manually rename them right click refactor rename and give it a name so this would be 0 6 h 2 so this will be the container project and the next one will be a refactor rename 0 7 to do rest api my sequel that's cool so we have all the seven projects set up and ready if you have problems importing any of these projects up you can go to the github repository of our course and over here inside the installing playlist there's a troubleshooting video at the end so that's the fourth video which is present it is a troubleshooting video it should help you to troubleshoot any problems that you would face the other resource which is also present is a link to the troubleshooting guide Eclipse and embedded maven so this has solutions to most of the typical problems that you would face whenever you are using embedded maven in Eclipse either you are not using JDK or you are having problems connecting to the resource so our some of the jars might be corrupt so what can you do in different cases so there are solutions for all that on this github repository cool in this specific step we downloaded all the projects that we want to be working on in the next few steps we downloaded REST API is fill stack applications web applications and also containers into our workspace let's look at them and also see how to deploy them into a double yes are you excited about it are you excited to get started with deploying all this stuff to AWS I am very excited to teach you all this stuff I'll see you in the next step until my welcome back in this quick tip video we look at something which might help you to complete the course faster if you are in a hurry we have a number of applications and for each of the applications we follow this life cycle we first set it up on our local machine test it and then we would actually build the artifact on the local machine a jar or a bar and then you take the jar or you are and deploy it to AWS the readme files on each of the projects contains the details of what the application does and what are the URLs available if you are in a hurry you can play the steps where we test them on the local machine and build the artifact at 2x speed for the first four projects we made the build artifacts available so if you go to the build artifacts backup there are jar files and var files which you can directly deploy instead of building them up from zero you can actually pull them out from the build artifacts back up and you can directly deploy it to AWS this thing holds four projects one two three and four as well for the full stack application we actually recommend to run it on your local and then you can deploy it on the AWS server ok that's the quick tip if you are not really in a hurry then don't worry about this you can go ahead at normal pace and focus on understanding each of the applications before you deploy them to AWS I'll see you in the next step welcome back in the previous steps we imported all these projects into Eclipse and we can see all the projects right here starting this step we would want to focus on running these applications on elastic beam stack you can see that there are a variety of applications in here we have REST API is we have web applications and we would want have applications which are talking to the database as well we also have a full stack application in here other than that we also have a containerized application and a multi container application using two containers let's not worry about all that right now let's focus on the first application and see how we can deploy that to elastic beam stack what I'll do is I close all the rest of the projects we would want to focus on 0 1 4 enough so I close all the other projects other than 0 1 and open this up so what is hello world REST API what does it contain this Springwood hello world REST API offers a very very simple hello world rest service if you look at the pound or XML the important thing is that this is packaged as a jar so we are packaging this application as a jar and the other important dependency which is presented here is Springwood starter web so this is used to build REST API with spring boot this application does not really connect to a database or does not have any other dependencies if you look at the package structure all that is present in here is there's a restful web applications class which is just declaring that it is a spring good application and launches the application up if you are familiar with Springwood this should all be a cakewalk right so this is nothing rocket science and the hello world controller has basically a few URLs so you can say that HelloWorld returns a simple piece of text hello world bean it creates an instance of the bean and returns it back and there's a path variable example as well now what we'll do is we'll try and run this application in our local before we build it and try to deploy it on elastic beam stack let's run this right-click Furness java application if you have problems doing it this way the other option option is open this up and you can do right click run as java application either of those ways should bring up your restful application I mean there's basically a hello world restful application nothing big you can see that there is a lot of log coming up and at the end of it it's a starting application cool let's launch up localhost the port which we have configured is 5,000 so if you look at application about properties you'd see that the pour this over dot port that we configured is 5000 this is because elastic beam stack assumes that the application will listen on support 5,000 we can actually change it when we configure elastic Beanstalk but adding any configuration to elastic Beanstalk will take us out of the free tire so I would rather prefer to put server not put directly in application but properties when it is possible so what we have done in here is we are running on volt 5000 so this is not the default 8080 that we are accustomed to with spring boot so I'm typing in local 4 host 5,000 hello world and the other URLs also here hello will be and the last one is hello one with a path variable so let's copy this and put it in here and run this oops I need to actually add a slash in 28 minutes so it's a Sullivan in 28 minutes or your name my name Rangga so these are the three simple hello world rest API is that are present in this particular application what we want to do is we would want to take this application and deploy it on elastic beam stack how do we do that let's look at that in the next step in this step we actually checked that our basic hello world example is working and it's ready I'll see you in the next step until then welcome back in the previous step we looked at the hello world REST API it's just a simple rest IP application you can go to standard spring dot io create a new Springwood application in pulled it into eclipse just add a simple hello world controller and that's what this application would look like there's nothing magical in here in this step let's see how we can actually take this to elastic beam stack we would want to deploy this application to elastic Beanstalk how can we do that what do we need to be able to do that think about it how do I take the application and deploy it on an elastic Beanstalk I would need a deployable unit and as we discussed earlier this project is built to be using a jar so we would be using jar as the deployable unit in here so how do we build a jar for this specific thing you are right you need to just say ambien package right click run as maven build and package you would see that the entire maven build would run so it would start creating the application running it running the tests it would do everything and then it would check if everything is fine at the end if everything is fine then it would create the jar you couldn't see that the tests are succeeded and now it is build success it says building jar and it says the jar is created what is the job that is created let's look at it so the jar that is created is having the name 0 1 springboard HelloWorld rest api zero point zero point one snapshot dot jar you can see that the jar is created in the target folder of the project and this is the job that we would need to pick up and deploy to elastic beanstalk let's look at how to do that in the next step until then bye welcome back in the previous step we ran the hello world arrest API in our local and we have created a jar file in the target folder you would want to deploy this now to AWS Beanstalk how do we do that let's get started now so I am now logged into the management console using the I mid-20s minutes under school dev and now if I would want to actually go ahead and look at the elastic being stack so I'm loading up elastic Beanstalk and over here you can see that I don't see any application the reason why I'm not able to see anything created it's because I have switched my region so make sure that we are in the right region US east north well that's where we need to be the US is no storage Enya and that's when we would see the rest API in 28 minutes application I'll go to the in 28 minutes dev environment so this is what we created earlier earlier we deployed a sample application in here what we'll do now is instruct the sample application we will deploy the jar we created how do we do that you know it's very simple it's you just need to say upload and deploy actually we could have taken the option of creating a new environment for this as well will burn up take the option of updating the existing environment with this version and for a future one you would create a new entry development let's go ahead and say upload and deploy and over here when you try and upload and deploy you can actually upload the file in here right off let's choose file and you need to navigate to the folder where the jar file is created so I'm now getting down to the target and go1 hello world rest api 0.1 snapshot batch are i would say open and now you can choose to deploy you can actually give a version label so I'll give a version label of hello world REST API char zero one so this is hello LSA page are 0 1 so I give that version label to this char and say deploy the version label can be used at a later point in time to retrieve this specific version so let's say I want to deploy in a QA environment what I can do is I can specify this version retrieve the jar and deploy it we will talk about it when we get to application versions for enough the interesting thing is you can see a lot of activity going on in the background you can see that elastic green stock is now updating our and do not mate it's trying to stop the earlier application and deploy the new application so we it's almost like we are deploying a new version of the application so it's trying to deploy that in this might take a little while a couple of minutes and you can see the events which are happening in here you can see that environment update is starting in here and it would go on for a few minutes so if you want to grab a coffee and be back in a couple of minutes go ahead grab a coffee okay cool now I get a message saying and run weight update completed successfully it took about a minute a couple of minutes typically it would take something less than five minutes and now what I can do is I can go to the URL so the URL is right here if I go to the URL you would get a slash error don't worry about this because I have not put the context root yet so if I do hello world that's cool so hello world is present now I can see hello world bean and you can also test the other URLs which are present in here you can see that everything looks perfect if you go to logs and you actually request the logs you can do the request for last hundred lines and you would see that some of the spring boot log will be visible in here so you can see that all the spring boot log is available in here if you really want to get the complete logs I would recommend you to to full locks and get the logs and see what present in there in step we deployed our hello world REST API to elastic Beanstalk we just created a jar and we were able to deploy it and that's all we needed to do to get our application up and running the reason why this is so simple is because we don't really need to connect to anything else we are not creating connecting to a database or we are not having a full stack application or any of that kind of stuff we will get those stuff a little later one of the important things you need to understand is while elastic beanstalk looks simple there is a lot of stuff it's doing in the background think about this where is this application running how are we able to use the URL and able to access the application there are a lot of things which are going on in the background there is a lot of magic behind what elastic Beanstalk does we will take a step by step approach to uncover that magic until the next step you
Info
Channel: in28minutes Cloud, DevOps and Microservices
Views: 39,085
Rating: undefined out of 5
Keywords: amazon web services, cloud computing, in28minutes, spring boot, amazon web service, in28minutes spring boot, aws for beginners, aws elastic beanstalk, spring boot aws, in28minutes tutorial, in28minutes java interview, in28minutes tutorials” in28minutes courses, aws cloud, elastic beanstalk
Id: ueKwBqobijE
Channel Id: undefined
Length: 76min 23sec (4583 seconds)
Published: Tue Jul 30 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.