Custom platform for AWS Elastic Beanstalk - Ubuntu 16.04 with apache2 and php 7.0

advices
devops
Custom platform for AWS Elastic Beanstalk - Ubuntu 16.04 with apache2 and php 7.0

In this section, we address the topic of creating an AWS Elastic Beanstalk Ubuntu 16.04 PHP custom platform with a configuration that allows you to run an apache2, php 7.0 and Ubuntu 16.04. This is especially helpful if your PHP website requires CURL to be compiled with OpenSSL (Amazon Linux comes with an NSS compiled CURL). This Ubuntu 16.04 EBS custom platform can also be configured to be used with nginx. If you need any help, please contact us.

The challenge

Configure an apache2, php 7.0, Ubuntu 16.04 custom platform for AWS Elastic Beanstalk.

The solution

We’ve created and deployed an AWS Elastic Beanstalk Ubuntu 16.04 PHP based Custom Platform. The custom EBS platforms allow us to customise the operating system, installed software, scripts and other system configurations. The AWS Elastic Beanstalk default PHP platform comes with apache, PHP 7.0 or 7.1 but it uses Amazon Linux as OS. Sometimes, it’s useful to have an Ubuntu 16.04 environment on EBS, so we configured an AWS EBS custom platform. The custom platform’s scripts can be found on our Github account here.

Pay attention when selecting the AMI you would like to use for this custom platform because they differ from region to region. For this configuration, we used the ami-1b791862 AMI and deployed the configuration on the Ireland region.

This custom AWS Elastic Beanstalk Ubuntu 16.04 PHP platform has the following setup:

  • apache2 ;
  • PHP 7.0;
  • various PHP modules (check the 02-install-php.sh script for more details).

Please consider the following aspects when using this AWS Elastic Beanstalk Ubuntu 16.04 PHP custom platform:

  • the PHP memory limit is set to default;
  • logrotation is enabled for apache2;
  • apache2 EBS health checks do NOT work;
  • environment level configuration does NOT work yet – we will update the article when it’s functional.

We will continue to update this custom EBS platform and release our modifications via Github.

For more details please feel free to contact us. We will be happy to help.

If you are interested in configuring a Custom platform for AWS Elastic Beanstalk running nginx, php 7.1, php-fpm, Google PageSpeed plugin and php-fpm caching platform on Amazon Linux please check this article on our blog.