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).
- 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.
- Once you get to the 'View Application' step in the guide, make sure that the sample application is accessible.
- In the AWS Elastic Beanstalk Console, select the sample application that you just deployed from the drop down.
- Expand the 'Environment Details' section at the bottom of the page.
- On the 'Overview' tab of the 'Environment Details', select 'Edit Configuration'.
- On the 'Server' tab, change the 'EC2 Instance Type' to the one that best matches your application's needs.
- 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:
- In the AWS Elastic Beanstalk Console, select the sample application that you just deployed from the drop down.
- In the 'Environments' panel, click on the 'Actions' drop-down and select 'Deploy a Different Version'.
- In the 'Deploy a Different Version' dialog, select 'Upload and deploy a new version'.
- Provide the 'Version label' and choose the WAR file to upload.
- Click on 'Deploy Version'.
- 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.