I would like to welcome eb (pronounced ee-bee) to the family of Elastic Beanstalk command line tools! Eb simplifies the development and deployment tasks from the terminal on Linux, Mac OS, and Microsoft Windows. Getting started using Elastic Beanstalk from the command line is now as simple as:
- eb init to set up credentials, choose the AWS Region, and the Elastic Beanstalk solution stack (operating system + application server + language environment).
- eb start to create the Elastic Beanstalk application and launch an environment within it.
- git aws.push to deploy code.
Here is how I use it to manage my Elastic Beanstalk applications...
First, download the updated Elastic Beanstalk Command Line Tools and unzip it to a directory on disk. For quick access to the eb command, I recommend that you add this directory to your PATH. You are all set up and ready to go!
Create Your Application
In your application’s directory, initialize your Git repository and run the following commands to create an Elastic Beanstalk application:
In the example above, ‘eb init’ walks you through a few questions and configures your settings so you can easily create and manage your application. It also configures your Git repository so you can directly push to Elastic Beanstalk. The command ‘eb start’ creates the resources and launches a sample application on Elastic Beanstalk. The application is accessible at the URL shown above.
Deploy Your Code
To deploy your code to Elastic Beanstalk, you simply use git aws.push like this:
To test your uploaded application, browse to the application’s URL:
Update your Configuration Settings
Eb stores configuration settings in a file called .optionsettings inside the .elasticbeanstalk directory. To update your configuration settings, simply open the .optionsettings file, make a change, and then run eb update.
For example, to update my instance type from t1.micro to m1.small, I simply change the value of ‘instancetype’ to ‘m1.small’ and then run the following commands:
Get Information about your Application
To get information about your Elastic Beanstalk application, you can use the eb status command:
Eb provides 2 mechanisms to clean up: eb stop and eb delete.
The eb stop command deletes the AWS resources that are running your application (such as the ELB and the EC2 instances). It however leaves behind all of the application versions and configuration settings that you had deployed, so you can quickly get started again. Eb stop is ideal when you are developing and testing your application and don’t need the AWS resources running over night. You can get going again by simply running eb start.
The eb delete command deletes the AWS resources as well as all application versions and configuration settings associated with your application. Eb delete is ideal when you’re cleaning up a test application and want to start working on a new application from scratch.
As you can see, eb gives you the power to set up, manage, and update your Elastic Beanstalk applications from the command line. Give it a try and let me know what you think.