2

I'm using Elastic Beanstalk to deploy a root app (node.js) and also want to run php code that node.js app needs to call in the same ec2 instance.

When I connect to the instance it says:

This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH WILL BE LOST if the instance is replaced by auto-scaling. [...]

It means that when I add php sources in /var/www/ folder (connected via ssh), it will be removed if the instance changes.

how could I run in the same instance node.js and php ?

2 Answers 2

1

You can explore the multi container option based on ECS to run more than one container per beanstalk environment.

Documentation:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_v2config.html

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecstutorial.html

Is there a particular reason you want both apps to run on the same instance?

Sign up to request clarification or add additional context in comments.

2 Comments

I can't speak for james, but I'm looking to do the same thing because our backend is written in PHP but we're looking to migrate to Node.js. Running both through the same API Gateway would be beneficial to test and make sure the migration is worthwhile. Unless you can think of another way to do it...
If you are planning to use Elastic Beanstalk, I would recommend creating two separate environments - one with PHP backend and other with Node.js backend. You will get two URLs for each of your two environments (or your ELBs). You can set up two Route 53 records that load balance across your two environments. You can use weighted records to control how much traffic goes to each environment. You can choose the number of instances in each environment based on the weights. Read more about weighted record sets here: tinyurl.com/jgr9jwb
0

maybe something like this:

**

create an ".ebextensions/nodeinstall.config" file

**

commands:
    node_install:
    cwd: /tmp

    command: 'yum install -y nodejs --enablerepo=epel'

I ran into a similar situation a while back and this worked for me.

source: http://qpleple.com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.