Тёмный

How to Easily Deploy a Spring Boot Application to AWS EC2 

The Dev World - by Sergio Lema
Подписаться 12 тыс.
Просмотров 49 тыс.
50% 1

The easiest way to deploy a Spring Boot application to the cloud is using AWS EC2. In this video I will show how to deploy a simple web application to EC2 in such a way it can be used from a CI/CD platform to upload a new version each time it's available.
This video belongs to a playlist where I show multiple ways to deploy application to AWS: • How to Easily Deploy a...
Content:
* What is the cloud. What are the main cloud providers
* What are the main services of AWS
* How does AWS EC2 work
* Which services are necessary to create an AWS EC2 instance. What is a Security Group. What is a VPC. What is S3.
* How to connect to an AWS EC2 instance in SSH
* How to create an AMI from a running AWS EC2 instance
* How to perform automatic actions on a AWS EC2 instance at the startup
My NEW eBook: sergiolema.dev/git-book/
Blog: bit.ly/47ornJL
LinkedIn: bit.ly/41Nn61q
Facebook: bit.ly/47rc9nh
My Desktop:
• Laptop: Macbook Pro 16' 2019
• Gaming Chair: amzn.to/47Vu6ed
• Mouse: amzn.to/3HoBwM1
• Desk: amzn.to/48Tc5Oi
• Screen: amzn.to/48VZkCL
Icons:
* credit cart by Larea from Noun Project
* comment by Gautam Arora from Noun Project
* Server by Alzam from Noun Project

Наука

Опубликовано:

 

4 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 125   
@shashankbhat6184
@shashankbhat6184 Год назад
Explanation is very clean. This video helped me a lot. Thanks🙏
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Thank to you for watching! Don't forget to share my channel with your network
@shashankbhat6184
@shashankbhat6184 Год назад
@@TheDevWorldbySergioLema Yeah, I'm sure my network will enjoy it 👍
@anthonycarella1779
@anthonycarella1779 3 месяца назад
The fact that half-way through this video, I was able to get a simple Spring Boot application on an EC2 instance makes it golden. Thank you so much!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
Thanks for the comment Anthony!
@santiagoibarbia3958
@santiagoibarbia3958 5 месяцев назад
Amazing video. All explained in just some minutes. Congrats!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 5 месяцев назад
Thank you Santi!
@Apopjak
@Apopjak Год назад
duuuude, U have no idea how much u helped me with this video, u re the best!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
So glad Andrej!
@pulato000
@pulato000 Год назад
Cool, looking forward to another one
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Yes, I'm already working on it
@programmierenabisz4664
@programmierenabisz4664 11 дней назад
Thank you so much! This made so many things clear to me. I worked with several old ways to manage my projects. From hosting my own servers (about 20 years ago) to some docker managed instances and so on. AWS was a misterium for me. So many things you can do there but you brought it to the point for me. EC2 is only a virtual machine :) And the networking is also only networking VPC (virtual private cnetwork ;))
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 11 дней назад
I'm so glad you understand it better now!
@programmierenabisz4664
@programmierenabisz4664 11 дней назад
​@@TheDevWorldbySergioLema I am looking the next video (4 Easy Steps to Deploy ...) and I left a similar comment there. Really, it's a kind of AHAAA moment for me. thank´s again!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 11 дней назад
Thanks again!
@lukamarkac6706
@lukamarkac6706 9 месяцев назад
Beautiful video, props bro!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 9 месяцев назад
Thanks Luka!
@user-sl6ch8hv8f
@user-sl6ch8hv8f 7 месяцев назад
Explanation very clean and excellent, thank you
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 7 месяцев назад
Thanks Youness! I try my best
@mihailegorin2349
@mihailegorin2349 Год назад
Thank you! Your video was very helpful for me
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
So glad. Don't hesitate to share it in your network
@user-kh9xs5lq9p
@user-kh9xs5lq9p 7 месяцев назад
this tutorial is very helpful. thank you!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 7 месяцев назад
Thank you
@ernestcronin8999
@ernestcronin8999 4 месяца назад
Excellent video. Thank you so much.
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 4 месяца назад
Thank you Ernest!
@bodyakov4483
@bodyakov4483 Год назад
Great video, thank you!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Thanks to you for watching!
@maYoutubeTube
@maYoutubeTube 8 месяцев назад
Great video. Thank you
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 8 месяцев назад
Thanks for watching! 😉
@MikeBrownphx
@MikeBrownphx Месяц назад
Great video.
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Месяц назад
Thanks Mike!
@makilles7479
@makilles7479 Год назад
Hi! Your video is excellent and is helping me a lot during my final project at college. However, I can't run the command "mvn" on my terminal (command not found). I also have a maven spring boot project, but I don't get what I did wrong. Would you help me, please?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Thanks. The "mvn" command is the Maven command. If you don't have it installed in your EC2 image, you can also use the Maven Wrapper in many Spring Boot projects (which doesn't need to install).
@user-vg1rk1ep3s
@user-vg1rk1ep3s Год назад
this video is helpful alot
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Thanks!!
@gamerpinguin007
@gamerpinguin007 10 месяцев назад
thanks, it helps a lot
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 10 месяцев назад
So glad!
@johncerpa3782
@johncerpa3782 Год назад
Video on VPC and networking would be great
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Ok, thanks for the feedback John
@user-is1nc9ni9e
@user-is1nc9ni9e Год назад
Inbound rules part is very helpfull.
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Glad it helped you!
@user-sf6rr5fq4i
@user-sf6rr5fq4i 9 месяцев назад
Thanks for the video. While I am trying to start ec2 instance using public ip address from local terminal. Connection is failing. Even ping to public ip is not working. can you suggest what would be failing ?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 9 месяцев назад
Check your security group. I must at least accept the port 22 for SSH and port 80 for ping.
@Domzheritcy
@Domzheritcy Год назад
Please continue make videos about Java and AWS
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
I'm on it 😉
@m.cheonsa
@m.cheonsa Месяц назад
Thank youuuu for the amazing video ! Does anyone know from where i can get that ssh key before creating the instance?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Месяц назад
You have to create it by your own, in your computer. Then upload it to AWS and assign it to the created EC2 instance.
@rafaelramirez8820
@rafaelramirez8820 Год назад
Thanks teacher
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Keep watching more videos! 😉
@kirankumarkondapally237
@kirankumarkondapally237 3 месяца назад
Hi ,At 4.36 of the video you have used SSH keys , how to created that one please let us know .The one it shown is already created one you have imported.
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
You have many ways to generate ssh keys. It depends on your OS. On windows, you have OpenSSH or Putty. On Linux or MacOS, you have ssh-keygen.
@morigene
@morigene 3 месяца назад
Thank you. All network services in AWS are very helpful. please if possible please give it to us. thank you.
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
I'll take it into account
@prjvnd
@prjvnd Год назад
Can the REST API's be accessible outside the region of EC2 ? I mean are the REST API's global ?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
It will depend on you Security Group, which Inbound traffic you authorize.
@zhanglijunshao3310
@zhanglijunshao3310 Год назад
when you import key pair, how did you get the content?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
it's the public part of my SSH key. You can easily find how to generate SSH keys here: www.google.com/search?q=create+ssh+key
@MarselGaisin
@MarselGaisin Год назад
After creating an application in Elastic Beanstalk, an error appears "The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist." Why is this happening?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
The video is not about Elastic Beanstalk. I haven't used Elastic Beanstalk for a while, I can't help you. Maybe if somebody else see the comment and knows the answer...
@bruno.theoret
@bruno.theoret 4 месяца назад
Merci pour la vidéo Sergio. Tu crée une nouvelle instance EC2 pour le CI/CD, mais comment arrêter, effacer ton ancienne instance et transférer les requêtes vers la nouvelle vm pour ne pas utiliser trop de ressources lors du déploiement?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 4 месяца назад
Merci pour ton commentaire Bruno. Là tu parles d'un cas plus avancé. En utilisant uniquement EC2, tu peux réussir ça en mettant un Load Balancer devant ton instance EC2. Quand tu crée ta nouvelle instance, il faudra la déclarer dans le Load Balancer. Et quand ru supprime l'ancienne, elle sera automatiquement supprimée du Load Balancer. Et le Load Balancer se chargera de rediriger le traffic d'une instance à l'autre.
@burcutas1647
@burcutas1647 10 месяцев назад
When I run the demo command in the terminal 08:00 , I get the following error: " 'demo' is not recognized as an internal or external command, operable program or batch file. " What can I do for it? Can you help?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 10 месяцев назад
😂 Sorry, demo is the name of the folder where I run the commands. My terminal displays it in another colour. It displays first the folder where I'm running the commands.
@oss2046
@oss2046 9 месяцев назад
Is it possible to do the same but with a war file instead of a jar file?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 9 месяцев назад
With a war file, you nees to first install a web server like Tomcat or Glassfish. The rest is the same (EC2 creation, security groups, VPN...)
@mykyta1235
@mykyta1235 3 месяца назад
thanks, great content
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
Thanks for watching!
@weixiangng8279
@weixiangng8279 23 часа назад
is aws ec2 from aws free tier?
@khanhne19
@khanhne19 11 месяцев назад
nice bros
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 11 месяцев назад
Thank you!
@alexanderayala-palacin5723
@alexanderayala-palacin5723 5 месяцев назад
I created the vpc, ssh key, security group, the instance, followed everything in the video, and when I went to my terminal and did ssh ec2-user@, I got the error: Permission denied (publickeymgssapi,keyex,gssapi-with-mic). Anybody else?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 5 месяцев назад
Did you linked your ssh key to the EC2 instance?
@anmarhammadi7471
@anmarhammadi7471 3 дня назад
Exact same happened to me. Will rewatch the video in case I missed a step.
@anmarhammadi7471
@anmarhammadi7471 3 дня назад
watched the video again and got stuck at the same part
@anmarhammadi7471
@anmarhammadi7471 3 дня назад
I suppose which terminal should we be using? I think it might be the AWS cli? I'll try this now
@hasanmhdamin6076
@hasanmhdamin6076 Год назад
Hi, I have connected to the server using ssh ec2-user@MY_IP it was success, and I've installed java. but when I tried to upload the JAR file I get this error: ED25519 key fingerprint is SHA256:XXXXXXXXXXX. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? and when I click yes, I get this error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Connection closed
@exerazor1911
@exerazor1911 Год назад
i was having the same error, make sure that you are running the scp command on your local machine and not while connected to the ec2 instance :)
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
You must use the same user ec2-user when copying the JAR file, "scp file.jar ec2-user@MY_IP:/home/ec2-user/"
@muadgra3545
@muadgra3545 3 месяца назад
I encountered problems (I'm using windows), you can also use EC2 console to connect
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
Yes, the AWS console is very useful, as you don't need to configure your computer
@naziashaikh998
@naziashaikh998 4 месяца назад
The worst part is some things are already configured at tutors end, like console, terminal etc, and we are not sure how did tutor set them up in first place ;( . also, having lengthy commands pasted in description would make it easier for us to simple copy paste and do the job :)
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 4 месяца назад
Sorry for not copy-past the commands on the description, but RU-vid don't render well some commands as it thinks it's some Script injection attack. The only thing I have previously configured, is the aws configure to create a profile connected to my AWS account. You can check how to do it here: docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-using-profiles
@40ozhemlock
@40ozhemlock 9 дней назад
Sorry I'm dumb. When you say "and go to a terminal" (to connect to the instance). Do you mean just the command line on my local machine? Or are you talking about something in AWS? Doesn't AWS provide like 3 different ways within the console to connect to the instance? What do you mean when you say "and go to a terminal"?
@40ozhemlock
@40ozhemlock 9 дней назад
tried it from the command line.... permission denied....
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 9 дней назад
Go to your local machine terminal. But you need to configure it before. Check here how to do it: docs.aws.amazon.com/cli/v1/userguide/cli-chap-configure.html
@40ozhemlock
@40ozhemlock 3 дня назад
@@TheDevWorldbySergioLema So I have made a lot of progress. Got a JAR file of my app onto the Linux Ec2. But when I run it, it doesn't pick up the properties from my properties file so I can't make the MYSQL DB connection. It keeps acting like it's trying to connect with root@... , But I have a ${DBUSERNAME} variable (and PW and URL) in my props file and I CANNOT get the app to pick those values up and connect with that. ANY ideas bro?
@carlosblinf
@carlosblinf Год назад
Sergio, video de VPC !!
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Noté!
@welbe9436
@welbe9436 Год назад
how did you add ssh key and what is ssh key, where to find that?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
An SSH keys is like a username/password to let your computer connecter to another computer via the port 22. You can generate them with ssh-keygen, putty or other tools. You must first generate a public/private key in your computer, then upload in the Key Pairs section of AWS the public one. Then, you can connect to the EC2 instances which have your Key Pair.
@mrowox
@mrowox Год назад
@@TheDevWorldbySergioLema I have generated my key-pair, uploaded the public one to was and I still cannot connect. the error is `Permission denied (publickey,gssapi-keyex,gssapi-with-mic).`
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Maybe your SSH key has permissions too open. Maybe the route to your SSH key is not the default one and your SSH agent can't find it. Check this link and try add the verbose option to see more details about the error: askubuntu.com/questions/311558/ssh-permission-denied-publickey
@sachinthanaaluvihare7961
@sachinthanaaluvihare7961 6 месяцев назад
If you get Permission denied (publickey,gssapi-keyex,gssapi-with-mic) when tring to ssh to ec2-user, just run chmod 400 on the pem file and try again
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 5 месяцев назад
Great advice!
@charlygarcia8223
@charlygarcia8223 5 месяцев назад
How do you do this on windows CMD?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 5 месяцев назад
The goal of those commands is to run them from a CI/CD platform like GitlabCI. I've never used Windows on a CI/CD platform. But the AWS CLI is the same for Windows. You can check the installation guide in the official AWS Console page.
@anmarhammadi7471
@anmarhammadi7471 3 дня назад
oh right so we should be using the AWS cli here not windows CMD prompt. I think a few people are confused as to what shell was used in this video to run the command ssh ec2-user@blablabla
@kanagasingamdanushan3701
@kanagasingamdanushan3701 Год назад
Why can't access end points after closed the terminal?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
In my case, I run the Spring Boot application in the terminal, not in a background task. If I close the terminal which is running the application, it stops. For production ready applications, you should configure the startup of your application in the User Details script. This way, it's running as soon as the instance is up.
@shubhamjain5889
@shubhamjain5889 3 месяца назад
@@TheDevWorldbySergioLema Can you please share the details. How to do this?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 3 месяца назад
It's the script I write into the UserDetails field in the video.
@rauchrodrigues272
@rauchrodrigues272 Год назад
i wish if ur instructions were simpler on where did you run your startup code how to make ssh etc
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
Sorry, I assumed you already have some knowledge about bash scripting. Tell me your doubts, I may guide you with some resources or links.
@kelvinboateng5445
@kelvinboateng5445 2 месяца назад
how do i add environment variables
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 2 месяца назад
The best way is to add them when creating the EC2 image, or in the startup script.
@elitemiro
@elitemiro Год назад
how to keep it running even after ssh session is terminated and my pc is shutdown? the app shuts down after a while
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
You can simply run it in background. Add the & symbol at the end of the command, and it will run in the background. Or create a screen and run it in the screen. Either way, when closing the SSH session, the application still runs.
@elitemiro
@elitemiro Год назад
@@TheDevWorldbySergioLema it still shuts down when i close the terminal i need to run like a dedicated server
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
I'm not sure about what you mean about '"close the terminal". When running the server, you must add the "&" symbol at the end of the command. Then, you should have the terminal free to continue. Exploring the processes, ps -a, you should see the previous server running. Then, close the SSH connection and the server must continue to run. If the "&" symbol doesn't work, try using a screen (linuxize.com/post/how-to-use-linux-screen/).
@elitemiro
@elitemiro Год назад
@@TheDevWorldbySergioLema thanks a lot the screen worked like a charm
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
I use it every time a need a long running task in a distance server.
@nirangasithara
@nirangasithara 8 месяцев назад
How did you make the SSH key ?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 8 месяцев назад
With ssh-keygen. For you, it will depend on your OS: docs.oracle.com/en/cloud/cloud-at-customer/occ-get-started/generate-ssh-key-pair.html#GUID-8B9E7FCB-CEA3-4FB3-BF1A-FD3406A2432F
@nirangasithara
@nirangasithara 8 месяцев назад
@@TheDevWorldbySergioLema thank you. As an alternative I can use the pem file too. Right ?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 8 месяцев назад
I'm not sure about this. I would say no, but I've never tried.
@naziashaikh998
@naziashaikh998 4 месяца назад
what terminal did he open?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 4 месяца назад
I use iTerm, but this won't change anything to the behavior.
@rmcf3972
@rmcf3972 2 месяца назад
Is there a free aws for spring boot?
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 2 месяца назад
There are free Linux servers in AWS for one year. You can run whatever you want on them.
@HaoTran-bq7sh
@HaoTran-bq7sh Год назад
how to deploy database
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
I didn't made a video about that, because it's just going to RDS, select the database, select the instance type, the amount of memory, and that's all
@alexandersepulveda5020
@alexandersepulveda5020 Год назад
nube*
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema Год назад
😅 Ups, corregido
@thomasfang5156
@thomasfang5156 7 месяцев назад
those kind of tutorial create more confuse
@TheDevWorldbySergioLema
@TheDevWorldbySergioLema 7 месяцев назад
I'm sorry for that. What was not clear enough?
Далее
🚀 Deploy Spring boot application to AWS Cloud 🚀
31:32
Кто понял тот понял
00:24
Просмотров 244 тыс.
Deploy Spring Boot Application To AWS
10:32
Просмотров 8 тыс.
Hosting Springboot App on render.com
20:19
Просмотров 26 тыс.
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Просмотров 30 тыс.
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
Просмотров 163 тыс.
Choose a phone for your mom
0:20
Просмотров 4,6 млн