Magento 2 and AWS – How to Set Up ElastiCache

awsmagento2

I have a Magento 2 based website on an AWS EC2 and a AWS RDS . I would like to setup AWS ElastiCache Redis however the only information I found is for Magento 1 and written back in 2014 that says I would end the app/etc/local.xml file

So my question is how would I write the needed code to go into the app/etc/env.php file which is I believe where I would need to edit. I believe I need to edit the section of the file that reads

'session' => 
    array (
           'save' => 'files',
    ),

However I am not sure what to replace that with.

thanks

Best Answer

'session' => 
array (
  'save' => 'redis',
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => '6379',

    'password' => '',
    'timeout' => '2.5',
    'persistent_identifier' => '',
    'database' => '2',
    'compression_threshold' => '2048',
    'compression_library' => 'gzip',
    'log_level' => '1',
    'max_concurrency' => '6',
    'break_after_frontend' => '5',
    'break_after_adminhtml' => '30',
    'first_lifetime' => '600',
    'bot_first_lifetime' => '60',
    'bot_lifetime' => '7200',
    'disable_locking' => '0',
    'min_lifetime' => '60',
    'max_lifetime' => '2592000'
  )
),

Here is the link http://devdocs.magento.com/guides/v2.0/config-guide/redis/redis-session.html