在 EC2 上运行 Java EE 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2084006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:20:56  来源:igfitidea点击:

Run Java EE app on EC2

javajakarta-eeamazon-ec2amazon-web-services

提问by Ryan Fernandes

Can anyone point me to the steps/resources that describe:

任何人都可以指出我描述的步骤/资源:

  1. How to deploy a Java EE app on amazon-EC2
  2. Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)
  1. 如何在 amazon-EC2 上部署 Java EE 应用程序
  2. 在实例重启后(可能使用 amazon-ebs)维护对应用服务器元数据的更改(部署新应用程序)

采纳答案by simonlord

First check this out if you haven't already ran through it: http://docs.aws.amazon.com/gettingstarted/latest/awsgsg-intro/intro.html
it'll give you an idea of how it all works.

如果您还没有浏览过它,请先检查一下:http: //docs.aws.amazon.com/gettingstarted/latest/awsgsg-intro/intro.html
它会让您了解它是如何工作的。

With regard to running a Java EE app on EC2, you have a couple of choices - but they generally come down to the following recipe:

关于在 EC2 上运行 Java EE 应用程序,您有几个选择 - 但它们通常归结为以下方法:

  1. Start an instance
  2. Install a Java EE application server (tomcat/glassfish/websphere/...)
  3. Install your application (war/ear) into the application server
  1. 启动实例
  2. 安装 Java EE 应用服务器(tomcat/glassfish/websphere/...)
  3. 将您的应用程序(war/ear)安装到应用服务器中

Now you can bundle the above into an ebs ami, or you can write a script (bash/sh/tcl) which applies those changes when your instance starts (which i prefer). The scripts allow you to modify what gets installed/started/moved around without having to rebundle your instance.

现在您可以将上述内容捆绑到一个 ebs ami 中,或者您可以编写一个脚本 (bash/sh/tcl),在您的实例启动时应用这些更改(我更喜欢)。这些脚本允许您修改安装/启动/移动的内容,而无需重新捆绑您的实例。

There's some great resources here: http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=100

这里有一些很棒的资源:http: //developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=100

Hope that helps.

希望有帮助。

回答by Pascal Thivent

How to deploy a Java EE app on amazon-EC2

如何在 amazon-EC2 上部署 Java EE 应用程序

You still deploy to an application server so it isn't really different. If you have more specific questions, please clarify. But have a look at Running JEE applications on Amazon EC2and How to deploy a java web application on an ec2 instance.

您仍然部署到应用程序服务器,所以它并没有真正的不同。如果您有更具体的问题,请澄清。但请查看在Amazon EC2运行 JEE 应用程序如何在 ec2 实例上部署 java Web 应用程序

Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)

在实例重启后(可能使用 amazon-ebs)维护对应用服务器元数据的更改(部署新应用程序)

If you use Amazon EBS, then you don't need to worry, Amazon EBS volumes are off-instance storage that persists independently from the life of an instance.

如果您使用 Amazon EBS,则无需担心,Amazon EBS 卷是实例外存储,独立于实例的生命周期而持续存在

回答by Sangram Anand

The Amazon AWS's newly Launched Elastic BeanStalk is here to resolve you concerns. You can deploy Java EE apps on Amazon Ec2 instances via Bean Stalk. All you need to do is create a new applications and create a environment in it and add you WAR file for deploying, AWS has its own version of Tomcat 6/7 with open JDK which can be customized to Sun JDK if required.

亚马逊 AWS 新推出的 Elastic BeanStalk 来解决您的顾虑。您可以通过 Bean Stalk 在 Amazon Ec2 实例上部署 Java EE 应用程序。您需要做的就是创建一个新的应用程序并在其中创建一个环境并添加您的 WAR 文件以进行部署,AWS 有自己的 Tomcat 6/7 版本,带有开放的 JDK,如果需要,可以将其定制为 Sun JDK。

Therefore Amazon offers complete Deployment tool to start using your app by just deploying in BeanStalk. BeanStalk offer Auto Scaling & Elastic Load balancing and a lots more to customize your application Environment.

因此,亚马逊提供了完整的部署工具,只需在 BeanStalk 中部署即可开始使用您的应用程序。BeanStalk 提供 Auto Scaling 和弹性负载平衡以及更多自定义应用程序环境的功能。

回答by elasticsecurity

If you start an ebs-booted instance, you do not need to care about persistency after a reboot (see http://aws.amazon.com/about-aws/whats-new/2009/12/03/amazon-ec2-instances-now-can-boot-from-amazon-ebs/) Concerning the deployment of Java EE, I don't see any difference to deploying it on a non-virtual OS.

如果启动 ebs 引导的实例,则无需关心重启后的持久性(参见http://aws.amazon.com/about-aws/whats-new/2009/12/03/amazon-ec2- instance-now-can-boot-from-amazon-ebs/) 关于 Java EE 的部署,我认为在非虚拟操作系统上部署它没有任何区别。

回答by Axel Fontaine

Boxfusesupports deploying Java EE applications using either Tomcat, TomEE Web Profile or TomEE Plus to AWS with a single command

Boxfuse支持使用 Tomcat、TomEE Web Profile 或 TomEE Plus 使用单个命令将 Java EE 应用程序部署到 AWS

boxfuse run mytomeeapp-1.0.war -env=prod

This will create an image, provision all necessary AWS infrastructure and launch the instances. It supports blue/green zero downtime updates with Elastic IPs and ELBs.

这将创建一个映像,配置所有必要的 AWS 基础设施并启动实例。它支持使用弹性 IP 和 ELB 进行蓝/绿零停机更新。

You can find a tutorial here: https://boxfuse.com/blog/javaee-aws.html

您可以在此处找到教程:https: //boxfuse.com/blog/javaee-aws.html

You don't have to worry about maintaining changes to the meta-data as all instances are immutable and contain all necessary app server info.

您不必担心维护对元数据的更改,因为所有实例都是不可变的,并且包含所有必要的应用服务器信息。

Disclaimer: I am the founder and CEO of Boxfuse

免责声明:我是 Boxfuse 的创始人兼 CEO