使用AWS Elastic Beanstalk在AWS上部署Spring Boot应用程序 [英] Deploying a Spring Boot Application on AWS Using AWS Elastic Beanstalk

查看:167
本文介绍了使用AWS Elastic Beanstalk在AWS上部署Spring Boot应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用AWS Elastic Beanstalk在AWS上部署Spring Boot应用程序,但是我看不到上传jar文件的选项,只有zip和war(?!)

I want to deploy a Spring Boot Application on AWS Using AWS Elastic Beanstalk, but I don't see the option to upload a jar file, only zip and war (?!)

,并且在本教程中,他们正在部署一个jar文件: https://aws.amazon.com/es/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/

and in this tutorial they are deploying a jar file: https://aws.amazon.com/es/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/

推荐答案

教程:如何使用Elastic Beanstalk将Spring Boot应用程序部署到Amazon AWS

Youtube视频教程: https://www.youtube. com/watch?v = JYVlzoRMa3U

源代码链接: https://github.com/marcthomas2013/spring-boot-aws

完整教程链接: https://mtdevuk.com/2015/02/10/how-to-deploy-a-spring-boot-application-to-amazon-aws -using-elastic-beanstalk/

  1. 在安装了Spring Extensions的情况下启动eclipse IDE.对于Luna,请将此链接添加到更新安装程序 http://dist.springsource. com/release/TOOLS/update/e4.4/
  2. 您还需要在Eclipse中安装Tomcat服务器.如果您没有此设置,请先搜索Google以获取设置说明,然后再继续.
  3. 选择文件->新建->其他-> Spring-> Spring Starter项目
  4. 将名称和工件设置为spring-boot-aws
  5. 将包装从罐子改为战争(这将做几件事,我将在后面解释)
  6. 选择Actuator和Remote Shell,以便我们使用一些RESTful服务来测试该应用程序.
  7. 单击完成
  1. Start up eclipse IDE with the Spring Extensions installed. For Luna add this link to your update installer http://dist.springsource.com/release/TOOLS/update/e4.4/
  2. You’ll also need Tomcat server installed in Eclipse. If you don’t have this setup then search Google for setup instructions before you continue.
  3. Select File->New->Other->Spring->Spring Starter Project
  4. Set the name and the artifact to spring-boot-aws
  5. Change the packaging from jar to war (This does a couple of things that I’ll explain later)
  6. Select Actuator and Remote Shell so that we have some RESTful services to test the app with.
  7. Click Finish

它使用一些REST服务(例如/beans)创建了一个简单的Spring Boot应用程序,该服务将返回应用程序中所有bean的JSON对象.

It has created a simple Spring Boot application with some REST services like /beans that will return a JSON object of all the beans in your application.

  1. 登录到Amazon AWS.
  2. 在主控制面板中,选择Deployment&下的Elastic Beanstalk.管理.
  3. 单击右上角的创建应用程序".
  4. 输入应用程序名称,然后单击下一步.
  5. 环境层– Web服务器
  6. 预定义的配置– Tomcat
  7. 环境类型–单个实例
  8. 单击下一步
  9. 选择上传自己的战争",单击浏览"并找到您之前创建的战争.
  10. 上载应用程序后,您会看到下一页,您可以在其中选择您的URL.
  11. 输入名称,然后单击检查可用性"以查看是否可以使用它.
  12. 单击下一步
  13. 在此示例中,我们不需要RDB,因此请在此处单击下一步.
  14. 在下一步中,您将定义将要创建的EC2实例,如果您使用的是免费试用版,请坚持使用免费的t1.micro实例类型.
  15. EC2密钥对,可以保留为未选择状态.您暂时不需要它,而且很可能还没有配置它.这将在以后的文章中介绍.
  16. 单击下一步.
  17. 在环境标签"中,再次单击下一步,因为我们对此并不在意.
  18. 查看配置,然后单击启动".
  1. Login to Amazon AWS.
  2. In the main control panel select Elastic Beanstalk under Deployment & Management.
  3. Click on Create Application in the top right corner.
  4. Enter the Application Name and click Next.
  5. Environment Tier – Web Server
  6. Predefined Configuration – Tomcat
  7. Environment Type – Single instance
  8. Click Next
  9. Select Upload your own, click Browse and locate the war you created earlier.
  10. When the application is uploaded you will see the next page where you select your URL.
  11. Enter a name and click check availability to see if you can use it.
  12. Click Next
  13. We don’t need a RDB in this example so click next here.
  14. In this next step you are defining the EC2 instance that will be created, if you are using a free trial then stick to the free t1.micro instance type.
  15. EC2 Key Pair, can be left unselected. You won’t need it for now and most likely you won’t have one configured yet. This will be covered in a later post.
  16. Click Next.
  17. In Environment Tags click next again because we don’t care about this.
  18. Review the configuration, and then click Launch.

Amazon AWS现在将置备您的服务器,安装Tomcat服务器并部署您上载的war文件.此操作确实需要5到10分钟的时间才能完成.

Amazon AWS will now provision your server, install the Tomcat server and deploy the war file that you uploaded. It does take a good 5-10 minutes for this action to complete.

此处还有另一个完整的教程: 如果您想使用CLI以官方方式部署代码,则可以通过

If you want to deploy code in the official way using CLI, then you can go through this tutorial:

PS 如果您遇到 502 Bad GateWay nginx问题,则可以使用以下三种选择 我更喜欢将弹簧启动端口更改为5000 在此处查看更多详细信息 Bad GatWay问题3选项解决它

P.S If you had problem of 502 Bad GateWay nginx you have three options i prefer changing the spring boot port to 5000 check here for more details Bad GatWay problem 3 options to solve it

这篇关于使用AWS Elastic Beanstalk在AWS上部署Spring Boot应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆