Search code examples
apacheamazon-web-servicesamazon-elastic-beanstalkmod-pagespeed

Is it possible to use AWS Beanstalk's .ebextensions config to install mod_pagespeed Apache module?


I'm using AWS Beanstalk for my Django/Python application, and I would like to use Google's mod_pagespeed module. Is it possible to install and run mod_pagespeed using the .ebextensions/.config file?


Solution

  • Download the package

    Add the rpm into your ebextensions directory

    create a .config file in the .ebextensions directory

    add commands to the config file like this:

    container_commands:
        01-command:
            command:        rm -rf /pagespeed/ebextensions
    
        02-command:
            command:        mkdir -p /pagespeed/ebextensions
    
        03-command:
            command:        cp -R .ebextensions/* /pagespeed/ebextensions/
    
        04-command:
            command:        rpm -U /pagespeed/ebextensions/mod-pagespeed.rpm
    

    Ensure the commands are indented as shown, with no tabs, otherwise it wont work.

    swap "mod-pagespeed.rpm" for whatever the actual rpm file name is.