Installing YII2 application on AWS free EC2

Hi All,

I have created YII2 application with advanced template.

I have created it on Ubuntu 14.04. Tested & its working fine.

Now I want to install/Upload it to AWS free EC2 .

Does any body has steps/process for it?

Thanks in adavance.


Just copy entire container folder.

Installing YII2 on AWS is pretty straight forward for a basic setup.

Once you have everything running correctly and want to start growing is where things start to get a little more interesting.

One thing I have found, is that running on Apache is going to limit your capacity a lot.

With just a basic GII generated CRUD app I was only able to get 12-15 hits per second with Apache Bench on a t2.micro ( free tier ). Memory issues will haunt you if you try to do much concurrency, resulting in dropped connections and skyrocketing response times.

After poking around and reading a LOT, I decided to try nginx. It uses php-fpm and it screems!! With the same app I get 90 Hits per second and more concurrency just slows down the response time a little but it still serves about 90 Hits per second.

As for the OS, I picked CentOS. Specifically I picked the Centminmod distribution. Lots of features for web servers and does everything I need.

Only downside is that it needs about 20GB disk space to install, and the AWS CentOS image does not pay attention to changing the disk size on creation. You have to manually change the partition size. Not hard to do, but a PITA.

Building out your app to a muti-tier to allow scaling up should not be much of a problem. You have to move your database off to

RDS or some other common database server that all your web servers to access.

You also have to move sessions off of the local hard drive. Put them in Elasticache or your database.

Then point your domain to a Elastic Load Balancer and add your web servers to it and you are read to start with the AWS dream!

Lots of detail in the actual implementation of this, but YII2 should not cause any complications.

Feel free to post any questions.