25

I am very new to the Amazon AWS services. I was wondering if there is a way to run an instance of EC2 (say, Amazon Linux AMI) and then connect two environments to this instance.

Particularly, I'd like to run a PHP and a Tomcat environment on a single EC2 instance.

The problem is, every time I create a new environment in Elastic Beanstalk, it seems to create a new EC2 instance as well. Am I missing something here?

I'd appreciate any hint on this.

Abbas
  • 3,228
  • 1
  • 23
  • 27

2 Answers2

19

AWS Elastic Beanstalk is designed for deploying your running apps in a way that is designed for scalability from the ground-up. Because of this, Elastic Beanstalk will launch one or more EC2 instances, connect them to an Elastic Load Balancer instance, configure CloudWatch monitoring and Auto Scaling triggers.

Also, because of its fundamental design for scalability, Elastic Beanstalk is designed around a one-app-per-environment model (whereby "environment", I mean one of these EC2 + ELB + CloudWatch + AutoScaling clusters).

Since running two separate web servers with two separate apps (PHP & Java) is not a fundamentally scalable design, it's not a use-case that Elastic Beanstalk is optimized for.

You are free to spin-up a standalone EC2 instance and install whatever you'd like on it, but you're right — git aws.push support has not been made available for standalone EC2 instances. If the git support is important to you, you'll need to weigh the pros and cons of each approach.

Ryan Parman
  • 6,855
  • 1
  • 29
  • 43
4

I would also like to be able to do this, basically from a cost perspective for demos etc.

For example, a single instance with one PHP app and one Java app. Or, a single instance with two Java apps.

However, from what I have read so far in the Elastic Beanstalk developer guide, I have not found anything explicitly stating that multiple applications per environment is supported (or even, multiple environments per EC2 instance - if that even makes sense).

It makes me wonder if this is a feature that is often requested and planned for the future, or alternatively if the single-app-per-environment model is 'by design' for some reason.

alza
  • 57
  • 5
  • Having the same problem, except I just didn't name the environment properly. Oh well, thanks for the info – Amon Apr 03 '20 at 19:21