使用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
- 在安装了Spring Extensions的情况下启动eclipse IDE.对于Luna,请将此链接添加到更新安装程序 http://dist.springsource. com/release/TOOLS/update/e4.4/
- 您还需要在Eclipse中安装Tomcat服务器.如果您没有此设置,请先搜索Google以获取设置说明,然后再继续.
- 选择文件->新建->其他-> Spring-> Spring Starter项目
- 将名称和工件设置为spring-boot-aws
- 将包装从罐子改为战争(这将做几件事,我将在后面解释)
- 选择Actuator和Remote Shell,以便我们使用一些RESTful服务来测试该应用程序.
- 单击完成
- 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/
- 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.
- Select File->New->Other->Spring->Spring Starter Project
- Set the name and the artifact to spring-boot-aws
- Change the packaging from jar to war (This does a couple of things that I’ll explain later)
- Select Actuator and Remote Shell so that we have some RESTful services to test the app with.
- 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.
- 登录到Amazon AWS.
- 在主控制面板中,选择Deployment&下的Elastic Beanstalk.管理.
- 单击右上角的创建应用程序".
- 输入应用程序名称,然后单击下一步.
- 环境层– Web服务器
- 预定义的配置– Tomcat
- 环境类型–单个实例
- 单击下一步
- 选择上传自己的战争",单击浏览"并找到您之前创建的战争.
- 上载应用程序后,您会看到下一页,您可以在其中选择您的URL.
- 输入名称,然后单击检查可用性"以查看是否可以使用它.
- 单击下一步
- 在此示例中,我们不需要RDB,因此请在此处单击下一步.
- 在下一步中,您将定义将要创建的EC2实例,如果您使用的是免费试用版,请坚持使用免费的t1.micro实例类型.
- EC2密钥对,可以保留为未选择状态.您暂时不需要它,而且很可能还没有配置它.这将在以后的文章中介绍.
- 单击下一步.
- 在环境标签"中,再次单击下一步,因为我们对此并不在意.
- 查看配置,然后单击启动".
- Login to Amazon AWS.
- In the main control panel select Elastic Beanstalk under Deployment & Management.
- Click on Create Application in the top right corner.
- Enter the Application Name and click Next.
- Environment Tier – Web Server
- Predefined Configuration – Tomcat
- Environment Type – Single instance
- Click Next
- Select Upload your own, click Browse and locate the war you created earlier.
- When the application is uploaded you will see the next page where you select your URL.
- Enter a name and click check availability to see if you can use it.
- Click Next
- We don’t need a RDB in this example so click next here.
- 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.
- 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.
- Click Next.
- In Environment Tags click next again because we don’t care about this.
- 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