« Back

Liferay on Amazon Elastic Beanstalk and EC2

Company Blogs May 3, 2011 By James Falkner

Recently I came across a forum post asking about deploying Liferay on Amazon's Elastic Beanstalk.  Elastic Beanstalk (EB) is basically a managed Amazon EC2 instance running Linux and a pre-installed Tomcat.  You can install (web) apps into that container, and with clever configuration (and your credit card information) it will automatically scale horizontally and vertically as usage demands rise or fall. Pretty sweet right?  This is a part of being in "The Cloud".  Since it runs Tomcat, it shouldn't be too hard to get Liferay running in this environment, should it?  Turns out, it's actually not that hard.  

For this example, I used a stock Liferay configuration, using embedded HSQLDB.  Clever folks can configure this to use Amazon's RDS service.

For the impatient/advanced

Here's a quick rundown of what you need to do:

  1. On your local system, create custom Liferay WAR file which includes missing dependencies and a custom portal-ext.properties file
  2. On EB, Create new EB Application, and upload your custom WAR file
  3. Configure JVM instance for higher Java memory settings
  4. (optional) Configure EC2 instance to use SSH
  5. Restart

Details:

First, as of this date, Elastic Beanstalk runs Tomcat 6.0.32.  Pretty close to the 6.0.29 that Liferay 6.0.6 ships with.  However, the version that Liferay Bundles ship with are slightly modified to configure things like default network ports, classloader behavior, filesystem paths, dependent libraries, and other various things.  So, to successfully deploy to EB, we will need to build a custom Liferay WAR file that includes the things that the EB Tomcat is missing, and configure ${liferay.home}.  So, to create this custom app:

  1. Download and un-jar the stock Liferay WAR file into some temporary directory (for example, download the .war file to /tmp and extract it to /tmp/lr-eb-war).  Save the original .war, you'll be updating it shortly.
  2. Download and un-jar the stock Liferay Tomcat Bundle into some other place (for example /tmp/lr-606-bundle). You'll be borrowing libraries from it shortly.
  3. Copy all of the global jar files from the Liferay Tomcat Bundle in lib/ext to your custom Liferay WAR file directory
    1. cp /tmp/lr-606-bundle/liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/*.jar /tmp/lr-eb-war/WEB-INF/lib
  4. Create a text file /tmp/lr-eb-war/WEB-INF/classes/portal-ext.properties which includes a single line: liferay.home=/tmp/liferay-home-eb
  5. Add these files back into the stock Liferay WAR file using the jar utility (note these instructions will work on unix/Linux/Mac OS X  Windows users can use a utility like 7-Zip or InfoZip or something else to accomplish the same thing).
    1. cd /tmp/lr-eb-war
    2. jar uvf ../liferay-portal-6.0.6-20110225.war WEB-INF/classes/portal-ext.properties WEB-INF/lib/*.jar

Once this is done, you're ready to create an EB account and log in.  Go here and click "Begin Using AWS Elastic Beanstalk" to create a new account. After creating an account, giving Amazon your credit card info, confirming your account via telephone, go to the main AWS Console screen.

Create a new EB Application, selecting to upload a custom file, and select to create a new deployment environment.  Make sure to pick the t1.micro configuration, otherwise you'll probably blow right past the "free" limits and start accruing charges on your credit card.  Better to save your money for the Liferay EE license and beefier EC2 instance later in production ;-)

After clicking "Finish" it will take a while to upload the (~130MB) custom WAR file.  You'll stare at a spinner for a while, with no indication of progress. Once you get the "Your Application has successfully been created" message you'll be ready to proceed.  You'll be placed at the AWS (Amazon Web Services) Console.  The only two tabs you'll use here is the "Elastic Beanstalk" tab (to configure Tomcat and applications) and the "EC2" tab to configure the virtual machines on which Tomcat runs.

Memory Configuration

Once the upload is complete, Amazon will create a virtual machine running Linux, put a load balancer in front, create a DNS record, deploy a bunch of other junk (such as an Auto Scaling service to add more machines when needed), launch the virtual machine and Tomcat, deploying your custom Liferay web app, but it'll be broken because it's not configured correctly and probably ran out of memory.  Ignore any errors in any log file output you may be able to see.   Once you get Liferay up and running you can play with all this stuff to your heart's content.  For now, let's go configure things so that Liferay works.

You'll have to wait for the environment to be fully "up" (might take 5-10 minutes) before you can start tweaking configuration.  Once the spinner is done spinning and everything seems steady-state,  click on the "Edit Configuration" link:

If things aren't ready to be configured, it'll tell you.  Here, you can see all the wonderful things you can configure, but the only thing you need to do here is on the Container tab.  Set the memory settings as shown below:

Click "Apply Changes".

Your First Liferay On The Cloud

If all goes well, Liferay should eventually come up (After 5-10 minutes).  On the main AWS Console, if the status turns to "Green" (you can also watch the "Events" tab), then you're good to go!  Click on the "Overview" tab and click on "View Running Version" to see and log into your new Liferay Instance On The Cloud.  Welcome to Web five-dot-oh :)  (You can also get the hostname from the Environment Details screen, and it's the same hostname you initially configured when setting up things at the beginning).

Troubleshooting

If things don't go so well, and you want to do traditional administration from the command line (and really, who doesn't?), you need to log into your running OS using ssh.  To do that, you need to create a keypair, download the private key, apply the key pair to the configuration for your EC2 instance, and open up port 22 (the ssh port) on the EC2 instance, and finally use your favorite ssh utility to ssh (or scp, or sftp, or...) into the virtual machine.

SSH: Creating a keypair

Here is where you use the "EC2" tab at the very top of your AWS console.  Click on it, and click "Key Pairs" on the left.  It'll tell you you don't have any.  Click "Create Key Pair" to create a new one.

Give it any name, and click create.  It'll automatically download a .pem file that contains the "private" side of this key pair.  This probably violates several PKI best practices, but what are you gonna do?  Store this file somewhere convenient, you'll be using it in a bit when ssh'ing to your running virtual machine. You'll also need to chmod 400 the file if on Unix/Linux/Mac OS X.  Otherwise ssh will refuse to use it, citing security concerns.  Thanks ssh.

SSH: Apply the Key Pair to your EC2 instance

You need to associate the newly-created key pair to your machine (this effectively configures SSH on the linux box).  To do this, go back to the "Elastic Beanstalk" tab at the very top of the screen.  Under "Environment Details" click on "Edit Configuration".  On the "Server" tab of this dialog, enter the name of your newly created keypair in the "Existing Key Pair" field.  Note there is no auto-completion or selection here.  You have to type in the full name (bah!!). Click "Apply Changes" and agree to the little warning that comes up:

SSH: Configure the Security Group

When you first created your Elastic Beanstalk application, Amazon automatically allocated a virtual machine to you, and applied a default Security Group configuration to it.  The Security Group, among other things, defines a set of networking rules that allow or disallow network traffic to and from the EC2 instance running Tomcat/Liferay.  You need to add ssh as one of the "allowed" applications for which network traffic is permitted.  Go back to the "EC2" tab at the very top of your screen, and click on "Security Groups" on the left, then click on the "elasticbeanstalk-default" group.  At the bottom, click on the "Inbound" tab, and create a new rule, selecting SSH from the "Create a new rule" dropdown:

Then click "Apply Rule Change" at the bottom of the "Inbound" tab.  This opens up port 22 to your EC2 instance so you can ssh to your running Linux instance.

SSH: Using The Command Line

Now that port 22 is open, you can ssh.  Again, these instructions work on unix/Linux/Mac OS X.  Windows users can use things like PuTTY to ssh to the machine.  To ssh to your instance, you need to know the DNS name of the virtual machine (Amazon dynamically allocates these so there's no way to guess).  To figure this out, click on the "Instances" tab on the left.  There may be multiple instances listed here.  You want the one that has the associated key pair mentioned in the "Key Pair Name" column.  Right-click on this, and select "Connect".  It'll show you the appropriate command line (you'll need to change the path to the saved .pem private key file from earlier).  It also shows you the DNS hostname of your running instance:

Note that the sample cut-and-pastable command line they give uses the root user.  Amazon has since updated their policy to require you to ssh as the ec2-user user.  You'll get error if you attempt to ssh as the root user.  So don't.  Here's the example, correct command line I use:

Once in, it's like any other Linux shell.  You can see the Tomcat process and other interesting info using ps and other utiities:

Notice Liferay is already deployed into Tomcat, located at /usr/share/tomcat6/webapps/ROOT.  You can edit anything under here to tweak Liferay.  However, you can't alter the Tomcat configuration directly, as the application files and execution runtime is owned by root, and you are merely ec2-user.  You can look in /tmp to see the Liferay Home directory you specified earlier in your portal-ext.properties.

That's it for now, hope you find it useful.  If you expand on this (e.g. configure RDS, or do some other cool thing), leave comments below!  Some improvements could be:

  • Configuring the JVM so that you don't have to inject all of the Liferay dependency JARs into the main Liferay web app.  This would allow future deployed Liferay extensions to use the same libraries and avoid classloader issues.
  • Configure Liferay IDE to be able to deploy to EB instances automatically given your login info
  • Configure the Liferay Home directory to not be in /tmp.

Have fun!

Threaded Replies Author Date
Hey James, its cool that you got Liferay... Gregory Amerson May 3, 2011 10:52 PM
Nice! I'll give it a try right now : ) Steffen Schuler May 4, 2011 3:01 AM
Greg, yeah, that was the first (and only) major... James Falkner May 4, 2011 8:48 AM
Gregory, how the micro instance is free? I... Joosep Simm May 5, 2011 5:14 AM
Oh right, micro is $0.02, I was thinking of... Gregory Amerson May 5, 2011 6:40 AM
BTW, after my experimentations on Tuesday, my... James Falkner May 5, 2011 6:59 AM
... you are broke? That explains how LF Inc.... Steffen Schuler May 5, 2011 7:07 AM
Just doing my part for the betterment of the... James Falkner May 5, 2011 8:06 AM
What is the difference in doing a Liferay... Don DeMoss May 11, 2011 6:55 PM
Hey Don, the difference is that the Elastic... James Falkner May 12, 2011 9:22 AM
James, Thanks for the update. I am just a... Don DeMoss May 12, 2011 3:00 PM
Thanks for the tutorial James. It was very... Michael Hartman May 13, 2011 8:26 AM
I did pretty much what you had written about in... Srinivas Murty May 13, 2011 1:45 PM
Has anyone figured out how to set up the... Don DeMoss May 17, 2011 9:56 AM
Hey Don, to configure Liferay to use an... James Falkner May 18, 2011 7:51 AM
@James, I've run into a problem with the... Michael Hartman May 20, 2011 7:03 AM
Hmm... I wonder if this bug is still present:... James Falkner May 20, 2011 7:11 AM
Is that possible with Elastic Beanstalk? Or is... Michael Hartman May 20, 2011 7:28 AM
Set captcha.check.portal.create_account=false... James Falkner May 20, 2011 7:35 AM
James since I was researching this for awhile... Ryan T June 14, 2011 3:43 PM
Btw I have some of the results I can release if... Ryan T June 14, 2011 4:00 PM
Ryan, definitely I'd like to see those! Feel... James Falkner June 15, 2011 5:29 AM
Has anyone done any more work with this? I... Don DeMoss July 20, 2011 11:44 AM
Only issue I noticed so far is with the S3... danny chanyalew July 21, 2011 4:59 AM
I know that James set this up on the Micro... Don DeMoss July 21, 2011 12:38 PM
Hey James, Do you mind if I turn this blog in... Thiago Leão Moreira July 24, 2011 9:09 PM
Thiago, Go for it! I'd love to see the... James Falkner July 26, 2011 9:58 AM
Don, the minimum supported configuration is >... James Falkner July 26, 2011 10:04 AM
I followed the steps as described, however I... Shane MacPhillamy August 21, 2011 11:02 PM
Hmm, I didn't get that... do you see any errors... James Falkner August 22, 2011 7:35 AM
how to deploy my custom... murali krishna November 7, 2011 12:57 AM
Murali: You would need to package it as a... James Falkner November 7, 2011 7:49 AM
Can't see the captcha image to create a new... Simran Butalia December 1, 2011 10:41 AM
I was able to configure Liferay on beanstalk... Vivek S December 4, 2011 2:52 PM
James-- As you know this whole concept really... Ryan T January 20, 2012 8:56 PM
***UPDATE*** 1) Turns out there was an AMI... Ryan T January 21, 2012 1:16 AM
Hi Ryan, I'm facing the same problem with the... Bruno Kirk January 23, 2012 12:10 AM
@Ryan - this is really awesome that you are... James Falkner January 23, 2012 7:48 AM
we are having the same issue... please post... S Noori January 24, 2012 11:04 PM
@James Fruit rollups and coffee make the world... Ryan T January 26, 2012 12:59 PM
I am wondering if anyone has created AMI Images... Jack Bakker July 15, 2012 1:11 PM
@James your blogs was really helpful and it... Ankit Pancholi February 25, 2014 11:09 PM
here is the working link... Ankit Pancholi February 26, 2014 9:07 PM
James: This method doesn't seem to allow for... David Welch April 4, 2015 10:34 AM
hey David - I don't know of anyone @ Liferay... James Falkner April 6, 2015 7:39 AM
Hi James, yes, I've checked out the Bitnami... David Welch April 6, 2015 8:11 AM
James, It would be great if you could have... Ankit Pancholi April 8, 2015 10:18 PM
Hi James, Thank you for your Blog Entry. I... Nish K July 21, 2015 1:56 PM
Great question, and to be honest I don't know... James Falkner July 21, 2015 2:21 PM
Hi Nish, When you deploy any war on Amazon... Ankit Pancholi July 23, 2015 9:34 PM

Hey James, its cool that you got Liferay running using the micro instance (free) instead of having to go with the small instance which starts to charge. I was able to get Liferay to run and even deploy plugins to it, but it required me to customize the AMI image that is used to bootstrap the environment. In the custom image I modified the default tomcat install to include all of the dependencies (liferay jars) in the global classpath of tomcat so that plugins can be deploy just like a local tomcat bundle. I will try to post more detail after ECS when I have a bit more time.
Posted on 5/3/11 10:52 PM.
Nice! I'll give it a try right now : )
Posted on 5/4/11 3:01 AM.
Greg, yeah, that was the first (and only) major problem I faced - the Liferay dependencies that we manually distribute in the global Tomcat classpath in our bundles (in lib/ext). I wish there were a way to configure the default Tomcat on the default micro instance to pick up the appropriate JARs in the global classpath. There probably is, but I didn't take the time to find it.
Posted on 5/4/11 8:48 AM.
Gregory, how the micro instance is free? I looked at Amazon price list and see $0.02 per hour fee for micro instance. Am I missing something?
Posted on 5/5/11 5:14 AM.
Oh right, micro is $0.02, I was thinking of another cloud service. emoticon
Posted on 5/5/11 6:40 AM in reply to Joosep Simm.
BTW, after my experimentations on Tuesday, my total bill is now $0.38. Most of it was from 'transfer charges' while uploading the 3 different versions of the 150MB .war file. I'm broke!
Posted on 5/5/11 6:59 AM in reply to Gregory Amerson.
... you are broke? That explains how LF Inc. doubles its First Quater Revenue : )
Posted on 5/5/11 7:07 AM in reply to James Falkner.
Just doing my part for the betterment of the company and our mission. "A penny saved is a penny earned" :-)
Posted on 5/5/11 8:06 AM in reply to Steffen Schuler.
What is the difference in doing a Liferay instance on Amazon using EC2 like Alexey Kahunin created or the instance that was created here using the Elastic Beanstalk? I am just trying to figure out an economical way of hosting Liferay and it seems that either could be a good option.

Any insight would be great.

Don
Posted on 5/11/11 6:55 PM in reply to James Falkner.
Hey Don, the difference is that the Elastic Beanstalk provides additional features above and beyond just using EC2. For example, it will automatically configure and manage Tomcat (which is running Liferay). You can upgrade or downgrade Liferay, get monitoring statistics relevant to running Java apps, and Amazon will automatically scale by adding new instances once you reach a certain threshold of network or CPU activity. All of that would have to be done manually if you were just using EC2 directly (but you can also manage it yourself if you wish).

According to Amazon, using Elastic Beanstalk costs no more than if you were to just use EC2 (and S3) directly, but it provides more administrative options. See here for more information on EB features: http://aws.amazon.com/elasticbeanstalk/#functionality
Posted on 5/12/11 9:22 AM.
James,
Thanks for the update. I am just a one man band. If you were to look at my posts on Liferay I am not even a programmer, but more like a person who dabbles. I have been playing around in Liferay for quite awhile because I see all the potential available to anyone who wants to implement it.

I will have to try the Elastic Beanstalk direction you have given us. I would like to see someone else pipe in with how to move beyond the HSQLDB and find out how to set up a production style database like you suggested.

Don
Posted on 5/12/11 3:00 PM in reply to James Falkner.
Thanks for the tutorial James. It was very helpful. It's amazing what we can do now where before it would have taken an entire enterprise to do!

A note for you PuTTY users, the private key generated by EB is in OpenSSH format. PuTTY cannot recognize a key in this format. You must use PuTTYgen to convert the key from your .pem file into PuTTY's .ppk format. It's easy to do; simply refer to section "8.2.12 Dealing with private keys in other formats
" of the PuTTY User Manual.
Posted on 5/13/11 8:26 AM.
I did pretty much what you had written about in your post. For some strange reason, my instance just would not start when I tried the "micro" instance. However, I seem to be experiencing another problem. I am unable to log in to my default Liferay portal. I get the "guest" page with a message stating "You do not have the roles required to access this portlet" for the Sign-in portlet. What am I missing here? I've tried Liferay in the past on local Linux systems without any problems using the embedded database and the demo users. I wonder what's going on here.
Posted on 5/13/11 1:45 PM.
Has anyone figured out how to set up the database using the RDS, or even MySQL?

Don
Posted on 5/17/11 9:56 AM in reply to Srinivas Murty.
Hey Don, to configure Liferay to use an existing MySQL, check this out: http://www.liferay.com/community/wiki/-/wiki/Main/Database+Configuration

Amazon's­ RDS service purports to be functionally identical to MySQL so it shouldn't be hard to configure to use it, you would do the exact same steps for RDS as you do for MySQL (and substitute the right hostname and port number and username and password for your RDS instance).
Posted on 5/18/11 7:51 AM in reply to Don DeMoss.
@James,
I've run into a problem with the 'Create Account' screen. The Captcha image is broken. Any thoughts as to why the image would not be able to be rendered when running in the Elastic Beanstalk?
Posted on 5/20/11 7:03 AM.
Hmm... I wonder if this bug is still present: http://issues.liferay.com/browse/LEP-7488 It causes captcha to not work when running on OpenJDK. It was seen a couple of years ago. Any chance you could try running with the Oracle JDK 1.5/1.6 instead of the built-in JDK on Elastic Beanstalk? (which is OpenJDK).
Posted on 5/20/11 7:11 AM in reply to Michael Hartman.
Is that possible with Elastic Beanstalk? Or is the in-use JDK sorta "locked down" in the same way that Tomcat is "locked down".

Is there a way to turn off Captcha?
Posted on 5/20/11 7:28 AM in reply to James Falkner.
Set captcha.check.portal.create_account=false in your portal-ext.properties to disable. I'm not sure if you can use your own JDK, but I presume you can, if you copy a JDK to the underlying linux OS, extract it, and set the right environment variables so that Tomcat uses it. You can copy the JDK by using 'scp' (once you have set up ssh). I did not try this, though.
Posted on 5/20/11 7:35 AM in reply to Michael Hartman.
James since I was researching this for awhile before hitting you guys up about it, I would recommend caution about using RDS vs mysql running on another instance in terms of performance, backing up, etc. We slapped our mysql db around a bit and got some interesting performance numbers back, like scaling up to larger instances only helped with specific types of db actions....
Posted on 6/14/11 3:43 PM in reply to James Falkner.
Btw I have some of the results I can release if you like, other more direct ones I cannot.. it is in an excel file however.
Posted on 6/14/11 4:00 PM in reply to Ryan Terwedo.
Ryan, definitely I'd like to see those! Feel free to attach to a forum post or send directly to me firstname.lastname@liferay.com (replace first name with james and last name with falkner)
Posted on 6/15/11 5:29 AM in reply to Ryan Terwedo.
Has anyone done any more work with this? I have been too busy with life, but I will have some free time soon, and I hope to play around with it soon. I'd love to hear about other peoples experiences.

Don
Posted on 7/20/11 11:44 AM in reply to James Falkner.
Only issue I noticed so far is with the S3 hook. Seems to be working for document library , but not for image gallery. (this is in a clustered set up, so you need to bring up at least 2 servers to see problem)
Posted on 7/21/11 4:59 AM in reply to Don DeMoss.
I know that James set this up on the Micro Instance (613 MB of memory, up to 2 ECUs (for short periodic bursts), EBS storage only, 32-bit or 64-bit platform) how was Liferay able to work using this? I believe the memory requirements for Liferay are beyond what the Micro Instance provides.

Did anyone have issues with this? How robust of a website could you launch using Liferay with such low amounts of memory? I would think it would be very slow. I know that the AWS Micro Instance is free for a year while you test things out. Here is the info on that:

Free Tier*

As part of AWS’s Free Usage Tier, new AWS customers can get started with Amazon EC2 for free. Upon sign-up, new AWS customers receive the following EC2 services each month for one year:

750 hours of EC2 running Linux/Unix Micro instance usage
750 hours of Elastic Load Balancing plus 15 GB data processing
10 GB of Amazon Elastic Block Storage (EBS) plus 1 million IOs, 1 GB snapshot storage, 10,000 snapshot Get Requests and 1,000 snapshot Put Requests
15 GB of bandwidth out aggregated across all AWS services



The Small Instance (Small Instance (Default) 1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), 160 GB of local instance storage, 32-bit platform). This isn't free and is charged at Small (Default) Linux $0.085 per hour Windows $0.12 per hour.

So what would actually work? I don't mind spending money each money each money, but if I could get away with a micro instance I would do that.

Thank you,
Don
Posted on 7/21/11 12:38 PM in reply to danny chanyalew.
Hey James,

Do you mind if I turn this blog in a presentation? emoticon
Posted on 7/24/11 9:09 PM in reply to Don DeMoss.
Thiago,

Go for it! I'd love to see the finished product emoticon
Posted on 7/26/11 9:58 AM in reply to Thiago Leão Moreira.
Don, the minimum supported configuration is > 613MB for sure, however Liferay can fit into smaller footprints, but you'll probably run out of memory for any reasonable site. I don't know what the absolute minimum would be, however I would guess it would be in the 400-500MB range.
Posted on 7/26/11 10:04 AM in reply to James Falkner.
I followed the steps as described, however I had to select a small instance, as micro caused a JVM exception out of memory.

Now when I navigate to Server Administration->Resources the pane is blank, I would expect to see some dials -- is there anything I can do to get the dials to display?
Posted on 8/21/11 11:02 PM in reply to James Falkner.
Hmm, I didn't get that... do you see any errors in the catalina.out file? (this will require you configure SSH as described in the blog to see the log file).
Posted on 8/22/11 7:35 AM in reply to Shane MacPhillamy.
how to deploy my custom application(spring-hibernet) inside liferay on cloud......
Posted on 11/7/11 12:57 AM in reply to James Falkner.
Murali: You would need to package it as a separate WAR file and deploy it in the same way that you deploy Liferay.
Posted on 11/7/11 7:49 AM in reply to murali krishna.
Can't see the captcha image to create a new account.. java.lang.Error: Probable fatal error:No fonts found.

Any thoughts on this?
Posted on 12/1/11 10:41 AM in reply to James Falkner.
I was able to configure Liferay on beanstalk and also connect to mySQL RDS database but I am seeing the following two issues
ISSUE 1
1) When I deploy a new theme to /tmp/liferay-home-eb/deploy I am getting the following error:
22:45:13,441 ERROR [AutoDeployDir:143] Unable to write my-theme.war-6.0.6.1.war
I resolved this error by changing file permissions as follows:
sudo su
chown tomcat my-theme.war-6.0.6.1.war

Liferay then extracts the war file to /var/lib/tomcat6/webapps/my-theme folder and shows the following message

22:45:25,976 INFO [ThemeAutoDeployListener:50] Themes for /tmp/liferay-home-eb/deploy/my-theme.war-6.0.6.1.war copied successfully. Deployment will start in a few seconds.

BUT nothing happens after this step and the theme is not deployed.

ISSUE 2:
Same issue as reported by Simran. The captcha is not working and I see the No fonts found error in the catalina.out file.
Posted on 12/4/11 2:52 PM in reply to Simran Butalia.
James--

As you know this whole concept really intrigues me.. hence I posted the original forum spot u mention.

I have been working on this for quite sometime and had a few comments.

1) Did you ever terminate an instance, and then try to load it with same parameters? (i.e. 32bit Tomcat 6). When I did this (I shut down to conserve costs) and try to launch a new environment, it will not, as it states (and much to my dismay--I forgot to copy the logs) that there is a SEVERE issue with JDBC etc etc and it will cause a memory leak blah blah and in short will not launch. You must completely delete the beanstalk app and follow the process (i.e. upload the 130mb file) again.

2) The default beanstalk AMI uses openjdk--reason why captcha doesnt work-- (I noticed the issue with some custom portlets and we think this is one reason why they don't load-- we get

Jan 21, 2012 2:54:56 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 21, 2012 2:54:56 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/SRIADatabase-portlet] startup failed due to previous errors)

You can change the sdk but it is a pain due to 1) above...

3)After you change the sdk--you must create a custom AMI to launch in beanstalk so that problem does not keep happening... I am trying to get to this point, but I am running out of fruit roll ups and coffee today. I know in theory how to do it, the issue is you will no longer get any auto updates (to OS or Tomcat) once you use a custom AMI.

4) Check out the control panel->server installation->Resources ...does not exist in the Liferay 6.0.6 I got booted. Same issue as stated above by another user.

5) Can you provide JVM settings for the container for different instance sizes? The one above is for micro

6) Did you try to scale it out(haev 2 micro instances reading same db)? I assume you would have to set the db parameters in the war file you upload, or create a custom AMI after setting it up in something like 6.1 initial load screen. ( I realize I have been talking about 6.0.6 this whole time)

7) You can view logs without SSH and setting up a key etc etc. There is a tab under environment which allows you to do this.

My brain is fried-and am almost out of fruit rollups, that is all for now =) ...I will try to update sdk as I just uploaded the war for about the 5th time. I can try and create a public custom AMI to use after it is sorted if there is a need for it.
Posted on 1/20/12 8:56 PM.
***UPDATE***

1) Turns out there was an AMI error on Amazons part... I was able to see the same thing in the logs, but fortunately for me it would restart {usually}...wonder where that link was...

2) Fix catcha by installing sunjdk..

Trick to this is below if you want it to stick around
i) Load Amazon Beanstalk AMI for type of instance. (You can find this AMI by just loading an instance in the type of environment you want in beanstalk--like 32bit-Tomcat 6---use the sample beanstalk app if you want--- go to ec2, look at that running instance--it prob wont have a name--- and copy the ami..You NEED TO USE THIS... as it has special beanstalk additions

ii) Boot up the beanstalk AMI image as any normal ec2 instance--log in via SSH-- modify it-- and create a private ami of modified ami

iii) Boot up liferay war (have not tried this in a cross environment-ie use the same type u modified to play it safe--like small 32bit tom 6--).. and wait until it loads.. after it loads ---like the edit config option in blog to change jvm--- paste in your custom ami-- and load it again. I change other settings like health checks to 100 sec, 5 sec wait, 2 healthy tries, 10 bad tries... to give instance enough time to load

3) is fixed--see above

4) is fixed when using Sunjdk instead of dedault openjsk

5) same

6) same

7) same
i) you may want to tail catalina to view items


8) NEW---I have been completely unable to deploy ANY portlet, it took tons of changing on tomcat 6 (set logging to FINE from INFO) and we still have no idea.

A tail of catalina produces:

:08:29:31,464 INFO [AutoDeployDir:167] Processing SRIADatabase-portlet-6.0.5.1.war
08:29:31,464 INFO [PortletAutoDeployListener:71] Copying portlets for /tmp/liferay-home-eb/deploy/SRIADatabase-portlet-6.0.5.1.war
Expanding: /tmp/liferay-home-eb/deploy/SRIADatabase-portlet-6.0.5.1.war into /var/cache/tomcat6/temp/20120121082931466
q Copying 1 file to /var/cache/tomcat6/temp/20120121082931466/WEB-INF
Copying 1 file to /var/cache/tomcat6/temp/20120121082931466/WEB-INF/classes
Copying 1 file to /var/cache/tomcat6/temp/20120121082931466/META-INF
Copying 12 files to /usr/share/tomcat6/webapps/SRIADatabase-portlet
Copying 1 file to /usr/share/tomcat6/webapps/SRIADatabase-portlet
Deleting directory /var/cache/tomcat6/temp/20120121082931466
08:29:32,709 INFO [PortletAutoDeployListener:81] Portlets for /tmp/liferay-home-eb/deploy/SRIADatabase-portlet-6.0.5.1.war copied successfully. Deployment will start in a few seconds.


After changing logs to FINE:

Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /var/lib/tomcat6/webapps/ROOT/WEB-INF/web.xml
Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] redeploy resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:46:54 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:03 AM org.apache.catalina.valves.RemoteIpValve invoke
FINE: Incoming request / with originalRemoteAddr '127.0.0.1', originalRemoteHost='127.0.0.1', originalSecure='false', originalScheme='http' will be seen as newRemoteAddr='127.0.0.1', newRemoteHost='127.0.0.1', newScheme='http', newSecure='false'
Jan 21, 2012 8:47:03 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[/c/portal/protected]' against GET /index.jsp --> false
Jan 21, 2012 8:47:03 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[/c/portal/protected]' against GET /index.jsp --> false
Jan 21, 2012 8:47:03 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[/c/portal/protected]' against GET /index.jsp --> false
Jan 21, 2012 8:47:03 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: Checking constraint 'SecurityConstraint[/c/portal/protected]' against GET /index.jsp --> false
Jan 21, 2012 8:47:03 AM org.apache.catalina.realm.RealmBase findSecurityConstraints
FINE: No applicable constraint located
Jan 21, 2012 8:47:04 AM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: loadClass(com.liferay.taglib.util.VelocityTaglib, false)
Jan 21, 2012 8:47:04 AM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: Returning class from cache
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT.war
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /var/lib/tomcat6/webapps/ROOT/WEB-INF/web.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] redeploy resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:04 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT.war
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /var/lib/tomcat6/webapps/ROOT/WEB-INF/web.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] redeploy resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:14 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT.war
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /var/lib/tomcat6/webapps/ROOT/WEB-INF/web.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] redeploy resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:24 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT.war
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] redeploy resource /var/lib/tomcat6/webapps/ROOT
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[] reload resource /var/lib/tomcat6/webapps/ROOT/WEB-INF/web.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] redeploy resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/context.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /usr/share/tomcat6/conf/web.xml
Jan 21, 2012 8:47:34 AM org.apache.catalina.startup.HostConfig checkResources
FINE: Checking context[/SRIADatabase-portlet] reload resource /etc/tomcat6/Catalina/localhost/SRIADatabase-portlet.xml


PLEASE forget time differences... I tried to deploy tons...

Funny enough under control panel-->update manager--> the plugins appeared. BUT WILL NOT SHOW UP in the portal to deploy in the normal fashion.

I am stuck.. not being able to deploy a portlet sucks... I can expand on other items as needed.

We deployed said portlets in a local host environment and all was good... so something on beanie is bad...
Posted on 1/21/12 1:16 AM in reply to Ryan Terwedo.
Hi Ryan,

I'm facing the same problem with the basic Amazon Linux32/64 with tomcat6/7
I was thinking of some kind of incompatibility between the generated class from the sun jdk and the open jdk from amazon. It seems you find it out.

I will try to follow your first lead and see what I can find out.
Posted on 1/23/12 12:10 AM in reply to Ryan Terwedo.
@Ryan - this is really awesome that you are taking the time to share what you have found. You have gone WELL beyond any place I ever went with EB emoticon So unfortunately you are in uncharted waters. I would suggest you summarize all of your findings in a blog post and post here (or in the forums). It is very valuable information and the comments of my blog don't do it justice in terms of formatting and presentation emoticon
Posted on 1/23/12 7:48 AM in reply to Bruno Kirk.
we are having the same issue... please post solutions.
Posted on 1/24/12 11:04 PM in reply to James Falkner.
@James

Fruit rollups and coffee make the world go round.. =)

I have a few ideas, but would need some help from someone who has more tomcat/linux experience to test permissions (possible reason why it does not work) and who knows more about a clustering enviro (pertinant for using beanie in the first place) I have not ventured into that world much as of yet.
Posted on 1/26/12 12:59 PM in reply to S Noori.
I am wondering if anyone has created AMI Images for Liferay and dependent stuff

I am working on a 'small' EC2 instance with LR v6.0.6 with Postgresql 8.4

finally got the config right for persistent root EBS volume to survive termination of EC2 instance (command line aws tool magic)

also got S3 bucket being accessed from an EC2 instance via s3fs but folder views are a bit wonky as seen from linux shell compared to AWS S3 web views and on first efforts the EC2 connection S3 using s3fs is a bit slow

ultimate goal is to play with LR 6.1 and Postgresql 9.1 towards clustering with nodes in the mars-east1 availability zone, but not there yet...
Posted on 7/15/12 1:11 PM in reply to Ryan Terwedo.
@James your blogs was really helpful and it inspire me to write more around this topic. I have created a blog post for Liferay on AWS Elastic Beanstalk, Configure with RDS db, S3 for liferay data folder. http://tech-ray.blogspot.com/
your comments / suggestions would be really useful.
Posted on 2/25/14 11:09 PM.
here is the working link http://liferayconnect.blogspot.in/
Posted on 2/26/14 9:07 PM in reply to Ankit c p.
James:
This method doesn't seem to allow for Lucene, Jgroups, ehcache, document management. Seems that someone would have posted an image on AWS that allows for this using Elastic Beanstalk, and S3, along with a configuration that supports unicast. Seems once this is configured once (believe it could saved as an AMI), any could boot the CE version and have an instantly scaleable and redundant Liferay! Has anyone done this or is anyone working on this at Liferay?

And, thanks for getting the discussion going with your blog, 4 years and still going!
Posted on 4/4/15 10:34 AM.
hey David - I don't know of anyone @ Liferay working on this - and you're right it does sound like a great idea. Have you checked out the Bitnami Liferay stack at https://bitnami.com/stack/liferay ?
Posted on 4/6/15 7:39 AM in reply to David Welch.
Hi James, yes, I've checked out the Bitnami offering, but, it doesn't seem to currently be using EB or S3 capabilities. There are a few posts out there about how to configure this using these features of AWS, with various opinions of the best method. Would be great to have a LR configuration guru post their opinion of best practice, and, even though there are a few issues to address, I think these issues could be overcome by LR configuration and some guidelines. This just seems to be a "perfect storm" to even have a "launch in AWS" (with Elastic Beanstalk) environment instead of having to go through the fairly extensive learning curve of knowing all the pieces that won't work when installing LRP "out of the box" in a multi-server AWS environment. Anyway, I'll be investigating, I'll post findings on the forums also.
Posted on 4/6/15 8:11 AM in reply to James Falkner.
James, It would be great if you could have someone review the following blog post, as lots of people seeking for inputs from liferay on same.
https://www.liferay.com/web/ankitcp/blog/-/blogs/liferay-on-aws-elastic-beanstal­k-configure-for-rds-and-s3
Posted on 4/8/15 10:18 PM in reply to David Welch.
Hi James, Thank you for your Blog Entry. I could setup Liferay 6.2.3 CE on Amazon Beanstalk, but unfortunately I couldn't deploy custom portlets. I used the Amazon AWS toolkit 2.0 on Eclipse Luna to upload and deploy custom portlets. After the upload Liferay is broken. I found that the reason for this is, that the content of docroot are directly copied into Liferay's ROOT folder and hereby Liferay Portal folders are overwritten. Is there a way to setup AWS or the beanstalk Liferay installation so that the aws toolkit does deploy the portlets correctly?
Posted on 7/21/15 1:56 PM.
Great question, and to be honest I don't know yet - I am doing some experiments with CloudFoundry this week which I suspect has similar issues - will let you know (via this blog) how it goes.
Posted on 7/21/15 2:21 PM in reply to Nish K.
Hi Nish,
When you deploy any war on Amazon Elastic Beanstalk as you noticed it replaced the content of docroot with the ROOT folder, so it means Elastic Beanstalk is expecting the uploaded war as the main application war and not treat it as a separate application (portlet) war in webapps.

As you have already gone through my blog, EBS ebextensions .config file 01_liferaysetup.config see the below command

16-deploy-war:
command: "s3cmd -c /home/ec2-user/.s3cfg get -f s3://lfr-data/Deploy/*.war /usr/share/tomcat7/deploy

I have configured s3 and placed the portlets war at the above path in s3 bucket, which will copy same to deploy folder and it works fine. Alternatively you can also keep your portlets war on .ebextensions folder in the bundled liferay war and mention appropriate cmd to copy same to deploy folder.

I have added comments to your queries,
https://www.liferay.com/web/ankitcp/blog/-/blogs/liferay-on-aws-elastic-beanstal­k-configure-for-rds-and-s3
Posted on 7/23/15 9:34 PM in reply to Nish K.