7

I am using AWS Elastic Beanstalk, it is easy to start with deploying Java based web app, which is great.

However, I want to install Memcached on every instance locally so they can be used for caching, but seems it validated the principle of Elastic Beanstalk?

Is it possible to deploy memcached locally and automatically, together with Elastic Beanstalk's auto scale feature?

(I know I can use Elastic Cache but want to save some money but still take the advantage of auto scaling)

Thanks.

3 Answers 3

6

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!

2

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.

2

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"
1
  • If you get service: command not found error, you may want to use the fullpath of service: /sbin/service memcached restart
    – Linh Dam
    Sep 23, 2019 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .