Running High-CPU or High-Memory Applications on AWS Elastic Beanstalk

Articles & Tutorials>AWS Elastic Beanstalk>Running High CPU or High Memory Applications on AWS Elastic Beanstalk
This article highlights how to change your EC2 instance type for AWS Elastic Beanstalk applications and how to diagnose issues with applications that require high-CPU or high-memory.

Details

Submitted By: Saad@AWS
AWS Products Used: AWS Elastic Beanstalk, Amazon EC2
Created On: January 28, 2011 12:39 AM GMT
Last Updated: January 28, 2011 12:39 AM GMT
Running High-CPU or High-Memory Applications When you launch an Elastic Beanstalk environment, by default the service launches a single 't1.micro' EC2 instance. This instance type is designed to meet the needs of a wide variety of web applications, many of which have relatively modest CPU or traffic needs. Applications with intensive and long-running operations may require more CPU or memory. If your application needs more resources you can easily configure Elastic Beanstalk to use a different EC2 instance type that is well-suited to your resource needs. The specifications of the t1.micro instance type and other EC2 instance types can be found at: http://aws.amazon.com/ec2/instance-types/. Pricing for the different EC2 instance types is available at http://aws.amazon.com/ec2/pricing/.

Change the Instance Type

Here is how you can change your EC2 instance type through the AWS Elastic Beanstalk console (https://console.aws.amazon.com/elasticbeanstalk).
  1. Follow the steps in the AWS Elastic Beanstalk Getting Started Guide (available at http://docs.amazonwebservices.com/elasticbeanstalk/latest/gsg/) to deploy the sample application or some application that does not require high memory or high CPU.
  2. Once you get to the 'View Application' step in the guide, make sure that the sample application is accessible.
  3. In the AWS Elastic Beanstalk Console, select the sample application that you just deployed from the drop down.
  4. Expand the 'Environment Details' section at the bottom of the page.
  5. On the 'Overview' tab of the 'Environment Details', select 'Edit Configuration'.
  6. On the 'Server' tab, change the 'EC2 Instance Type' to the one that best matches your application's needs.
  7. The existing EC2 instance(s) will be terminated and new EC2 instance(s), based on the new instance type, will be launched.

Deploy your Application

Now that we have an environment with a different EC2 Instance Type, let's deploy your application:
  1. In the AWS Elastic Beanstalk Console, select the sample application that you just deployed from the drop down.
  2. In the 'Environments' panel, click on the 'Actions' drop-down and select 'Deploy a Different Version'.
  3. In the 'Deploy a Different Version' dialog, select 'Upload and deploy a new version'.
  4. Provide the 'Version label' and choose the WAR file to upload.
  5. Click on 'Deploy Version'.
  6. The new WAR file will be deployed to your EC2 instance.

What happens if you deploy a High-CPU app into the default t1.micro environment?

Elastic Beanstalk regularly checks your running instances to ensure they are healthy. An application that consumes 95% or greater of the CPU may make the instance unresponsive to this health check. If after 1 minute an instance has not responded to its health check URL, Elastic Beanstalk will look at the CloudWatch CPU utilization. If CPU Utilization is greater than 95%, Elastic Beanstalk will log the following event: Instance '<instance id>' is experiencing CPU Utilization greater than 95.00%. Consider adjusting autoscaling settings or upgrading to an instance type larger than a 't1.micro'. To address this, you can either change to a larger instance type as outlined above or adjust auto-scaling settings to use CPU utilization instead of the default setting of Network Bandwidth In to determine when to add additional instances.
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.