# AWS Cloud Deployment: Deploy Spring Boot via ECS, ECR & Elastic Beanstalk

## Метаданные

- **Канал:** Telusko
- **YouTube:** https://www.youtube.com/watch?v=ydL5NSrWfAk
- **Дата:** 29.04.2026
- **Длительность:** 1:30:16
- **Просмотры:** 2,979

## Описание

If you've ever built a Spring Boot app and wondered "how do I actually get this thing live on AWS?" this is the video you've been waiting for.

No fluff. No skipped steps. Just one complete, hands-on journey from your local machine to a production-ready cloud deployment.

We cover three of the most widely used AWS deployment strategies in the industry—so by the end, you won't just have a deployed app, you'll understand why each approach exists and when to use it.

Here's what we'll build together:
* AWS Fundamentals — Understand the global infrastructure before diving into services. Concepts first, clicks second.

* Elastic Beanstalk — The quickest way to deploy your Spring Boot app with AWS managing most of the infrastructure.

* Dockerizing Spring Boot — Learn how to containerize your application for portability and consistency.

* Amazon ECR — Securely store, version, and manage your Docker images using AWS’s private container registry.

* Amazon ECS — Scale beyond a single container and understand AWS container orchestration in real-world deployments.

Whether you're a developer stepping into DevOps or someone finally ready to seriously learn AWS deployment, this complete tutorial is designed for you.

Drop a comment if you get stuck—I read every single one.

Check out our courses:

DevOps Bootcamp: https://go.telusko.com/complete-devops
Coupon: TELUSKO10   (10% Discount)

Industry-Ready Spring Boot, React & Gen AI -Live Course : https://go.telusko.com/industry-ready-springboot
Coupon: TELUSKO10   (10% Discount)

Master Java Spring Development : https://go.telusko.com/masterjava
Coupon: TELUSKO10   (10% Discount)

For More Queries WhatsApp or Call on  :  +919008963671

website : https://courses.telusko.com/

Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
TELUSKO Android App : https://go.telusko.com/TELUSKOAPP
TELUSKO IOS App : https://apple.co/3SsgmU2
Discord : https://discord.gg/D8hWe9BqfF

00:00:00 - Why Cloud and What is Cloud Computing
00:11:35 - AWS Free tier Account creation
00:16:10 - AWS Console and IAM Account
00:23:28 - Simple WebApp Project
00:32:33 - Deploying on Elastic Beanstalk
00:40:43 - SpringBoot Project with DB
00:46:32 - Creating Database in AWS RDS
00:55:07 - Deploying app on AWS Beanstalk
01:00:41 - Introduction to ECR
01:06:16 - Configuring AWS CLI
01:10:11 - Creating cluster, task and running task for MySQL
01:20:39 - Pushing The Docker image of app
01:24:40 - Running Java App Tasks

## Содержание

### [0:00](https://www.youtube.com/watch?v=ydL5NSrWfAk) Why Cloud and What is Cloud Computing

Hello everyone, my name is Hyderra Abbas. I welcome you to the series on cloud deployment. Before we understand anything about the deployment, first we need to understand some fundamentals that what exactly is cloud computing? Why we may have to go about this, right? See software development involves many step. Out of all there are two major step number one writing a code. Number two giving life to code. That means deploying the application and maintaining that application. Coming to developing the application or writing the code, we can decide based on the type of application whether it is a static application or a dynamic application. A basic static application in sense using HTML, CSS or JavaScript. Or if you want to develop a dynamic application which gives dynamic a different response to uh different user then we can have the backend and database also backend you can use any technology of your own choice Java spring boot you can go withnet python django nodejs expressjs whatever you want and whichever database you want you can have based on the need of the application right now coming to the giving life to code that means deploying your application Once developer done writing the code, you want to deploy that application so that people can access it. Right? Now when it comes to deploy the application, if you run your application on your local laptop with the help of local host, you can access your application and you can use it. And whatever application we develop, it is not just for us. We developed the application so that people across the globe over inter networking over internet can access our application and use the services which we are providing through our application. And if you deploy your application on your local laptop you can access. Okay. But people across the globe cannot access because for that you need public IP. So whatever you have right now is a private IP. Local host within your laptop where you have developed you can access it. But if you want that to be accessed around the globe, then you have to buy the public IP. Suppose you have bought the public IP and domain name and you have deployed your application in your machine only by installing some of the uh web servers such as Tomcat or GlassFish or any other web server. You have got it and you have deployed you have kept your application on your local laptop. You got the IP address, you got the DNS and you have made it public. People around the globe can access. If so many people are trying to access your application, your laptop cannot you know withhold that. You cannot your laptop cannot manage that traffic right. So if you just play one small game or maybe some game in your laptop it gets heats up and your laptop you know cannot withstand if the traffic increases your laptop may crash your entire system will go down. That's where back then we had something called as physical servers. on premises infrastructure. That means whatever it takes to give our software, our application life, we used to buy and we used to maintain a separate data centers. We call it as on premises infrastructure. Whatever networking needed, whatever servers needed, whatever software needed, the one who manages the entire setup, the administrators, all of that we used to have in our premises or we used to maintain a separate data center. Right? Suppose we have bought one server a huge server with high configuration and we have installed any of the software a web server and we have deployed our application there right that to we have to maintain the security networking we have to manage everything by our own because we have to maintain that in our local on premises right and now if the traffic increases one server cannot take lot of request it may get heat up it may crash cash also we may have to buy more server that means if there is a need if you are putting up some sale and number of people who are trying to access your services you know application if they increases you may have to increase the servers systems one system cannot handle so much of you know request then it is not easy to scale up right buying uh servers all of a sudden is not possible again it takes some time you may have to buy and maybe you are predicting that there will be so much of traffic first only you are making arrangement maybe you have got some 10 15 server so that it can take lacks of traffic or it can manage the traffic very well but the traffic did not turn up the people are not using your application that means whatever the extra 8 10 servers you have got you are wasting the money on this see first of all you may have to spend lot of money to buy all these you know devices and maintaining them right buying the server servers, uh, arranging the networking, taking care of the security, I know having the separate administrators who are taking care of this and maintaining everything by yourself, making sure that the thing is, you know, going wrong, it is a expensive process. And if there is a problem of scaling, it is not so easy. If you buy so many things, if people are not turning up, then it is your loss. If you are making maybe if you have only one or two servers if there are so many people trying to access your application it may crash and you may have to buy more servers. It is not easy all of a sudden to buy the servers and maintaining. So what I'm trying to say is coming to deploying your application if you have on premises your own infrastructure it had it own limitations difficulties associated with it. That's where a concept of cloud computing came into picture where they gave you one option that whatever services you need in order to give life to your application those services those servers you can buy over the internet wherein you need not to maintain anything physically so many companies are there like we have Amazon's AWS Microsoft Azure we have Google cloud Oracle IBM cloud so many cloud providers are there. They told whatever it takes all these servers, networking, security, right? Everything we will take care which is required to give life to your application code which is required for the deployment we will give on internet. We have our dedicated data centers. We have maintained that it is not your headache. If you want to deploy your application, if you want to give a life to your application after the code is written by developer, we will take care of this. All the servers you need, all the security, networking, maintenance, whatever it takes, scaling, if there is a demand of high traffic, you know, whatever it takes, autoscaling, everything, we will take care. You can buy our services over the internet. That's where the cloud computing comes into picture. In simplified terms, it is like you're buying someone's else computer over the network, over internet where they will give you whatever it takes. You can buy the servers there, database there. Every cloud providers gives you hundreds of uh services which is required to make sure that your application is running smoothly based on the use case, based on the demand you have, they will take care of it. And most of the cloud providers works on pay as you go model. That means how muchever you're using, you have to pay only for that. Example, you have got two servers and you have deployed your application there. Right? Now all of a sudden if there is a huge traffic coming up you to your application then automatically number of service no servers will be increased by the cloud providers. We do have an option of uh autoscaling there automatically number of servers will increase to cater the traffic and if all of a sudden traffic goes down then automatically the number of servers will be reduced. Then you have to pay for how much our servers are getting used. Not just about the servers. All the most of the services which are uh provided by the cloud providers they work on pay as you go model. How muchever you are using only that you may have to pay right. So in simplified terms if I have to tell you that if you want to give a life to your code, if you want to deploy your application, whatever infrastructure is needed, whatever service is needed, whatever facilities is needed, in order to give a life to your code, in order to maintain it, in order to manage the traffic, security, networking, all of these services will be given to you via internet by the cloud providers who will take care of all these things and these cloud providers provides different types of services. We have something called as infrastructure as service, platform as a service and then we have software as a service. Coming to infrastructure as a service, whatever infrastructure is needed to run your application, the you know the server, the networking, they will take care. So whatever other things are needed the application code the data and the operating system you have to take care one of the example for this EC2 instance provided by the AWS service where they'll give you the servers you have to decide which operating system you want how much the size you have to decide you have the control and you have to deploy or keep your application code there. will provide you only infrastructure the storage the server which is needed the networking which is needed they will take care and the rest of the things we may have to take care we have some control over it. Now coming to the platform as a service we have to take care of only our application code and application data the operating system the infrastructure the networking the runtime environment which is needed to run our application everything the cloud provider will give you just to take care of your application code your application data rest of all things the cloud provider will give you and coming to the software as a service now entire software itself you'll have all the software which we have these is uh you can say Google meet you can say the zoom meeting where the entire software we are getting it as a whole service we should not take care of anything we are just using the software directly so every company uses the combination of all three infrastructure uh no as a service then we have a platform as a service and uh then we have the software as a service combination of all three services which is provided by the these cloud providers we use in order to make sure that our entire uh company's ecosystem is working right. So buying the services over the internet to make sure that the entire ecosystem of our application is working fine is only called as cloud computing and we have many cloud providers right now. We have IBM cloud, Oracle cloud, we have Amazon's AWS, we have Microsoft Azure. out of all this in this entire series I'm going to follow with AWS which is uh one of the most popularly uh used cloud computing services over the internet and that's what we are going to focus whichever you want based on the need you can go ahead and you can pick that but in this series we are going to go with AWS so first we need to understand how do we create an account in AWS and then we shall see how do we use the services available in the AWS How do we create a

### [11:35](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=695s) AWS Free tier Account creation

free tear account in AWS? For which you can open any of your favorite browser and search for AWS free tier account and we have an option here. The first option please do click on this. It will redirect to this page wherein we have an option here create an account. Please click on this again. It will open a new tab wherein we have to enter few details. Right. So now we have an option. I would like to enter few details here. First the email id. Okay. Let me enter the email id here. I have entered the email id. I would like to give the uh username right and click on verify the email id. It will send you the verification code on your email ID. Please do enter the verification code here. I have entered Sometimes it may go on your spams. Please do check that also. And now click on verify. Right. And after which it'll ask you to give you the password. Please give the password which you can recall. Let me enter my password here. I have entered the password here. Now continue to the next step. I have clicked here again. It will redirect to this page. And we have an option here. Go with the free or paid. You can go with the free. I would like to click on choose the free plan because we are creating a free tier account here. Right. And now it will ask you to enter few details here. It is for the business or personal. I would like to click on personal. And it is asking me to enter my full name. Let me just enter here and fill all the details which it is asking. After you fill all this, you can just click on agree and continue to the next step. Now it'll ask you to enter the billing information wherein you have to enter either credit card or debit card details. You need not to worry autoction will not happen on the free tar account. So if by chance there is some bill and if you have not paid account will be suspended. Auto deduction will not happen. So freely you can enter all the billing details. So let me enter here. After filling the debit or credit card option, you have an option here. Save the card and charge automatically for the future payments. Please don't click that. Okay. You can scroll here and you have an option here. Do you have a PAN? Please click on yes. And you can enter the PAN number here and you may have to upload the PDF of your PAN card that is needed. They'll not be using it for any of the financial deduction but that is required for the billing. So, let me add that here. All this detail is for the India based on the country of uh USA. You can mention the details which is being asked while creating the account. Fine. Now I would like to click on verify and continue. And uh for the authentication of the billing information, it will deduct very small amount. If you are in India, it is 2 rupees and similar if you are in some different regions which you can easily pay. So let me just enter the OTP and proceed further. I'll click on submit and I'll just close this. It will redirect to me a different page and we have an option here confirm your identity. I would like to just say here personal use and ownership type. I would like to just go with the individual here and based on the region of your state you may have to enter that region specific documents which is being asked right for India it may ask PAN card and the other details here and based on your country of stay you can enter that particular details here. All this is for the formality. You can proceed ahead and fill all the required details in order to create this free tier account. After filling the required details, I'll click on continue. Now again it will redirect to one more page wherein we have to verify our identity by entering the mobile phone based on your region of stay. You can enter. You can decide whether you want a text message or wise call. Okay. I would like to just go with the text message and enter my details. Now it is asking me to enter the uh code here. Let me just enter. I have entered the code. Let me click on uh continue here. All right. Now maybe we may have final step or the account will be created. Okay. So it has redirected to this page wherein we have got one message here. Congratulations, we are activating your account which should take a few minutes. You'll receive an email when this is complete. Right? Once you receive the email, you can just click on this and again we have an option of sign into console and we may have to sign in with the required details. Right? Whatever details we have given the email id and password same thing you may have to give and login you'll be able to see the dashboard which you can see on your screen right now how do we create an EC2 instance and how to create a Linux machine and use that for our purpose we shall see going forward now the account is successfully created we can use this free account for our requirement now after creating the

### [16:10](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=970s) AWS Console and IAM Account

AWS account if you logged in your console may look something like this exactly not the same because I have use some of the services. You may not be able to see for the first time if you are logged into your AWS account. I may have some cost and usages because I usually experiment with some of the services though this is not the main account but for some classes or live classes or some of the services we may have to explore. I'm able to see some bills. You may not be able to see the same. These are the services which I have recently visited. Uh since for the first time you're able to log in, you may not be able to see exactly the uh same thing here what I have in front of me. You may have a different console. But what we have logged in is as a root user. Right? Now if you see here top uh you know left side we have all services here. Recently visited all application all services. Okay. And all the recently visited services you can able to see here and we have a concept of all services. AWS supports more than 200 plus services here. Okay. Uh based on your need you can use it. The most often service very often everyone uses is the EC2 which I have already uh bookmarked here. You can see here it is available on the screen also because I have bookmarked here right like the way we have if you want to create your own isolated network we have VPC if you want to work with the uh Kubernetes then we have elastic kubernetes service we have AM we have code build s3 bugget right the bean stack if you want to use uh infrastructure as a service from the AWS then we have to go with the EC2 where they'll take care of networking they'll give you the server you have to decide the operating system you have to set up the environment to run your application which is application runtime. You have to take care of your code and uh platform as a service. We have elastic bean stack. Let me just uh show you this. We have elastic bean stack run and manage your web application. We may have to use some of these services in this entire series. But what I want to show you is like this we have a number of services based on your need you can use it. Out of all the services which we have here uh we are able to login right now as a root user you have the complete access right but in real time we will have a team right development team we'll have a testing devops team every team we will not give this root access to everyone that do whatever you want right that's not the case we have to give the control access to this you know AWS account so every team member of your project may have to use AWS we may have to use the cloud for some reasons. For that we may have to create the users. uh give their own credentials and they should have a control access to this entire AWS account. That's where AM comes into picture. You can say here AM okay manage access to AWS resources. So we have to create the know users. groups. Maybe example we have a development group. In the development there are 10 users testing group uh devops group cloud group we may have to give and the privileges that this particular group how much AWS access should we give how much of the resources of AWS they should be using it so in the real time you'll not be getting the root login to you know root ID to log into your AWS account and use it you'll be getting the AM details AM user details okay so that means you'll be getting the credentials and once you logged in, you'll not have the access to all the resources of AWS. Based on the team you are working on and based on what you you'll be doing with AWS, you'll have a limited resources access because of AM. Right? So here we have user group. So I'll create one group here by the name maybe uh development. Let me just create here. Whatever group you want, you can create. I'll say here maybe dev team. Okay, dev team. And that's the name I have given here. And do you want to add any users? Right now there is no access and what permissions based on the need you can specify which permission you have. Example I want to give EC2 full access or see Amazon EC2 that means they can use only EC2. Whatever access you want you can give. For now uh since we are here for the learning purpose I would like to give the complete administrator access and I have created this uh group here with the admin access. Now I'll create some users here. You can create any number of users and add that to a group. So maybe I'll give the first user here called as hush and provide the user to AWS management console. Yes, please give this and I want to give a custom generated password. So let me just give some custom generated uh password here. Okay, I would like to give this and uh all right so fine I would like to just see here user must create a new password at the next sign in. So for this hush I'll tell you hush look this is your username this is your password please log into the AWS account with the AM details they'll be able to log to the AWS account and they will have an option to change the password of their own choice so for this you can create this for the first time when the hush will log in he'll have an option to change the password if you uncheck this same password hush has to use which I am giving here okay it's up to hers so I would like to ask my hers you can change if you want you have to click as a admin of the entire account. If you are going to create the multiple users, you can ask them to change it. So I'll keep it unchecked because I want to login by myself as a hers here. Okay. So which group they belong to this uh dev group. So I would like to say next and create the user. Likewise you can create any number of users. This is the console uh URL. Okay. And this is the username password. Likewise you can create any number of groups and in that group you can add n number of users. What I'm trying to say is generally in the real time we don't log to our company's AWS account as a root user. We will be given AM username and password and once we log into our AWS account we will have the limited access. So based on what is our work in AWS our manager will decide and uh we will be given the credentials. If I log in only that many services I can use in my AWS account. So generally we log into our AWS as a user. Right now whatever group and user I have created I have given the entire administer and administrator access but in the uh company based on your need they may give you a specific access. Okay. So I would like to just uh return to the user we have this many users. Now I would like to log out to my account. I've logged into your account. The moment I say sign in so I'll be getting this page. Okay. So account ID default it will give you an option. Now uh the username is hush. I'll give the password as a IMC here IM user sign in. Okay. So I'll give the password which I have used this and now I would like to login into uh this thing. Okay. As a hush I'm able to login. So this is my account as a hush. See here current cost and usage I don't have the access of this because I have a limited access whatever I want. Administrate access I have for most of the services. However I don't have the root privilege where I can do everything with this account. Right? So now as a user I have logged in. Now I have to perform whatever operation we want as an IM user only. Now let's develop a basic

### [23:28](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=1408s) Simple WebApp Project

Spring Boot Maven web application which I would like to deploy in the AWS elastic bean stack. So I would like to just search here elastic bean stack. Okay. So here is where I want to deploy the application by using this platform as a service which is the elastic bean stack end toend web application management. Right. So I would like to use the spring boot here in order to develop this basic uh web application to start with. So it is Java. I have opened the startspring. io spring initializer irrespective of the ID you have. Uh you can develop the project here. You can create the project here and then you can use any IDE of your own choice. Okay. So now it is a Java Maven. I would like to use a spring boot stable version and let the package be com. telescope and the application name I would like to just give it as maybe sample web application that's the name I have given here any name of your own choice so that should not create a no problem packaging as the jar uh configuration application. properties properties Java 17 I want to use and only one dependency which is a web dependency based on the need of application you can add any dependencies but to start with it is a simple uh web project so I would like to just add only web part here now let me just generate this project and I'll open the Eclipse IDE now the project will be available on my download downloads I'll just take that and add uh in the directory where I have opened the Eclipse which is Java SB and I will extract the project there. Once you extract the project using the Eclipse ID, I will import the existing Maven project. Let me do that. Import that here. I'm using Eclipse ID, you can open the project in any IDE of your choice. It should not be a problem. Whichever ID you're already comfortable with. Okay. So now I would like to just import this import the existing Maven project. I may have to navigate to the path. So it is Java uh no SB. And we do have one application just now which we have created. out of all the applications it is the let me just uh show you this sample web application okay and now I would like to say finish the project will be imported within no time it will take some time and the entire project structure is in front of us you can see in the dependencies uh right now we have only one dependency which is the web dependency right so now it's a basic application I would like to just go back here and uh create maybe one package by the name uh controller I will say here controller that's the package and let me create one rest controller whichever is the name of the class you want you can create so maybe I'll just give it as u telesco controller whatever name uh you want you can give it and everyone knows people at least who are watching this they should be knowing the basics of uh spring boot so I would like to just add here maybe rest controller okay I'm just going to generate the response here and uh maybe let me just create one response for the homepage. I will see here uh maybe method name as home return type let it be a string right so anyone getting into maybe I'll just say here a basic application a basic message I will say maybe welcome to telesco learning okay that's what I have told here and I'll map this entire information to a get request by using get mapping annotation I have kept in mind people who are watching this they know the spring boot That's what in my mind and now I'll just uh give the endpoint which is default. This is the home. Okay, for the first time people visiting the application by default they'll be getting it as welcome to telescope. And similarly I would like to develop one more response. Maybe I'll just say here uh get info. That's the name. I'll say here get information and I will say here information is the end point and um I will say maybe whatever message you want visit telesco. com for courses information okay great so I have created two API methods one is the home one is if uh the end user reaches out to the info since they are binded to a get request after running this application We can check it in the local host also. Okay. So first before I do anything I would like to run this application. Okay. This is a sample application. Let me say right click. I will say here uh run as the Java or Spring Boot application. So by default Spring Boot application gets deployed in 8080 port number. That's a default port number for any Spring Boot web application which will be deployed in embedded Tomcat server which is already available in the Spring Boot. Since it is a spring boot project, you need not to do any extra efforts. The moment you run the spring boot application, by default, it gets deployed in embedded Tomcat server with the port number 8080. So that's what I have done here. So let me open the browser or you can open the postman tool also not a problem but I would like to open the browser here and I will navigate. Let me do that here. As you can see I have navigated localhost 8080 homepage. We are getting welcome to telescope. And if I reach out to maybe our endpoint which we have created info. So we have visit telescope. com for courses information. So basically a simple web application is ready. Now I want to deploy this in elastic bean stack. But if before I do this I want to package this application into jar file. Different ids different options we have in Eclipse ID. the way we have to run the Maven goal commands in order to generate the jar file or V file is slightly different with respect to UI maybe in the intellig ID is slightly different but both the ids it is possible to generate the uh jar file right so now I would like to generate the uh jar file here for which before even I do this let me also specify the port number the default port number on which the spring boot application works is 80080 but I want to change it to server port equals to 5,000 because 8080 port number by default uh you know the family of 80 80080 and all the 80 family will be somewhere getting used in the elastic bean stack. Since we have a plan of deploying this application inside that service of our AWS so it is expecting us to give a specific family port number for which I'm giving it as 5,000 as the port number. or you can give any other also but I have given here 5,000 because I have a plan of using a specific AWS service in order to deploy the application which can work for us right so this is the port number I have given after giving the port number you can just go to the application all right I'll say right click and we have an option of run as maven build directly we have an option here and it is asking me to give the maven goals which I want to run clean if there is already jar file generated please delete that and the package it will do the compilation running the test cases all the Maven goals before package that will be executed without any problem okay so clean package now I would like to say apply and uh run here let me just check yes it is running it is creating see build is uh successful and you can see here if I refresh my project I'll say right click and let me just refresh my project and we have here target folder getting created So target folder is created and one jar file is also generated with snapshot version everything. If you don't want this if you want to give only name that is also possible. So for which what you may have to do is if you don't want to generate this you want to clean this again. So you can open your pom. xml file which we have here and if you just scroll down within this build you may have to specify what should be the name. So let me just add this here. As you can see I have added here. This is the name I want for the jar file. So after adding this I'll say right click and update the Maven update the project. I would like to update this. It has been updated. Let me save this again. I'll just go back here. I'll say run as the Maven build and the goals which I want to execute is clean. I want to clean the existing jar file which is generated. And we have an option of package right apply. And I'll say run here. And the moment I do this again the jar file has to be generated. All right. It is building and the build is successful right. So let me just refresh my project. If I say refreshed uh we can see here we have jar inside the target directory got uh created left side you can see here and we have here option of simple application. jar and this jar we can use in order to deploy the application. There are multiple options available. You can dockerize you can generate the v file jar file. Based on that you can deploy. How do we uh do that in the AWS elastic bean stack? We may have to see that. Now let's deploy

### [32:33](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=1953s) Deploying on Elastic Beanstalk

the simple web application which we have created. We have already generated the jar file and the same we may have to just deploy and I'm going to use this platform as a service which is Amazon elastic bean stack. Okay. So I have opened this and we have an option of create application. Uh you can keep it web server environment. Give the name of the application whatever you would like to give. I'll just give it as maybe simple application that's the name I would like to give right or maybe I'll say here simple application okay now domain name if you want you can uh give it if not it'll autogenerate at the time of generating the URL so I would like to keep it default and we have an option of platform here which platform you would like to go with right so we have multiple you can go with docker and we have an option of you can see Tomcat if you had generated the v file of the project which we have created Then you have to choose Tomcat. Since we have generated the jar file, you have to go and uh choose this uh Java. I have clicked it. Okay. By default, it has selected some of the platform and the platform version. Let it be uh you don't uh change that. Okay. Then we have an option here application code sample application which maybe elastic bean stack only will you know give you or I would like to upload your own code or you would like to go with your own code. Since we have already generated the jar file and we have developed the application. So I would like to just click on upload your code here. Right now you have an option here. So you would like to upload the code from the public S3 URL S3 buckets. Maybe if you have already uploaded your code there from there directly you can add if not from the local file. I have not done that. I have not created any S3 buckets. We have not added any project there. So I would like to just click on local file and I would like to just maybe version label it asking let's go with v1 choose the file I have to just select the jar file which is available here. Okay so now let me just go back here uh we have an option of u you know uh java sb here is the workspace and here we had an option of sample web application. Okay. So the sample web application the name. So let me just uh check this. What is the name we had given? It was sample web application. Okay. So let me just open this. I think it is sample web application. Okay. Create uh the same. So let me select this sample web application. And if I open this we have a target directory. Inside the target directory we have this jar file. This jar file we may have to select. Open this. And the jar file has been selected. Okay. Now what is the preset you want? You want high availability. That means the type of instance. How many instances? Since it is for the demonstration demo purpose, I would like to go with single instance which is free tier eligible. So let me just click on next. The moment I click on next, it will redirect to this page. Uh service role. Do you want to create it or choose one? So I would just create one, a new role. Okay. So it will create its own role. So let me just check where we have. We are in this uh Pacific. So it's globally. So let me just go back here. All right. I'll just say here next and next. A new role has been created guys. I'll say here create the role. And the same role I would like to select here. Right. So if I refresh the role has been created. It has been selected by default. EC2 instance profile. It is asking. Okay. So what is the profile? See other roles are there. we may have to give the authority like what which services it can use. So I'll just again click on create a role here a new role I want to create a you know u AWS services. So use case okay you can go with EC2 also behind the scene also anyway it'll use EC2 only and I'll say here next and uh I'll give administrator access. It is not recommended to give administrator access to everything but I wanted to make it work and it is not in the production. So no issues. Apart from that I would like to also give administrator access for AWS elastic bean stack and maybe web tier uh worker tier service uh role SNS. Okay. And uh maybe RDS if in case if it is required in future ECS if you want to use it. uh even if you go with only one access also it is more than sufficient okay so I would like to add this and uh role name it is asking me AWS EC2 role okay let it be I'll say here create and the role has been created here okay let me just go back and if I have to refresh this we do have an option of uh you can see AWS beanstack EC2 role okay keep pair if just in case if you want to log into the EC2 instance which it is getting created See behind the scene elastic bean stack uses EC2 only. EC2 is infrastructure as a service a server will be created because we have given the single instance free tar. So to get connected just in case do you want to create any key pair do you want to select it? It is what it is asking. So I don't want to get connected even if you don't select I have created so many key pairs in my AWS account for different purposes. Even if you don't select here, it is not a problem because anywhere we are not getting connected to that uh you know uh EC2 machine for now. So I'll say here if you want you can just go and say next for now nothing much is needed. You can just click on skip to review. Let me see next what options we will have. All right VPC and all is asking let me just go with skip to review because we don't have much here to do it. Okay and you can see uh we do have an option. All right. Uh which one it is choosing? Single instance. It is going with instance type T3. micro and T3. Because we have gone with the free T eligible, right? So that's the reason for this. Okay. Now I would like to just click on create and the moment I create it'll take some time. Uh we'll be getting the URL also. You can see here elastic bean stack is uh launching your environment. This will take a few minutes. and events also you can see here it is giving you the logs each and every second what exactly is happening it is giving you the locks info okay if you keep on refreshing you'll be getting uh so many locks and it'll take some time and your application will be ready you'll be getting the domain here URL using which you can access the application so let's wait for some time uh to for the domain to be generated for the URL to be generated as you can see the URL has been given if you want you can just click on this okay so creating the environment started. Okay. Successfully launched the environment. All right. Uh instance also has been added. So it is okay. And I just have to click on this URL. The moment I click this, I should be able to access the application. So let me just click here. As you can see, welcome to telescope learning. That was the basic application, right? We tried to access. Let me just reach out to the another endpoint which we had created here info and you can see visit telescope. com for the courses information. Basically uh we could able to deploy the very basic Spring Boot Maven application into AWS by using uh elastic bean stack. Not just that I would like to also show you EC2. We have not created any instances, right? We had just used elastic bean stack. It will create the instances on the R half. We should not be taking care of infrastructure because elastic bean stack comes under platform as a service where it'll take care of everything and it'll give you a readymate option just to upload your code. So let me just show you this. See this instances we have not created simple app environment. You can see on your screen this was created behind the scene by elastic bean stack. Right? We have not created this. So if I have to just get back here. So elastic bin stock and we have an option here. This is the application uh which is executing and this is the domain and we could able to also access the application here without any problem. You can see here welcome to telesco learning. So this was our uh first application which we could able to deploy. So far what we have seen is that

### [40:43](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=2443s) SpringBoot Project with DB

we could able to build a basic spring boot web application and that we could able to uh successfully deploy with elastic bean stock. Right? We just generated a jar file and simply we uploaded the jar file because elastic beantock comes under platform as a service. It will take care of a rest of the things. But that was just a simple application. It was a single tier application. We did not had any database there. Right? So what if there is an application which also has database. How do we do that? That's what we may have to see here. Suppose if it is in your local machine, you have installed the required softwares maybe Java IDE. You have developed the application and in your local machine only you have installed the database and you could able to get connected to that uh no database and you can run the application but this time you want to deploy that in AWS. How do you do that? Can we just generate a jar of our project like the way we have done earlier and deploy that in the elastic bean stock and can that get connected to the database which is locally there in our system? The answer is no. Then what we may have to do? We may have to go with one of the service in the AWS which is RDS using which you can create one relational database on the AWS itself. So we may have to just first create the database on the AWS. All the credentials we may have to add in the application configuration file right different ways you can maintain differently depends on what text tax you're using. If you're going with the Kubernetes you can go with the config maps in the genkins also we have an option of maintaining the secrets. If not, if it is a simple application, you can just add those configuration, the database URL, uh the password, everything on your application. properties and you can create jar of this. Once you deploy that application will be able to get connected to the RDS which you're creating on the you know AWS. How do we achieve that? We will see this. But before this what application I'm going to deploy which has the database I would like to just quickly give you a walk through. I have kept in mind that people who are watching this entire video they already know the spring boot they are exposed to the coding because this is the last part we are seeing here cloud deployment part here right so I'll keep in mind that you have already uh seen the development you are aware of the spring boot that's what I have kept in mind and I would like to just quickly give you the walk through of the code what I'm doing with this code you can do with the same projects which you have done throughout your spring boot journey right so this is our simple application so if I have to give you the walk through on the pom. xml XML we have the dependencies here leaf for the front end and data jpa we have web to create the APIs this is a theme leaf and dev tools for auto roll no uh reloading and I would like to go with the mysql here that also we have okay now if I have to give you the controller these are the endpoints we have I'm giving the walkthrough I'm not developing the application because I have kept in mind that you already know the development right so this is uh one of the endpoint which will give you the list of all the courses if you want to update register a new course right if you want to delete the course so we have multiple options in this application I'll just show you the output also this is the model class uh entity class which is going to get uh connected or it is representing the table of database I would like to say that and this is our repository layer in the spring boot if you're going the data JPA I would like to go with cred repository right and this is our business logic the service which is getting connected to database and performing some activity right so front end we are using here theme lift the back end uh it's of course spring boot and uh we are getting connected to MySQL database I hope you will be uh you know able to understand this code here because nothing uh know much we have done here it's a very basic application even if you know uh the basics of spring boot or you can say you know the entire all the layers how we develop in the spring boot ecosystem now let me just show you the output how it looks like in my local setup where we have database connected here itself and spring boot uh spring boot application is also on the local machine you can see in the application. properties if I have to open application. properties properties. Uh see here I'm getting connected to local host. Okay, this is the username of my database on my local machine and this is the password which I would like to use to get connected and it is a local host right in the local setup. I would like to just show you the application output. So let me just run this here. I'll say run as spring boot application. All right. So it is getting executed and it's getting deployed in 8080. Once you're going to use the elastic bean stock, you may have to change it to the family of 5,000. I'll do that before we generate the uh jar file. So let me just go back to my browser and try to access this. So let me open the browser here. All right, you can see we do have this browser and if you reach out to 800800800 local host course list is the endpoint of the application resource. See here we are getting this output. If you want you can add a new course here. Let's just add the new course. I'll just say here uh dev ops and uh whatever the maybe and I'll say here the name of the instructors and we do have the uh duration maybe I'll say here 100 hours and some fees randomly I will just write save the course and you can see we could able to get this I hope you are able to understand if you want you can update if you want you can delete all the operations that means we do have an application which is getting connected to database and able to perform the operation a very basic application Same I would like to deploy with the elastic bean stock which we have already used but to deploy a simple application this time it is a multi-ter application for which first what we may have to do is to create the database on the cloud itself and that credentials we may have to add in the application dot properties here we may have to update after which we may have to generate the jar of this and then we may have to deploy how do we do that we may have to see now let's create

### [46:32](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=2792s) Creating Database in AWS RDS

the database on AWS right I have logged into my AWS as a user like the way we have done earlier and here you can just search for RDS right we have an option of Aurora and RDS and here you can just navigate to the left we have an option of databases here is where we may have to create it right so now uh I'll just click on the option of create database uh full configuration easy create anything is fine let's go with the full configuration my SQL database I would like to choose here and let it be the default addition the version let it be default and here it is option uh is it for production uh it is for testing and development it is for the sandbox very basic so I would like to just go with the dev or testing and let me just use either single abb instance or multi-AZB instance uh multiple is not required a cluster is not required here because it is for the testing this is more than sufficient two instances even if you go with this uh that will also not create any problem. So DB instance identifier let's keep it uh as it is database one or maybe if you want we can just give a different name it should not create a major problem master username admin I would like to keep it as it is password sales manage so let me give my password which can be managed easily I'll just give here okay and I have given the password here password authentication keep it as it is and uh Now let's go with this bustable classes. This basic is more than sufficient here because it is a simple application. And allocated storage I think 20 GB is more than sufficient. 200 is not needed. Right now uh connectivity you can see I don't connect to EC2 that's fine. Default VPC if you want you can create your own VPC. security groups subnets and then create it. If in case you are going to deploy that using uh you know AWS EKS okay and then you're using docker AWS EKS which is Kubernetes cluster then all of them have to be in the same uh you know VPC. So since we are not doing that here I would like to go with the default VPC which is already available which will be there in every new AWS account you're creating by default on VPC will be there which is isolated network. Right now, public access. This is very important. You may have to check on yes. We may have to go with this uh public access. I have clicked yes. Existing uh security group. Let it be the existing one. Whatever we already have here. And uh I don't want to have any monitoring. I would like to disable that. Okay. And I don't want to have any backup also. It's not required. So with this I would like to just go and uh click here. Okay. So enable enhance metrics when you see different uh process threads I use this CPU. If you want you can enable this will not create problem even if you disable it should not create a major problem. Okay so now I have selected the required make I have made it public because I want uh to get connected to this database. Okay. So it is for the testing. It's not like we are doing in one VPC where we are using Kubernetes for the deployment and in that case you can go with uh no here in the production but right now I would like to go with the yes right so now let me just create uh the database it will take some time and the database will be ready here okay so let me just disable and uh it'll take some time after that the database will be ready let's wait for that some time you can see the database is created It takes some time and your DB will be ready. You just have to click here and there are multiple ways to get connected. We have an option of endpoint and here we have the endpoint. Okay, you can just click on this. I would like to open my SQL workbench a client machine to get connected to this database. Okay. So for which I'll just say here new connection. Name of the connection let's it be AWS RDS. Whatever name you want you can give it. And the host name the endpoint you may have to add here. The username I mean the master username is admin. That's what I had given. And the password we may have to store in vault and I would like to give the password which I have used at the time of creating that. Okay. So now I'll say okay. And let me just click on okay. Hopefully, we should be in a position to get connected to this. Let me just click on this. And uh if I click this, I'm getting one warning here. Uh it's some of the features are incompatible. That's fine. I'll say continue anyway. And I could able to get into the database. This is a client. The database is not on my local machine. We have created on the AWS cloud. And we are just using one of the client MySQL editor to get connected to the MySQL which we have created on the AWS cloud. Okay. Now let me just create one database here. I'll say create database. Database name of this I would like to give it as whatever you want. Maybe let's go with Terisco DB. All right. And let me just run this query. And if I refresh our database is ready here. Okay. So this is the name I have to give to my application. Uh let me just see if I could able to get connected. This is our application application. properties and the database name is Tisco DB. So I would like to give the name of the database is telesco db that's the name and what is the endpoint we may have to specify here this can be managed uh if you're going with kubernetes we have a config map and secrets there if you're going with genkins at the time of deploying your cicd pipeline there also we have an option of maintaining the secrets and credentials we have an option there but right now I would like to do it in my application. properties properties only because we have not seen uh those topics. Okay. So here only I would like to add the endpoint of my database I have added and the username is admin and the password it's not recommended to add the password directly here in the production either you have to go with Kubernetes config maps and secrets or you can go with the genkins secrets also okay or multiple other options are available. I would like to just uh save this application. Now I would like to just run this. Okay. So let me just run this run as uh Java Spring Boot application and uh it is running. I hope there will be no problem here. Fingers crossed. And uh seems like no problem. Let me just see here. Okay, it is starting. All right. What is the name of the DB? Is it telescope DB which we have created? I think it is telescope DB only. No problem there. And um again yes it is ready and the application it is starting guys. You can see one by one. It is taking some time. Uh we have got some errors here. Communication link failure. Let me just see what is the error. I think the database name is also correct which we have given there as uh DB. So that should not create any problem. admin and this is the password which we have given uh the time of we creating the uh database. I think this is also we have given rightly and let me just go back and add in my application here is where we have to get connected because we could able to get corrected there right so let me just save this and uh again we have an issue let me just rerun the application once again I'll say right click and run as the spring boot application the Java application right it is getting connected so Yes, it is fine now. There is no problem and it is able to insert some default I mean you can see creation of table and all it is working fine. Let's try to access the application the same localhost application which we had here and I would like to just uh refresh to this and uh yes we could able to add our applic I mean we could able to get connected to our application. Let's try to add some data here. Okay, I'll say Java name of the trainer, some duration I would like to give and some fees I would like to enter here. Right, I'll say save the course and you can see we could able to do this. So now application is locally available on our machine and database is on AWS and we could able to establish the connection. Now what we may have to do is we may have to generate a jar file of our application and that application we may have to deploy using elastic bean stock. Let's do that. The database is created

### [55:07](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=3307s) Deploying app on AWS Beanstalk

on the cloud and we could able to get connected to that database from our application by running locally. Now we have to get our application also onto the cloud. In other words, we may have to deploy our application using elastic beanto for which I would like to open the elastic beanto. If not you can just search here you'll be able to open this. Earlier also we have done this in this series. Right now create the application and we will have an option here. Do the same steps what we have done earlier. web server name of the application. I would like to just give it as maybe uh Tellesco application. And then it is asking to give the name uh let it be by default Tiscoco app environment. Domain I would like to keep it as it is. And the platform I would like to run the Java. So it is Java. Jar file is what I would like to run. Uh if you are running the V file then you may have to go with the uh Tomcat here. So sample application are we going to upload our own code? We are code here. Right. So version will be v1. It's not there on the S3. We may have to upload locally. We may have to choose the file. But the file is not generated. Let me open this. Uh before I do anything, I would like to change the port number for elastic bean stock to 5,000. This application will listen to the 5,000 port number. And alongside that pom. xml, here is where I would like to also add the name of my jar file. So let me just add that. As you can see, I have added this course app. jar jar will be the final jar which will be generated. So let me just update my uh package here. I'll say here the pom. xml I would like to update the entire project and now everything will be updated right. So now I would like to know get into my project. Right click we have an option here run as maven build and what is a build you would like to execute. Of course it is clean. If there is already a target directory jar file, clean that and compile, test and package a jar file. Right? So now I would like to say apply and run. Let's see. Hopefully the jar file will be generated. It'll take some time. It is compiling, running the test cases and u then finally we should be having the uh jar file here. Okay, build is successful. And if I refresh the project, I'll say right click and refresh this project. We have target directory and then we have course app dot jar which we may have to upload there. So let me get back to my AWS upload your code version is v1 and I would like to just choose the file here. Okay. So it is maybe D drive and in the D drive uh wherever my Eclipse ID is open there is where my project is also. So name of the project is course application and here we have an option okay the target directory within this we have this course app jar course application dot jar file and uh let me just open this you can see here file has been added okay now single instance free tier eligible that's more than sufficient next I would like to click on next and uh service role I think uh if you could able to recall earlier also we have done that by that time we had created a new role. I would like to use the same role which has been already created. Okay. Uh so I think we have uh same role. This is the role which we have created earlier for the first time when we have used elastic beantock to deploy our basic web application. Okay. Now this is not required. I'm not going to get connected to the instances which this service will use behind the scene. So I will say here next or you can just uh get into skip to review. Okay. Even if you want you can just select to next and uh again which VPC you want. I would like to keep everything uh default. Okay, whatever default VPC we have available. I would like to just choose the same and uh skip to review. And finally we have an option here. Some errors are there. What is the problem? Invalid null space. Specify the subnets for the VPC. Okay. So let me just keep it normal and skip to review without selecting this. And now I would like to just say here create this. Let's see if it is getting created. And the moment I have clicked on create, it is creating. It will take some time as we have seen earlier also. Let's wait and see if you could able to access the application. So our database is already on AWS, right? And now we are deploying our application also in AWS. It is using a different service elastic bin stock and we have database RDS and whether they can work together is what we have to see. So let's wait for some time and see if you could able to access. As you can see the application is successfully deployed. The environment is created and we have already got the domain here. I would like to just click on the domain here and uh of course we have endpoints here. directly you cannot access the course list is the endpoint to access the resource. I will just say here course list and the moment I hit this I'm able to access the application right now if you want you can add uh new course you can do whatever you want maybe devops and I would like to give the instructor's names maybe it is uh 100 hours okay and maybe some pricing also I will add randomly okay save the course and you can see we could able to get this here so we have our application running on AWS and also our database in the AWS is both of them are able to communicate with each other. Fine. Till

### [1:00:41](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=3641s) Introduction to ECR

this point we were able to deploy our application on AWS using elastic beanto. So what we have done is we created the database uh using RDS that URL we have updated in our application. properties the configuration file and then we generated the jar file and we have updated that using elastic beanto we have uploaded there and we could able to deploy and we are able to access the application right. So generally what happens is we don't just generate a jar file and upload right so we use the concept of containerization in docker you might have already learned the concept of containers so what we may have to do is instead of running our application by generating a jar file and then know uploading just a jar file we may have to run that inside the containers now coming to containers in AWS we have multiple options we have an option of uh EKS which is kubernetes service and also we have an option of elastic container service which is ECS right two options we have uh in production most often people might use the uh Amazon's EKS which is the Kubernetes again if you have to get into the EKS we may have to learn what is pod uh what is services different types of services and all the different components of Kubernetes it's a vast topic again the entire direction of this will go towards the Kubernetes and I don't want that to happen so instead of Kubernetes we are going to use here one of the service from the AWS which is ECS elastic container service right so using that we are going to use the concept of containers to deploy our application right so what we are going to do here is we are going to create the image of our application whatever application we have developed and then we should also have a image of database which we are going to use it example we are not just going to uh create the RDS on the AWS and then going to update the URL like the way we have done earlier right so what is we created database and that you know URL we have added here the username and password that's what we have done that's not what we are going to follow here we are going with the concept of containerization right so we need to have the image whenever you want to run anything on the container the first thing you must have is the image and coming to the database which we are using here MySQL you can get that from the official docker registry which is the docker hub because it is a public you can just get it from there you can just pull that image and we can run that inside the containers and image of the database which we are going to use can get from the internet uh using the docker hub. How about the image of our application which we have developed locally in our machine. So what we may have do is we may have to generate the image of our application and that application we may have to run. So we will have one container running our application. more container running the MySQL database. two containers will be there which will be uh running inside something called as ECS elastic container service which is like a cluster meaning which has multiple no machine server working together to make sure that your application is working fine right so we will have one image which will be taking from the internet about the MySQL database and we'll be running one container will be formed and we have to generate a image of our application and for that the moment we run container will be formed so our application will be running inside the container with the concept of ECS. Now like the way we have Dockerhub one of the registry for your images in Amazon also we have a concept of ECR elastic container registry. So whatever application we are going to develop here, whatever application we have, we are going to generate an image using a docker file and that image we are going to upload in Amazon's own registry we have which is ECR right and then we are going to pull the image from the official docker hub for our MySQL and then we have to run these images the moment you run this images containers will be formed and these containers will be running inside one of the service of AWS which is E CS. So what I'm trying to say is this time I want to make our application run inside the container and to make it happen one of the AWS service we are going to use here is ECS. Right? We can use EKS also. Again the direction of this entire discussion will go towards the Kubernetes. I don't want that to happen. I'm going to use the concept of ECS which could be used to run your application inside the container. So whatever image we are going to create for our application that image we are going to push inside the ECR which is Amazon's elastic container registry like the way docker hub we have where images will be there. So we are going to push our image in ECR. From there we'll take our image and run. The moment you run containers will be formed and inside the container our application will be running using a concept of ECS which is elastic container service. And how we are going to do this we may have to understand for which we may have to also install the AWS CLI. Why AWS CLI? If you ask me just to get connected to our AWS account and by running some of the commands we can upload the image which is getting generated our application image into ECR all these things I know to do by using the web console there again we have to explore so many things instead of that we have an option of AWS CLI we may have to install that and we have an IM account right we may have to just create the secret key and access key and we have to log to our AWS account using AWS CLI and then we may have to upload our applications image Then we have to take the image of our database and we have to make it work together. How exactly these things happens? We may have to see going

### [1:06:16](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=3976s) Configuring AWS CLI

forward. Now let's first install the AWS CLI which we are going to use uh for the further process for which you can just open your favorite browser and search for AWS CLI. Okay. And then you may have to just click the first link or directly you can go to the windows. I would like to just go to the first link and we have an option of uh get started here. it will redirect to this page on you can see on the left hand side we do have an option of install or update this right so again uh here we have an option AWS CLI install and update instructions based on the machine you have you can just choose any uh since I'm going to use uh Windows here we have an option of uh you know AWS amazon. com AWS CLI okay you just have to install this click on this it will take some time and uh it will be downloaded you can see on your screen it has been downloaded. You just have to open and click on next, next. Which is very easy. I have done that. In my local machine, it is already present. Nothing much to do. Uh like the way you install any software. Just click on next, next. After which you just have to open a new uh command prompt. After opening the new command prompt, you'll have an option here. Okay? So the option will be you just have to search AWS - version. That is what you may have to search here. And the moment you search here, you'll be getting this option here. Okay. AWS CLI with Python Windows 11. You can see the entire option. It is available. If you are able to see this, that means it is successfully installed. Right? After that is done, you may have to configure this. You may have to tell that which AWS account you're going to use. You may have to allow the access to the AWS account which you are using. Right? There are lacks and crores and millions of accounts in AWS. Which account you would like to access, which resource you want to create using the CLI. You may have to specify that for which you just have to run here AWS configure. This is a command you may have to run. Just to let you know that you have an access to AWS your account only. Okay. So AWS configure the moment you head this it'll ask you the access key and secret key. For this you just have to log into your AWS account. Okay. The same IM account which we have done earlier. Here also we have an option of uh you can see here the uh security credentials. If not you can just search for I am you can see here we have an option of AM and in the IM also we have option of users right and we have harsh user here okay if you just click here and we will have an option of security credentials right you can see here uh right now there is no access key zero access keys you just have to click on create the access key the moment you just do this for what purpose I'm using this access key for command line interface And then I would like to say I acknowledge and I'll say next. Okay. And it is asking me some default tag value. You can ignore that. And you can see we have an access key here. Same access key I'll copy here. Of course after this I'll delete after this video. Uh I'll just say here because I don't want you to access that. So I'll just get back here and copy the secret key. And I would like just go back and add this secret key. And I will say hit this default region AP South one. is uh how the output format to be it's okay you can just leave it as it is see here it's done again I will say AWS - version I'm getting the AWS version and of course I'll say here AWS AM list I'll say hyphen users that's what I have specified and the moment I do this you'll be able to see this see we are getting this option of uh you know who created we can see the name of the user hers is the user all the user details I'm able to get here. That means I could able to get connected from my AWS CLI from my command line to the AWS account because I'm able to get the user ID. name. That means successfully AWS CLI has been

### [1:10:11](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=4211s) Creating cluster, task and running task for MySQL

configured. Now we are able to configure the AWS CLI. It's time to explore ECS. But before that we may have to also explore ECR. What we have spoke earlier is that we may have to create a image of our application and that image we may have to push in ECR and then using ECS we may have to take it. But before we even do that we have also talked about one more thing before we generate the jar file of this spring boot application we may have to add the actual URL of our database. We have not created any database using the RDS and of course this application running on AWS cannot use a database which is there on our local machine. What is the solution? What we have talked earlier is that we will have two containers. One container running our database and that database image directly we can get from the official image which is the docker hub right and uh then we have to make that running and that URL we may have to update here. After we update the URL, username and password of our application which is running inside the container in the ECS and then we may have to create a jar of this and we have to uh generate the uh docker image of this for which I have already created a docker file. I hope you know the basics of docker at this level. One docker file has been added uh using java. Uh this is a work directly inside the container. Uh there will be a jar file. Please uh generate you know copy that from there and add it in the workspace and this application would be listening to 80080 port number because last earlier we are what we have seen is elastic bean stock there 5,000 was required but here it is not required 80080 it'll work fine and at the time of container running I want to run that jar file which we have given the name here a simple docker file so that should not be a matter of concern right so now what we may have do is I'll just get back to my AWS account. Okay, the same account which we have logged in as AM user. And here I'm going to search for ECS. Okay, so we have an option of elastic container service here. Okay, and uh we have an option of uh clusters. Let's create one cluster here. Create a cluster. So it is asking us to give the name of this. I would like as maybe Tiscoco. That's the name I would like to give here. And now we have an option of infrastructure fargate only Fargate and manage instances Fargate and self-manage instances. So usually we have to create EC2 instance in order to deploy our application. Last in the previous deployment what we have done is we have used one of the service which is which comes under the category of platform as a service which is everything AD will take care of. You just have to take care of the application code and application data. The infrastructure which is needed how many instances right all the volume storage instances type and everything will be taken care by elastic bean stock uh we need not to worry about the runtime all the required softwares generally if not we may have to create the instance of our own configuration we may have to install all the runtime the required software to run our application all this headache was not required earlier here also I don't want to create the instance start the instance end the know stop the instance uh arrange all the runtime all of that is not required. I would like to go with the serverless. Uh serverless means it does not mean that there are no servers. It is just like we need not to manage the servers. They'll take care of this. So I would like to just go with the fargate only and nothing uh extra because everything is optional here. So that's fine. I would like to just click on create this. Within no time this will be created. So let's wait until it is created. As you can see the cluster is created here. And if you just click on this cluster uh task, we may have to assign the task run a new task. That means what it has to run? It has to run one MySQL container for which I just uh will just you know navigate to task definition. And I'll just create a new task here. Okay. And uh it will redirect to this uh page. So MySQL DB is a name I would like to give here AWS Fargate. Let it be uh so keep this as the defaults the configuration. So I would like to just click on none the task role here and after which it is asking us to give the name of our container MySQL container image MySQL latest image. So this image it will pull from the official docker hub the official registry of all the public images. Since MySQL comes under the category of public images everyone can download right. So if you just specify MySQL latest it will only take care of downloading or taking the image which is required to create a container. So this is official uh image of uh MySQL and then the port number I would like to give the name of this default HTTP port. Apart from this I'll add my own port. So it is 3306 MySQL port number and uh name MySQL port and I would like to just give it as HTTP. Okay. So after this uh I would like to just scroll down and this is very important the environment variables. We have to specify the username the password. Okay. So I would like to just create on add environment variables and we may have to add some variables. MySQL root password. This is very important. And I would like to just give the root password here. Root 1 2 3. This is the most important. And after which I would like to just add MySQL database. Okay. And the database name I would like to give it as telescope DB. this database name I'm talking about what we used to specify here right the Talisco DB same name okay and uh I'm getting this default values you may have to type this because I had already created before I record the video so I'm getting the auto suggestions here okay so user I would like to give the username as admin and then password mySQL password keep it same uh don't change this okay this things you can uh decide what you want to do it the name of the database username and uh the password but this uh keys keep it as it is okay this is very important here so I have specified this and after this is over okay uh let's keep things uh as it is no issues port mapping that's fine and now I would like just click on create the task so the task is created here you can see here we are getting so these are the details which we have here JSON if you want you can just run this entire JSON so I have just gone navigated using the console and I have created is no problem. Now let me just go back to the cluster and we have this a task here run a new task that is what we may have to uh click here. So we have a family of MySQL DB here. Okay. So task definition revision by default it is selecting some number keep it as it is. But one thing after everything is over all the resources you may have to delete which you have created all the instances NAD gateways or anything which got created behind this elastic IPs if not the bill will be generated you have to be careful at the end again I'll remind each and every service which you might have created here you may have to delete you may have to verify everything in your AWS account okay what are the things we may have to verify I will just tell you this okay that's fine here and uh launch type you can go with launch type Fargate, latest networking. We have not created any VPC. Okay, if someone watching this are aware of ABC know AWS and if you want you can create your own VPC subnets and that you can add it here. So no problem but I have gone with the defaults which we have here. So create a new security group. I would like to give the name of the security group as uh Terisco course security group. So I'll just add all traffic. It is for the demonstration purpose but uh if production and real you may have to specify who can enter. It's about deciding the traffic who can get in. I will say all the traffic for now. If not you have to specify from where you have to give the source which source who can get in. Customize and you can specify the values of that particular instance. Maybe a particular server only can get into this. You may have to decide this. So now for the demonstration it is totally fine for the testing for the de environment. So I would like to just go with the uh no all traffic and make sure that uh the public IP is turned on. Okay. Let me just cross check if I have given everything right. That's fine. So I would like to just click on create this. So we have an option here. The security group that is already exist in the VPC. Okay. This name is already exist. I would like to just go with number two. Okay. So let me just click on create this. So it should be creating within no time. So it is provisioning instance. It is creating. So you can see here we will have the uh public IP. This public IP only we may have to use here. We may have to copy this and we may have to allocate it here. And before that I would like to also test it. So let's wait uh for it to run it. Okay. So let me just get back to the task. And it is still in the stage of provisioning. It is pending. I hope it will be running. Let me just wait for one more minute. As you can see, now it is running. You just have to refresh. It shows click this. And before I add this details in my application, I would like to just check if I'm able to get uh connected to this. Okay. So, I'll just get back to MySQL workbench locally. So, after which I would like to just say new connection and name of this connection maybe AWS. Okay, only AWS I'll just give here. Or maybe AWS course application. That's fine. And uh host name I would like to just add this. The username it is admin is what we have given. Password I'll not give the root. If you want you can give that. I would like to just give the user password for admin which we have created. Okay. So I'll just give this. I'll say okay. And uh AWS course I have just clicked this to check the connection is fine. All right. Continue anyway. And we could able to get connected. You can see we have the database also ready here. Right. So now the same IP I would like to just add it. I mean the IP address which we have added there. Right. I might have to just add this here. And I think that is the username and that's the password. Uh there also we have set. Okay. So let me just save this and let's see what is the next the basic setup is ready. One container which having which is having the database that is working fine. Now

### [1:20:39](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=4839s) Pushing The Docker image of app

let's create a image of our application and then push that into ECR. For which first I have updated the uh public IP which we have got the username and the password of the database. After which I would like to just clean just in case if there is any uh you know jar available the previous jar. So run as maven build. So I would like to just say here if it is already there clean that and then package this application create a new jar file. Okay. So I would like to just say apply and then run. So new jar would be created. You can see on the right hand side. So we do have an option here. So it is running. I hope without any problem the build will be successful. Okay. So great build is successful. So if I have to refresh my project, just say refresh, we have this target and we do have this course app jar ready with us. Okay. Now we may have to just uh know we already have a docker file also. We may have to just create this and push it. Now how do you do that? for which as you know we are going to use the ECR. So I'll just do one thing. I'll say right click open that in the new tab and here I will just search for ECR. You can see elastic container registry and uh I would like to just create new repository here. Name of this I'll just give it as telescope mutable let it be. So no problem and keep it default and create this. So we have this telescope here. Now how do we push it? For which you just have to click on view push commands. Make sure one thing that you have already configured uh AWS CLI which we have done earlier and docker is installed locally on your machine. I have kept in mind people who are watching docker is installed locally. So that's what you have to do it. Now if docker is installed AWS CLI is configured. Wherever this project is right you have to open the command prompt from this. So you have to navigate to the project where you have there and you may have to open the uh command prompt from where this project is. So I would just say here see here uh java sp is the workspace name course app here is where we have a project right. So now I just have to run this commands very simple it is. So let me just uh get back here. I'll just copy this and I may have to just run one by one. Okay. So let me hit this. So I'll have an option of login successful. Let's wait. You can see login succeeded. So after which I just have to go back and build a docker image. This is the command to create a image. Docker file is already available. So it will create a docker image. It is generating the docker image. And once docker image is generated, you may have to tag the docker image before pushing it. Okay. So docker image generated. I'm tagging that image. That's also done. Now I may have to just go back and push that image. You can see here. So I would just copy this and get back here. I'll say right click and push this image. Okay. So it'll take some time and the image will be pushed. It is taking some time. Okay. So let me just get back to my AWS here and you can see if I refresh right now no images are there. It is getting updated. Let me see if image is successfully. Yes, it is able to push that image successfully and we do have an option of uh latest here which you can see here we do have this option and this URI is what we may have to you know update again in the ECS like the way we have one task right and we have created one task definition mysql and we use public image here at the time of we creating the task. Now we may have to create one more task. Okay. And then at the time of creating one more task we may have to add that URI which we have here. No image URI. Same thing we may have to update that. Let's see that

### [1:24:40](https://www.youtube.com/watch?v=ydL5NSrWfAk&t=5080s) Running Java App Tasks

next. Now it's time to get back to the ECS and in our cluster we may have to just run and create one container for our application. Okay. So before we assign a new task here I would like to just do one thing. Go back to the task definition and create a new definition. Earlier we have done this task definition for MySQL public image. This time we are doing for our own application. Okay. So I'll just give the name here as maybe telesco application. All right. And uh keep this things default like the way earlier we have done. No changes there. So it is asking us to give the name here course app container. Maybe I'll just give the name of this Java 2 and image URI. Same thing you may have to do here. This is our image which we have just now posted. And I would like to just add this image here. Fine. And the port mapping, this is HTTP port. I'll just give it as 8080 because you can see here our application is listening to the port number 8080. And same thing we have specified in the uh docker file also. I just get back here and 8080 and it is web port HTTP. Okay, this task that's this is what you have to do here. Uh nothing much. keep the things as it is. Okay. So, let me just cross check. Yes, this is the task. Nothing more. And I would just click on create the task. The task will be created here. Now, get back to the cluster. And in my cluster, we have a task here. And I may have to just create a new one. This is the old uh that I was just checking it before the video recording. Now, it is telescope application. All right. And launch type again. Fargate latest networking go with the uh VPC which is default that's what we have been using here create a new security group I'll just give it as uh application security group okay and you can just customize who can access I'll just say here all traffic anywhere so that anyone can access make sure that public IP is uh turned on here okay now I would like to just click on create this and it will take some time and it should be ready you can see here uh we are getting it as provisioning. Let's wait for 1 minute and see if you could able to access. So basically what we have done is already we have one container where our MySQL is uh you know running and now we create our own image of our application push that into the ECR and from the ECR we could able to pull that into our ECS. Now we are just running this and see if we are getting the container. So again I'm uh refreshing it. It's still in the provisioning. Now we got the here option as uh it is running and we can see public IP we have. I just have to copy this public IP get back to the browser. I'll just paste this and it is listening to port number 8080 and we have an endpoint called as course list. That's the endpoint. The moment I hit this we could able to access the application. You can see here we can add whatever data you want. Maybe devops. uh I'll just add the duration here and maybe some fees also I will just add it say here save the course you can see all the operations are working fine right so this is one more way of deploying your application into AWS where we are using the concept of containers inside the containers our application is working so many things we have done I hope you got the clarity there are lot of customization which you can do it for which you may have to learn more uh AWS you can create your own VPCs these subnets you're you can have your own networking right you can create Kubernetes clusters multiple things can be done that's based on you know the AWS knowledge if you're going for the AWS certification or maybe exploring AWS lot of the things can be done this is one of the demonstration just to show that how the applications are working how AWS services can be used for the deployment of the application it's like uh not every application need to follow this process only there are different ways uh to be done you can create your VPC Subnets, you can create your own instances. You can have whole customization based on how much AWS knowledge you have. I have kept it very simple uh by considering people who are watching they have the Java Spring Boot knowledge. They have basics of Docker knowledge and they can use that and even if they are new to the AWS they can just you know uh demonstrate the deployment of the application using one is a platform as a service one more is using the ECS. After this is done, the entire practice is done. You have to make sure every all the resources which got created should be deleted. All the task which you have created, right? Task. For example, just if I have to show you and you can just you know have an option of stop. If not you can say here stop all. We have an option here. You can see here select and we do have an option of uh stop all and you have to stop all the task. you may have to dregister the services right after the practice is done. Okay, if I have to get back to my clusters and u again the task definitions also you can just click on this get into this click on this we have an option of dregister you have to dregister and after that is over everything is dregister you can delete this okay we have an option of delete the cluster and after that is over you can just check nad gateway if it is not running elastic IP if it is there you have to release it if there are any instances running you may have to delete that if not you will be charged but I hope you got the picture of how these applications are deployed in AWS.

---
*Источник: https://ekstraktznaniy.ru/video/49262*