Instance's deployment / post configuration for AWS Elastic Beanstalk
The possibility to customize your environments is indeed one of the key characteristics of AWS Elastic Beanstalk in comparison to other PaaS offerings:
Most existing application containers or platform-as-a-service solutions, while reducing the amount of programming required, significantly diminish developers' flexibility and control. [...] However, with Elastic Beanstalk, you retain full control over the AWS resources powering your application. If you decide you want to take over some (or all) of the elements of their infrastructure, you can do so seamlessly [...]
What you are looking for is possible by facilitating a Custom AMI. Once you have launched an environment, you can customize its configuration details, amongst those the AMI used by your instances as illustrated in Configuring Servers. While there are some requirements to be met in order to properly execute within Beanstalk, you can basically customize these AMIs to your heart's content, the process is documented in Using Custom AMIs (for a 3rd party explanation see e.g. How to customize an Amazon Elastic Beanstalk instance).
Please be aware of the following implication though:
Important
After you are running on your own custom AMI, you will no longer receive any automated updates to the operating system, software stack, or the AWS Elastic Beanstalk host manager.
This means you will need to track the evolution of the AWS AMIs yourself to ensure stability and security of your application - this isn't as easy as it should be currently, as discussed e.g. in Amazon AMI product lifecycle questions and more recently Keeping up with the AWS Developers (Latest AMI's).
Good luck!
You can now configure AWS Elastic Beanstalk using configuration files. This is an alternative to creating and maintaining custom AMIs.
http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html
It is currently supported on Tomcat 6/7, Python 2.6, and Ruby 1.8.7/1.9.3.
As written before using configuration file Create a file:
./.ebextensions/myapp.config
with the following:
packages:
yum:
memcached: []
container_commands:
01_memcached_start:
command: "service memcached restart"